Bering
Home
About
Developing
   Section 1
   Section 2
   Section 3
   Section 4
   Section 5
   Section 6
   Section 7

Search Web Pages




3. Userland program development using a virtual Debian/slink box

This virtual machine will be used for Bering userland programs development. It is the latest available version of Debian "slink".


3.1. Installing your virtual Debian/slink machine

First of all create a new non-root account (e.g. leafuml) and login to that account. Then:

a) Download a 2.4.XX-YY UML kernel from the Leaf_UML section of the LEAF download area. Unpack it and make it executable:

cd /home/leafuml
bunzip2 linuxuml-2.4.XX-YY.bz2
chmod 755 linuxuml-2.4.XX-YY
Important

Replace XX by the linux kernel "sublevel" number and YY by the UML patch number available for that linux kernel. In the examples below you will have to replace XX and YY by the actual numbers of the UML kernel you have downloaded.

b) Download the Leaf_UML Debian "slink" filesystem with the basic set of packages allowing compilation of LEAF glibc 2.0 based userspace programs. Unpack it:

cd /home/leafuml
bunzip2 root_fs_slink.bz2

You will end up with a 200M root_fs_slink ext2 filesystem. Make sure your linuxuml kernel is executable (chmod 755 linuxuml-2.4.XX-YY)

Make sure everything is working by issuing the command (within an xterm):

./linuxuml-2.4.XX-YY ubd0=root_fs_slink

You should see the kernel boot sequence in your xterm and at the end of the process three new virtual console will pop up. You can now log into your new virtual machine.

Important

The password of the root login is root.

Important

To speed up the execution of programs on your virtual machine edit /etc/mtab and make sure to mount tmpfs when you boot up. Your /etc/mtab will look like:

/dev/ubd/0 / ext2 rw 0 0
proc /proc proc rw 0 0
/tmpfs /tmp tmpfs rw,size=64M 0 0

Issue your favorite commands to make sure you are in a linux box :-). Then halt.

3.2. Connecting your virtual machine to the network

First make sure ethertap + netlink_dev or tuntap are compiled within your host kernel or loaded as a module.

Let's assume your host is at IP 192.168.1.1 and belongs to a 192.168.1.0/24 private network connected to the Internet through the 192.168.1.254 gateway (your LEAF box).

Launch your virtual machine by issuing the command (if your host runs ethertap):

./linuxuml-2.4.XX-YY ubd0=root_fs_slink eth0=ethertap,tap0,,192.168.1.100

If your host runs tuntap (which appeared with 2.4 kernels), you will rather issue the following command:

./linuxuml-2.4.XX-YY ubd0=root_fs_slink eth0=tuntap,,,192.168.1.100

Login as root on your UML Debian/slink machine. Then issue the following commands:

ifconfig lo 127.0.0.1 up
ifconfig eth0 192.168.1.101 up
route add default gw 192.168.1.254

You should be able to ping your host (192.168.1.1), any external IP's and any domain name (ping www.yahoo.com).

For more information on UML and networking please refer to the UML documentation.

Note

If you issue ifconfig and netstat -ar commands on the host machine you will notice that an ethertap device has been fired at address 192.168.1.100 and a route is now available to the reach the UML. This has been done automatically by the uml_net program which was installed to begin with (See prerequisites).

3.3. Connecting your virtual machine to the host filesystem

This is as easy as:

mount none /mnt -t hostfs -o /some/host/directory

This command, issued within the UML machine, will attach /some/host/directory to the UML /mnt directory.

  • Created on 2004-03-26 11:13:52 by mhnoyes
  • Updated on 2004-05-02 11:39:55 by mhnoyes

 Printable Version


Hosted on Get LEAF Linux Embedded Appliance Framework at SourceForge.net. Fast, secure and Free Open Source software downloads, and powered by phpWebSite.