Running Raspbian Stretch on Raspberry Pi 3A/B+
[on RPi] Install a bunch of development files (for simplicity we use build-dep, not everything is really needed, but it is easier this way).
Edit sources list in /etc/apt/sources.list and uncomment the deb-src line:
sudo nano /etc/apt/sources.list
Update your system and install required libraries:
sudo apt-get update sudo apt-get build-dep qt4-x11 sudo apt-get build-dep libqt5gui5 sudo apt-get install libudev-dev libinput-dev libts-dev libxcb-xinerama0-dev libxcb-xinerama0
Optional depending on your project:
sudo apt-get install wiringpi libnfc-bin libnfc-dev fonts-texgyre
Optional depending if you want to use QtMultimedia:
sudo apt-get install gstreamer1.0-plugins* libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libopenal-data libsndio6.1 libopenal1 libopenal-dev pulseaudio
[on RPi] Prepare our target directory
sudo mkdir /usr/local/qt5pi sudo chown pi:pi /usr/local/qt5pi
[onRPi] Correct links to EGL and GLES Drivers
sudo rm /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo rm /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0 sudo ln -s /opt/vc/lib/libbrcmEGL.so /usr/lib/arm-linux-gnueabihf/libEGL.so.1.0.0 sudo ln -s /opt/vc/lib/libbrcmGLESv2.so /usr/lib/arm-linux-gnueabihf/libGLESv2.so.2.0.0
[on host] Create our working directory and get a toolchain:
mkdir ~/raspi cd ~/raspi git clone https://github.com/raspberrypi/tools
[on host] Create a sysroot. Using rsync we can properly keep things synchronized in the future as well.
mkdir sysroot sysroot/usr sysroot/opt rsync -avz pi@yourpi:/lib sysroot rsync -avz pi@yourpi:/usr/include sysroot/usr rsync -avz pi@yourpi:/usr/lib sysroot/usr rsync -avz pi@yourpi:/opt/vc sysroot/opt
[on host] Adjust symlinks to be relative. Use provided script, because the old fixQualifiedLibraryPaths is not working properly:
wget https://raw.githubusercontent.com/riscv/riscv-poky/master/scripts/sysroot-relativelinks.py chmod +x sysroot-relativelinks.py ./sysroot-relativelinks.py sysroot
[on host] Get QT (start with qtbase first)
git clone git://code.qt.io/qt/qtbase.git -b 5.12.3 cd qtbase
[on host] Modify the qmake.conf –> mkspecs/devices/linux-rasp-pi3-g++/qmake.conf
nano ~/raspi/qtbase/mkspecs/devices/linux-rasp-pi3-g++/qmake.confVC_LIBRARY_PATH = $$[QT_SYSROOT]/opt/vc/lib VC_INCLUDE_PATH = $$[QT_SYSROOT]/opt/vc/include VC_LINK_LINE = -L$${VC_LIBRARY_PATH} QMAKE_LIBDIR_OPENGL_ES2 = $${VC_LIBRARY_PATH} QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2 QMAKE_LIBDIR_OPENVG = $$QMAKE_LIBDIR_OPENGL_ES2
[on host] Compile, make, make install
./configure -release -opengl es2 -device linux-rasp-pi3-g++ -device-option CROSS_COMPILE=~/raspi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf- -sysroot ~/raspi/sysroot -opensource -confirm-license -make libs -prefix /usr/local/qt5pi -extprefix ~/raspi/qt5pi -hostprefix ~/raspi/qt5 -no-use-gold-linker -v -no-gbm make -j4 make install
If you failed build –>
git clean -dfx
[on host] Deploy Qt to the device. We simply sync everything from ~/raspi/qt5pi to the prefix we configured above.
rsync -avz qt5pi pi@yourpi:/usr/local
[on RPi] Update the device to let the linker find the Qt libs:
echo /usr/local/qt5pi/lib | sudo tee /etc/ld.so.conf.d/qt5pi.conf sudo ldconfig
[on host] Build other Qt modules as desired, the steps are always the same:
git clone git://code.qt.io/qt/<qt-module>.git -b <qt-version> cd <qt-module> ~/raspi/qt5/bin/qmake make make install
My Modules:
- qtbase
- qtxmlpatterns
- qtsvg
- qtdeclarative
- qtimageformats
- qtgraphicaleffects
- qtquickcontrols
- qtquickcontrols2
- qtvirtualkeyboard
- qtwebsockets
- qtwebglplugin
- qtcharts
- qtconnectivity
- qtmultimedia
- qtlocation
Then deploy new files by running:
rsync -avz qt5pi pi@yourpi:/usr/local
Set physical Display size in mm:
sudo nano ~/.profile
# physical display properties
export QT_QPA_EGLFS_PHYSICAL_WIDTH=211
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=127
source .profile
'언어 > 라즈베리파이' 카테고리의 다른 글
라즈베리파이 보드 버전과 라즈베리파이 OS버전 확인하기 (0) | 2021.01.08 |
---|---|
설치된 패키지 확인 (0) | 2021.01.08 |
Upgrading Raspbian OS from Stretch to Buster (0) | 2019.10.15 |
라즈비안 버스터 Faster_OpenCV_4_Raspberry_Pi (0) | 2019.10.15 |
라즈베리파이 NodeJs 설치 (0) | 2019.09.25 |