Split firmware images using dd

30 March 2014

Sometimes it is necessary to split a complete flash dump into several partitions. This can easily be done using dd.

Say we have just backed up the firmware over JTAG and we want to split our 8 MiB binary file into several smaller files. That is convenient, since you can simply restore the bootloader, or any other partition, without damaging any of the remaining partitions.

Flash-Layout*

Bootloader      0xB0000000     192K
Configuration   0xB0030000     256K
Image 0         0xB0070000    3840K
Image 1         0xB0430000    3840K
Boot Params     0xB07F0000      64K

The first partition

Splitting the first partition “Bootloader” into a seperate file is pretty straight forward. Set the blocksize to 1024, this allows us to split off 192 blocks (192 KiB).

dd if=FULL.dump of=bootloader.bin bs=1024 count=192

The second partiton

Splitting the second partiton “Configuration” into a seperate file is a little more complex. We split off 256 blocks (256 KiB) and skip the first 192 blocks (192 KiB).

dd if=FULL.dump of=configuration.bin bs=1024 count=256 skip=192

The remaining partitions

Split the remaining three partitions:

dd if=FULL.dump of=image_0.bin bs=1024 count=3840 skip=448
dd if=FULL.dump of=image_1.bin bs=1024 count=3840 skip=4288
dd if=FULL.dump of=boot_params.bin bs=1024 count=64 skip=8128

*as reported by the bootloader