Tipandaboard: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
(Convert ExpressionEngine section headers)
(Redirect to TIPandaBoard)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}
#REDIRECT [[TIPandaBoard]]
 
[[Category:Devices]]
 
== 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 [http://www.omappedia.com/wiki/OMAP_Ubuntu_Core omapedia], from which much of this information was borrowed.
 
Get qemu-utils:
<code>apt-get install qemu-utils<code>
 
And create an image
</code>qemu-image create disk.img 1G</code> ''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:
<code>
# Partition the image
printf ",32,C,*,,L\n\n\n" | sfdisk -uM -D disk.img
# Format boot partition
sudo losetup /dev/loop0 disk.img -o 32256 —sizelimit 41094144
sudo mkfs.vfat -F 32 -n "bootfs" /dev/loop0
sudo losetup -d /dev/loop0
# Format root partition
sudo losetup /dev/loop0 disk.img -o 41126400
sudo mkfs.ext4 -L "rootfs" /dev/loop0
sudo losetup -d /dev/loop0
</code>
 
And now it's time to put some files on our image. Let's start with the Ubuntu core rootfs, available from [http://cdimage.ubuntu.com/ubuntu-core/releases/ here].
<code>
# Mount the rootfs
mkdir rootfs
sudo mount -o loop,offset=41126400 disk.img rootfs
# Download &amp; unpack Ubuntu Core
wget http://cdimage.ubuntu.com/ubuntu-core/releases/12.04.2/release/ubuntu-core-12.04.2-core-armhf.tar.gz
sudo tar —numeric-owner -xf ubuntu-core-12.04.2-core-armhf.tar.gz -C rootfs/
</code>
 
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.
<code>
# Get qemu-user-static so that we can chroot in
sudo apt-get install qemu-user-static
sudo cp /usr/bin/qemu-arm-static rootfs/usr/bin/
# Chroot in
sudo chroot rootfs
# Add the TI PPA to apt sources
printf "deb http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main\ndeb-src http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main" > /etc/apt/sources.list.d/ti.list
apt-key adv —recv-keys —keyserver keyserver.ubuntu.com B2E908737DB60AD5
# Also enable universe
sed -i 's/#  universe$/\1 universe/g' /etc/apt/sources.list
# Better mount a few things before we start installing…
mount /dev
mount /dev/pts
mount /proc
# And update &amp; upgrade
apt-get update
apt-get upgrade -y
# Install packages which we require for Qt
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
# …and anything else we might need, such as an SSH server
apt-get install netbase isc-dhcp-client openssh-server -y
# All done, clean up and get out
service udev stop
umount /proc
umount /dev/pts
umount /dev
exit
sudo rm rootfs/usr/bin/qemu-arm-static
</code>
 
Here are a few other things which may be handy for development:
<code>
# Enable serial console
cat > ttyO2.conf <<EOF
start on stopped rc or RUNLEVEL=[2345]
stop on runlevel [!2345]
 
respawn
exec /sbin/getty -L –8 115200 ttyO2
EOF
sudo mv ttyO2.conf rootfs/etc/init/
sudo chmod ''x rootfs/etc/init/ttyO2.conf
 
# Allow root to login without a password
sudo sed -i 's/root:/root:/' rootfs/etc/shadow
</code>
 
When we are done with the rootfs, unmount it:
<code>sudo umount rootfs<code>
 
 
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.
</code>
# 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
<code>
 
 
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.
 
 
==== Build Qt ====
Make sure you have your native and cross-compilers installed. Ubuntu provides one (so does Linaro):
</code>sudo apt-get g-arm-linux-gnueabihf build-essential</code>
 
You will want to mount that rootfs from the previous section to make life easier when building Qt. From above:
<code>
mkdir rootfs
sudo mount -o loop,offset=41126400 disk.img rootfs
</code>
 
Now configure (note the last 3 include arguments; these are required due to funky placement of the GBM/DRM headers in the TI repository):
<code>
./configure -device linux-pandaboard-g''+ -nomake tests -nomake examples -prefix /your_path_to_qt -sysroot /your_rootfs_path
-I/your_rootfs_path/usr/include -I/your_rootfs_path/usr/include/gbm -I/your_rootfs_path/usr/include/drm
</code>
 
If all goes well, you should be able to run <code>make &amp;&amp; make install<code> 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 ===

Latest revision as of 14:19, 28 August 2015

Redirect to: