{"id":23636429,"url":"https://github.com/petrcernyy/buildroot_rpi4_rt","last_synced_at":"2026-04-30T02:37:44.779Z","repository":{"id":269885842,"uuid":"892255641","full_name":"petrcernyy/buildroot_rpi4_rt","owner":"petrcernyy","description":"Guide for creating minimal build with Buildroot for Raspberry Pi 4 with Preempt_RT patch, enabled Wi-Fi and Qt6 for graphical applications.","archived":false,"fork":false,"pushed_at":"2024-12-26T22:15:02.000Z","size":332,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-23T18:21:27.899Z","etag":null,"topics":["buildroot","linux","preempt-rt","qt6","raspberry","wifi"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petrcernyy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-21T19:23:33.000Z","updated_at":"2024-12-26T22:15:05.000Z","dependencies_parsed_at":"2024-12-26T23:18:50.218Z","dependency_job_id":"dbe43dd8-ef76-4536-a781-fc68bfb9aeba","html_url":"https://github.com/petrcernyy/buildroot_rpi4_rt","commit_stats":null,"previous_names":["petrcernyy/buildroot_rpi4_rt"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/petrcernyy/buildroot_rpi4_rt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrcernyy%2Fbuildroot_rpi4_rt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrcernyy%2Fbuildroot_rpi4_rt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrcernyy%2Fbuildroot_rpi4_rt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrcernyy%2Fbuildroot_rpi4_rt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petrcernyy","download_url":"https://codeload.github.com/petrcernyy/buildroot_rpi4_rt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrcernyy%2Fbuildroot_rpi4_rt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259659667,"owners_count":22891672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buildroot","linux","preempt-rt","qt6","raspberry","wifi"],"created_at":"2024-12-28T06:12:25.965Z","updated_at":"2026-04-30T02:37:44.772Z","avatar_url":"https://github.com/petrcernyy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi - RT, Wi-Fi, Qt6 build\nThis guide describes the steps to build custom linux build using [Buildroot](https://buildroot.org/)  for Raspberry Pi 4. The build focuses mainly on enabling Preempt-RT patch to run Linux in real-time, then Wi-Fi is enabled and using Qt6 to creating custom Qt applications.\n\n## 1. Download buildroot\n\n`cd ~`\\\n`git clone git://git.busybox.net/buildroot`\n\n## 2. Get Linux kernel and patch\nIn order to enable Preempt-RT patch we have to match Linux kernel version and patch version. I find it easiest to download the desired kernel version from [here](https://www.kernel.org/pub/linux/kernel/) and then find its matching patch version [here](https://cdn.kernel.org/pub/linux/kernel/projects/rt/). These version should match as close as possible ideally the versions should be equal.\nDownload the patch in .patch.xz format.\n\nThen write the hashes for patch and kernel.\\\n`cd buildroot`\\\n`vim linux/linux.hash`\\\nFind the corresponding hash for your patch file in sha256sums.asc, then find the corresponding hash for your kernel file in sha256sums.asc. Copy both lines to linux.hash. \n\n## 3. Enabling RT\nCreate a file `linux.config` in `buildroot/board/raspberrypi-rt`.\n\n`mkdir board/raspberrypi-rt`\\\n`touch board/raspberrypi-rt/linux.config`\n\nAnd pass in it the following:\n\n    # enable full preemption \n    CONFIG_PREEMPT_RT=y\n\n## 4. Create defconfig\nBuildroot ships with basic minimal configs for lots of boards as well as Rapsberry Pi 4. These are located in `buildroot/configs`. Clone the `raspberrypi4_64_defconfig`\n\n`cd configs`\\\n`cp raspberrypi4_64_defconfig custom_raspberrypi_4_64_defconfig`\n\nMake changes to the following line:\n\n    BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION=\"file:///home/petr/buildroot/linux-stable_20240529.tar.gz\"\n\nAnd change it so it points to the location of your kernel file like so:\n\n    BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION=\"file://~/buildroot/linux-stable_20240529.tar.gz\"\n\nThen add the following lines to the file so that the link points to your patch file.\n\n    BR2_LINUX_KERNEL_PATCH=\"https://cdn.kernel.org/pub/linux/kernel/projects/rt/6.6/older/patch-6.6.31-rt31.patch.xz\"\n    BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=\"board/raspberrypi-rt/linux.config\"\n\nNow make the defconfig.\n\n`cd ..`\\\n`make custom_raspberrypi4_64_defconfig`\n\n## 5. Enabling Wi-Fi\n\nNow to enable Wi-Fi start the menuconfig.\n\n`make menuconfig`\n\nEnable mdev\\\n`System configuration -\u003e /dev management -\u003e Dynamic using devtmpfs + mdev`\n\nEnable Rpi-firmware + Wi-Fi firmware\\\n`Target packages -\u003e Hardware handling -\u003e Firmware -\u003e brcmfmac-sdio-firmware-rpi -\u003e brcmfmac-sdio-firmware-rpi-wifi`\\\n`Target packages -\u003e Hardware handling -\u003e Firmware -\u003e rpi-firmware -\u003e rpi 4 (default)`\n\nDHCP interface\\\n`System configuration -\u003e Network interface to configure through DHCP -\u003e wlan0`\n\nEnable SSH\\\n`Target packages -\u003e Networking applications -\u003e openssh`\n\nEnable DHCP\\\n`Target packages -\u003e Networking applications -\u003e dhcp (ISC) -\u003e dhcp server -\u003e Enable delayed ACK feature`\\\n`Target packages -\u003e Networking applications -\u003e dhcp (ISC) -\u003e dhcp server -\u003e Enable paranoia options`\\\n`Target packages -\u003e Networking applications -\u003e dhcp (ISC) -\u003e dhcp relay`\\\n`Target packages -\u003e Networking applications -\u003e dhcp (ISC) -\u003e dhcp client`\\\n`Target packages -\u003e Networking applications -\u003e dhcpd`\\\n`Target packages -\u003e Networking applications -\u003e dhcpdump`\n\nEnable WPA_SUPPLICANT\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Enable nl80211 support`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Enable autoscan`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Enable WPS`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Enable WPA3 support`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Install wpa_cli binary`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Install wpa_client shared library`\\\n`Target packages -\u003e Networking applications -\u003e wpa_supplicant -\u003e Install wpa_passphrase binary`\n\nNow Wi-Fi should be enabled.\n\n## 6. Enabling Qt6\nWe will use Qt6 with direct framebuffer `linuxfb`\n\nFirst enable fonts text will get displayed.\\\n`Target packages -\u003e Fonts, cursors, icons, sounds and themes -\u003e DejaVu fonts`\n\nThen enable Qt6\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e gui module`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e gui module -\u003e linuxfb support`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e gui module -\u003e fontconfig support`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e gui module -\u003e widgets module`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e gui module -\u003e widgets module -\u003e printing support`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6base -\u003e network module`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6declarative`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6declarative -\u003e quick module`\\\n`Target packages -\u003e Graphics libraries and applications -\u003e Qt6 -\u003e qt6svg`\n\nNow Qt6 should be enabled.\n\n## 7. Enabling Camera\n`Target packages -\u003e Hardware handling -\u003e Firmware -\u003e rpi 4 (default + extended)`\\\n`Target packages -\u003e Audio and video applications -\u003e v4l2grab`\\\n`Target packages -\u003e Audio and video applications -\u003e v4l2loopback`\\\n`Target packages -\u003e Audio and video applications -\u003e v4l2loopback -\u003e utils`\\\n`Target packages -\u003e Libraries -\u003e Hardware handling -\u003e libv4l`\\\n`Target packages -\u003e Libraries -\u003e Hardware handling -\u003e libv4l -\u003e v4l-utils-tools`\\\n`Target packages -\u003e Libraries -\u003e Multimedia -\u003e libcamera -\u003e everything`\\\n`Target packages -\u003e Libraries -\u003e Multimedia -\u003e libcamera-apps \\\n\n## 8. Final modifications\nNow everything should be ready. Before we make the build we should set the root password and enable vim or nano support in:\\\n`Target packages -\u003e Text editors and viewers -\u003e vim`\\\n`Filesystem images -\u003e exact size (1024M)`\n\n## 9. Build\nNow save the config and proceed to build. This will take approximatelly 2-3 hours.\\\n`make`\n\nAfter the build is finished write the image in `buildroot/output/image`\nto your sdcard. You can use for example [balenaEtcher](https://etcher.balena.io/)\n\n## 10. Config.txt\nIf you have an HDMI display and need to set the resolution you can edit the file `config.txt` which is located in boot partion of the sdcard. I use [this display](https://biqu.equipment/products/bigtreetech-hdmi5-v1-0-hdmi7-v1-0?srsltid=AfmBOoqUnVOCdIJNJAyeoUxYi9mNu7-l6GgqVu6NE623K9qej1hkcWyk). The manufacturer states to include these lines in the file:\n```\n# uncomment to force a specific HDMI mode (this will force VGA)\nhdmi_group=2\nhdmi_mode=87\nhdmi_cvt 800 480 60 6 0 0 0\n# uncomment to force a HDMI mode rather than DVI. This can make audio work in\n# DMT (computer monitor) modes\nhdmi_drive=1\n```\n\nAdd\n```\nstart_x=1\ngpu_mem=128\ndtoverlay=imx219\n```\n\n\n## 11. Booting and configuring Wi-Fi\nNow boot the Raspberry Pi. After boot is finished log in as root.\nTo enable the Wi-Fi firstly configure the wpa_supplicant.conf file using the following command.\\\n`wpa_passphrase SSID pswd | tee /etc/wpa_supplicant.conf`\n\nThen connect to Wi-Fi\\\n`wpa_supplicant -B -c /etc/wpa_supplicant.conf -i wlan0`\\\nThe `-B` flag specifies to run the command in background.\n\nNow we should be connected to Wi-Fi but we have yet to receive public IP address. Run\\\n`dhclient wlan0`\n\nNow to check we are indeed connected run\\\n`ifconfig`\n\nYou should be able to see your IP address.\n\n## 12. SSH root login\nOpenSSH defaultly forbids root login over SSH. So we have to fix this.\\\n`vim /etc/ssh/sshd_config`\\\nLocate the lines `PasswordAuthentication yes` and ensure it is not commented and the option is set to `yes`.  Then locate `PermitRootLogin prohibit-password` and ensure it is not commented and change `prohibit-password`to `yes`.\nSave the file and now we have to restart the sshd daemon.\\\n`killall sshd`\\\n`/usr/sbin/sshd`\n\nNow we can test the SSH connection.\n\n## 13. Qt developement\nFor developement it is easiest to use Qt Boot2Qt toolchain which can cross-compile from PC to Raspberry. Ensure you have the same version of Qt toolchain as your Qt on Raspberry. You can verify the version on your host machine\n`buildroot/output/host/bin/qmake --version`\n\nThen install Qt and Boot to Qt software Stack as follows\n![image](./images/qt_maintance.png)\n\nNow to develop your application run Qt Creator. Create a new project and \nselect Qt Quick Application. \n![image](./images/qt_quickproject.png)\n\nMake sure the Minimal required version is less then the version that is located at Rapberry. \n![image](./images/qt_version.png)\n\nSelect a Boot2Qt Kit and create project.\n![image](./images/qt_kit.png)\n\nNewer version of Qt6 use zstd for packaging. Since we do not have this package on Raspberry we can specify to not use this in CMakeLists.txt with the following command\n`set(QT_FEATURE_zstd OFF)`\n\nThen we can build our application and after building copy it to Raspberry over SSH using `scp`.\n\nSince we want to use `linuxfb` we have to run the application on Raspberry like so\n`./appTest -platform linuxfb`\n\n# Raspberry Pi 5\nFor building for Raspberry Pi 5 the steps are the same, only clone the raspberrypi5_defconfig. A difference is in editing resolution in step 9. The Raspberry Pi 5 uses different drivers (KSM) which ingnore the edits in config.txt. In order for them to apply we can revert to old drivers by adding `dtoverlay=vc4-fkms-v3d`. So add the following to the config.txt\n\n```\ndtoverlay=vc4-fkms-v3d\n# uncomment to force a specific HDMI mode (this will force VGA)\nhdmi_group=2\nhdmi_mode=87\nhdmi_cvt 800 480 60 6 0 0 0\n# uncomment to force a HDMI mode rather than DVI. This can make audio work in\n# DMT (computer monitor) modes\nhdmi_drive=1\n```\n\nThere is also problem with the Buildroot build for Raspberry Pi 5. The image does not contain overlays folder in boot partion, therefore Raspberry does not boot. In order to fix this we can copy an entire overlays folder to the boot partion of sdcard for example from the official [GitHub of Raspberry](https://github.com/raspberrypi/firmware/tree/master/boot/overlays)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrcernyy%2Fbuildroot_rpi4_rt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrcernyy%2Fbuildroot_rpi4_rt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrcernyy%2Fbuildroot_rpi4_rt/lists"}