http://uml.devloop.org.uk/howto.html
http://uml.devloop.org.uk/faq.html
http://user-mode-linux.sourceforge.net/index.html
Запуск
Скачать ядро, скомпилировать:make defconfig ARCH=um
make ARCH=um
Скачать root_fs, например Debian-Wheezy
Запустить:
host% mkdir /tmp/uml
host% TMPDIR=/tmp/uml ./linux ubda=Debian-Wheezy-AMD64-root_fs mem=1024m
Остановить:
guest% halt
Настройка сети
http://user-mode-linux.sourceforge.net/network.htmlhost% sudo aptitude install uml-utilities
Добавить пользователя в группу uml-net:
host% sudo vi /etc/group
newgrp uml-net # login to group
hot-plug it into a running UML:
pCtikQ - umlid, можно найти в папке ~/.uml
uml_console
tuntap - TUN and TAP are virtual-network kernel devices. Being network devices supported entirely in software, they differ from ordinary network devices which are backed up by hardware network adapters
host% uml_mconsole pCtikQ config eth0=tuntap,,,192.168.0.254
# or do it via bash command
host% uml_mconsole `ls -1t ~/.uml | head -n1` config eth0=tuntap,,,192.168.0.254
Enable the device within UML:guest% ifconfig eth0 192.168.0.253 up
guest% route add default gw 192.168.0.254
Set up NAT on the host in order to communicate with the outside Internet:
host% sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Запуск в gdb
http://web2.clarkson.edu/class/cs644/kernel/setup/uml/gdb_uml.htmlhost% TMPDIR=/tmp/uml gdb ./linux
(gdb) handle SIGSEGV pass nostop noprint
(gdb) handle SIGUSR1 pass nostop noprint
(gdb) break netlink_create
(gdb) run ubda=Debian-Wheezy-AMD64-root_fs mem=512m
handle SIGSEGV pass nostop noprint handle SIGUSR1 pass nostop noprint r ubda=Debian-Wheezy-AMD64-root_fs mem=512m
Tips on debugging optimized code
The Linux kernel and all kernel modules are always built with optimization on. This is not just for performance reasons: the kernel code requires and assumes that it is optimized and does not function otherwise.Tips on debugging optimized code