Changes

Jump to navigation Jump to search
Line 1: Line 1:  
[[Build drivers from source for rpi/zh|查看中文]]
 
[[Build drivers from source for rpi/zh|查看中文]]
   −
The main resources in this section are the [https://www.raspberrypi.org/documentation/linux/kernel/building.md official piOS building method]. We use the method of cross-compilation.
+
The main resources in this section are the [https://www.raspberrypi.org/documentation/linux/kernel/building.md official piOS building method].  
    +
We provide methods to compile locally on Raspberry Pi and cross-compile on PC. It is recommended to use Raspberry Pi local compilation, which is simpler and faster.
 +
 +
=== Building the Drivers Locally ===
 +
 +
=== Cross-Compiling the Drivers ===
 
The following operations are done on ubuntu PC.
 
The following operations are done on ubuntu PC.
===Build cross-compilation environment on Ubuntu 64-bit operating system)===
+
====Build cross-compilation environment on Ubuntu 64-bit operating system)====
 
<code>sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev</code>
 
<code>sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev</code>
   Line 14: Line 19:     
<code>sudo apt install crossbuild-essential-arm64</code>
 
<code>sudo apt install crossbuild-essential-arm64</code>
===Download the standard version of the piOS source code===
+
====Download the standard version of the piOS source code====
 
=====Confirm the piOS version of your raspberry Pi=====
 
=====Confirm the piOS version of your raspberry Pi=====
   Line 60: Line 65:     
Modify the Makefile in the same path,add the corresponding dts compilation option.
 
Modify the Makefile in the same path,add the corresponding dts compilation option.
===Building===
+
====Building====
====Preparing====
+
=====Preparing=====
    
*For Raspberry Pi 1, Zero and Zero W, and Raspberry Pi Compute Module 1 default (32-bit only) build configuration
 
*For Raspberry Pi 1, Zero and Zero W, and Raspberry Pi Compute Module 1 default (32-bit only) build configuration
Line 86: Line 91:     
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig</code>
 
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig</code>
====Add compilation options====
+
=====Add compilation options=====
    
*32-bit version
 
*32-bit version
Line 108: Line 113:     
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs -j4</code>
 
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image modules dtbs -j4</code>
===Frequently Questions===
  −
  −
*disagrees about version of symbol module_layout
  −
  −
After the system has been booted, <code>dmesg</code> can see this error reported when the driver of camera is loaded. It is caused by the mismatch between the original piOS version on the board and the compiled camera driver version.
  −
  −
It is recommended to refer to this [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#cross-compiling-the-kernel link] to recompile from the code and install Image, dtb, modules as a whole.
   
===References===
 
===References===
 
https://www.raspberrypi.org/documentation/linux/kernel/building.md
 
https://www.raspberrypi.org/documentation/linux/kernel/building.md

Navigation menu