uboot-extlinux-config.bbclass: add support for DTBOs
cover uboot-extlinux-config.bbclass: add support for DTBOs
Currently, Yocto only supports FIT setups in extlinux for providing and applying Device Tree Overlays. It even has an additional requirement of needing the base FDT image node to have a load property outside of the DRAM location where the FIT data is stored. This is being fixed in U-Boot, c.f.
https://lore.kernel.org/u-boot/20241219-extlinux-relocate-dtb-when-dtbo-v1-1-fe5eeb8fd4f1@cherry.de/
Until that is merged, one needs to set UBOOT_DTB_LOADADDRESS (not UBOOT_DTBO_LOADADDRESS!) when building the FIT image. One can then boot a FIT image and apply FDTOs by setting UBOOT_EXTLINUX_KERNEL_IMAGE to the path to the fitimage on disk followed by (no space!) '#<conf-1>#<conf-2>' with <conf-1> being the name of the config node with the base FDT, and <conf-2> the name of the config node with the FDTO to apply.
For FIT-less setups, the FDTOVERLAYS (or devicetree-overlay) property needs to be set per label. This is what this patch series does.
---
Quentin Schulz (2):
uboot-extlinux-config.bbclass: simplify FDT/FDTDIR logic uboot-extlinux-config.bbclass: add support for DTBOs
meta/classes-recipe/uboot-extlinux-config.bbclass | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
---
base-commit: 783347d27b179d85098dc2166bc8234a08b7811b
change-id: 20241217-extlinux-overlays-1ebfbb73fc81
Best regards,
Signature · 1 line
Quentin Schulz <[email protected]>
PATCH 1/2 uboot-extlinux-config.bbclass: simplify FDT/FDTDIR logic
From: Quentin Schulz <[email protected]>
The three blocks share the same LABEL and KERNEL content, so let's factor that part out.
--- meta/classes-recipe/uboot-extlinux-config.bbclass | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
meta/classes-recipe/uboot-extlinux-config.bbclass +4 -6
@@ -137,14 +137,12 @@ python do_create_extlinux_config() { fdt = localdata.getVar('UBOOT_EXTLINUX_FDT') + cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image)) + if fdt: - cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDT %s\n' % - (menu_description, kernel_image, fdt)) + cfgfile.write('\tFDT %s\n' % (fdt)) elif fdtdir: - cfgfile.write('LABEL %s\n\tKERNEL %s\n\tFDTDIR %s\n' % - (menu_description, kernel_image, fdtdir)) - else: - cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image)) + cfgfile.write('\tFDTDIR %s\n' % (fdtdir)) kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS')
Signature · 1 line
2.47.1
PATCH 2/2 uboot-extlinux-config.bbclass: add support for DTBOs
In reply to Quentin SchulzFrom: Quentin Schulz <[email protected]>
Also known as FDTO, DTO or Device Tree Overlay.
This adds a new property per label in extlinux.conf for which device tree overlays to apply on top of the base device tree (the one specified in FDT or guessed by the bootloader if only FDTDIR is set). It is a space-separated list of paths to the .dtbo file(s).
Note that the base FDT needs to have symbols enabled (DTC_FLAGS needs to have -@ in it) for an overlay to be applicable.
This is only applicable for non-FIT setups.
--- meta/classes-recipe/uboot-extlinux-config.bbclass | 6 ++++++ 1 file changed, 6 insertions(+)
meta/classes-recipe/uboot-extlinux-config.bbclass +6 -0
@@ -15,6 +15,7 @@ # UBOOT_EXTLINUX_KERNEL_IMAGE - Kernel image name. # UBOOT_EXTLINUX_FDTDIR - Device tree directory. # UBOOT_EXTLINUX_FDT - Device tree file. +# UBOOT_EXTLINUX_FDTOVERLAYS - Device tree overlay files. Space-separated list. # UBOOT_EXTLINUX_INITRD - Indicates a list of filesystem images to # concatenate and use as an initrd (optional). # UBOOT_EXTLINUX_MENU_DESCRIPTION - Name to use as description.
@@ -66,6 +67,7 @@ UBOOT_EXTLINUX_CONSOLE ??= "console=${console},${baudrate}" UBOOT_EXTLINUX_LABELS ??= "linux" UBOOT_EXTLINUX_FDT ??= "" +UBOOT_EXTLINUX_FDTOVERLAYS ??= "" UBOOT_EXTLINUX_FDTDIR ??= "../" UBOOT_EXTLINUX_KERNEL_IMAGE ??= "../${KERNEL_IMAGETYPE}" UBOOT_EXTLINUX_KERNEL_ARGS ??= "rootwait rw"
@@ -136,6 +138,7 @@ python do_create_extlinux_config() { fdtdir = localdata.getVar('UBOOT_EXTLINUX_FDTDIR') fdt = localdata.getVar('UBOOT_EXTLINUX_FDT') + fdtoverlays = localdata.getVar('UBOOT_EXTLINUX_FDTOVERLAYS') cfgfile.write('LABEL %s\n\tKERNEL %s\n' % (menu_description, kernel_image))
@@ -144,6 +147,9 @@ python do_create_extlinux_config() { elif fdtdir: cfgfile.write('\tFDTDIR %s\n' % (fdtdir)) + if fdtoverlays: + cfgfile.write('\tFDTOVERLAYS %s\n' % (' '.join(fdtoverlays.split()))) + kernel_args = localdata.getVar('UBOOT_EXTLINUX_KERNEL_ARGS') initrd = localdata.getVar('UBOOT_EXTLINUX_INITRD')
Signature · 1 line
2.47.1