Skip to content

Commit

Permalink
release R2407
Browse files Browse the repository at this point in the history
  • Loading branch information
maierkomor committed Jul 28, 2024
1 parent 229ee17 commit 1de4e82
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
R2407:
======
- fix ROMFS missing on 1MB builds

R2406:
======
- fix mDNS regression caused by IDF update
Expand Down
40 changes: 37 additions & 3 deletions main/fs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023, Thomas Maier-Komor
* Copyright (C) 2018-2024, Thomas Maier-Komor
* Atrium Firmware Package for ESP
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -118,6 +118,34 @@ static struct dirent *rootfs_vfs_readdir(DIR *d)
return r;
return 0;
}


#if 0 // not needed, as stat is directed to child filesystem
static int rootfs_vfs_stat(const char *fn, struct stat *st)
{
log_dbug(TAG,"rootfs_vfs_stat(%s,...)",fn);
if ((0 == fn) || (0 == st))
return EINVAL;
for (int e = 0; e < (sizeof(RootEntr)/sizeof(RootEntr[0])); ++e) {
if ((0 != RootEntr[e]) && (0 == strcmp(fn,RootEntr[e]))) {
st->st_mode = S_IFDIR;
return 0;
}
}
return -1;
}


static int rootfs_vfs_fstat(int fd, struct stat *st)
{
log_dbug(TAG,"rootfs_vfs_fstat(%d,...)",fd);
if (0 == st)
return EINVAL;
abort();
// TODO
return 0;
}
#endif // no stat/fstat
#endif


Expand Down Expand Up @@ -147,6 +175,10 @@ void rootfs_init()
vfs.opendir = rootfs_vfs_opendir;
vfs.readdir = rootfs_vfs_readdir;
vfs.readdir_r = rootfs_vfs_readdir_r;
#if 0 // not needed, as stat is directed to child filesystem
vfs.fstat = rootfs_vfs_fstat;
vfs.stat = rootfs_vfs_stat;
#endif
if (esp_err_t e = esp_vfs_register("",&vfs,0))
log_warn(TAG,"VFS register rootfs: %s",esp_err_to_name(e));
else
Expand Down Expand Up @@ -287,7 +319,9 @@ static void init_hwconf()

static void romfs_init()
{
#ifndef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
#ifdef CONFIG_ESPTOOLPY_FLASHSIZE_1MB
romfs_setup();
#else
if (const char *r = romfs_setup()) {
rootfs_add(r);
}
Expand Down Expand Up @@ -315,7 +349,7 @@ const char *shell_format(Terminal &term, int argc, const char *args[])
}
#else
if (argc != 2)
return "Missing argument.";
return "Invalid number of arguments.";
#if defined CONFIG_SPIFFS
return shell_format_spiffs(term,args[1]) ? "Failed." : 0;
#endif
Expand Down
26 changes: 12 additions & 14 deletions main/romfs.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023, Thomas Maier-Komor
* Copyright (C) 2018-2024, Thomas Maier-Komor
* Atrium Firmware Package for ESP
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -411,18 +411,16 @@ const char *romfs_setup()
log_dbug(TAG,"looking for " ROMFS_MAGIC);
while (pi != 0) {
p = esp_partition_get(pi);
uint8_t magic[8];
#if IDF_VERSION >= 50
esp_partition_read_raw(p,0,(char *)magic,sizeof(magic));
#else
spi_flash_read(p->address,magic,sizeof(magic));
#endif
log_hex(TAG,magic,sizeof(magic),"partition %s",p->label);
if (0 == memcmp(magic,ROMFS_MAGIC,sizeof(magic))) {
log_info(TAG,"%s has ROMFS",p->label);
break;
uint8_t magic[8] = { 0 };
if (esp_err_t e = esp_partition_read(p,0,(char *)magic,sizeof(magic))) {
log_warn(TAG,"read partition %s: %s",p->label,esp_err_to_name(e));
} else {
log_hex(TAG,magic,sizeof(magic),"partition %s",p->label);
if (0 == memcmp(magic,ROMFS_MAGIC,sizeof(magic))) {
break;
}
log_dbug(TAG,"%s has no ROMFS",p->label);
}
log_dbug(TAG,"%s has no ROMFS",p->label);
pi = esp_partition_next(pi);
p = 0;
}
Expand All @@ -446,10 +444,10 @@ const char *romfs_setup()
}
#endif
if (p == 0) {
log_dbug(TAG,"no romfs found");
log_info(TAG,"no romfs found");
return 0;
}
log_dbug(TAG,"using partition %s",p->label);
log_info(TAG,"ROMFS on partition %s",p->label);

RomfsBaseAddr = p->address;
RomfsSpace = p->size;
Expand Down

0 comments on commit 1de4e82

Please sign in to comment.