Kernelimage

From InCircuit
Jump to: navigation, search

As stated in Generated Images, buildroot provides a dedicated kernel-image called uImage. As the bootloader can not read all filesystems by default, this has to be flashed into a separate partition of the NAND-Flash.


Writing the image into flash

While booting via NFS, a new kernel can be flashed by first erasing the first NAND-partition and write the Image directly into that partition afterwards. This can be done by using the following commands:

 flash_eraseall /dev/mtdX
 dd if=/boot/uImage of=/dev/mtdblockX bs=131072

where mtdX and mtdblockX specify the flash partition in which the kernel resides. More information about the mtd devices may be available from the command "mtdinfo /dev/mtdX".

This would write the kernelimage found at /boot/uImage into the partition X. The parameter bs specifies the blocksize to use and should match the sector-size of the flash in use. It would work with other sizes, too, but would unnecessarily stress the device and take a larger amount of time.

On some devices the command flashcp is available which is a better alternative to dd. Use it as following:

 flashcp /boot/uImage /dev/mtdX

If your Kernel Version does not support the flash_eraseall Command, use

 flash_erase /dev/mtdX 0 0

instead. This should work on newer Versions.

Booting the new image

With the default environment, the device will automatically boot the new kernel, the next time it is started. If the environment has changed, eg. for booting via NFS, the following line can be used to boot the new kernel from flash once

 mtdparts default; nand read 0x70400000 nand0,0; bootm

To store this configration and making the kernel being loaded from flash by default, the following lines can be used:

 askenv bootcmd
 mtdparts default; nand read 0x70400000 nand0,0; bootm
 saveenv
Personal tools