Changes

Jump to navigation Jump to search
Line 232: Line 232:  
<code>gst-launch-1.0 v4l2src device=/dev/video2 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink videosink=autovideosink sync=false text-overlay=false -v</code>
 
<code>gst-launch-1.0 v4l2src device=/dev/video2 ! "video/x-raw,format=(string)UYVY, width=(int)1920, height=(int)1080,framerate=(fraction)30/1" ! videoconvert ! fpsdisplaysink videosink=autovideosink sync=false text-overlay=false -v</code>
 
=== Source code cross compilation ===
 
=== Source code cross compilation ===
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, and the 5.4.72 version of 32bitOS is taken as an example.
+
Please refer to: [[Build drivers from source for rpi]].
   −
The following operations are done on ubuntu PC.
+
=== Document History ===
 
  −
==== 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>
  −
 
  −
* 32-bit piOS target version
  −
 
  −
<code>sudo apt install crossbuild-essential-armhf</code>
  −
 
  −
* 64-bit piOS target version
  −
 
  −
<code>sudo apt install crossbuild-essential-arm64</code>
  −
 
  −
==== Download the standard version of the piOS source code ====
  −
 
  −
===== Confirm the piOS version of your raspberry Pi =====
  −
 
  −
* <code>Release version</code>
  −
 
  −
<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>
  −
 
  −
* <code>Code tag</code>
  −
 
  −
<code>$ cp /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz ./</code>
  −
 
  −
<code>gunzip changelog.Debian.gz</code>
  −
 
  −
Check the top lines and you will know the tag.
  −
===== 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>
  −
 
  −
''PS: Please replace the above two commands with your own corresponding versions.''
  −
 
  −
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 ====
  −
 
  −
*For Raspberry Pi 1, Zero and Zero W, and Raspberry Pi Compute Module 1 default (32-bit only) build configuration
  −
 
  −
<code>KERNEL=kernel</code>
  −
 
  −
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig</code>
  −
 
  −
*For Raspberry Pi 2, 3, 3+ and Zero 2 W, and Raspberry Pi Compute Modules 3 and 3+ default 32-bit build configuration
  −
 
  −
<code>KERNEL=kernel7</code>
  −
 
  −
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig</code>
  −
 
  −
*For Raspberry Pi 4 and 400, and Raspberry Pi Compute Module 4 default 32-bit build configuration
  −
 
  −
<code>KERNEL=kernel7l</code>
  −
 
  −
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2711_defconfig</code>
  −
 
  −
* For Raspberry Pi 3, 3+, 4, 400 and Zero 2 W, and Raspberry Pi Compute Modules 3, 3+ and 4 default 64-bit build configuration
  −
 
  −
<code>KERNEL=kernel8</code>
  −
 
  −
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bcm2711_defconfig</code>
  −
==== Add compilation options ====
  −
 
  −
* 32-bit version
  −
 
  −
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig</code>
  −
 
  −
* 64-bit version
  −
 
  −
<code>make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig</code>
  −
 
  −
Add the compilation options by the corresponding camera module, for 5.4 version kernel the path is driver-- > multimedia-- > i2C.
  −
 
  −
For 5.10 version kernel,the path is Device Drivers --> Multimedia Support --> Media ancillary drivers --> Camera sensor devices.
  −
 
  −
===== Build =====
  −
 
  −
* <code>32-bit version</code>
     −
<code>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j4</code>
+
*20220411
   −
* <code>64-bit version</code>
+
<br />
 
  −
<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 ===
  −
<nowiki>https://www.raspberrypi.org/documentation/linux/kernel/building.md</nowiki>
  −
 
  −
=== Document History ===
      
* 20220302
 
* 20220302

Navigation menu