SDK Device Tree Overview
1. Introduction to Device Tree
The Device Tree is a mechanism used in the Linux kernel to describe board-level hardware information. It is written in text format, typically using the .dts (Device Tree Source) or .dtsi (Device Tree Source Include) file extensions. The .dts file defines specific hardware device information, while the .dtsi file is used to extract common device or platform configurations that are referenced by .dts files.
For Luckfox Pico, the device tree files are located in the following directory of the SDK: luckfox-pico SDK/sysdrv/source/kernel/arch/arm/boot/dts
During the build process, .dts and .dtsi files are compiled into binary .dtb (Device Tree Blob) files. At system startup, U-Boot loads the .dtb file into memory. The kernel then parses this file during boot to initialize hardware, load drivers, and register device nodes based on the hardware information it contains.
It is important to note that starting from Linux kernel 4.4, a Dynamic Device Tree mechanism was introduced. This allows parts of the .dtb configuration to be modified or overridden at runtime. Kernel drivers can adapt dynamically to the new configuration instead of relying solely on the statically loaded .dtb during boot.
2. Device Tree Configuration Overview
During the image build phase for Luckfox Lyra, you must first select the appropriate board support file:
./build.sh lunch
The board support file information is symbolically linked to
<luckfox-Lyra SDK>/device/rockchip/rk3506/*_defconfig/.The board support file configures the
.dtsfile corresponding to the Luckfox Lyra model. For models that share a large number of common hardware design elements, their.dtsfiles include a common.dtsifile to facilitate unified management.The corresponding
.dtsand.dtsidevice tree files for each model are as follows:型号 .dts .dtsi Luckfox Lyra rk3506g-luckfox-lyra-sd.dts rk3506-luckfox-lyra.dtsi Luckfox Lyra b rk3506g-luckfox-lyra.dts/rk3506g-luckfox-lyra-sd.dts rk3506-luckfox-lyra.dtsi Luckfox Lyra Plus rk3506g-luckfox-lyra-plus.dts/rk3506g-luckfox-lyra-plus-sd.dts rk3506-luckfox-lyra.dtsi Luckfox Lyra Ultra rk3506b-luckfox-lyra-ultra.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Ultra W rk3506b-luckfox-lyra-ultra-w.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Zero W rk3506b-luckfox-lyra-zero-w.dts/rk3506b-luckfox-lyra-zero-w-sd.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Pi A rk3506b-luckfox-lyra-pi.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Pi B rk3506b-luckfox-lyra-pi-sd.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Pico Pi A W rk3506b-luckfox-lyra-pi-w.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Pico Pi B W rk3506b-luckfox-lyra-pi-w-sd.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra B/Lyra Plus rk3506g-luckfox-lyra-amp-spinand.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Zero W rk3506b-luckfox-lyra-amp-spinand.dts rk3506-luckfox-lyra-ultra.dtsi Luckfox Lyra Ultra/Ultra W/Pi A/Pi A w rk3506b-luckfox-lyra-amp-emmc.dts rk3506-luckfox-lyra-ultra.dtsi
3. Device tree configuration
The default DSI screen model supported by Luckfox Lyra series development boards is 10.1-DSI-TOUCH-A. In addition, we have also adapted the DSI screens of Luckfox official, Raspberry Pi Han, and Weixue to ensure that their display and touch functions work properly. If you need to use other screens, users need to modify the relevant device tree configurations by themselves.
3.1 Luckfox and Raspberry Pi DSI screens (800*480)
Enter the device tree directory and find the device tree file that needs to be modified.
cd <sdk directory>/kernel-6.1/arch/arm/boot/dts
$ ls | grep luckfox
rk3506b-luckfox-lyra-amp-emmc.dts
rk3506b-luckfox-lyra-amp-spinand.dts
rk3506b-luckfox-lyra-pi.dts
rk3506b-luckfox-lyra-pi-sd.dts
rk3506b-luckfox-lyra-pi-w.dts
rk3506b-luckfox-lyra-pi-w-sd.dts
rk3506b-luckfox-lyra-ultra.dts
rk3506b-luckfox-lyra-ultra-w.dts
rk3506b-luckfox-lyra-zero-w.dts
rk3506b-luckfox-lyra-zero-w-sd.dts
rk3506g-luckfox-lyra-amp-spinand.dts
rk3506g-luckfox-lyra.dts
rk3506g-luckfox-lyra-plus.dts
rk3506g-luckfox-lyra-plus-sd.dts
rk3506g-luckfox-lyra-sd.dts
rk3506-luckfox-lyra.dtsi
rk3506-luckfox-lyra-ultra.dtsi
$ vim rk3506-luckfox-lyra.dtsiAdjust the data transmission channel configuration to 1 Lane mode.

Comment out the default initialization sequence and enable the initialization sequence of the Xinghu or Raspberry Pi official DSI screen.

Modify the dsi -> disp_timings0 -> native-mode node to make sure it matches the screen parameters.
disp_timings0: display-timings {
//native-mode = <&dsi_timing0>;
native-mode = <&ws_800_480>;
3.2 Weixue DSI screen
Enter the device tree directory and find the device tree file that needs to be modified.
cd <sdk directory>/kernel-6.1/arch/arm/boot/dts
$ ls | grep luckfox
rk3506b-luckfox-lyra-amp-emmc.dts
rk3506b-luckfox-lyra-amp-spinand.dts
rk3506b-luckfox-lyra-pi.dts
rk3506b-luckfox-lyra-pi-sd.dts
rk3506b-luckfox-lyra-pi-w.dts
rk3506b-luckfox-lyra-pi-w-sd.dts
rk3506b-luckfox-lyra-ultra.dts
rk3506b-luckfox-lyra-ultra-w.dts
rk3506b-luckfox-lyra-zero-w.dts
rk3506b-luckfox-lyra-zero-w-sd.dts
rk3506g-luckfox-lyra-amp-spinand.dts
rk3506g-luckfox-lyra.dts
rk3506g-luckfox-lyra-plus.dts
rk3506g-luckfox-lyra-plus-sd.dts
rk3506g-luckfox-lyra-sd.dts
rk3506-luckfox-lyra.dtsi
rk3506-luckfox-lyra-ultra.dtsi
$ vim rk3506-luckfox-lyra.dtsiComment out the default initialization sequence.
// 10inch1
/*
panel-init-sequence = [......
];
*/Modify dsi->disp_timings0->native-mode node to make sure it matches the screen parameters.

Enable touch configuration in i2c2->gt911.

3.3 101M-8001280-IPS-CT-K
Enter the device tree directory and locate the device tree file to be modified.
cd <sdk directory>/kernel-6.1/arch/arm/boot/dts
$ ls | grep luckfox
rk3506b-luckfox-lyra-amp-emmc.dts
rk3506b-luckfox-lyra-amp-spinand.dts
rk3506b-luckfox-lyra-pi.dts
rk3506b-luckfox-lyra-pi-sd.dts
rk3506b-luckfox-lyra-pi-w.dts
rk3506b-luckfox-lyra-pi-w-sd.dts
rk3506b-luckfox-lyra-ultra.dts
rk3506b-luckfox-lyra-ultra-w.dts
rk3506b-luckfox-lyra-zero-w.dts
rk3506b-luckfox-lyra-zero-w-sd.dts
rk3506g-luckfox-lyra-amp-spinand.dts
rk3506g-luckfox-lyra.dts
rk3506g-luckfox-lyra-plus.dts
rk3506g-luckfox-lyra-plus-sd.dts
rk3506g-luckfox-lyra-sd.dts
rk3506-luckfox-lyra.dtsi
rk3506-luckfox-lyra-ultra.dtsi
$ vim rk3506-luckfox-lyra.dtsiEnable the backlight node.

Link the backlight node within the dsi_panel node.

Disable the default backlight driver.
