From patchwork Mon Sep 2 20:35:32 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: 1979760 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 4WyLBD08FZz1yXY for ; Tue, 3 Sep 2024 06:36:04 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 5A33D4032F; Mon, 2 Sep 2024 20:36:02 +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 XvXFba29hJ6S; Mon, 2 Sep 2024 20:36:01 +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 5308940319 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id 5308940319; Mon, 2 Sep 2024 20:36:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id CD9711BF8B4 for ; Mon, 2 Sep 2024 20:35:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id BA87680DA9 for ; Mon, 2 Sep 2024 20:35:56 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6NNw1yZje3fS for ; Mon, 2 Sep 2024 20:35:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::330; helo=mail-wm1-x330.google.com; envelope-from=gael.portay@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 5D07080D6C DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5D07080D6C Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5D07080D6C for ; Mon, 2 Sep 2024 20:35:55 +0000 (UTC) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-42bbd3bed1bso4553995e9.1 for ; Mon, 02 Sep 2024 13:35:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725309353; x=1725914153; 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=W19N87FuqYls6hH8TLNLGINPXMhpTTPxBLE97FVQ+EI=; b=vfQS9OaPQ3BWqgLztvbV2hJCclTrlZEyrsw8AFdH5Qv+vb8VRcYTcBF5Gb4Mv6l/On nHePK3PoBAc4FbfXCpYJ+axfz/a95XR0n98DgPUbW1diS+WmaUKaT88VVoe3WaiZHorh B+FdZRePl7u78Ul/OdWbasd6kRM0LgnLwJuthzdnVoY5T9zIBfwSnpqWDpKBdLh1kYjw QumjRkxy6xNN+pt2tFA2I/hEOxRcA3QeIFGMAbDOkS2j9FPttUGr8+jhsbL67eYWRhCc m3z+Ug/PsJKmdphCcz7Fe6NvqIJcWe3Hsxkr20u01GChT8BtZBwz6bXEo+I/br5kF0qc th/g== X-Gm-Message-State: AOJu0Yy09phm7M5OZgv2999q6y9Nqomrv08NrUnSha8Tm9EtEaJi0mEb hGu60g3liVtx1jktku9IGY2meoLDyV4+WLFcJ/PClm7OEj9bprzU5ZOEKFW5Jts= X-Google-Smtp-Source: AGHT+IGGVECpYz7zy33F3c4/Th2ZNnMNFnSo4PvvdzqHw2flpZo0FPFrvDw/BxY6Mw7HQ9wwkSAsHQ== X-Received: by 2002:a05:600c:4fd6:b0:426:6cd1:d116 with SMTP id 5b1f17b1804b1-42bbb435e82mr44860805e9.3.1725309352605; Mon, 02 Sep 2024 13:35:52 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:ce:f2f0:2a6b:35ff:feb8:77d9]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bbc8de253sm96609475e9.0.2024.09.02.13.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 13:35:51 -0700 (PDT) From: " =?utf-8?q?Ga=C3=ABl_PORTAY?= " X-Google-Original-From: =?utf-8?q?Ga=C3=ABl_PORTAY?= To: buildroot@buildroot.org Date: Mon, 2 Sep 2024 22:35:32 +0200 Message-ID: <20240902203533.3961108-2-gael.portay@rtone.fr> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240902203533.3961108-1-gael.portay@rtone.fr> References: <20240902203533.3961108-1-gael.portay@rtone.fr> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725309353; x=1725914153; 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=W19N87FuqYls6hH8TLNLGINPXMhpTTPxBLE97FVQ+EI=; b=aEKO9B5QDVWRaziAf81MP6k2XkVNa6RNh/XdtNK6BuNLWeCGxNrIbRY6+coUD6+OUE XoMDgmBzbEuTvYu9vmxcuTQE2d0XOkHdqyHYHBjmOxQ3RVXO6GH4wsyWnat0hg198GiO rcXDLC8LHssNuRyP1MtZH+rfkECYOoxLpEK4EXo+Mi6rpw0QPr2w0ut3tyMMgh5ObYIG ibA/mdzUTlei+p1lRVIeuSr/Uarl6z+2SEYWDCcUwUJOn9LjGWqCWZj6tPz7YzsVdC1v smi1loVsDV9CNTNdQz9Hxh7Wf/RbZFoMOjR90xIkY6hy4WShnHV6wkLFbvQVm3iGwgHW J3Dw== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=aEKO9B5Q Subject: [Buildroot] [PATCH 1/2] linux: add device-tree blob overlays support 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: Niklas Cassel , =?utf-8?q?Ga=C3=ABl_PORTAY?= , Julien Grossholtz , Fiona Klute , Michael Walle , Christian Stewart , Martin Bark Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" The device-tree blob overlay is an upstream feature; one can build a .dtbo from .dtso thanks to commit 363547d2191c (kbuild: Allow DTB overlays to built from .dtso named source files)[1] (linux-6.1-rc2). This introduces the three new dtbo configs to build in-tree or out-of-tree dtbos, and to keep the directory name. 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 (it takes in-tree files relative to dts directory, without file extention: i.e. without .dts) - BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH is equivalent to BR2_LINUX_KERNEL_CUSTOM_DTS_PATH (it takes out-of-tree files relative to buildroot directory, with file extention .dtso) - BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME is equivalent to BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME [1]: https://github.com/torvalds/linux/commit/363547d2191cbc32ca954ba75d72908712398ff2 Signed-off-by: Gaƫl PORTAY --- linux/Config.in | 24 ++++++++++++++++++++++++ linux/linux.mk | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/linux/Config.in b/linux/Config.in index 526dd9ff00..41f5eb271d 100644 --- a/linux/Config.in +++ b/linux/Config.in @@ -440,6 +440,30 @@ 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 .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 (.dtso) + and Device Tree Source Include (.dtsi) files, separated by + spaces. These files will be copied to the kernel sources and + the .dtso files will be compiled from there. + +config BR2_LINUX_KERNEL_DTBO_KEEP_DIRNAME + bool "Keep the directory name of the Device Tree Overlay" + depends on BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT + 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 16d9f19470..d3ea427336 100644 --- a/linux/linux.mk +++ b/linux/linux.mk @@ -202,6 +202,18 @@ 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)) + +# We keep only the .dtso files, so that the user can specify both .dtso +# and .dtsi files in BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH. Both will be +# copied to arch//boot/dts, but only the .dtso files will +# actually be generated as .dtbo. +LINUX_DTS_OVERLAY_NAMES += $(basename $(filter %.dtso,$(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)) @@ -462,10 +474,26 @@ define LINUX_INSTALL_DTB $(1)/$(if $(BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME),$(dtb),$(notdir $(dtb))) ) endef +define LINUX_BUILD_DTBO + $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) $(LINUX_DTBOS) +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 @@ -508,10 +536,14 @@ define LINUX_BUILD_CMDS $(foreach dts,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_PATH)), \ cp -f $(dts) $(LINUX_ARCH_PATH)/boot/dts/ ) + $(foreach dtso,$(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_DTS_OVERLAY_PATH)), \ + cp -f $(dtso) $(LINUX_ARCH_PATH)/boot/dts/ + ) $(LINUX_MAKE_ENV) $(BR2_MAKE) $(LINUX_MAKE_FLAGS) -C $(@D) all $(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) @@ -533,6 +565,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) endef endif @@ -547,6 +580,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)