Homepage Wiki Forum Buy

Quemu

From GNUBLIN

If you want to port an existing application on GNUBLIN you often have to cross-compile it. Addicted to the dependencies and complexity of the program you need may many libraries. By using the toolchain on your PC to compile it you have to create many linker and include-paths.

It's easier to compile the program directly on GNUBLIN. By an big application this could really need some time. But therefore exists Qemu. With Qemu you can quickly emulate GNUBLIN on you machine. That's perfect to compile such huge programs. If the program is compiled you can copy the result or the whole file-system to your SD-Card and use the application.

Qemu.png

To delock the mouse and coursor press Strg + Alt

Preparation

At first you have to install this program:

sudo apt-get install qemu-system

Now you need an image with about the size of 2 GB (It also can be smaller):

sudo dd if=/dev/zero of=rootfs.img bs=1M count=2000

After that you have to get it as an ext3 file-system:

sudo mkfs.ext3 -F rootfs.img

Now we create a new folder and mount the image there:

mkdir newfolder
sudo mount rootfs.img newfolder/ -o loop

If the file-system is extracted in the newfolder you have to make modifications on the file (as root):

sudo vi newfolder/etc/inittab

You have to replace the last line

T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt102

with

1:2345:respawn:/sbin/getty 38400 tty1

Now its important to unmount the image:

sudo umount newfolder/

As last step you have to get the Qemu Kernal (zImage) becaouse Qemu runs with his own Kernel:

wget www.gnublin.org/downloads/gnublin_distro/kernels/qemu_kernel/zImage

Booting Qemu

After all preparations are done without any errors it is now possible to boot the root file-system via Qemu:

sudo qemu-system-arm -M versatilepb -cpu arm926 -kernel zImage -hda rootfs.img -m 256 -append "root=/dev/sda rootfstype=ext3 mem=256M devtmpfs.mount=0 rw"

It is more comfortable to use the emulator over SSH. The easiest way is to configure a "Bridge" like we show here. Is the system running with an network check the IP-address with the command ifconfig you will find the address by the interface eth0. Now you can get a connection by using ssh. The advantage by SSH is you can easily copy files between the GNUBLIN-Terminal and your own machine.

Qemu in the network

In order to run qemu with the network support you have to configure a network bridge on the host system.

Insert the following in /etc/network/interfaces of the host machine:

#auto eth0
iface eth0 inet manual
auto virbr0
iface virbr0 inet dhcp
    bridge_ports eth0 tap0
    bridge_fd 9
    bridge_hello 2
    bridge_maxage 12
    bridge_stp off
    bridge_maxwait 5

Restart the network

: sudo /etc/init.d/networking restart

It is important that the eth0 interface has to be in the reconfigured status. There for "iface eth0 inet manual".

The network configuration on the guest system can now be set as usual. Normally type

ifup eth0
sudo qemu-system-arm -M versatilepb -cpu arm926 -kernel zImage -hda rootfs.img -m 256 -net nic -net tap -append "root=/dev/sda rootfstype=ext3 mem=256M devtmpfs.mount=0 rw"
In other languages