[yocto] How to define and build device tree in Yocto?
Bas Mevissen
abuse at basmevissen.nl
Mon May 6 07:35:36 PDT 2019
On 5/5/19 2:03 PM, JH wrote:
> Hi,
>
Hi JH,
> I think the device tree blob is build from device tree source, but I
> could not find any dts files in recipe source directory, there are
> many dts files in build directory and there are dtb in build
> directory.
>
Already answered by Gabriele.
> If I have a device tree source, where I should put it and how to
> define the recipe to built it?
>
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.
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"
}
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
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.
Hope this helps,
Bas.
More information about the yocto
mailing list