An easy kernel development environment

This article which sounds like anti-oracle virtual box, but it wasn’t and highlighted the use of virtual box made me write this blog. http://www.zdnet.com/blog/virtualization/what-sucks-worse-than-oracles-virtualbox/3405

I have been a big fan of Oracle virtual box and indeed it’s the best Type2 hypervisor (based on features for x86) I have used. I would say qemu as the lightest and the fastest. When I started poking around on Linux kernel running over virtual box, my modules crashed and caused file-system corruptions. This led me to use a desktop machine as a Linux test machine. But I could not carry my test machine with me. And so, I have changed my environment to two virtual machines (test and development) using virtual box.

I will describe here how to Setup two virtual machines for Linux development environment

Please refer these links which describe how to :

  1. Build and test a module using the environment refer here.
  2. Change the kernel of test machine refer here
  3. Removing the kernel of test machine refer here

Overview of the setup:

  • Host OS is windows
  • Virtual box from Oracle
  • Ubuntu as the test and development Linux distribution

overview

1. Downloads and software packages:

  • Download Oracle Virtual Box  and don’t forget the corresponding extension pack.
  • Download the Ubuntu ISO. I use Ubuntu 12.10. You can use Ubuntu 12.04 as it is LTS.

2. Virtual machines: Create two virtual machines,

  • Development machine with at least 20GB hard disk
  • Test machine with 4.5GB hard disk.

Refer the virtual box user guide if any doubts.

3. New network interface: Create a new host only adapter in the virtual box from Oracle VM Virtual Box Manager > File > Preferences > Network.

pic1

Create new adapter with the credentials as shown.

pic3

So the network adapter appears as shown

pic3_a

4. Tuning the test machine: Boot the test machine and strip it to bare minimum by removing the unnecessary software like games, Firefox etc. Even strip its GUI and make it text only using the grub as described here.

5. Setting up the network: With both the virtual machines stopped configure the network interface as shown.

test_machine

development_machine

Leave the first network adapter unaltered in the development machine. This interface will be used for downloading additional softwares.
Now start both the machines and get the IP of both machines using “ifconfig”. In my case development machine IP is 192.10.100 and test machine IP is 192.10.101. Ping both the machines from each other and verify the network connection.

6. First login: To login to the test machine using SSH install openSSH-client in your development machine using the command at a terminal

sudo apt-get install openssh-client

Now type the command at a terminal

ssh test@192.10.10.101

I have used test as it is my user name on test machine. You will get a warning for the RSA when you login the first time

The authenticity of host '192.10.10.101' can't be established.
RSA key fingerprint is b1:2d:33:67:ce:35:4d:5f:f3:a8:cd:c0:c4:48:86:12.
Are you sure you want to continue connecting (yes/no)?

Type yes

7. Test: You can test the setup by shutting down the test machine using the command after logging on to the machine on ssh

$ sudo poweroff

The Linux development environment is configured.

Please feel free to send me queries or improvements for this writeup. If you find this useful or useless please post your reply

Advertisements

One thought on “An easy kernel development environment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s