Development platform virtualization using qemu


Published on

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Development platform virtualization using qemu

  1. 1. Platform Virtualization(i386)for kernel booting, debugging and testing Requirements Linux machine (Virtual or Real) Qemu, busybox, initramfs, kernel packages : build-essential, libncurses5-dev, vnc4server
  2. 2. InstallationsQemu: is a generic and open source machine emulator and virtualizer.http://wiki.qemu.orgMethod 1:Install a virtualbox virtual manager to run ubuntu 12.04 in windows 7. Then updated the ubuntupackages , means the initial updates. Then installed qemu ,# sudo apt-get install qemuafter installation check whether the qemu is installed correctly, run the command,# qemu-system-i386popup a black qemu windows shows some no disk found notification.Fig 1 : Qemu window
  3. 3. Method 2:Download the latest qemu source from Extract the source and install# tar xf qemu-1.2.0.tar.bz2# cd qemu-1.2.0.tar.bz2# sudo ./configure --target-list=i386-softmmu# sudo make# sudo make installCheck the qemu working, run command# qemu-system-i386popup a black qemu windows shows some no disk found notification [Fig. 1].Fig 2 : working qemu window of a custom kernel
  4. 4. Busybox: The Swiss Army Knife of Embedded Linuxhttp://busybox.netDownload latest busybox tar from the website and extract it.#tar xf busybox-1.20.2.tar.bz2#cd busybox-1.20.2#make allnoconfig#make menuconfigSelect appropriate options in menuconfig. busybox settings -> build options -> static binary[essential] coreutils -> enable cat, touch, chmod, chroot, cp, echo, ln, ls, mkdir, mknod, pwd, rm, rmdir console utils -> clear editor -> vi find -> find, grep init -> poweroff, init [essential] linux system utils -> mdev, mount[essential] network utils -> ping, arp, httpd, ifconfig shells -> ash, choose which shell is aliased to sh & bash name[essential]save the configuration.#make#make installmake install command copies the binaries generated to _install directory.
  5. 5. initramfs: is a root filesystem which is embedded into the kernel and loaded at an early stage of the boot process.Create a main directory initramfs#mkdir initramfs#cd initramfsCreate a basic folder structure#mkdir -pv bin lib dev etc mnt/root proc root sbin sysCopy some default device nodes to device directory#sudo cp -va /dev/{null,console,tty} devNow copy the busybox binaries in _install directory into initramfs.#cd busybox-1.20.2#sudo cp -avR _install/* ../initramfsFig 3 : busybox copy to initramfs
  6. 6. Create a init script in initramfs directory#cd initramfs#sudo gedit initFig 4: init scriptChange the permission settings of init script to executable#sudo chmod +x initFig 5 : initramfs folder structure
  7. 7. Optional Steps for cpio archive[Optional]#find . -print0 | cpio --null -ov --format=newc> ../initram.cpioFig 6 : copy files to archives
  8. 8. Kernel: Linux is a clone of the operating system Unix, written from scratch by LinusTorvalds with assistance from a loosely-knit team of hackers across the Net. a stable kernel and untar it,Fig 7 : tar xf linux-2.6.34.tar.bz2# cd linux-2.6.34# make allnoconfig# make menuconfigselect appropriate options. general setup -> initial RAM filesystem and RAM disk support -> initramfs source [/home/premjith/linux_qemu/initramfs] Bus options -> PCI support ELF Format/Emulation -> Kernel support ELF binaries Networking Support [y] -> Networking options ->packet socket ->unix domain socket
  9. 9. -> TCP/IP networking Device drivers -> ATA -> Network device support File systems -> second extended FS support -> ext3 Kernel hacking -> kernel debugging -> compile the kernel with debug infoFig 8 : kernel configurationsave the configuration and run make# makeIt generates a bzImage of kernel in arch/x86/boot/
  10. 10. Virtual booting of kernel image in Qemu#qemu-system-i386 -kernel linux-2.6.34/arch/x86/boot/bzImageFig 9 : final qemu window