Sunday, 11 August 2019

EGL and QT-5.12.4 on Raspberry PI

EGL + QT-5.12 on Beaglebone

debian-9.9-iot-armhf-2019-06-30 

Prerequisites

For a chroot and build system we would need.  A folder in your home. Put no spaces, no dashes, no dots to the folder you would use. Like: /home/me/QTFTF.
I use /BOARDS/QTFTF under root because HOME partition is to small now.
The /BOARDS/QTFTF has all my owner-ship set. For this exercise I use this folder. In the shell commands or scripts down the post just replace it with yours.

  cd /BOARDS/QTFTF

  • BBB Downloads
    • wget https://rcn-ee.com/rootfs/bb.org/testing/2019-08-03/stretch-lxqt/bone-debian-9.9-lxqt-armhf-2019-08-03-4gb.img.xz
    • tar xfv https://rcn-ee.com/rootfs/bb.org/testing/2019-08-03/stretch-lxqt/bone-debian-9.9-lxqt-armhf-2019-08-03-4gb.img.xz
    • rm *.xz
  • Setup Root FS 
    • Untar the Image to bone-debian-9.9-iot-armhf-2019-06-30-4gb.img
    • check the rootfs offset
      • dd this image to SDcard as well 
        • sudo dd if=bone-debian-9.9-iot-armhf-2019-06-30-4gb.img of=/dev/mm<TAB> bs=4M && sudo sync && sync
    • Boot BBB on sdcard
    • ssh debian@IP.OF.BB.B 
      • temppwd
  • On BBB

    • cd /opt/scripts/tools
    • sudo ./grow_partition.sh
    • reboot
    • log in again
    • sudo telinit 0
    • get the card out. 
  • Back To PC
      • fdisk bone-debian-9.9-iot-armhf-2019-06-30-4gb.img
        • Device                                        Boot Start     End Sectors  Size Id Type
          bone-debian-9.9-iot-armhf-2019-06-30-4gb.img1 *     8192 6963199 6955008  3.3G 83 Linux
        • Start = 8192
        • Find offset as offset=8192*512 - >   4194304
    • mkdir sdcard
    • sudo mount -o loop,offset=4194304 ./bone-debian-9.9-iot-armhf-2019-06-30-4gb.img ./sdcard/
    • ls sdcard/
      bbb-uEnv.txt  bin  boot  dev  etc  home  ID.txt  lib  lost+found  media  mnt  nfs-uEnv.txt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
    •  mkdir ROOTFS
    • sudo rsync -rav ./sdcard/ ./ROOTFS/
    •  mount | grep sdcard
      •  /BOARDS/QTFTF/bone-debian-9.9-iot-armhf-2019-06-30-4gb.img on /BOARDS/QTFTF/sdcard type ext4 (rw,relatime)
    • sudo umount /BOARDS/QTFTF/sdcard
  •  So far
    • Folder Structure on PC
.
├── ROOTFS



 Chroot script on PC

#!/bin/bash
ROOT_FS=./ROOTFS

[[ ! -f /usr/bin/qemu-arm-static ]] && echo "install qemu arm static please" && exit
[[ ! -f ./$ROOT_FS/bin/qemu-arm-static  ]] && cp /usr/bin/qemu-arm-static ./$ROOT_FS/usr/bin/qemu-arm-static

rm  ./$ROOT_FS/etc/resolv.conf
cp  /etc/resolv.conf  ./$ROOT_FS/etc/resolv.conf
if [[ -f ./$ROOT_FS/etc/resolv.conf ]];then
    mount -t proc proc ./$ROOT_FS/proc/
    mount -t sysfs sys ./$ROOT_FS/sys/
    mount -o bind /dev ./$ROOT_FS/dev/
    mount --bind /dev/pts  ./$ROOT_FS/dev/pts

    chroot ./$ROOT_FS qemu-arm-static /bin/bash

    umount  ./$ROOT_FS/dev/pts
    umount ./$ROOT_FS/dev/
    umount ./$ROOT_FS/sys/
    umount ./$ROOT_FS/proc/
fi

Qt default 5.7 install (under chroot)

  • chmod +x ./chroot.sh
  • sudo ./chroot.sh
  • check the net
    • ping google.com
    • cannot -> fix your DNS
  • su debian
  • cd 
  • mkdir system # we save the /lib /usr and /etc
  • exit
  • cd /home/debian
  • rsync -rav {/lib,/usr,/etc} ./system/
  • apt-get update
  • sudo apt-get install build-essential perl python git
    sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby 
    sudo apt-get install qt5-default libqt5qml5 qml-module-qtquick-controls 
    qt5-default qtdeclarative5-dev  qtquickcontrols5-examples 
    sudo apt install libclang-6.0-dev llvm-6.0 (if you enable doc)

 Qt5 5.12.4 on chrooted env

  • git clone git://code.qt.io/qt/qt5.git
    •  cd qt5
    • git checkout 5.12.4
    • git submodule update --init --recursive 
       
       
       

Configure


  • mkdir /home/debian/prefix
  • ./configure  -device-option CROSS_COMPILE=/usr/bin/ -platform  linux-g++  --enable-shared -prefix /home/debian/prefix -opengl es2   -sysroot / -opensource -confirm-license -make libs -v -no-gbm -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebglplugin -recheck-all -no-qml-debug -nomake examples -nomake tests -no-pulseaudio -no-alsa -device linux-generic-g++
  • MAKE
    • make -j4
  •  Wait about 12 .. 14 hours
    • Check prefix  folder
  • sync
  • exit # (get out of chroot) 
  • On PC X86

  • sync

Patch the SDcard 

  • Plug the sdcard to BBB
    • BOOT
      • sudo apt-get update
      • sudo apt-get install qtquickcontrols5-examples
      •  sudo apt-get install qt5-default libqt5qml5 qml-module-qtquick-controls qt5-default qtdeclarative5-dev  qtquickcontrols5-examples
  • reboot
  • restore /home/debian/system/etc/ld*  -> /etc
    • sudo cp  system/etc/ld* /etc
    • mkdir prefix
  • check eglinfo  and gles1test1 fff

  • On PC

  • Copy QT 5.12 from PC to BBB
  • From PC rsync the ROOTFS/home/debian/prefix - > BBB:~/prefix
    • cd  /BOARDS/QTFTF
    • sudo rsync -rav ./ROOTFS/home/debian/prefix/ debian@IP.OF.BB.BB:~/prefix/
    • OR
    • Do it all on PC, by mounting the SDcard to PC
  • On BBB

  • Configure qt 7 to qt 5.12.4
    • Patch or create /etc/xdg/qtchooser/default.conf
debian@beaglebone:~$ cat /etc/xdg/qtchooser/default.conf
/home/debian/prefix/bin
/home/debian/prefix

  • Test
    • qmake -query

 QT_SYSROOT:/
QT_INSTALL_PREFIX://home/debian/prefix
QT_INSTALL_PREFIX/raw:/home/debian/prefix
QT_INSTALL_ARCHDATA://home/debian/prefix
QT_INSTALL_ARCHDATA/raw:/home/debian/prefix
QT_INSTALL_DATA://home/debian/prefix
QT_INSTALL_DATA/raw:/home/debian/prefix
QT_INSTALL_DOCS://home/debian/prefix/doc
QT_INSTALL_DOCS/raw:/home/debian/prefix/doc
QT_INSTALL_HEADERS://home/debian/prefix/include
QT_INSTALL_HEADERS/raw:/home/debian/prefix/include
QT_INSTALL_LIBS://home/debian/prefix/lib
QT_INSTALL_LIBS/raw:/home/debian/prefix/lib
QT_INSTALL_LIBEXECS://home/debian/prefix/libexec
QT_INSTALL_LIBEXECS/raw:/home/debian/prefix/libexec
QT_INSTALL_BINS://home/debian/prefix/bin
QT_INSTALL_BINS/raw:/home/debian/prefix/bin
QT_INSTALL_TESTS://home/debian/prefix/tests
QT_INSTALL_TESTS/raw:/home/debian/prefix/tests
QT_INSTALL_PLUGINS://home/debian/prefix/plugins
QT_INSTALL_PLUGINS/raw:/home/debian/prefix/plugins
QT_INSTALL_IMPORTS://home/debian/prefix/imports
QT_INSTALL_IMPORTS/raw:/home/debian/prefix/imports
QT_INSTALL_QML://home/debian/prefix/qml
QT_INSTALL_QML/raw:/home/debian/prefix/qml
QT_INSTALL_TRANSLATIONS://home/debian/prefix/translations
QT_INSTALL_TRANSLATIONS/raw:/home/debian/prefix/translations
QT_INSTALL_CONFIGURATION://home/debian/prefix/etc/xdg
QT_INSTALL_CONFIGURATION/raw:/home/debian/prefix/etc/xdg
QT_INSTALL_EXAMPLES://home/debian/prefix/examples
QT_INSTALL_EXAMPLES/raw:/home/debian/prefix/examples
QT_INSTALL_DEMOS://home/debian/prefix/examples
QT_INSTALL_DEMOS/raw:/home/debian/prefix/examples
QT_HOST_PREFIX://home/debian/prefix
QT_HOST_DATA:/home/debian/prefix
QT_HOST_BINS:/home/debian/prefix/bin
QT_HOST_LIBS:/home/debian/prefix/lib
QMAKE_SPEC:linux-g++
QMAKE_XSPEC:linux-g++
QMAKE_VERSION:3.1
QT_VERSION:5.12.4



Now you can have an app using


import QtQuick 2.12  &  import QtQuick.Controls 2.5 & import QtQuick.Layouts 1.12


http://173.249.22.226/uploads/MAH06598.MP4


Prebuild QT prefix folder



FILE: /etc/xdg/qtchooser/default.conf content
 

/home/debian/prefix/bin
/home/debian/
prefix



FILE: /etc/profile.d/qt_env.sh

#!/bin/sh

export QT_QPA_GENERIC_PLUGINS=Auto
export QT_QPA_EGLFS_INTEGRATION=none
# export QT_QPA_EGLFS_ROTATION=90
# export QT_QPA_EGLFS_PHYSICAL_WIDTH=144
# export QT_QPA_EGLFS_PHYSICAL_HEIGHT=864
# export QT_QPA_GENERIC_PLUGINS=evdevkeyboard:/dev/input/event# (1,2,3...)


export QT_QPA_PLATFORM=eglfs
#export QT_QPA_PLATFORM=linuxfb
 



Aug 2019

You can buy a sdcard from my store





No comments:

Post a Comment