Line 49: |
Line 49: |
| Solutions: | | Solutions: |
| | | |
− | 1. Upgrade piOS, and build again. | + | ====== 1. Upgrade piOS, and build again. ====== |
− | | |
| <code>sudo apt update</code> | | <code>sudo apt update</code> |
| | | |
Line 57: |
Line 56: |
| <code>sudo apt install raspberrypi-kernel-headers</code> | | <code>sudo apt install raspberrypi-kernel-headers</code> |
| | | |
− | 2. Install specific version kernel headers.
| + | Specifically, for the Raspberry Pi 4 series, 32-bit PiOS will automatically switch to 64-bit mode after upgrading to the latest version. However, the raspberrypi-kernel-headers package is missing the build directory for the v8+ mode. |
| + | |
| + | For example: |
| + | |
| + | <code>$ uname -a</code> |
| + | |
| + | <code>Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux</code> |
| + | |
| + | There is no build directory under <code>/lib/modules/6.1.21-v8+/</code>. |
| | | |
| + | If this happens, you can add <code>arm_64bit=0</code> to the <code>/boot/config.txt</code> file and then restart the Raspberry Pi to switch back to 32-bit mode. |
| + | |
| + | ====== 2. Install specific version kernel headers. ====== |
| Download the deb package for the version of piOS you are currently using from this [https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/ link] and install it. | | Download the deb package for the version of piOS you are currently using from this [https://archive.raspberrypi.org/debian/pool/main/r/raspberrypi-firmware/ link] and install it. |
| | | |
| For tag name, please determine according to the local piOS version and raspberrypi OS [https://github.com/raspberrypi/linux/tags tags]. | | For tag name, please determine according to the local piOS version and raspberrypi OS [https://github.com/raspberrypi/linux/tags tags]. |
| + | |
| + | ====== 3. Use rpi-source ====== |
| + | Use rpi-source from <nowiki>https://github.com/RPi-Distro/rpi-source</nowiki> it sets up everything you need to build your own kernel (from the current running kernel by default). |
| === Cross-Compiling the Drivers === | | === Cross-Compiling the Drivers === |
| The following operations are done on ubuntu PC. | | The following operations are done on ubuntu PC. |
Line 193: |
Line 206: |
| | | |
| === Document History === | | === Document History === |
| + | |
| + | * 20230510 |
| + | |
| + | Add solution for"Missing build directory" error. |
| | | |
| * 20230326 | | * 20230326 |