Difference between revisions of "Kernelimage"

From InCircuit
Jump to: navigation, search
(Writing the image into flash)
(Writing the image into flash)
Line 6: Line 6:
 
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:
 
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/mtd0
+
   flash_eraseall /dev/mtdX
   dd if=/boot/uImage of=/dev/mtdblock0 bs=131072
+
   dd if=/boot/uImage of=/dev/mtdblockX bs=131072
 +
 
 +
where mtdX and mtdblockX specify the flash partition in which the kernel resides.
  
 
If your Kernel Version does not support the flash_eraseall Command, use
 
If your Kernel Version does not support the flash_eraseall Command, use

Revision as of 17:26, 28 March 2014

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.

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

 flash_erase /dev/mtd0 0 0

instead. This should work on newer Versions.

This would write the kernelimage found at /boot/uImage into the first partition. 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.

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