YOCTO : Modify Linux OS features by editing it'

2020-05-03 11:17发布

问题:

I am using YOCTO project SUMO release to Build Linux kernel for my embedded board.

I want to customize the features of my board. They told me to edit the device tree file.

My question is what is the path of this DT file ? And when i modify it, I must rebuild all the kernel using Bitbake ?

Thanks.

回答1:

Create the following tree in your layer meta-custom:

recipes-kernel/
└── linux
    ├── linux-at91
    │   ├── 0001-my-custom-dt.patch
    └── linux-at91_%.bbappend

In linux-at91_%.bbappend, put

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-my-custom-dt.patch"

To generate 0001-my-custom-dt.patch, you can use the following steps:

git clone https://github.com/linux4sam/linux-at91.git
cd linux-at91/
quilt new 0001-my-custom-dt.patch
quilt add arch/arm/boot/dts/at91-sama5d27_som1_ek.dts 
vim arch/arm/boot/dts/at91-sama5d27_som1_ek.dts

# modify DT

quilt refresh

You should obtain something like:

Index: linux-at91/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
===================================================================
--- linux-at91.orig/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
+++ linux-at91/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
@@ -538,7 +538,7 @@
        compatible = "gpio-leds";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_led_gpio_default>;
-       status = "okay"; /* Conflict with pwm0. */
+       status = "disabled"; /* Conflict with pwm0. */

        red {
            label = "red";

Finally copy patch in recipes-kernel/linux/linux-at91 and relaunch Yocto build.


Note: you could also create an entire custom device-tree by using KERNEL_DEVICETREE bitbake variable.