SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
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
Installations
Qemu:             is a generic and open source machine emulator and virtualizer.
http://wiki.qemu.org




Method 1:
Install a virtualbox virtual manager to run ubuntu 12.04 in windows 7. Then updated the ubuntu
packages , means the initial updates. Then installed qemu ,

# sudo apt-get install qemu

after installation check whether the qemu is installed correctly, run the command,

# qemu-system-i386

popup a black qemu windows shows some no disk found notification.




Fig 1 : Qemu window
Method 2:
Download the latest qemu source from http://wiki.qemu.org. 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 install


Check the qemu working, run command

# qemu-system-i386

popup a black qemu windows shows some no disk found notification [Fig. 1].




Fig 2 : working qemu window of a custom kernel
Busybox:               The Swiss Army Knife of Embedded Linux
http://busybox.net

Download 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 menuconfig


Select 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 install


make install command copies the binaries generated to _install directory.
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 initramfs


Create a basic folder structure
#mkdir -pv bin lib dev etc mnt/root proc root sbin sys


Copy some default device nodes to device directory
#sudo cp -va /dev/{null,console,tty} dev


Now copy the busybox binaries in _install directory into initramfs.
#cd busybox-1.20.2
#sudo cp -avR _install/* ../initramfs




Fig 3 : busybox copy to initramfs
Create a init script in initramfs directory
#cd initramfs
#sudo gedit init




Fig 4: init script


Change the permission settings of init script to executable
#sudo chmod +x init




Fig 5 : initramfs folder structure
Optional Steps for cpio archive[Optional]


#find . -print0 | cpio --null -ov --format=newc> ../initram.cpio




Fig 6 : copy files to archives
Kernel: Linux is a clone of the operating system Unix, written from scratch by Linus
Torvalds with assistance from a loosely-knit team of hackers across the Net.
http://www.kernel.org/

Download a stable kernel and untar it,




Fig 7 : Kernel.org


# tar xf linux-2.6.34.tar.bz2
# cd linux-2.6.34
# make allnoconfig
# make menuconfig


select 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
-> 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 info




Fig 8 : kernel configuration

save the configuration and run make

# make

It generates a bzImage of kernel in arch/x86/boot/
Virtual booting of kernel image in Qemu

#qemu-system-i386 -kernel linux-2.6.34/arch/x86/boot/bzImage




Fig 9 : final qemu window

Contenu connexe

Tendances

Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
Rashila Rr
 

Tendances (20)

RPM Building
RPM BuildingRPM Building
RPM Building
 
Introduction to Linux Kernel
Introduction to Linux KernelIntroduction to Linux Kernel
Introduction to Linux Kernel
 
repositor.io - Simple Repository Management
repositor.io - Simple Repository Managementrepositor.io - Simple Repository Management
repositor.io - Simple Repository Management
 
Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)Recipe of a linux Live CD (archived)
Recipe of a linux Live CD (archived)
 
Linux kernel system call
Linux kernel system callLinux kernel system call
Linux kernel system call
 
Ftp configuration
Ftp configurationFtp configuration
Ftp configuration
 
Learning Computer Network Through Network Simulation Program
Learning Computer Network Through Network Simulation ProgramLearning Computer Network Through Network Simulation Program
Learning Computer Network Through Network Simulation Program
 
3. introduction of centos
3. introduction of centos3. introduction of centos
3. introduction of centos
 
Asiabsdcon15
Asiabsdcon15Asiabsdcon15
Asiabsdcon15
 
Ilf2012
Ilf2012Ilf2012
Ilf2012
 
Scale9x sun
Scale9x sunScale9x sun
Scale9x sun
 
Tlf2013
Tlf2013Tlf2013
Tlf2013
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
Sweden11
Sweden11Sweden11
Sweden11
 
Kernel Recipes 2013 - Conditional boot
Kernel Recipes 2013 - Conditional bootKernel Recipes 2013 - Conditional boot
Kernel Recipes 2013 - Conditional boot
 
Qemu
QemuQemu
Qemu
 
Linux kernel booting
Linux kernel bootingLinux kernel booting
Linux kernel booting
 
Gnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-semGnubs-pres-foss-cdac-sem
Gnubs-pres-foss-cdac-sem
 
Minix3 fosdem2014
Minix3 fosdem2014Minix3 fosdem2014
Minix3 fosdem2014
 
Lavigne bsdmag may13
Lavigne bsdmag may13Lavigne bsdmag may13
Lavigne bsdmag may13
 

En vedette

Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
hughpearse
 
Code blocks – open source ide
Code blocks – open source ideCode blocks – open source ide
Code blocks – open source ide
Save the Children
 
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
Anne Nicolas
 

En vedette (20)

Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
 
Diagnostics of a Linux System
Diagnostics of a Linux SystemDiagnostics of a Linux System
Diagnostics of a Linux System
 
ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)
ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)
ROP Illmatic: Exploring Universal ROP on glibc x86-64 (ja)
 
Kernel Recipes 2016 - Landlock LSM: Unprivileged sandboxing
Kernel Recipes 2016 - Landlock LSM: Unprivileged sandboxingKernel Recipes 2016 - Landlock LSM: Unprivileged sandboxing
Kernel Recipes 2016 - Landlock LSM: Unprivileged sandboxing
 
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel developmentKernel Recipes 2016 - Why you need a test strategy for your kernel development
Kernel Recipes 2016 - Why you need a test strategy for your kernel development
 
LuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for LuaLuaNode: Asynchronous I/O for Lua
LuaNode: Asynchronous I/O for Lua
 
Virtualization with qemu-kvm and libvirt on openSUSE 42.2
Virtualization with qemu-kvm and libvirt on openSUSE 42.2Virtualization with qemu-kvm and libvirt on openSUSE 42.2
Virtualization with qemu-kvm and libvirt on openSUSE 42.2
 
Code blocks – open source ide
Code blocks – open source ideCode blocks – open source ide
Code blocks – open source ide
 
Using QEMU for cross development
Using QEMU for cross developmentUsing QEMU for cross development
Using QEMU for cross development
 
Kernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyoneKernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyone
 
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMUKernel Recipes 2015: Speed up your kernel development cycle with QEMU
Kernel Recipes 2015: Speed up your kernel development cycle with QEMU
 
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
Kernel Recipes 2015: Puma: Pooling Unused Memory in Virtual Machines for I/O ...
 
Dave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMUDave Gilbert - KVM and QEMU
Dave Gilbert - KVM and QEMU
 
Basic of virtual memory of Linux
Basic of virtual memory of LinuxBasic of virtual memory of Linux
Basic of virtual memory of Linux
 
Hardware-Assisted Rootkits & Instrumentation
Hardware-Assisted Rootkits & InstrumentationHardware-Assisted Rootkits & Instrumentation
Hardware-Assisted Rootkits & Instrumentation
 
Kernel Recipes 2016 - The kernel report
Kernel Recipes 2016 - The kernel reportKernel Recipes 2016 - The kernel report
Kernel Recipes 2016 - The kernel report
 
ARM 64bit has come!
ARM 64bit has come!ARM 64bit has come!
ARM 64bit has come!
 
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s goingKernel Recipes 2016 - Kernel documentation: what we have and where it’s going
Kernel Recipes 2016 - Kernel documentation: what we have and where it’s going
 
Kernel Recipes 2016 - New hwmon device registration API - Jean Delvare
Kernel Recipes 2016 -  New hwmon device registration API - Jean DelvareKernel Recipes 2016 -  New hwmon device registration API - Jean Delvare
Kernel Recipes 2016 - New hwmon device registration API - Jean Delvare
 
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
Kernel Recipes 2016 - Would an ABI changes visualization tool be useful to Li...
 

Similaire à Development platform virtualization using qemu

Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
mcganesh
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5
Carlos Eduardo
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i
Logesh Kumar Anandhan
 
Automatic systems installations and change management wit FAI - Talk for Netw...
Automatic systems installations and change management wit FAI - Talk for Netw...Automatic systems installations and change management wit FAI - Talk for Netw...
Automatic systems installations and change management wit FAI - Talk for Netw...
Henning Sprang
 

Similaire à Development platform virtualization using qemu (20)

Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
Kvm setup
Kvm setupKvm setup
Kvm setup
 
3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
7-compiling the Linux kerne pdf type is it
7-compiling the Linux kerne pdf type is it7-compiling the Linux kerne pdf type is it
7-compiling the Linux kerne pdf type is it
 
Building
BuildingBuilding
Building
 
Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5Instalando Cacti no CentOS 5
Instalando Cacti no CentOS 5
 
QEMU in Cross building
QEMU in Cross buildingQEMU in Cross building
QEMU in Cross building
 
Linux Containers From Scratch
Linux Containers From ScratchLinux Containers From Scratch
Linux Containers From Scratch
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
 
Linux
LinuxLinux
Linux
 
Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)Advanced Level Training on Koha / TLS (ToT)
Advanced Level Training on Koha / TLS (ToT)
 
KCC_Final.pdf
KCC_Final.pdfKCC_Final.pdf
KCC_Final.pdf
 
Jana treek 4
Jana treek 4Jana treek 4
Jana treek 4
 
LSA2 - 02 Namespaces
LSA2 - 02  NamespacesLSA2 - 02  Namespaces
LSA2 - 02 Namespaces
 
2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i2345014 unix-linux-bsd-cheat-sheets-i
2345014 unix-linux-bsd-cheat-sheets-i
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
Automatic systems installations and change management wit FAI - Talk for Netw...
Automatic systems installations and change management wit FAI - Talk for Netw...Automatic systems installations and change management wit FAI - Talk for Netw...
Automatic systems installations and change management wit FAI - Talk for Netw...
 
Linux Kernel Tour
Linux Kernel TourLinux Kernel Tour
Linux Kernel Tour
 

Development platform virtualization using qemu

  • 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. Installations Qemu: is a generic and open source machine emulator and virtualizer. http://wiki.qemu.org Method 1: Install a virtualbox virtual manager to run ubuntu 12.04 in windows 7. Then updated the ubuntu packages , means the initial updates. Then installed qemu , # sudo apt-get install qemu after installation check whether the qemu is installed correctly, run the command, # qemu-system-i386 popup a black qemu windows shows some no disk found notification. Fig 1 : Qemu window
  • 3. Method 2: Download the latest qemu source from http://wiki.qemu.org. 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 install Check the qemu working, run command # qemu-system-i386 popup a black qemu windows shows some no disk found notification [Fig. 1]. Fig 2 : working qemu window of a custom kernel
  • 4. Busybox: The Swiss Army Knife of Embedded Linux http://busybox.net Download 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 menuconfig Select 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 install make install command copies the binaries generated to _install directory.
  • 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 initramfs Create a basic folder structure #mkdir -pv bin lib dev etc mnt/root proc root sbin sys Copy some default device nodes to device directory #sudo cp -va /dev/{null,console,tty} dev Now copy the busybox binaries in _install directory into initramfs. #cd busybox-1.20.2 #sudo cp -avR _install/* ../initramfs Fig 3 : busybox copy to initramfs
  • 6. Create a init script in initramfs directory #cd initramfs #sudo gedit init Fig 4: init script Change the permission settings of init script to executable #sudo chmod +x init Fig 5 : initramfs folder structure
  • 7. Optional Steps for cpio archive[Optional] #find . -print0 | cpio --null -ov --format=newc> ../initram.cpio Fig 6 : copy files to archives
  • 8. Kernel: Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. http://www.kernel.org/ Download a stable kernel and untar it, Fig 7 : Kernel.org # tar xf linux-2.6.34.tar.bz2 # cd linux-2.6.34 # make allnoconfig # make menuconfig select 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. -> 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 info Fig 8 : kernel configuration save the configuration and run make # make It generates a bzImage of kernel in arch/x86/boot/
  • 10. Virtual booting of kernel image in Qemu #qemu-system-i386 -kernel linux-2.6.34/arch/x86/boot/bzImage Fig 9 : final qemu window