Optimized QEMU procedure
Paul Boddie
paul at boddie.org.uk
Wed Sep 12 04:59:13 EDT 2012
On Wednesday 12 September 2012 08:50:49 Hans Bezemer wrote:
>
> Sorry for the obvious typos and inefficiencies, but it was kinda late ;-) I
> enhanced and optimized the procedure a little - without the "dirty" boot.
> You can now do most of the procedure in the comfort of your host OS.
>
> (1) For that I took a kernel from
> http://people.debian.org/~aurel32/qemu/mipsel/
> (2) I made a raw disk (ben.img) of 512 megs, partitioned it and made a
> Linux partition;
> under an ARM(!) emulated Linux (it's much easier that way than a looped
> device). Exit the emulation and enter your host system again.
I'm not sure I completely understand how using QEMU is easier for this part. I
can see that it's awkward to use fdisk to add information to the disk image,
and using mkfs on an image file with a partition table probably involves some
work telling it where to start writing - I've only ever used it on devices or
on image files that aren't partitioned (for User Mode Linux) - but is there
anything else?
> (3) Mount it with "mount -o loop,offset=31232 -t ext2 ben.img /mnt"
> (4) wgetted the openwrt*-rootfs.tar.gz
> (5) cd /mnt; tar -xzvf <path>openwrt*-rootfs.tar.gz
> (6) cd /mnt/dev; mknod console c 5 1
> (7) Populated /dev a bit more (disk, null and tty - see below); chmod 777 *
> (8) cd /mnt/etc; mv inittab inittab.old; cd init.d; mv rcS rcS.old
> (9) vi rcS; lines "#!/bin/sh<cr>mount -t proc proc /proc" added
> (10) umount /mnt
> (11) Booted with: qemu-system-mipsel -m 32 -kernel vmlinux-qemu -hda
> ben.img -append "root=/dev/sda1 rw console=tty0" -no-reboot
> (12) BTW, "halt" works at this stage.
>
> Population of /dev:
>
> crwxrwxrwx 1 root root 5, 1 1970-01-01 01:01 console
> crwxrwxrwx 1 root root 1, 3 2012-09-11 21:38 null
> brw-r--r-- 1 root root 8, 0 2012-09-11 21:46 sda
> brw-r--r-- 1 root root 8, 1 2012-09-11 21:46 sda1
> crwxrwxrwx 1 root root 4, 0 1970-01-01 01:02 tty0
> crwxrwxrwx 1 root root 4, 1 1970-01-01 01:02 tty1
> crw-r--r-- 1 root root 4, 2 2012-09-11 22:08 tty2
>
> Translate it to mknod commands like this:
>
> crwxrwxrwx 1 root root 5, 1 1970-01-01 01:01 console
>
> becomes:
>
> mknod console c 5 1
>
> c = first character of first string;
> 5 = number after owner
> 1 = number after that
>
> Any comments, addititions or errors are appreciated.
I looked at various documents about devices and created the basic set of
devices:
http://hgweb.boddie.org.uk/qi-emdebian/file/5bc2f2eb7f63/qi-emdebian-postsetup
This seemed to get me going far enough to be able to configure a Debian system
on the NanoNote. With the usual Debian init system running, udev takes over
the show.
Paul
More information about the discussion
mailing list