Repository navigation
ambarella: s3l: enable overlayfs, so a flashed image keeps its settings - #2781
Conversation
/init stacks an overlay on the rootfs to keep settings in rootfs_data, and skips it when the kernel has no overlay filesystem. The S3L kernel had none, 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. CONFIG_OVERLAYFS_FS comes with the overlayfs v18 patch for the 3.10 ambarella-s3l kernel (the one OpenIPC carries for the 3.10 ingenic-t31 kernel). Until that kernel has it, olddefconfig drops the unknown option and nothing else in the config changes. Tested on an Amcrest IP4M-1026E, flashed and booted from flash: rootfs_data mounts as jffs2 with overlayfs over /, fw_printenv works, and settings survive reboots. With the patched kernel this config passes olddefconfig unchanged, and the kernel keeps the inode/file layout the prebuilt iav.ko expects.
PR Summary by QodoEnable OverlayFS in the Ambarella S3L kernel configuration
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Overlay fix is inert until kernel lands
|
|
Goes with OpenIPC/linux#177, which adds overlayfs to the ambarella-s3l kernel. Either can merge first: until #177 is in, olddefconfig just drops the option. |
openipc-ai
left a comment
There was a problem hiding this comment.
The config line itself looks right, and I found no problem in the code. Two things are needed before this can merge, and both are about evidence, because nothing else covers this change: ci-matrix.py --stdin gives 0/123 boards for this path (S3L is in UNBUILT_FAMILIES) and the Firmware job was skipped. The green CI Gate says nothing about this config, the kernel link or the size cap. This review comes from reading the diff, /init and the selector; nothing was built or run on a camera.
Needed before merge
- Please paste the actual output from the Amcrest IP4M-1026E. The Testing section describes the results, and the tree asks for the output itself:
/proc/mounts, the relevantdmesglines,fw_printenv, and a setting surviving a reboot. - Please paste the uImage size with overlayfs on.
=ybuilds it into a kernel with a cap of about 2 MB on 8 MB NOR, and since CI doesn't build this board, neitherCHECK_SIZEnor the headroom warning will run on it. Amake BOARD=s3l_litelog against the #177 kernel showing the size line would cover this.
Merge order
- OpenIPC/linux#177 should land first. You're right that either order is safe at build time:
ambarella-s3lhas nofs/overlayfs/Kconfigyet, soolddefconfigdrops the line. But the kernel comes from a branch-named tarball with no pinned SHA. If this lands first, merging #177 alone changes S3L boot behaviour at the next build, with no firmware commit to show it. With #177 first, the change is tied to this commit.
Worth checking, not blocking
- Sysupgrade from an existing read-only S3L image. Until now
/initexited atgrep -q overlay /proc/filesystemson these kernels, so S3L has never run the overlay code below it. Your flash round trips cover conversion from stock, including the first format ofrootfs_data, but the PR doesn't mention an upgrade from an OpenIPC image. If you can try that, please include the result. - The UBI image is untested.
s3l_litealso setsBR2_TARGET_ROOTFS_UBI, and this config reaches that image too. From reading/init, a failed UBIFS mount falls back to tmpfs, so it should fail safely, but if you have no NAND S3L to test on, please say so in the description.
|
Thanks. All five points are answered below, with output from the IP4M-1026E (UART console) and from builds at this PR's head, What was built.
2. uImage size with overlayfs on. The unmodified That's about 5 KB over the 1582 KB you measured at #2766. On the device profile, the same build with only 4. Upgrading from a read-only S3L image. I flashed an image identical to the camera image but with overlayfs off in the kernel, which is what an S3L image from current master looks like: Two things on that image are worth knowing, both of which this PR fixes:
From there, I ran One caveat, which comes from my test setup and not from the PR. Both of my images carried the same local build ID, so sysupgrade said 1. Output from the camera, on this PR's image (
(overlayfs v18 logs nothing when it mounts.)
A setting surviving a reboot. The claim's root password and a marker file in
So a live erase does happen, but only on 5. UBI. I have no NAND S3L to test on, so the 3. Merge order: the kernel side is merged, so that's settled. |
openipc-ai
left a comment
There was a problem hiding this comment.
Thanks, this answers everything I asked for and more, so I'm approving it. The upgrade path and the firstboot run are what I was most concerned about, and both came back clean.
What I checked myself, with this PR merged onto current master (b08259fb0) and the kernel at 7022a237. I didn't run this on a camera:
CONFIG_OVERLAYFS_FS=ysurvivesolddefconfignext toCONFIG_LBDAF=y.iav.ko's offset still holds:inode.i_cdevis0x110,sizeof(struct inode)is0x128, andfile.private_datais0x70. I checked because #2778 showed that CI can't catch this.uImageis 1587/2048 KB, the same as your number.
Your findings:
- A read-only image can't be claimed. I hadn't realised that, and it's the strongest reason for this PR: it means a flashed S3L image from
masteris locked out from the first boot. Since #2783, those are the images the nightly would publish. firstbooterases live. It's the fallbacksysupgradewas written to accept, and your run came back clean. It's one run on one camera, and the same applies to T31 and the other branches with this overlayfs. Nothing to change here.- UBI: untested, as you said. From reading
/init, a failed mount falls back to tmpfs, so it should fail safely.
One thing outside this PR: master doesn't fit right now. With #2782's microcode and #2785's Majestic together, make BOARD=s3l_lite stops at rootfs.squashfs: [5516KB/5120KB], 396 KB over, with or without this PR. Your 3384 KB was measured before those two landed. I'm raising this separately, so you don't need to do anything, but this PR's S3L CI job will fail until it's fixed.
Problem
/initstacks an overlay on the rootfs to keep settings inrootfs_data, and skips it when the kernel has no overlay filesystem. The S3L kernel has none, 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");Fix
Set
CONFIG_OVERLAYFS_FS=yinbr-ext-chip-ambarella/board/s3l/s3l.generic.config, where Kconfig places it (as int31.generic.config).It merges safely in either order with the linux PR. On today's
ambarella-s3lkernel,olddefconfigdrops the unknown option and nothing else in the config changes. With the overlayfs kernel, the config passesolddefconfigunchanged.Testing
On an Amcrest IP4M-1026E (S3L, OV4689), flashed and booted from SPI-NOR with the overlayfs kernel:
rootfs_datamounts as jffs2, withoverlayfsover/;fw_printenvworks, and settings survive reboots.This was repeated across two stock ↔ OpenIPC flash round trips. The kernel keeps the
inode/filelayout the prebuiltiav.koexpects (i_cdev0x110,private_data0x70; the same check as #2763).