Booting into installed debian

This guilde helps you booting your newly installed debian image

This is a bit complex since we need the kernel and initrd that was installed during the installation. So we first need to loop-mount the image (or mount usb sd-card) and grab the kernel and initrd.

Getting image and initrd from on-disk image

First find the start block of the root partition in the image.

$ /sbin/sfdisk  -l -uS debian.img 
Disk debian.img: cannot get geometry

Disk debian.img: 248 cylinders, 255 heads, 63 sectors/track
Warning: extended partition does not start at a cylinder boundary.
DOS and Linux will interpret the contents differently.
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
debian.img1   *      2048   3727359    3725312  83  Linux
debian.img2       3729406   3999743     270338   5  Extended
debian.img3             0         -          0   0  Empty
debian.img4             0         -          0   0  Empty
debian.img5       3729408   3999743     270336  82  Linux swap / Solaris

Offsets are given in sector size of 512 byte so multiply the start sector of the root partition (2048) with sector-size (512) to get the offset (1048576) in the image that points to the partition. Loop mount it (as root).

$ mkdir img
# mount -o loop,offset=1048576 debian.img img

There, now df should show you a line of your newly mounted disk on the img file. Copy the kernel and initrd files out from the image and unmount it.

$ cp img/boot/vmlinuz .
$ cp img/boot/initrd.img .
# umount img

Boot into newly installed kernel

Append root=/dev/sda1 which points to the root partition and start qemu with copied kernel.

./qemu-system-arm -M versatilepb -kernel vmlinuz -initrd initrd.img -append "root=/dev/sda1" -hda debian.img

This should give you login prompt after boot.

qemu/debian/boot/image.txt ยท Last modified: 2012/07/10 16:49 (external edit)
Trace: image
CC Attribution-Share Alike 3.0 Unported Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0