Changes

Jump to navigation Jump to search
Line 114: Line 114:     
The following operations are done on ubuntu PC.
 
The following operations are done on ubuntu PC.
 +
 +
==== '''Build cross-compilation environment on Ubuntu 64-bitoperating system)''' ====
 +
<code>sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev</code>
 +
 +
<code>sudo apt install crossbuild-essential-armhf</code>
 +
 +
==== Download the standard version of the piOS source code ====
 +
 +
===== Confirm the piOS version of your raspberry Pi =====
 +
<code>$ uname -a</code>
 +
 +
<code>Linux raspberrypi 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux</code>
 +
 +
===== There are two ways to get the source code of the version you want: =====
 +
 +
# using git to clone the corresponding branch and checkout the corresponding tag.
 +
 +
<code>git clone --branch rpi-5.4.y <nowiki>https://github.com/raspberrypi/linux</nowiki></code>
 +
 +
<code>git checkout raspberrypi-kernel_1.20201022-1</code>
 +
 +
2. Manually download the version code of the corresponding tag directly from the link below.
 +
 +
https://github.com/raspberrypi/linux/tags
 +
 +
==== Patch our  code to kernel ====
 +
 +
*Driver source code
 +
 +
camera driver path is : linux/drivers/media/i2c,copy our camera module drivers to this path.
 +
 +
*Modify the the Makefile and Kconfig files
 +
 +
Modify the Config and Makefile in the same path,add the corresponding camera driver.
 +
 +
*dts file
 +
 +
dts file path is :linux/arch/arm/boot/dts/overlays,copy our [camera]-overlay.dts files to this path.
 +
 +
*Modify dts Makefile
 +
 +
Modify the Makefile in the same path,add the corresponding dts compilation option.
 +
 +
==== Building ====
 +
 +
==== Preparing ====
 +
<code>export ARCH=arm</code>
 +
 +
<code>export CROSS_COMPILE=arm-linux-gnueabihf-</code>
 +
 +
* Raspberry Pi 1, Pi Zero, Pi Zero W, and Compute Module default build configuration
 +
 +
<code>KERNEL=kernel</code>
 +
 +
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig</code>
 +
 +
* Raspberry Pi 2, Pi 3, Pi 3+, and Compute Module 3 default build configuration
 +
 +
<code>KERNEL=kernel7</code>
 +
 +
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig</code>
 +
 +
* Raspberry Pi 4 default build configuration
 +
 +
<code>KERNEL=kernel7l</code>
 +
 +
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig</code>
 +
 +
==== Add compilation options ====
 +
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig</code>
 +
 +
Add the compilation options by the corresponding camera module, the path is driver-- > multimedia-- > i2C.
 +
 +
===== Build =====
 +
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4</code>
 +
 +
=== References ===
 +
<nowiki>https://www.raspberrypi.org/documentation/linux/kernel/building.md</nowiki>

Navigation menu