Welcome! Log In Create A New Profile

Advanced

Create an SD card image without an actual SD card!

Posted by gnexus 
Create an SD card image without an actual SD card!
June 27, 2012 02:50PM
That is what I'm doing because my SD card is currently in my A10 device creating a Debian rootfs.

Here is how you do it:

install qemu-img and kpartx

qemu-img create -f raw sdcard.img 3896475648

kpartx -a sdcard.img

losetup -a
/dev/loop0: [2058]:33685511 (sdcard.img)

fdisk /dev/loop0

create the partitions as per instructions . . .

install u-boot

install the kernel

install the rootfs

Done!

Will it boot? That, of course, is the big question!

First you need to write the image to the SD card:

dd if=sdcard.img of=/dev/mmcblk0 bs=1024

sync (don't forget to sync, or it may not flush the buffers and write the image to SD.

You can grow or shrink the image to fit your SD card with:
# qemu-img resize filename [+|-]size[K|M|G|T]

Be careful when resizing images. You must first resize or delete partitions to fit before shrinking an image. I lost a swap partition because there was not enough room for it by 1 single byte!



Edited 2 time(s). Last edit at 06/28/2012 10:28AM by gnexus.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: