I'm composing a final image to be flushed on a board with a NAND flash( erase block
= 128Kb, page size
= 2Kb).
After the OpenWrt
build I've got a linux
kernel and a rootfs-squashfs
binaries.
I have a board with a binary-only u-boot which looks for a kernel at an address 0x640000
. I place the kernel
at that position in the flash. For some reason (1), I have to place the rootfs-squashfs
image NOT the next to the kernel. I place it at an address 0x4020000
(I placed a fake u-boot
image at a 0x4000000
address (2) which occupies exactly one erase block
and u-boot
image's header.ih_size
== 128Kb - 64b - 8b).
Then I have two cases:
a. left it as is and power the board :). After linux
gets booted, an overlayfs
's upper directory is /tmp/root
which is backed by the RAM, so all changes are lost after the board reboots.
b. place a jffs2
image immediately after the rootfs-squashfs
image. After linux
gets booted, an overlayfs
's upper dir is /overlay
which is backed by a rootfs_data
partition. [after I make some changes to my system, I get a error/warning that some erase block
was marked as a bad block
...., there's a question about similar case: A 'create a bad block at page ...' message after a jffs2 image was mounted and files were added , however that's about a custom parition, not a rootfs_data
]
(1) this how a recovery mode works on these hubs (one kernel
plus two rootfs-squashfs
images). I talk about a case when a second rootfs-squashfs
image is used
(2) to allow linux
to split a partition into rootfs
and rootfs_data
partitions
So, the questions are:
- is it allowed to
just
place ajffs
image into the flash and let it work withoutbad block
s triggering - which way is used in OpenWrt to handle such problem