EmbeddedRelated.com
Forums

Updating the linux kernel and the root file system

Started by goodtimes July 10, 2007
Hi,
I need to update the linux kernel on the flash memory while the target is
executing. Also I need to update the root file system. Can somebody please
explain me how these things are best done?


goodtimes <getmukesh505@gmail.com> wrote:

> I need to update the linux kernel on the flash memory while the target is > executing. Also I need to update the root file system. Can somebody please > explain me how these things are best done?
Is the kernel running directly from flash (XIP), or does your flash hold a (possibly compressed) kernel image that is copied to RAM at boot time and run from there? If the kernel is running from RAM, it is safe to overwrite the flash partition containing the kernel from a running system. Note that there is always a risk that something goes wrong while writing the image, (power outage, etc) leaving your system unbootable. A safer method would be to create two partitions to hold your kernel. When you booted from partition A, you write the new kernel to partition B, verify the data is properly written, and then configure the bootloader to boot from partition B from now on. The next update will go to partion A, reversing the setup. In the ideal situation, the bootloader is notified by your OS that the newly upgraded partition has properly booted, or reverts to the previous kernel at the next boot if this is not the case.