Drücke „Enter”, um zum Inhalt zu springen.

Cross-Compile QT 6.2.1 / Raspberry Pi 4 / Yocto

Marc Wapelhorst

Build QT6 Embedded Image for Raspberry Pi 4

1.Install the following packages on your Linux Host (Tested on Manjaro):

repo, cpio, diffstat, chrpath, git-lfs, rpcsvc-proto

 

2. Create a build directory in your home Folder:

mkdir ~/yocto
cd ~/yocto

 

3. Go to https://code.qt.io/cgit/yocto/boot2qt-manifest.git/tree/ and download the manifest XML
of the version you want to build. In this case: v6.2.1.xml

wget https://code.qt.io/cgit/yocto/boot2qt-manifest.git/tree/v6.2.1.xml

 

4. Initialize and sync the repository:

repo init -u git://code.qt.io/yocto/boot2qt-manifest -m v6.2.1.xml
repo sync

 

5. Configure the build environment by setting the MACHINE value:

Raspberry Pi raspberrypi
Raspberry Pi 2 raspberrypi2
Raspberry Pi 3 raspberrypi3
Raspberry Pi 4 raspberrypi4
Raspberry Pi 4 64-bit raspberrypi4-64
Raspberry Pi Zero raspberrypi0
export MACHINE=raspberrypi4
source ./setup-environment.sh

 

6. Build the Raspberry Pi 4 Image:

bitbake b2qt-embedded-qt6-image

After successfully build, you can find the image here:
–> yocto/build-raspberrypi4/tmp/deploy/images/raspberrypi4/

 

7. Build the SDK, you can use to build your code with QTCreator:

bitbake meta-toolchain-b2qt-embedded-qt6-sdk

After successfully buils, you can find the SDK here:
–> yocto/build-raspberrypi4/tmp/deploy/sdk/

 

8. Install the SDK on your Linux Host:

cd ~/yocto/build-raspberrypi4/tmp/deploy/sdk/
./b2qt-x86_64-meta-toolchain-b2qt-embedded-qt6-sdk-raspberrypi4.sh

 

 

Enable Wifi in b2qt-embedded-qt6-image (on RPI)

 1. Edit the wpa_supplicant.conf file:

vi /etc/wpa_supplicant.conf

like this (your password, your SSID:

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
ssid="<yourSSID>"
psk="<yourPassword>"
key_mgmt=WPA-PSK
}

 

2. Create a script to unblock the wifi device, restart wpa_supplicant and start dhcp on wlan0

vi /etc/startwifi.sh

with the following content:

#!/bin/sh 

killall wpa_supplicant 
sleep 1 
/usr/sbin/rfkill unblock wlan 
sleep 1 
wpa_supplicant -B -iwlan0 -c/etc/wpa_supplicant.conf -Dnl80211 
sleep 1 
udhcpc -i wlan0 

: exit 0

 

3. Create Systemd Service File:

vi /lib/systemd/system/rfkill-unblock-wifi.service

with the following content:

[Unit] 
Description=RFKill-Unblock WiFi Devices 
After=systemd-user-sessions.service 

[Service] 
User=root 
Type=oneshot 
ExecStart=/etc/startwifi.sh 
ExecStop= 
RemainAfterExit=yes 

[Install] 
WantedBy=multi-user.target

 

4. Enable the systemd service:

systemctl enable rfkill-unblock-wifi.service