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.