当前位置:网站首页>Buildroot system for making raspberry pie cm3

Buildroot system for making raspberry pie cm3

2022-07-05 08:10:00 Nanbolwan

I wrote an article about how to pass buildroot Make raspberry pie CM3 System image file of , The whole compilation process is carried out according to the previous article, and you can get an image file smoothly (sdcard.img). But this file is burned to sd After the card can be in raspberry pie 3+ Start normally on the board, but switch to the actual raspberry pie CM3 Can't start when on the board .
I have consulted many materials on the Internet , But it really involves CM3 There is little content . I can only search my own articles , After a long time of research, I finally successfully compiled and ran . The solution process is recorded below :

1. Why raspberry pie 3+ and CM3 Of CPU It is the same compiled system that can be started in the former but cannot be started in the latter ?

This question has been lingering in my brain since I first encountered this problem , I know that as long as I find the answer to this problem, the problem may be solved . So I burned my compiled system to SD In addition, the card will burn the system of the official website to another SD In the card , stay windows Compare the differences between the two in the system .
The obvious difference is that there are bcm2710-rpi-cm3.dtb File this file does not exist in our own system .
After consulting the materials, I learned ,*.dtb The file in Linux The function of system startup is to define the board level device tree , To be clear, this document tells CPU The system I am currently starting contains those peripherals , There are several I2C,UART etc. . although CPU identical , But raspberry pie 3+ and CM3 Different peripherals . So during system startup uboot The loaded device tree file is different . So when we start our own system uboot Unable to find bcm2710-rpi-cm3.dtb This file .
Then I put the official system bcm2710-rpi-cm3.dtb Can I copy the file to my compiled system ?
The answer is no , If you can, there is no content below , I tried, and it turned out that I couldn't . as a result of , Device tree in overload There are a series of files in the folder to support . In fact, what we lack is not only bcm2710-rpi-cm3.dtb A file , But a series of related documents to define CM3 External equipment of .
How to solve this problem ? Don't buildroot You can't make it CM3 Your system ?

2. Find a way out

The first command we execute when compiling the system
make raspberrypi3_64_defconfig
I guess the relevant configuration may be raspberrypi3_64_defconfig This configuration file reflects . So I checked this file .

BR2_aarch64=y
BR2_cortex_a53=y
BR2_ARM_FPU_VFPV4=y

BR2_TOOLCHAIN_BUILDROOT_CXX=y

BR2_SYSTEM_DHCP="eth0"

# Linux headers same as kernel, a 5.4 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y

BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,9a1dd17906692f1ab76e45b9f59976b063b37034)/linux-9a1dd17906692f1ab76e45b9f59976b063b37034.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi3"

# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus broadcom/bcm2837-rpi-3-b"

BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y

BR2_PACKAGE_RPI_FIRMWARE=y

# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="--aarch64 --add-miniuart-bt-overlay"

So I found that there are relevant definitions in this file , So I copied it to buildroot In this file under the root directory broadcom/bcm2837-rpi-cm3. Reconfigure the compiler . But it didn't work , It is found that there is still no bcm2710-rpi-cm3.dtb This file .

3. Once gave up using buildroot

I once gave up using buildroot, Instead, I try to recompile the raspberry kernel and then upgrade the kernel to the official system to achieve the effect of cutting the kernel module . If readers want to know about this aspect, they can check the relevant tutorials on the official website :https://www.raspberrypi.org/documentation/linux/kernel/building.md
I found the following steps when trying the above tutorial :

sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
sudo cp arch/arm64/boot/Image mnt/fat32/$KERNEL.img
sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/
sudo umount mnt/fat32
sudo umount mnt/ext4

So I learned that , After the system is compiled, the kernel source code arch/arm64/dts/broadcom/ The following part of and generates all dtb, Just choose which device trees are included in the process of making the image . Inspired by this , I realized that there was no problem with my operation in the second step , But there must be some problems during the operation, which led to the final failure .

4. An unexpected discovery

I'm trying to reconfigure buildroot when , perform make menuconfig after
stay kernel I found raspberrypi3_64_defconfig The path of the configuration file is in buildroot In the root directory configs In the catalog raspberrypi3_64_defconfig file . That is to say, we implement make raspberrypi3_64_defconfig The configuration file that works when this command is configs Under the table of contents , I changed the root directory before raspberrypi3_64_defconfig The document didn't work . Try again and finally succeed !!

5. summary buildroot Make raspberry pie CM3 Steps for

1. change configs In the catalog raspberrypi3_64_defconfig The changed file is as follows :

BR2_aarch64=y
BR2_cortex_a53=y
BR2_ARM_FPU_VFPV4=y

BR2_TOOLCHAIN_BUILDROOT_CXX=y

BR2_SYSTEM_DHCP="eth0"

# Linux headers same as kernel, a 5.4 series
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y

BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL=y
BR2_LINUX_KERNEL_CUSTOM_TARBALL_LOCATION="$(call github,raspberrypi,linux,9a1dd17906692f1ab76e45b9f59976b063b37034)/linux-9a1dd17906692f1ab76e45b9f59976b063b37034.tar.gz"
BR2_LINUX_KERNEL_DEFCONFIG="bcmrpi3"

# Build the DTB from the kernel sources
BR2_LINUX_KERNEL_DTS_SUPPORT=y
# Add... After this parameter broadcom/bcm2837-rpi-cm3
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus broadcom/bcm2837-rpi-3-b broadcom/bcm2837-rpi-cm3"

BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y

BR2_PACKAGE_RPI_FIRMWARE=y

# Required tools to create the SD image
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y

# Filesystem / image
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_4=y
BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3-64/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3-64/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="--aarch64 --add-miniuart-bt-overlay"

2. stay buildroot Execute... In the root directory make raspberrypi3_64_defconfig.
3. perform make menuconfig Just follow my previous blog
https://blog.csdn.net/BLUCEJIE/article/details/104653770

原网站

版权声明
本文为[Nanbolwan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140545440019.html