Qemu, Qt, Buildroot

(Skrev detta pÃ¥ en tidigare blogg. Infon är användbar fortfarande sÃ¥ jag ”framporterar” texten :-))

1. Krav

  • Ubuntu 13.04
  • Buildroot – http://buildroot.uclibc.org/downloads/buildroot-2013.02-rc1.tar.bz2

2. Installera Ubuntupaket

  • apt-get install nfs-kernel-server
  • apt-get install qemu qemu-system qemu-system-arm qemu-keymaps qemu-user qemu-utils

3. NFS Server

  • mkdir /nfs-root
  • Add to /etc/exports: /nfs-root 127.0.0.1(rw,sync,no_subtree_check,all_squash,insecure,anonuid=0,anongid=0)

4. myinit.sh – Add to <path>/nfs-root

#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t ramfs ramfs /dev
/sbin/mdev -s
/etc/init.d/rcS
export DISPLAY=:0
exec /bin/sh

5. qtapp.sh – Add to <path>/nfs-root

#!/bin/sh
export QWS_KEYBOARD=”TTY:/dev/tty1″
export QWS_DISPLAY=”LinuxFb:/dev/fb0:0″
export QWS_SIZE=”800×480″
/myApp -qws -keyboard &

6. myApp – Add to <path>/nfs-root (your Qt application)

7. Konfigurera buildroot

mkdir build ; cd build
wget http://buildroot.uclibc.org/downloads/buildroot-2013.02-rc1.tar.bz2 tar jxf buildroot-2013.02-rc1.tar.bz2
cd buildroot-2013.02-rc1
make menuconfig

Välj sedan följande att konfigurera följande:

  • Target arch -> ARM (little endian)
  • Target arch variant -> arm926t
  • Toolchain -> Type -> External toolchain
  • Toolchain -> Toolchain -> Sourcery Codebench ARM 2012.03
  • Toolchain -> Toolchain origin -> Toolchain to be downloaded and installed
  • Toolchain -> Enable MMU support
  • System Configuration -> /dev management -> (Static using device table)
  • System Configuration -> Init system -> Busybox
  • System Configuration -> Port to run a getty (ttyAMA0)
  • Package Selection for target -> Busybox (1.21.x)
  • Package Selection for target -> Graphic libraries -> directfb (select all)
  • Package Selection for target -> Graphic libraries -> Qt -> Approve free license
  • Package Selection for target -> Graphic libraries -> Qt -> Gui Module
  • Package Selection for target -> Graphic libraries -> Qt -> DBus Module
  • Package Selection for target -> Graphic libraries -> Qt -> XML Module
  • Package Selection for target -> Graphic libraries -> Qt -> Freetype2 (Qt freetype2)
  • Package Selection for target -> Graphic libraries -> Qt -> JPEG (Qt bundled)
  • Package Selection for target -> Graphic libraries -> Qt -> PNG (Qt bundled)
  • Package Selection for target -> Graphic libraries -> Qt -> zlib (Qt zlib)
  • Package Selection for target -> Graphic libraries -> Qt -> Graphics drivers -> Linux Framebuffer
  • Package Selection for target -> Graphic libraries -> Qt -> Graphics drivers -> Qt Virtual Framebuffer
  • Package Selection for target -> Graphic libraries -> Qt -> Graphics drivers -> directFB
  • Package Selection for target -> Graphic libraries -> Qt -> Mouse drivers -> select all
  • Package Selection for target -> Graphic libraries -> Qt -> Keyboard drivers -> select all
  • Package Selection for target -> Graphic libraries -> Qt -> Script Module
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Servers -> select all
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Libraries -> select all
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Libraries -> select all
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Applications -> select all
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Protocols -> select all
  • Package Selection for target -> Graphic libraries -> X.org -> X11R7 Applications -> select all
  • Package Selection for target -> Graphic libraries -> xterm
  • Package Selection for target -> Graphic libraries -> xvkbd
  • Package Selection for target -> Filesystems and … -> select all
  • Package Selection for target -> Libraries -> Crypto -> libgcrypt
  • Package Selection for target -> Networking … -> dropbear
  • Filesystem images -> cpio
  • Filesystem images -> ext2
  • Filesystem images -> jffs2
  • Filesystem images -> romfs
  • Filesystem images -> squashfs
  • Filesystem images -> tar the root filesystem
  • Bootloaders -> U-Boot
  • Bootloaders -> U-Boot board name -> versatilepb
  • Bootloaders -> Custom Network Settings -> server ip -> 10.0.2.2
  • Bootloaders -> Custom Network Settings -> ip address -> 10.0.2.15
  • Bootloaders -> Custom Network Settings -> gateway ip -> 10.0.2.1
  • Bootloaders -> Custom Network Settings -> netmask -> 255.255.255.0
  • Bootloaders -> Custom Network Settings -> ethernet address -> 04:25:fe:ed:00:18
  • Kernel -> Linux Kernel -> Kernel version -> 3.7.6
  • Kernel -> Linux Kernel -> Kernel configuration -> Using a defconfig
  • Kernel -> Linux Kernel -> Defconfig name -> versatile
  • Kernel -> Linux Kernel -> Install kernel image to /boot in target


8. Bygg buildroot

make


9. Extrahera rootfs till nfs-monteringen

cd /nfs-root
tar xf build/buildroot-2013.02-rc1/output/images/rootfs.tar

10. Starta Qemu

qemu-system-arm -M versatilepb -kernel build/buildroot-2013.02-rc1/output/images/zImage -append ”nfsroot=10.0.2.2:/nfs-root rw ip=10.0.2.15::10.0.2.1:255.255.255.0 init=/myinit.sh console=ttyAMA0” -m 256 -serial stdio

11. Starta Qt-applikationen

./qtapp.sh