QEMU based virtual image.

QEMU

Toolchain

As we will be using (emulating) an "older" machine, the cortex A9 toolchains we used in the other case will not work for us. We will use an older Codesourcery arm toolchain (note that it's prefix is arm-none-linux-gnueabi-).:

wget http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
tar xf arm-2014.05-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
export PATH=$PWD/arm-2014.05/bin:$PATH

Kernel

We will use a vanilla kernel with the versatile-quemu defconfig. and versatile-pb DTB.


wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.2.3.tar.xz
tar xf linux-4.2.3.tar.xz
cd linux-4.2.3/

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-gnueabi-

# defconfig
make versatile_qemu_defconfig

#  for faster build (we don't need modules right now): make -j5  zImage dtbs
time ionice -c3 nice -n10 make -j5

# insert sdcard, mount...
cp arch/arm/boot/zImage /run/media/$USER/boot/

Booting

export PATH=$(HOME)/embeddedlinux/usr/bin/:$PATH

qemu-system-arm \
    -M versatilepb \
    -nographic \
    -kernel linux-4.2.3/arch/arm/boot/zImage \
    -dtb linux-4.2.3/arch/arm/boot/dts/versatile-pb.dtb \
    -append console=ttyAMA0

USB

QEMU emulates USB hardware. If you add support for OHCI (usb 1.1) and USB mass storage in the kernel, you can mount "usb disks" inside QEMU. The simplest way is to mount a file containing a filesystem image:

You can also connect an existing usb device from your host to the QEMU system, look in qemu documentation for the syntax of the usb_add command. Note that the device must not be used by the host system.

Vim logo FireFox logo CSS XHTML
Jozef Siska @ KAI FMFI UK YoYo @ KSP KAI (DAI) KSP