BeagleBone Black Beginners Guide: Difference between revisions
(Created page with "1. Preparing BBB<br /> * root@Matilda:~# apt-get update * root@Matilda:~# apt-get dist-upgrade * root@Matilda:~# apt-get install libssl-d* libicu-dev icu-doc * root@Matilda:~#...") |
(Add to Ports.) |
||
Line 1: | Line 1: | ||
[[Category:Ports]] | |||
1. Preparing BBB<br /> | 1. Preparing BBB<br /> | ||
* root@Matilda:~# apt-get update | * root@Matilda:~# apt-get update |
Latest revision as of 15:42, 25 November 2016
1. Preparing BBB
- root@Matilda:~# apt-get update
- root@Matilda:~# apt-get dist-upgrade
- root@Matilda:~# apt-get install libssl-d* libicu-dev icu-doc
- root@Matilda:~# apt-get clean
OS version
- root@Matilda:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.5 (jessie)
Release: 8.5
Codename: jessie
Linux kernel
- root@Matilda:~# uname -a
Linux Matilda 4.1.13-ti-r30 #1 SMP PREEMPT Fri Nov 13 21:54:17 UTC 2015 armv7l GNU/Linux
check compiler version
- root@Matilda:~# arm-linux-gnueabihf-gcc --version
for example
- root@Matilda:~# arm-linux-gnueabihf-gcc --version
arm-linux-gnueabihf-gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2. Copy bbb image to workstation
connect bbb to workstation via microUSB. Type this command on workstation and bbb
- workstation@workstation:~/opt$ nc -l 19000|dd bs=1M of=bbb-with-ssl-and-icu-dev.img
- root@Matilda:~# dd bs=1M if=/dev/mmcblk0|nc 192.168.7.1 19000
3. Preparing workstation
OS version
- workstation@workstation:~/opt$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04 LTS
Release: 16.04
Codename: xenial
Linux kernel
- workstation@workstation:~/opt$ uname -a
Linux workstation 4.4.0-28-generic #47-Ubuntu SMP Fri Jun 24 10:09:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
- workstation@workstation:~/opt$ sudo mkdir /mnt/bbb-rootfs
- workstation@workstation:~/opt$ sudo mount -o loop,offset=101711872 bbb-with-ssl-and-icu-dev.img /mnt/bbb-rootfs/
calculating offset
- workstation@workstation:~/opt$ file bbb-with-ssl-and-icu-dev.img
- bbb-with-ssl-and-icu-dev.img: DOS/MBR boot sector; partition 1 : ID=0xe, active, start-CHS (0x20,0,1), end-CHS (0x3ff,3,16), startsector 2048, 196608 sectors; partition 2 : ID=0x83, start-CHS (0x3ff,3,16), end-CHS (0x3ff,3,16), startsector 198656, 7354368 sectors
offset= partion2 startsector * 512 (SD card block size) = 101711872
- workstation@workstation:~/opt$ sudo apt-get install git-core build-essential
- workstation@workstation:~/opt$ sudo apt-get install libgles2-mesa-dev libcap-dev libbz2-dev libgcrypt11-dev libpci-dev libnss3-dev build-essential libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdrm-dev libfontconfig1-dev libxtst-dev libasound2-dev gperf libcups2-dev libpulse-dev libudev-dev libssl-dev flex bison ruby libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev i2c-tools libi2c-dev libstdc++6 lib32stdc++6 "^libxcb.*" libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev
4. Clone the cross-compile-tools repository:
This repository contains a script that will be used to fix some symbolic links.
- workstation@workstation:~/opt$ git clone https://git.milosolutions.com/other/cross-compile-tools.git
5. Download toolchain
- workstation@workstation:~/opt$ wget http://releases.linaro.org/15.05/components/toolchain/binaries/arm-linux-gnueabihf/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf.tar.xz
- workstation@workstation:~/opt$ tar xf gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf.tar.xz
6. Download qt5
- workstation@workstation:~/opt$ mkdir qt5bbb
- workstation@workstation:~/opt$ cd qt5bbb
- workstation@workstation:~/opt$ git clone git://code.qt.io/qt/qt5.git
- workstation@workstation:~/opt$ cd qt5
- workstation@workstation:~/opt$ git checkout 5.7
- workstation@workstation:~/opt$ perl init-repository
- workstation@workstation:~/opt$ cd ~/opt/cross-compile-tools
- workstation@workstation:~/opt$ sudo ./fixQualifiedLibraryPaths /mnt/bbb-rootfs ~/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc
7. Compiling qtbase (Qt 5.7)
- workstation@workstation:~/opt$ cd ~/opt/qt5bbb/qt5/qtbase/
- workstation@workstation:~/opt$ ./configure -device linux-beagleboard-g++ -device-option CROSS_COMPILE=~/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/bbb-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5bbb -hostprefix /usr/local/qt5bbb -no-xcb -qt-zlib -no-opengl -qt-libpng -nomake examples -nomake tests -no-xkb -no-xshape -no-xsync -no-xcursor -no-xfixes -no-xrandr -no-kms -no-eglfs -no-xcb -no-accessibility -no-opengl -skip multimedia -skip webkit -no-gui -no-widgets -no-egl -no-openvg -openssl -no-qml-debug -v
- workstation@workstation:~/opt$ make -j4
you can see this compilation errors (no such file or directory, it is Ukrainian)
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/librt.so: Немає такого файла або каталогу
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libdl.so: Немає такого файла або каталогу
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libdl.so: Немає такого файла або каталогу
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.so: Немає такого файла або каталогу
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/librt.so: Немає такого файла або каталогу
/usr/lib/gcc-cross/arm-linux-gnueabihf/5/../../../../arm-linux-gnueabihf/bin/ld.gold: помилка: не вдалося відкрити /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libm.so: Немає такого файла або каталогу
to fix this errors
- workstation@workstation:~/opt/qt5bbb/qt5/qtbase$ sudo ln -sf /mnt/bbb-rootfs/lib/arm-linux-gnueabihf/librt.so.1 /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/librt.so
- workstation@workstation:~/opt/qt5bbb/qt5/qtbase$ sudo ln -sf /mnt/bbb-rootfs/lib/arm-linux-gnueabihf/libdl.so.2 /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libdl.so
- workstation@workstation:~/opt/qt5bbb/qt5/qtbase$ sudo ln -sf /mnt/bbb-rootfs/lib/arm-linux-gnueabihf/libglib-2.0.so.0 /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libglib-2.0.so
- workstation@workstation:~/opt/qt5bbb/qt5/qtbase$ sudo ln -sf /mnt/bbb-rootfs/lib/arm-linux-gnueabihf/libm.so.6 /mnt/bbb-rootfs/usr/lib/arm-linux-gnueabihf/libm.so
and
- workstation@workstation:~/opt/qt5bbb/qt5/qtbase$ make -j4
- workstation@workstation:~/opt$ sudo make install
8. Compiling other modules
QtSerialport
- workstation@workstation:~/opt$ cd ../qtserialport/
- workstation@workstation:~/opt$ /usr/local/qt5bbb/bin/qmake .
- workstation@workstation:~/opt$ make -j4
- workstation@workstation:~/opt$ sudo make install
QtSerialBus
- workstation@workstation:~/opt$ cd ../qtserialbus/
- workstation@workstation:~/opt$ /usr/local/qt5bbb/bin/qmake .
- workstation@workstation:~/opt$ make -j4
- workstation@workstation:~/opt$ sudo make install
9. Upload libraries to BBB
- workstation@workstation:~/opt$ scp -r /mnt/bbb-rootfs/usr/local/qt5bbb root@192.168.7.2:/usr/local/
10. Configuring Qt Creator
To use Qt Creator properly, you must configure the "Qt Version" and "Tool Chains" sections.
Tool Chain Settings[edit] go to Tools -> Options..-> Build & Run -> Compilers tab. click in "Add -> GCC". On "Compiler Path" set to "/home/<you>/opt/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++". Name it "ARM GCC" or similar. obs: Adjust it to your username.
Qt Version settings.[edit] Now go to Tools -> Options..-> Build & Run -> Qt Versions tab. Click in "Add.." and choose you qmake for raspberry "/usr/local/qt5bbb/bin/qmake".
Configure Linux Devices[edit] Go to Tools -> Options…-> Devices -> Devices tab.
Add a new configuration setting a "Generic Linux Device" Hostname or IP address is the IP of your BBB user is debian password is temppwd. if your not did change it.
11. Target Path
When you try to deploy a program on your BBB from QtCreator you may get an error about an unknown command. This is because QtCreator does not know where to copy the compiled file onto the BBB. The following line should be added to your .pro file:
target.path = /home/Matilda/
You may change the path to anything you want and the executable will be copied to and run from this location.
Now you are ready to run your first Qt BBB project.
12. Sources:
https://wiki.qt.io/Raspberry_Pi_Beginners_Guide
https://blog.guh.guru/tech/crosscompile-qt-5-2-1-for-bbb