cajjed wrote: ↑
To update the kernel partitions I use an SD card and then do the following:
Is there any method that would let you update the kernel from rootfs when running from nandflash?
Your repeated use of the phrase "from rootfs
" makes no sense.
The Linux kernel, regardless of how it is booted, has to have a rootfs.
This root filesystem can be a filesystem in a NAND partition or in a SDcard partition or in memory in a ramfs/tmpfs.
You seem to conflate a "rootfs
" with NAND, which is incorrect.
The kernel doesn't care (and doesn't even know) where its image came from or what bootloader performed the loading.
The root filesystem that the Linux kernel (initially) mounts does not have to be stored in the same medium that holds the booted kernel image.
For example you could boot (AT91Bootstrap and U-Boot) from SDcard, load the Linux kernel and dtb images from NAND, and then the kernel could mount a rootfs in a partition on the SDcard!
Your other misconception seems to be the accessibility of the kernel image stored in raw NAND.
The kernel (and Device Tree blob) image(s) are simply read by the bootloader (e.g. U-Boot) during boot, and placed in main memory (for execution).
Once loaded into memory by the bootloader, the stored images in NAND (or anywhere else) are not accessed by the executing kernel, and are expendable until the next boot procedure.
IOW there are no extra restrictions on the accessibility of any kernel (and dtb) images compared to any other unmounted MTD partitions while the Linux kernel is executing.
There is no need to boot Linux from SDcard simply to "update the kernel partition
The shell commands that you use when booting Linux from SDcard (to overwrite the kernel partition) are just as valid when you boot Linux from NAND.
cajjed wrote: ↑
I imagine I could have a second kernel partition and then tweak the uboot_env to choose the new kernel on reboot. Just curious if there was any other options?
The NAND MTD partitioning you use looks like the legacy Atmel scheme that can be improved upon.
The modern preference is to utilize the filesystem capabilities of U-Boot (e.g. ubifsmount and ubifsload), and store the kernel and dtb images as files within the Linux root filesystem (i.e. the /boot
directory), which is presumably in a NAND partition/volume.
Ideally you want as much of the NAND flash to be part of the filesystem (or UBI volume) as possible (rather than as raw partitions) so that wear-leveling (and bad-block management) can be more effective.