apt-get install ssh qemu vde nfs-kernel-server debootstrap uml-utilities bridge-utils dnsmasq
- In the file /etc/sysctl uncomment the following line to allow IP forwarding:
- In the file /etc/modules, add a new line with "tun", to make that module load on boot.
- Configure DNSmasq. Edit the file /etc/dnsmasq.conf and change the following options:
user=nobody domain=qemu.lan interface=qtap0 dhcp-range=10.1.1.1,10.1.1.253,255.255.255.0,10.1.1.255,8h
- To avoid the need for root privileges add the group "vde2-net" to all users that will use VDE (log-out and log-in for this to take effect)
sudo usermod -aG vde2-net $USER
- Add the new network interface. Edit the file /etc/network/interfaces and paste this:
auto qtap0 iface qtap0 inet static address 10.1.1.1 netmask 255.255.255.0 pre-up /sbin/modprobe ipt_MASQUERADE pre-up /usr/bin/vde_switch --tap qtap0 --sock /var/run/vde.ctl \ --daemon --group vde2-net --mod 775 \ --mgmt /var/run/vde.mgmt --mgmtmode 770 \ --pidfile /var/run/vde_switch.pid pre-up /etc/init.d/dnsmasq restart up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE down iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE post-down kill -s HUP `cat /var/run/vde_switch.pid`
- Either restart the PC or simply do:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" sudo modprobe tun sudo ifup qtap0
- Share the new directory out via NFS, by adding the following entry to /etc/exports:
It may also be necessary to share with 10.1.1.0/24(rw,no_root_squash,sync); however in my experience the NFS request came to the server from 127.0.0.1.
- Then export the filesystem:
- Download a kernel for arm-linux;
- Place the arm-linux zimage in /usr/local/etc/images/zImage.arm, and then create the following script as /usr/local/bin/start-qemu-arm:
#!/bin/sh #console="ttyAMA0" # serial console nfsserver="10.1.1.1" # address of NFS server nfsdir="/nfs/share/arm" # exported share where debian/arm is installed address="10.1.1.100" # address for guest server gateway="10.1.1.1" # default gateway netmask="255.255.255.0" # subnet mask hostname="arm.home" # hostname for guest server device="eth0" # interface that guest server will use mem=256 # memory for guest server in Mb #tap="/var/run/vde/tap0.ctl" # vde tap socket kernel="/usr/local/etc/images/zImage.arm" # arm kernel nfsopts="rsize=8192,wsize=8192,hard,intr,tcp,nolock" # nfs options #consoleopt="console=$console" nfsrootopt="nfsroot=$nfsserver:$nfsdir,$nfsopts" ipopt="ip=$address::$gateway:$netmask:$hostname:$device" init="" if [ "x$1" = "xsingle" ] then init="init=/bin/bash" fi vdeq qemu-system-arm -net vde,vlan=0 -net nic,vlan=0 -m $mem \ -kernel $kernel -append "root=/dev/nfs $nfsrootopt $ipopt $init"
Then from the command prompt run:
sudo /usr/local/bin/start-qemu-arm single
Now you should get a window with the famous penguin and a login prompt.
The rest of this HOWTO is unverified.
The emulated guest server should start up and boot into a bash prompt. The filesystem will be mounted read-only, and it will be necessary to remount it read-write before any further work can be done on it:
guest# mount -n -o remount,rw / guest# mount /proc
Now run the second stage of debootstrap, within the guest system, to finalise the installation:
guest# cd / guest# ./debootstrap/debootstrap --second-stage
This will probably take a while to run; the emulator isn't particularly fast. When it's finished, adjust a few remaining files, such as /etc/hostname and /etc/resolv.conf; also install ssh:
guest# apt-get install ssh
Once this is done, you can shut the server down. It's safe to just kill the qemu process from the host machine - since its filesystem is mounted from an NFS server, there's no need to shut it down cleanly.
Now you can start it up completely:
When it finishes booting, you should be able to ssh into it on 10.1.6.50, and you'll have a working Debian installation running on an emulated ARM processor.