Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development.

Similar presentations


Presentation on theme: "1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development."— Presentation transcript:

1 1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development Kernel Development with VirtualBox Marco Stornelli Created with OpenOffice.org 3.1.1OpenOffice.org

2 2 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Rights to copy Attribution – ShareAlike 3.0 You are free to copy, distribute, display, and perform the work to make derivative works to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by- sa/3.0/legalcodehttp://creativecommons.org/licenses/by- sa/3.0/legalcode Marco Stornelli © Copyright 2009 - 2010 http://www.webalice.it/firefox8 2

3 3 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Best viewed with... This document is best viewed with a recent PDF reader or with OpenOffice.org itself!OpenOffice.org Take advantage of internal or external hyper links So, don’t hesitate to click on them! See next page. Find pages quickly thanks to automatic search Use thumbnails to navigate in the document in a quick way

4 4 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 VirtualBox VirtualBox is a virtualization tool. There is a free version called OSE. With VirtualBox we can work with virtualized environments. We must work with the same arch of our host. Add your Linux user to the group vboxusers to be able to use it without be root. Load vboxdrv kernel module to be able to run it.

5 5 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Compile the kernel Compile the kernel and build an isoimage make FDARGS= FDINITRD= isoimage We can use a simple initrd as rootfs or we can use a flexible NFS root filesystem. To either build a simple initrd or use NFS, see my presentation “ Embedded Linux kernel and Drivers ”.

6 6 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Build rootfs We can copy or link all the executable of our host system in the new target filesystem. Coping is more secure than linking because with this one we could break down our system! Instead of using our host bins we could use busybox. If we use busybox we have to copy several libraries from our host lib folder: ld libcrypt libm libnss_files libnss_nis libwrap ld-linux libcrypt libnsl libnss_files libresolv libanl libc libnss_compat libnss_hesiod librt libBrokenLocale libdl libnss_nis libgcc_s libutil libnss_dns libnss_nisplus

7 7 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Create a new virtual machine Open VirtualBox and click on “New”. Select name of your virtual machine and select as OS Linux 2.6 (or 2.4). Select the memory for your system, for very basic environment 32MB are enough. Don't select any virtual hard disk for now. Click finish. Click on “Settings” and under CD/DVD menu select “mount CD/DVD” and then ISO image file. Select your kernel image.

8 8 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Network setup with VirtualBox 2.x Under “Net” menu, enable a network device and select in the menu “Attached To” “Host Interface”. In the text field now enabled “Interface name” edit tap1. Leave blank the fields “Setup Application” and “Terminate Application”. Now your virtual machine is ready but we need to enable the virtual interface in our host system.

9 9 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Network setup with VirtualBox 3.x Under “Net” menu, enable a network device and select in the menu “Interface with bridge”. In the combo box select br0 (See in the next slides how to create a bridge). Now your virtual machine is ready but we need to enable the virtual interface in our host system.

10 10 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Virtual interfaces: Tips and Tricks Software packages you need to perform this step: brctl – Bridge utilities tunctl – Tun/Tap utilities All the commands will must be executed as root. Unless the first and second step, all the changes will be transient, so if you want a permanent configuration you can create a start-up script. Check out your firewall configuration, it could happen that it doesn't allow the communication between the virtual and the host machine. In this case a simple solution is shut down it (example for OpenSuse): rcSuSEfirewall2 stop

11 11 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Create a virtual interface (1) Load module for tun/tap modprobe tun (*) Setup tap and bring up the interface tunctl -t tap1 -u root (*) ifconfig tap1 up (*) Create a bridge brctl addbr br0 Setup our interfaces ifconfig eth0 0.0.0.0 promisc ifconfig tap1 promisc

12 12 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Create a virtual interface (2) Add our real interface to the bridge brctl addif br0 eth0 Add the interface to VirtualBox VBoxAddIF tap1 br0 (*) Setup the bridge with an IP address ifconfig br0 192.168.0.1 up Now the configuration is ready! You can use the bridge address as NFS address to pass it to the linux kernel of our virtual machine. (*) Step needed only for VirtualBox 2.x

13 13 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Legal statements Linux is a registered trademark of Linus Torvalds Linux logo by Larry Ewing VirtualBox is a trademark of Sun Microsystems, Inc. Other company, product, and service names may be trademarks or service marks of others


Download ppt "1 Kernel development with VirtualBox © Copyright 2009, Marco Stornelli Creative Commons Attribution-ShareAlike 3.0 license 9/30/2016 Linux development."

Similar presentations


Ads by Google