Download QEMU
Extract the package, build and install it.
cd qemu-0.10.5
./configure
make
make install
Build BusyBox
Download it here.
make defconfigIn menuconfig goto 'Build Options' and set 'Build BusyBox as a static binary'.
make menuconfig
make
make CONFIG_PREFIX=$bb_install_path install
Create rootfs image for QEMU
Create file image for rootfs.
Make ext2 filesystem.
Mount image to populate.
Copy BusyBox into mounted filesystem image
dd if=/dev/zero of=rootfs.img bs=1k count=100k
mke2fs -F -m 0 rootfs.img -t ext2
mount rootfs.img /mnt/qemu -t ext2 -o loop
rsync -a $bb_install_path /mnt/qemu
Then create the rootfs
cd /mnt/qemu
mkdir dev etc etc/init.d bin proc mnt tmp var var/shm
sudo chmod 755 . dev etc etc/init.d bin proc mnt tmp var var/shm
cd dev
sudo mknod tty c 5 0
sudo mknod console c 5 1
sudo chmod 666 tty console
sudo mknod tty0 c 4 0
sudo chmod 666 tty0
sudo mknod null c 1 3
sudo chmod 666 null
cd ../etc
echo "::sysinit:/etc/init.d/rcS" > inittab
echo "::askfirst:/bin/sh" >> inittab
sudo chmod 644 inittab
cd init.d
echo "mount -a" >> rcS
sudo chmod 744 rcS
cd ..
sudo echo "proc /proc proc defaults 0 0" >>fstab
sudo chmod 644 fstab
cd ~
sudo umount /mnt/qemu
Running the image on QEMU
You can find the vmlinuz image in /boot folder
Issue the command
qemu -kernel /boot/vmlinuz-2.6.28-11-generic -hda rootfs.img -append "root=/dev/sda"