Translations of this page:
This is an old revision of the document!
About this Article
we may want to backup our SD bootable OS which have installed many application software. We can make SD Bootable OS into a SD card image.here is guide for you.This guide is for Linux platform only.
$sudo umount /media/* $sudo mount /dev/sdb1 /mnt $sudo tar -cp * |sudo gzip -9 > ~/bootfs.tar.gz $sudo umount /mnt
$sudo mount /dev/sdb2 /mnt $sudo tar -cp * |sudo gzip -9 > ~/rootfs.tar.gz
$ mkdir WORK_DIR $cd $WORK_DIR //creating empty image , this space is 2.5G,you can change by yourself $sudo dd if=/dev/zero of=disk.img count=5000000 //associating /dev/loop0 with the image $sudo losetup /dev/loop0 disk.img $sudo dd if=/dev/zero of=/dev/loop0 bs=1k count=1024 $sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/loop0 bs=1024 seek=8 //write uboot in image
$sudo fdisk /dev/loop0
Using the fdisk command to create 2 partitions on the SD Card, e.g.
Show bellow
Device Boot Start End Blocks Id System /dev/loop0p1 2048 133119 65536 83 Linux /dev/loop0p2 133120 4999999 2433440 83 Linu
Also we recommend you to look at Bootable_SD_card
$cd $WORK_DIR //associateing /dev/loop0 with image again $sudo losetup -d /dev/loop0 && sudo losetup /dev/loop0 disk.img //associateing /dev/loop1 with the first partition of /dev/loop0,1048576=512*2048) $sudo losetup -o 1048576 /dev/loop1 /dev/loop0 //format the first partition $sudo mkfs.vfat /dev/loop1 //format the second partitions $sudo mkfs.ext4 /dev/loop2 $sudo mount /dev/loop1 /mnt //decompressing bootfs.tar.gz to the first partition $sudo tar -zxvf ~/bootfs.tar.gz -C /mnt $sudo umount /mnt $sudo mount /dev/loop2 /mnt //decompressing rootfs.tar.gz to second partition $sudo tar -zxvf ~/rootfs.tar.gz -C /mnt $sync && umount /mnt //cancel associating $losetup -d /dev/loop2 //cancel associating $losetup -d /dev/loop1 //cancel associating $losetup -d /dev/loop0