Skip to content
brabo edited this page Aug 22, 2017 · 16 revisions

Running on QEMU

The requirements to test frosted on synthetic target are:

  • a Linux distribution, or a POSIX-compliant OS which supports the tools described below

How to run the QEMU example synthetic target:

  • Clone frosted

git clone git://github.com/insane-adding-machines/frosted.git

  • Run QEMU environment setup script by sourcing it, required to have changes to $PATH apply after termination of the script (will install dependencies to ~/frosted-qemu). Note: this is a bash script, and includes Debian-based distro specific commands. You can however use this script as a guide as to what you need to do to get things working.

. scripts/frosted-qemu-setup

  • Use the example frosted kernel pre-defined config for qemu, included in defconfig:

make defconfig TARGET=qemunet

  • Download the example frosted-userland config to frosted-userland/kconfig/.config

wget https://git.io/vKgDR -O frosted-userland/kconfig/.config

  • Compile frosted

make

  • Run the frosted image on qemu

make qemu

Network Support

  • If you want to enable tun/tap connectivity, run the "net" version

make qemunet

This target will create a frosted-to-host networking device (called frost0 on host). Configure your host machine to have an IP address in the same range as the frosted VM. For example, assuming that the address configured on frosted eth0 device is 192.168.2.150, set up the frost0 interface on the host machine to be 192.168.2.1 with netmask 255.255.255.0.

If everything is configured properly, you should be able to ping frosted at 192.168.2.150

Enable NAT with network support

To allow your frosted virtual machine to access the Internet using NAT, allow forwarding on the host machine. For example, if your frosted VM address is 192.168.20.150, and the device your host uses to access the Internet is labeled eth0, do: echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward

Add a MASQUERADE rule to your host firewall to change the source address for frosted traffic: sudo iptables -t nat -A POSTROUTING -s 192.168.20.150/32 -o eth0 -j MASQUERADE

Run the virtual machine as in the example above, using make qemunet

Enable bridged networking (experimental)

  • Host networking setup example using bridge-utils
brctl addbr br0
brctl addif br0 eth0
ifconfig br0 192.168.20.1 netmask 255.255.255.0 broadcast 192.168.20.255

Run the VM using make qemubridge

Debug targets

  • Debugging the kernel
    • start qemu in debug mode:

make qemudbg

for the net version:

make qemunetdbg

for the bridge version:

make qemunetbridge

  • start the debugger: From another console run arm-frosted-eabi-gdb or arm-none-eabi-gdb and attach to localhost:3333 to start debugging. You can use the following settings in your local .gdbinit script:
 tar ext :3333
 layout src
 file kernel.elf
 stepi
 focus c