Repository navigation
ambarella: s3l: add overlayfs (v18), as on the T31 kernel - #177
Conversation
OpenIPC's /init keeps settings in rootfs_data through an overlay over the squashfs root, and skips it when /proc/filesystems has no overlay. 3.10 predates the mainline one, so a flashed S3L image booted with a read-only root: nothing persisted, and /etc/fw_env.config could not be written, so fw_printenv/fw_setenv failed. This is Miklos Szeredi's out-of-tree overlayfs v18 (fs/overlayfs plus its VFS hooks), the same patch OpenIPC carries on its 3.10.14 ingenic-t31 kernel (0001-overlayfs.v18.patch, e7666aa). It applies here with line offsets only. It registers "overlayfs", which /init mounts with lowerdir=/,upperdir=/overlay; boards enable it with CONFIG_OVERLAYFS_FS. struct inode and struct file keep their layout (inode.i_cdev 0x110, file.private_data 0x70, as the prebuilt iav.ko expects); super_block and inode_operations only grow at their ends. Tested on the Amcrest IP4M-1026E: the flashed image mounts rootfs_data as jffs2 with overlayfs over /, fw_printenv works, and a file written to /etc survives reboots, across two stock <-> OpenIPC flash round trips.
PR Summary by Qodoambarella: s3l: backport overlayfs v18 for persistent root settings
AI Description
Diagram
High-Level Assessment
Files changed (22)
|
|
Goes with OpenIPC/firmware#2781, which sets CONFIG_OVERLAYFS_FS=y in s3l.generic.config so S3L images use this. |
Code Review by Qodo
1. Directory reads can omit files silently
|
|
These are all in the overlayfs v18 code itself (fs/overlayfs/*), which this PR imports unchanged from the ingenic-t31 kernel's 0001-overlayfs.v18.patch, so the T31 copy has them too. I'd rather keep the two identical than fork the S3L copy here. If any of them matter in practice, backporting the mainline fixes to both kernels would be a separate change. |
|
No objection to the approach, and nothing here should need a respin. One test to ask for: Small bugs for a follow-up, on both
Known limits of v18, for the record. Copy-up creates the file under its final name and fills it in place ( |
|
Thanks for merging. I ran the
Noted on the three |
Problem
OpenIPC's
/initkeeps settings inrootfs_datathrough an overlay over the squashfs root. It skips the overlay when/proc/filesystemshas none. This 3.10 kernel predates mainline overlayfs and has no other, so a flashed S3L image boots with a read-only root:/etc/fw_env.configcan't be written, sofw_printenv/fw_setenvfail ("environment not initialized");Change
Miklos Szeredi's out-of-tree overlayfs v18 (
fs/overlayfsplus its VFS hooks innamei.c,namespace.c,open.c,splice.c,fs.h,mount.h). It's the same patch this repo carries on the 3.10.14ingenic-t31kernel (0001-overlayfs.v18.patch, e7666aa), and it applies here with line offsets only. It registersoverlayfs, which/initmounts withlowerdir=/,upperdir=/overlay. Boards turn it on withCONFIG_OVERLAYFS_FS=y; it's off by default.The prebuilt S3L modules (
iav.ko& co.) are unaffected:struct inodeandstruct filekeep their layout (inode.i_cdev0x110,file.private_data0x70, asiav.koexpects).super_blockandinode_operationsonly grow at their ends.Testing
On an Amcrest IP4M-1026E (S3L, OV4689), flashed and booted from SPI-NOR with
CONFIG_OVERLAYFS_FS=y:rootfs_datamounts as jffs2, withoverlayfsover/;fw_printenvworks, and the root password and a test file in/etcsurvive reboots;This was repeated across two stock ↔ OpenIPC flash round trips. On this branch alone, the kernel also builds with
s3l.generic.configplusCONFIG_OVERLAYFS_FS=y, using the S3L hard-float toolchain. Theinode/fileoffsets above were measured on that build with a throwaway module.