From: Niklas Cassel via buildroot <buildroot@buildroot.org>
To: "Gaël PORTAY" <gael.portay@rtone.fr>
Cc: Julien Grossholtz <julien.grossholtz@openest.io>,
Michael Walle <michael@walle.cc>,
Damien Le Moal <dlemoal@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"buildroot@buildroot.org" <buildroot@buildroot.org>,
Martin Bark <martin@barkynet.com>
Subject: Re: [Buildroot] [RFC PATCH 1/2] linux: install in-tree device-tree blob overlays
Date: Fri, 30 Aug 2024 12:20:35 +0000 [thread overview]
Message-ID: <ZtG5EnLkVJ1EMCTl@ryzen.lan> (raw)
In-Reply-To: <20240412140945.1626579-2-gael.portay@rtone.fr>
Hello Gaël,
On Fri, Apr 12, 2024 at 04:09:44PM +0200, Gaël PORTAY wrote:
> The device-tree blob overlays are automatically built from the custom
> raspberrypi linux tree (for both architectures arm and arm64).
>
> The device-tree overlays is mostly a downstream feature even though the
> upstream kernel generates the symbols node into the device-tree blobs it
> compiles (thanks to the option -@ in the DTC_FLAGS); and it does not
> have intree device-tree overlays.
>
> Note: The device-tree overlays require the node __symbols__ to be part
> of the device-tree blob to get successfully loaded at runtime if the
> overlaied nodes make reference to symbols from the original devicetree
> blob.
>
> The kernel image and the device-tree blobs for the raspberrypi boards
> are built from the downstream linux package, and the device-tree blob
> overlays are taken from the package rpi-firmware. Both packages linux
> and rpi-firmware have to be closely synced.
>
> The buildroot tree maintains the packages and the board configurations,
> and it keeps things synced.
>
> The downstream configurations in br2-external trees require to pay
> attention to that synchronization as well. If the files are out-of-sync,
> (i.e. the dtbos in the rpi-firmware package from the buildroot tree do
> not match the linux commit in the br2-external tree), then the boot may
> fail.
>
> Since the Raspberry Pi's with Bluetooth have no dedicated debugging UART,
> they require to merge the bt-miniuart.dtbo to restore the UART0 to the
> accessible GPIOs of 40-pin GPIO header.
>
> The investigation of the boot failure is comlicated if the root cause is
> due to the out-of-sync merge of the debugging uart's dtbo to the dtb and
> if firmware bootloader does not output the debug traces.
>
> MESS:00:00:05.389885:0: brfs: File read: /mfs/sd/overlays/miniuart-bt.dtbo
> MESS:00:00:05.408881:0: dterror: can't find symbol 'uart1_bt_pins'
> MESS:00:00:05.411942:0: Failed to resolve overlay 'miniuart-bt'
>
> All this long story to introduce the three new dtbos configs to build
> in-tree or out-of-tree dtbos, and to keep the directory name (assuming
> the downstream trees uses the directory name overlays).
>
> The three configs are the equivalent to existing dts configs:
> - BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES is equivalent to
> BR2_LINUX_KERNEL_INTREE_DTS_NAME
> - BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH is equivalent to
> BR2_LINUX_KERNEL_CUSTOM_DTS_PATH
> - BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME is equivalent to
> BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME
>
> Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
> ---
> linux/Config.in | 23 +++++++++++++++++++++++
> linux/linux.mk | 24 ++++++++++++++++++++++++
> 2 files changed, 47 insertions(+)
>
> diff --git a/linux/Config.in b/linux/Config.in
> index 2767b709d4..fdd57e6ff9 100644
> --- a/linux/Config.in
> +++ b/linux/Config.in
> @@ -434,6 +434,29 @@ config BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
> Choose this option to support Device Tree overlays
> on the target system.
>
> +config BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES
> + string "In-tree Device Tree Source Overlay file names"
> + depends on BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT
> + help
> + Name of in-tree device tree source file, without
> + the trailing -overlay.dts. You can provide a list of
> + dts files to build, separated by spaces.
I do not like that you assume that the DT overlay has a -overlay.dts suffix,
that seems to be something specific for the raspberry pi downstream kernel.
Most device tree overlays in the upstream kernel simply have a .dtso suffix:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=40658534756f8369e93b84fa75c20bde6528cb82
So it would be nice if your patch supported that as well.
Also see this other proposal from Michael Walle:
https://lore.kernel.org/buildroot/20240213154847.914068-1-michael@walle.cc/
Kind regards,
Niklas
> +
> +config BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH
> + string "Out-of-tree Device Tree Source Overlay file paths"
> + help
> + Paths to out-of-tree Device Tree Source Overlay (-overlay.dts)
> + and Device Tree Source Include (.dtsi) files, separated by
> + spaces. These files will be copied to the kernel sources and
> + the .dts files will be compiled from there.
> +
> +config BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME
> + bool "Keep the directory name of the Device Tree Overlay"
> + help
> + If enabled, the device tree blob overlays keep their
> + directory prefixes when they get copied to the
> + output image directory or the target directory.
> +
> endif
>
> config BR2_LINUX_KERNEL_INSTALL_TARGET
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 4e12b36c1f..8b3563394d 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -199,6 +199,14 @@ LINUX_DTS_NAME += $(basename $(filter %.dts,$(notdir $(call qstrip,$(BR2_LINUX_K
>
> LINUX_DTBS = $(addsuffix .dtb,$(LINUX_DTS_NAME))
>
> +ifeq ($(BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT),y)
> +LINUX_DTS_OVERLAY_NAMES += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_OVERLAY_NAMES))
> +
> +LINUX_DTS_OVERLAY_NAMES += $(basename $(filter %-overlay.dts,$(notdir $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH)))))
> +
> +LINUX_DTBOS = $(addsuffix .dtbo,$(LINUX_DTS_OVERLAY_NAMES))
> +endif
> +
> ifeq ($(BR2_LINUX_KERNEL_IMAGE_TARGET_CUSTOM),y)
> LINUX_IMAGE_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_NAME))
> LINUX_TARGET_NAME = $(call qstrip,$(BR2_LINUX_KERNEL_IMAGE_TARGET_NAME))
> @@ -459,10 +467,23 @@ define LINUX_INSTALL_DTB
> $(1)/$(if $(BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME),$(dtb),$(notdir $(dtb)))
> )
> endef
> +define LINUX_INSTALL_DTBO
> + $(foreach dtbo,$(LINUX_DTBOS), \
> + install -D \
> + $(wildcard $(LINUX_ARCH_PATH)/boot/dts/$(dtbo)) \
> + $(1)/$(if $(BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME),$(dtbo),$(notdir $(dtbo)))
> + )
> +endef
> endif # BR2_LINUX_KERNEL_APPENDED_DTB
> endif # BR2_LINUX_KERNEL_DTB_IS_SELF_BUILT
> endif # BR2_LINUX_KERNEL_DTS_SUPPORT
>
> +ifeq ($(BR2_LINUX_KERNEL_DTS_OVERLAY_SUPPORT),y)
> +define LINUX_BUILD_DTBO
> + $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_DTBOS)
> +endef
> +endif # BR2_LINUX_KERNEL_DTS_OVERLAY_SUPPORT
> +
> ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
> # dtbs moved from arch/$ARCH/boot to arch/$ARCH/boot/dts since 3.8-rc1
> define LINUX_APPEND_DTB
> @@ -509,6 +530,7 @@ define LINUX_BUILD_CMDS
> $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_TARGET_NAME)
> $(LINUX_BUILD_DTB)
> $(LINUX_APPEND_DTB)
> + $(LINUX_BUILD_DTBO)
> endef
>
> ifeq ($(BR2_LINUX_KERNEL_APPENDED_DTB),y)
> @@ -530,6 +552,7 @@ ifeq ($(BR2_LINUX_KERNEL_INSTALL_TARGET),y)
> define LINUX_INSTALL_KERNEL_IMAGE_TO_TARGET
> $(call LINUX_INSTALL_IMAGE,$(TARGET_DIR)/boot)
> $(call LINUX_INSTALL_DTB,$(TARGET_DIR)/boot)
> + $(call LINUX_INSTALL_DTBO,$(TARGET_DIR)/boot/overlays)
> endef
> endif
>
> @@ -544,6 +567,7 @@ endef
> define LINUX_INSTALL_IMAGES_CMDS
> $(call LINUX_INSTALL_IMAGE,$(BINARIES_DIR))
> $(call LINUX_INSTALL_DTB,$(BINARIES_DIR))
> + $(call LINUX_INSTALL_DTBO,$(BINARIES_DIR))
> endef
>
> ifeq ($(BR2_STRIP_strip),y)
> --
> 2.44.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-08-30 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 14:09 [Buildroot] [RFC PATCH 0/2] linux: install in-tree device-tree blob overlays Gaël PORTAY
2024-04-12 14:09 ` [Buildroot] [RFC PATCH 1/2] " Gaël PORTAY
2024-08-30 12:20 ` Niklas Cassel via buildroot [this message]
2024-09-02 19:57 ` Gaël PORTAY
2024-04-12 14:09 ` [Buildroot] [RFC PATCH 2/2] board/raspberrypi: " Gaël PORTAY
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZtG5EnLkVJ1EMCTl@ryzen.lan \
--to=buildroot@buildroot.org \
--cc=Niklas.Cassel@wdc.com \
--cc=dlemoal@kernel.org \
--cc=gael.portay@rtone.fr \
--cc=julien.grossholtz@openest.io \
--cc=martin@barkynet.com \
--cc=michael@walle.cc \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.