Taylorbyte.com

Documentation Wiki

Archlinux UML

Create image file

sudo dd if=/dev/zero of=/srv/rootfs.img bs=1MB count=4000
sudo mkfs.ext4 -F /srv/rootfs.img
sudo tune2fs -o discard /srv/rootfs.img
sudo mkdir /mnt/uml
sudo mount -o loop /srv/rootfs.img /mnt/uml/
sudo mkdir -p /mnt/uml/var/lib/pacman
sudo pacman -Sy base -r /mnt/uml/

sudo pacman -r /mnt/uml/ -Sy dhclient netctl wpa_actiond ifplugd sudo wget openssh openssl vim net-tools inetutils openntpd rsync

sudo cd /mnt/uml/dev
sudo mknod --mode=660 ubd0 b 98 0
sudo chown root:disk ubd0

edit /mnt/uml/etc/fstab

/dev/ubd0 / ext4 defaults,discard 0 0
sudo umount /mnt/uml

UML Network

edit /etc/network.d/bridge

INTERFACE="br0"
CONNECTION="bridge"
DESCRIPTION="Bridge connection"
BRIDGE_INTERFACES="eth0 tap0"
IP="dhcp"
## sets forward delay time
#FWD_DELAY=0
## sets max age of hello message
#MAX_AGE=10

edit /etc/network.d/tap

INTERFACE='tap0'
CONNECTION='tuntap'
MODE='tap'
USER='nobody'
GROUP='nobody'

## Example IP configuration
#IP='static'
#SKIPNOCARRIER='yes'
#ADDR='10.10.1.2'

start tap

sudo systemctl restart netcfg@tap
if addr

if that worked enable it for boot

sudo systemctl enable netcfg@tap

start bridge

sudo systemctl restart netcfg@bridge
if addr

if that worked enable it for boot

sudo systemctl enable netcfg@bridge

Compile custom uml kernel

sudo wget -4 http://i7.lan/latest_kernel/linux-3.13.5.tar.xz
sudo tar -xf linux-3.13.5.tar.xz
cd linux-3.13.5
sudo make mrproper ARCH=um -j 8
sudo make defconfig ARCH=um
sudo make ARCH=um -j 8
#sudo make menuconfig ARCH=um

sudo strip linux

# make modules_install INSTALL_MOD_PATH=~/umllibmodules ARCH=um
# copy modules from the path above into the uml machines /lib/modules/[kernel]

sudo mv linux ..

Start UML

vmlinux ubd0=/srv/rootfs.img eth0=tuntap,tap0,3f:2a:bb:00:00:00,dhcp mem=128M con=pty

OR custom

./linux ubd0=/srv/rootfs.img eth0=tuntap,tap0,6a:5c:c7:8e:f8:c0,192.168.0.100 mem=128M console=/dev/pts/3

Connect to UML console

sudo minicom -D /dev/pts/3