TIPandaBoard
Qt on the PandaBoard
It should be possible to run Qt 5.1 (along with Qt Quick 2) on the Panda using Linux or Android. These instructions only cover running Qt in a single-window, fullscreen fashion without X11.
Linux
Let's use Linux… and by Linux, I really mean Ubuntu.
Acquire an image
There are many ways to build or get an Ubuntu disk image - you can install Ubuntu server, for example. Or, you might download a pre-built image from Linaro (or write one with linaro-media-create). For this wiki, we will use Ubuntu Core and walk you through the process. For more details and other fun PandaBoard stuff, please visit "omapedia":http://www.omappedia.com/wiki/OMAP_Ubuntu_Core, from which much of this information was borrowed.
Get qemu-utils:
apt-get install qemu-utils<code>
And create an image<br />
qemu-image create disk.img 1G 1G means 1 gigabyte. Feel free to choose a different size!
Let's create a few partitions. We need a small partition (32mb in the example) for the bootloader, and the rest of the card can be ext4:
<br /># Partition the image<br />printf ",32,C,*,,L\n\n\n&quot; | sfdisk -uM -D disk.img<br /># Format boot partition<br />sudo losetup /dev/loop0 disk.img -o 32256 —sizelimit 41094144<br />sudo mkfs.vfat -F 32 -n "bootfs&quot; /dev/loop0<br />sudo losetup -d /dev/loop0<br /># Format root partition<br />sudo losetup /dev/loop0 disk.img -o 41126400<br />sudo mkfs.ext4 -L "rootfs&quot; /dev/loop0<br />sudo losetup -d /dev/loop0<br />
And now it's time to put some files on our image. Let's start with the Ubuntu core rootfs, available from "here":http://cdimage.ubuntu.com/ubuntu-core/releases/.
<br /># Mount the rootfs<br />mkdir rootfs<br />sudo mount -o loop,offset=41126400 disk.img rootfs<br /># Download & unpack Ubuntu Core<br />wget http://cdimage.ubuntu.com/ubuntu-core/releases/12.04.2/release/ubuntu-core-12.04.2-core-armhf.tar.gz<br />sudo tar —numeric-owner -xf ubuntu-core-12.04.2-core-armhf.tar.gz -C rootfs/<br />
Now's a good time to tweak the file system. Let's start by installing the packages that we need in order to compile Qt.
<br /># Get qemu-user-static so that we can chroot in<br />sudo apt-get install qemu-user-static<br />sudo cp /usr/bin/qemu-arm-static rootfs/usr/bin/<br /># Chroot in<br />sudo chroot rootfs<br /># Add the TI PPA to apt sources<br />printf "deb http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main\ndeb-src http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main&quot; > /etc/apt/sources.list.d/ti.list<br />apt-key adv —recv-keys —keyserver keyserver.ubuntu.com B2E908737DB60AD5<br /># Also enable universe<br />sed -i 's/# universe$/\1 universe/g' /etc/apt/sources.list<br /># Better mount a few things before we start installing…<br />mount /dev<br />mount /dev/pts<br />mount /proc<br /># And update & upgrade<br />apt-get update<br />apt-get upgrade -y<br /># Install packages which we require for Qt<br />apt-get install libegl1-sgx-omap4 libgles2-sgx-omap4 libegl1-sgx-omap4-dev libgles2-sgx-omap4-dev libdrm-dev libwayland-dev libgbm-dev libffi-dev<br /># …and anything else we might need, such as an SSH server<br />apt-get install netbase isc-dhcp-client openssh-server -y<br /># All done, clean up and get out<br />service udev stop<br />umount /proc<br />umount /dev/pts<br />umount /dev<br />exit<br />sudo rm rootfs/usr/bin/qemu-arm-static<br />
Here are a few other things which may be handy for development:
<br /># Enable serial console<br />cat > ttyO2.conf <<EOF<br />start on stopped rc or RUNLEVEL=[2345]<br />stop on runlevel [!2345]
respawn<br />exec /sbin/getty -L –8 115200 ttyO2<br />EOF<br />sudo mv ttyO2.conf rootfs/etc/init/<br />sudo chmod ''x rootfs/etc/init/ttyO2.conf
<br /># Allow root to login without a password<br />sudo sed -i 's/root:/root:/' rootfs/etc/shadow<br />
When we are done with the rootfs, unmount it:
sudo umount rootfs<code>
<br />Now it's time to deal with the boot partition. There are other bootloaders out there, but U-boot is popular and easy to get working.<br />
# Create a boot.script for U-boot
cat > boot.script <<EOF
setenv bootargs console=tty0 console=ttyO2,115200n8 root=/dev/mmcblk0p2 rw earlyprintk vram=48M omapfb.vram=0:24M,1:24M consoleblank=0
fatload mmc 0:1 0x80000000 uImage
bootm 0x80000000
EOF
# Compile the script for U-boot
mkimage -A arm -T script -C none -n "Boot Image" -d boot.script boot.scr
# Get the kernel and bootloader files from Ubuntu
wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/MLO
wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/u-boot.bin
wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/uImage
# Mount the boot partition
mkdir bootfs
sudo mount -o loop,offset=32256 disk.img bootfs
# And copy everything over
sudo cp MLO u-boot.bin uImage boot.scr bootfs/
# All done, unmount
sudo umount bootfs
<br />Ok, now you've got an image. As long as it's been properly unmounted and you should be able to dd it to an SD card.
<br />h4. Build Qt
<br />Make sure you have your native and cross-compilers installed. Ubuntu provides one (so does Linaro):<br />
sudo apt-get g-arm-linux-gnueabihf build-essential
You will want to mount that rootfs from the previous section to make life easier when building Qt. From above:
<br />mkdir rootfs<br />sudo mount -o loop,offset=41126400 disk.img rootfs<br />
Now configure (note the last 3 include arguments; these are required due to funky placement of the GBM/DRM headers in the TI repository):
<br />./configure -device linux-pandaboard-g''+ -nomake tests -nomake examples -prefix /your_path_to_qt -sysroot /your_rootfs_path<br />-I/your_rootfs_path/usr/include -I/your_rootfs_path/usr/include/gbm -I/your_rootfs_path/usr/include/drm<br />
If all goes well, you should be able to run make && make install
to finish building Qt. If an important feature is missing (like OpenGL ES 2), run configure with -v for potentially helpful error messages. It should be possible to build OpenGL ES 2 along with the EGLFS, minimal EGL, and KMS QPA plugins.
Android