How to genere a raw image of Linino flash

Let's suppose you want to clone our flash to transfer it on another device.


  1. Linino board running Linino distribution
  2. USB key or SD card with at leasdt 32MB free

Generate raw flash image

  • Insert the USD key or SD card in to the Linino board and retrieve which the device mounted

root@linino:/# dmesg | tail 
[ 75.680000] sd 1:0:0:0: [sdb] No Caching mode page present
[ 75.680000] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[ 75.690000] sdb: sdb1
[ 75.700000] sd 1:0:0:0: [sdb] No Caching mode page present
[ 75.700000] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[ 75.710000] sd 1:0:0:0: [sdb] Attached SCSI disk

In our example we inserted an USB key into our Linino ONE and the device is mounted on /mnt/sdb1.

  • Generate the flash images

The flash is partitioned following a specific flash layout. To see which is the flash layout used on Linino board follow the next steps:

  1. Collect the information from dmesg output

[ 0.700000] m25p80 spi0.0: found w25q128, expected m25p80
[ 0.700000] m25p80 spi0.0: w25q128 (16384 Kbytes)
[ 0.710000] 7 cmdlinepart partitions found on MTD device spi0.0
[ 0.710000] Creating 7 MTD partitions on "spi0.0":
[ 0.720000] 0x000000000000-0x000000040000 : "u-boot"
[ 0.720000] 0x000000040000-0x000000050000 : "u-boot-env"
[ 0.730000] 0x000000050000-0x000000ea0000 : "rootfs"
[ 0.740000] mtd: partition "rootfs" set to be root filesystem
[ 0.740000] mtd: partition "rootfs_data" created automatically, ofs=7C0000, len=6E0000
[ 0.750000] 0x0000007c0000-0x000000ea0000 : "rootfs_data"
[ 0.750000] 0x000000ea0000-0x000000fe0000 : "kernel"
[ 0.760000] 0x000000fe0000-0x000000ff0000 : "nvram"
[ 0.760000] 0x000000ff0000-0x000001000000 : "art"
[ 0.770000] 0x000000050000-0x000000fe0000 : "firmware" ...

and from the output of the command:

root@linino:/# cat /proc/mtd 
dev: size erasesize name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00e50000 00010000 "rootfs"
mtd3: 006e0000 00010000 "rootfs_data"
mtd4: 00140000 00010000 "kernel"
mtd5: 00010000 00010000 "nvram"
mtd6: 00010000 00010000 "art"
mtd7: 00f90000 00010000 "firmware"

This data show us that our flash has a partition called “firmware” that include both rootfs/rootfs_data/kernel. So in order to have a complete image of the flash we need to combine the partition: mtd0, mtd1, mtd7, mtd5, mtd6.

dd if=/dev/mtd0 of=/mnt/sdb1/flash_u-boot.bin bs=1M; 
dd if=/dev/mtd1 of=/mnt/sdb1/flash_u-boot_env.bin bs=1M;
dd if=/dev/mtd7 of=/mnt/sdb1/flash_fw.bin bs=1M;
dd if=/dev/mtd5 of=/mnt/sdb1/flash_nvram.bin bs=1M;
dd if=/dev/mtd6 of=/mnt/sdb1/flash_art.bin bs=1M;  

cat /mnt/sdb1/flash_u-boot.bin /mnt/sdb1/flash_u-boot_env.bin /mnt/sdb1/flash_fw.bin /mnt/sdb1/flash_nvram.bin /mnt/sdb1/flash_art.bin > /mnt/sdb1/flash_raw.bin

At the end you'll find a copy of the flash on the USB/SD flash_raw.bin