重新构建 buildroot 以包含自定义设备树 dts 修改

问题描述 投票:0回答:1

您好,我能够构建系统映像并使用 buildroot 成功启动我的 Orange PI Zero 3。

在学习Linux设备驱动程序的过程中,我现在需要修改设备树。为此,我创建文件

sun50i-h616-orangepi-zero3-custom.dts
并将原始文件包含在其中。

现在按照这个:Buildroot:如何修改自定义板的设备树?

指向 Buildroot 菜单配置中“树外自定义 DTS”菜单项 (BR2_LINUX_KERNEL_CUSTOM_DTS_PATH) 中的 dt。

但是在我进行上述编辑并在 buildroot 上运行

make
后,它只会从以前的二进制映像重新生成文件系统。它不进行编译(包括 dtb)...

如何只将dtb重新编译成预编译系统?

编辑:运行

make clean all
确实会触发完整的重新编译。但是 uboot 现在正在尝试加载一个不存在的
/boot/allwinner/sun50i-h616-orangepi-zero3.dtb
,而它应该加载(我相信)
/boot/sun50i-h616-orangepi-zero3-custom.dtb

这是启动日志:

U-Boot SPL 2021.07 (Dec 20 2023 - 15:24:56 +0000)
DRAM: 1024 MiB
Trying to boot from MMC1
NOTICE:  BL31: v2.9(release):v2.9
NOTICE:  BL31: Built : 15:21:07, Dec 20 2023
NOTICE:  BL31: Detected Allwinner H616 SoC (1823)
NOTICE:  BL31: Found U-Boot DTB at 0x4a0822d0, model: OrangePi Zero3
ERROR:   RSB: set run-time address: 0x10003


U-Boot 2021.07 (Dec 20 2023 - 15:24:56 +0000) Allwinner Technology

CPU: Allwinner H616 (SUN50I)       
Model: OrangePi Zero3                
I2C: ready                         
DRAM:  1 GiB                        
MMC:   mmc@4020000: 0                
Loading Environment from FAT... Unable to use mmc 0:1... In:    serial@5000000 Out:   serial@5000000                   
Err:   serial@5000000                
Net:   No ethernet found.            
starting USB...                      
No working controllers found          
Autoboot in 2 seconds, press <Space> to stop switch to partitions #0, OK           
mmc0 is current device                
Scanning mmc 0:1...                   
Found /boot/extlinux/extlinux.conf    
Retrieving file: /boot/extlinux/extlinux.conf
176 bytes read in 2 ms (85.9 KiB/s)   
1:      default                      
Retrieving file: /boot/Image         
22532104 bytes read in 1806 ms (11.9 MiB/s)
append: root=PARTUUID=693bf98f-ac7c-49d5-89d8-bdbebeb8ef82 rootwait console=ttyS0,115200 rootfstype=ext4 quiet panic=10
Retrieving file: /boot/allwinner/sun50i-h616-orangepi-zero3.dtb
Failed to load '/boot/allwinner/sun50i-h616-orangepi-zero3.dtb'
Moving Image from 0x40080000 to 0x40200000, end=41800000                                                                                                     
                                                                                                                                                             
Starting kernel ...

并挂在那里。另外,仅针对 dtb 构建整个系统也很不方便。有没有办法使构建根仅将设备树 blob 更新到文件系统中?

编辑2:看到这个:如何在buildroot中正确使用自定义设备树源?

u-boot 传递给内核的设备树由 u-boot 的 CONFIG_DEFAULT_FDT_FILE 选项定义 <...> 此选项应设置为类似

imx28-custom.dtb
的内容。

仍然是同样的错误

Failed to load '/boot/allwinner/sun50i-h616-orangepi-zero3.dtb'

EDIT3:好的,我在 uboot 提示符下手动加载 dtb:

Autoboot in 2 seconds, press <Space> to stop
=> setenv bootargs "root=PARTUUID=693bf98f-ac7c-49d5-89d8-bdbebeb8ef82 rootwait console=ttyS0,115200 rootfstype=ext4 quiet panic=10"
=> ext4load mmc 0:1 ${kernel_addr_r} boot/Image
22532104 bytes read in 1805 ms (11.9 MiB/s)
=> ext4load mmc 0:1 ${fdt_addr_r} boot/sun50i-h616-orangepi-zero3-custom.dtb
39939 bytes read in 5 ms (7.6 MiB/s)
=> booti ${kernel_addr_r} - ${fdt_addr_r}
Moving Image from 0x40080000 to 0x40200000, end=41800000
## Flattened Device Tree blob at 4fa00000
   Booting using the fdt blob at 0x4fa00000
   Loading Device Tree to 0000000049ff3000, end 0000000049fffc02 ... OK

Starting kernel ...

[    0.758652] axp20x-regulator axp20x-regulator: DCDC frequency on AXP313a is fixed to 3 MHz.
[    0.758659] axp20x-regulator axp20x-regulator: Error setting dcdc frequency: -22
[    0.867654] debugfs: Directory '1100000.mixer' with parent 'regmap' already present!
[    0.875431] debugfs: Directory '1100000.mixer' with parent 'regmap' already present!
[    0.911703] OF: /thermal-zones/gpu-thermal/cooling-maps/map0: could not get #cooling-cells for /soc/gpu@1800000
[    0.921811] thermal_sys: Add a cooling_device property with at least one device
[    0.929119] thermal thermal_zone0: binding zone gpu-thermal with cdev cpufreq-cpu0 failed:-2

它在那里崩溃了!我在这里做错了什么?我失去了尝试的想法:(

EDIT4 我用

bootargs "root=PARTUUID=693bf98f-ac7c-49d5-89d8-bdbebeb8ef82 rootfstype=ext4"
重试,结果成功了!所以手动启动是有效的。但需要获得 buildroot 才能兑现
CONFIG_DEFAULT_FDT_FILE
选项。

linux-kernel embedded-linux buildroot device-tree
1个回答
0
投票

如何只将dtb重新编译成预编译系统?

不确定是否还有其他/更好的方法,但我只是删除了Linux内核构建子目录中的几个隐藏文件:

.stamp_built
,
.stamp_images_installed
,
.stamp_installed
,和
.stamp_target_installed

然后从 Buildroot 目录发出顶级 make

© www.soinside.com 2019 - 2024. All rights reserved.