TIPandaBoard: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Devices]]
[[Category:Devices]]


Line 11: Line 12:
==== Acquire an image ====
==== 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.
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 & 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 & 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


Get qemu-utils:<br /><code>apt-get install qemu-utils<code>
# Allow root to login without a password
sudo sed -i 's/root:/root:/' rootfs/etc/shadow
</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!''
When we are done with the rootfs, unmount it:
<code>sudo umount rootfs</code>


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 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>


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]
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.


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>
==== 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>


<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.
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>


<br />h4. Build Qt
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 />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>
<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>
./configure -device linux-pandaboard-g++ -nomake tests -nomake examples -prefix /your_path_to_qt -sysroot /your_rootfs_path
<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>
-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.
If all goes well, you should be able to run <code>make && 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 ===
=== Android ===

Latest revision as of 12:26, 13 April 2015


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, from which much of this information was borrowed.

Get qemu-utils:

apt-get install qemu-utils

And create an image

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:

# 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

And now it's time to put some files on our image. Let's start with the Ubuntu core rootfs, available from here.

# Mount the rootfs
mkdir rootfs
sudo mount -o loop,offset=41126400 disk.img rootfs
# Download & 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/

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.

# 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 & 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

Here are a few other things which may be handy for development:

# 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

When we are done with the rootfs, unmount it:

sudo umount rootfs


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.

# 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


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):

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:

mkdir rootfs
sudo mount -o loop,offset=41126400 disk.img rootfs

Now configure (note the last 3 include arguments; these are required due to funky placement of the GBM/DRM headers in the TI repository):

./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

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