[yocto] How to define and build device tree in Yocto?

JH jupiter.hce at gmail.com
Mon May 6 17:13:23 PDT 2019


Hi Bas and Gabriele,

Thank you so much for you advice.

> My usual way of doing it is as follows:
>
> I usually don't need to make large modifications to the kernel source,
> so I don't need to clone the kernel, but use the default kernel for the
> SoC with some patches.

So do I.

> I use a platform support layer and add a .bbappend file for the (arm)
> kernel to add a custom dts and .config files, together with some small
> patches:
>
> *** File meta-<platform>/recipes-kernel/linux/linux-<version>_%.bbappend:
>
> THISAPPENDFILESDIR := "${THISDIR}/files"
> FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
>
> require linux-set-custom-defconfig.inc
> require linux-add-custom-dts.inc
>
> # The first patch simply appends my custom DTS to the list of DTD files
> in the Makefile
> SRC_URI += \
>          "file://add-custom-dts.patch \
>           file://some_other.patch \
>           file://another_driver_patch.patch \
>          "
>
> *** File meta-<platform>/recipes-kernel/linux/linux-add-custom-dts.inc
>
> do_add_platform_dts() {
> 	cp -f "${THISAPPENDFILESDIR}/custom.dts" \
>              "${WORKDIR}/git/arch/arm/boot/dts"
> }

That is exactly I am looking for the proper location of the dts files,
thank you so much.

> addtask add_platform_dts before do_preconfigure after do_patch
>
> *** File
> meta-<platform>/recipes-kernel/linux/linux-set-custom-defconfig.inc
>
> do_set_custom_defconfig() {
>          cp -f "${THISAPPENDFILESDIR}/defconfig" "${WORKDIR}/defconfig"
> }
>
> addtask set_custom_defconfig before do_preconfigure after do_patch

Good advice, I missed that one, how did you do the defconfig usually?
Compile it in kernel source like using following command?

make ARCH=arm imx_v6_v7_defconfig

> It is maybe a bit complex, but it saves cloning the kernel for the sake
> of just adding a single DTS with defconfig and a few patches.

That is procedure I was looking for.

> Hope this helps,

Great helps, thank you so much.

- jupiter

> Bas.
>


More information about the yocto mailing list