From patchwork Fri Apr 12 14:09:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABl_PORTAY?= X-Patchwork-Id: 1923161 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VGJPG5fLdz1yYL for ; Sat, 13 Apr 2024 00:10:26 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 2C47241F3C; Fri, 12 Apr 2024 14:10:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id eVKRji1v9XWl; Fri, 12 Apr 2024 14:10:21 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4FFED41F44 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 4FFED41F44; Fri, 12 Apr 2024 14:10:20 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 24BF71BF39D for ; Fri, 12 Apr 2024 14:10:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1EC944051B for ; Fri, 12 Apr 2024 14:10:16 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id w3eFVW7glTeQ for ; Fri, 12 Apr 2024 14:10:15 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32a; helo=mail-wm1-x32a.google.com; envelope-from=gael.portay@rtone.fr; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org 71D15401D5 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org 71D15401D5 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by smtp2.osuosl.org (Postfix) with ESMTPS id 71D15401D5 for ; Fri, 12 Apr 2024 14:10:14 +0000 (UTC) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-41802e8daafso3275395e9.2 for ; Fri, 12 Apr 2024 07:10:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931012; x=1713535812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2eEJvBRQJoAaQMnXZWIGTNN8AeMc6FhrNQbkwXUhVAU=; b=MBzZdkIizl+iQufkSIOZsv58/deoQtAMLZNNwZK0lkwV2wLJUFEWxIbQnSdNot74ml p2o/aJ28TplENqIxkll0/yhby9Nb5082R1I2psdFFvy7f0sumyBUt4nhTRuJfqVlL3CO vzR4bG/QjFMBQ0EV5jDtk+SrFMQ3LYQ7RnyO4hGKHHnmJkILqbD1qCQbEw9WFNys/tII dU5dcUIyGj5DdnouWX/oEvRqoIq9tb3/cVA8ijLyTxXDIO+tCROiN8gkXBcud6//h6YA AxMC8lTG2JJdohjBE+tTMZoYrPXB9Y0W905P0cBDXw/8SnSdnsUAZMf0lAYQTG+6Pdbs AlvA== X-Gm-Message-State: AOJu0Yx/CkrElqtg9KqKpeo+8V99b7ah+SPYXUtWHigUXs4WHrzVs/lb ukIVuaOsQcdSGH9OUpQ+Ett0zmpoQs+9830DaAv19DxkIohTV1BN8CI74pZbLei8X2BSnVrSfs2 Zjjo= X-Google-Smtp-Source: AGHT+IF6Ls3CVAY5CW47w2MNStsBJfvTJ7ulCKRAW3zU0mf2+Yo++r/ESGUDV2RqoGZTk5kZk4uLaQ== X-Received: by 2002:a05:600c:35ca:b0:416:8091:a39e with SMTP id r10-20020a05600c35ca00b004168091a39emr2417395wmq.10.1712931011839; Fri, 12 Apr 2024 07:10:11 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:ce:f2f0:2a6b:35ff:feb8:77d9]) by smtp.gmail.com with ESMTPSA id gw7-20020a05600c850700b004146e58cc35sm9111114wmb.46.2024.04.12.07.10.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:10:11 -0700 (PDT) From: =?utf-8?q?Ga=C3=ABl_PORTAY?= To: buildroot@buildroot.org, Thomas Petazzoni Date: Fri, 12 Apr 2024 16:09:44 +0200 Message-ID: <20240412140945.1626579-2-gael.portay@rtone.fr> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412140945.1626579-1-gael.portay@rtone.fr> References: <20240412140945.1626579-1-gael.portay@rtone.fr> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rtone.fr; s=google; t=1712931012; x=1713535812; darn=buildroot.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2eEJvBRQJoAaQMnXZWIGTNN8AeMc6FhrNQbkwXUhVAU=; b=DLmK2KFtiqHvAJfRPXoU54epZ7hteZx7PZnS6RqOE79RXJ9BR8OG02XnJm3r4ta9wM Dhfoj7ex6p5XWmfouSlzz8BsM6+MTwmrqA+0B1C/TQlOqrtdVcCtn2uXbrgno2DgTTad dNdhz3IH581RfSpNm7oEeKdaMAC/fzjQQ1vs8= X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=none dis=none) header.from=rtone.fr X-Mailman-Original-Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=rtone.fr header.i=@rtone.fr header.a=rsa-sha256 header.s=google header.b=DLmK2KFt Subject: [Buildroot] [RFC PATCH 1/2] linux: install in-tree device-tree blob overlays X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Ga=C3=ABl_PORTAY?= , Martin Bark , Julien Grossholtz Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" 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 --- linux/Config.in | 23 +++++++++++++++++++++++ linux/linux.mk | 24 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+) -- 2.44.0 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. + +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)