Tipandaboard: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Redirect to TIPandaBoard)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Devices]]
#REDIRECT [[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:<br /><code>apt-get install qemu-utils<code>
 
And create an image<br /></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:<br /><code><br /># Partition the image<br />printf &quot;,32,C,*,,L\n\n\n&amp;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 &quot;bootfs&amp;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 &quot;rootfs&amp;quot; /dev/loop0<br />sudo losetup -d /dev/loop0<br /></code>
 
And now it's time to put some files on our image. Let's start with the Ubuntu core rootfs, available from &quot;here&amp;quot;:http://cdimage.ubuntu.com/ubuntu-core/releases/.<br /><code><br /># Mount the rootfs<br />mkdir rootfs<br />sudo mount -o loop,offset=41126400 disk.img rootfs<br /># Download &amp; 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 /></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.<br /><code><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 &quot;deb http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main\ndeb-src http://ppa.launchpad.net/tiomap-dev/release/ubuntu precise main&amp;quot; &gt; /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 &amp; 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 /></code>
 
Here are a few other things which may be handy for development:<br /><code><br /># Enable serial console<br />cat &gt; ttyO2.conf &lt;&lt;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 /></code>
<br />When we are done with the rootfs, unmount it:<br /><code>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 /></code><br /># Create a boot.script for U-boot<br />cat &gt; boot.script &lt;&lt;EOF<br />setenv bootargs console=tty0 console=ttyO2,115200n8 root=/dev/mmcblk0p2 rw earlyprintk vram=48M omapfb.vram=0:24M,1:24M consoleblank=0<br />fatload mmc 0:1 0x80000000 uImage<br />bootm 0x80000000<br />EOF<br /># Compile the script for U-boot<br />mkimage -A arm -T script -C none -n &quot;Boot Image&amp;quot; -d boot.script boot.scr<br /># Get the kernel and bootloader files from Ubuntu<br />wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/MLO<br />wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/u-boot.bin<br />wget http://ports.ubuntu.com/ubuntu-ports/dists/precise/main/installer-armhf/current/images/omap4/netboot/uImage<br /># Mount the boot partition<br />mkdir bootfs<br />sudo mount -o loop,offset=32256 disk.img bootfs<br /># And copy everything over<br />sudo cp MLO u-boot.bin uImage boot.scr bootfs/<br /># All done, unmount<br />sudo umount bootfs<br /><code>
 
<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 /></code>sudo apt-get g-arm-linux-gnueabihf build-essential</code>
<br />You will want to mount that rootfs from the previous section to make life easier when building Qt. From above:<br /><code><br />mkdir rootfs<br />sudo mount -o loop,offset=41126400 disk.img rootfs<br /></code>
<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 /><code><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 /></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: