Bartlomiej Grzeskowiak
Bartlomiej Grzeskowiak

Reputation: 1019

kernel update via /dev/mtd

I'm working on embedded device where kernel image is stored inside /dev/mtd4 part of flash. I would like to update this kernel without Uboot.

How is it possible ? I was trying to call:

echo ./kernel.bin > /dev/mtdblock4 

but it doesn't work. Stored data are not recognized as kernel in next boot.

Upvotes: 3

Views: 16003

Answers (5)

KBell
KBell

Reputation: 3

I also have a device where I update the kernel image and use uBoot. My workflow is:

  • I transfer the new imagefile to the devices tmp directory
  • I erase the flash mtd directory:

    flash_eraseall /dev/mtd3

  • then I copy from tmp to flash directory (/tmp/ --> /dev/mtd3)

    flashcp /tmp/uImage /dev/mtd3

I hope this helps, regards

Upvotes: 0

nomoney29
nomoney29

Reputation: 126

To update the different mtd blocks, I use following routine:

# flash_eraseall /dev/mtd3
# dd if="kernel.bin" of=/dev/mtd3 bs=16k conv=sync

Upvotes: 0

Luke Postema
Luke Postema

Reputation: 375

I've never used flashcp. Where can I get it? I use flash_erase or flash_eraseall and then nandwrite. If you don't have these utilities, you can get the source here and build them for your target.

To update my system, I use:

# /usr/bin/flash_erase /dev/mtd3
# /usr/bin/nandwrite -m -p /dev/mtd3 /uImage

Is this NAND flash? If so, I don't think that echo or cat are going to properly skip bad blocks for you.

Upvotes: 4

shodanex
shodanex

Reputation: 15406

You should use the mtdutils tool flashcp :

flashcp -v ./kernel.bin /dev/mtd4

flashcp will take care of the erasing, writing, and verifying which cat won't do. Note that is works with the char driver and not the block driver. -v is for verbose operation

Upvotes: 10

It should at least be cat kernel.bin > /dev/mtdblock4 but that probably won't work neither.

And it depends upon how your kernel is actually loaded (what is the bootloader).

Upvotes: 4

Related Questions