From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 02 Feb 2024 16:12:47 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rVvDi-0001Yr-0M for lore@lore.pengutronix.de; Fri, 02 Feb 2024 16:12:47 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rVvDi-00033L-Nx; Fri, 02 Feb 2024 16:12:46 +0100 Received: from mail.thorsis.com ([92.198.35.195]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rVvDC-0002fb-6Q; Fri, 02 Feb 2024 16:12:14 +0100 From: Alexander Dahl DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=default; t=1706886732; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u1xpfB3IUJPwerNI67ywi1YLFh5aJ7MziOaGywa14b8=; b=BW/85WwsSJRTqFm4NzJaEnn6Lsf85mk6itBeIWlYze3uPIa4/Cwe5qNFyOxhBeObZEmFYQ zoztZe6OuXb47QZ8p1k6L7qBlHPUFusXv1rBRj0azAsvz8RaugoFG2KPoGEmGbvh/gbss9 fDawQh5zCyOVJ0SnEiUKHHjhKQjXmXi3u8xmF+TNj85UEiLN7Muk7qhEuXYPQs9PhOacLf B6T7p/1XPeQKz+om1VS1og+Etf0c+tNxbOAK68oqqkHjN/T05nge+y+i501itpYXc2fSqy S9kSNdrLXaL8VlTKLXAZp9IBeAwq11EEa7XzAJ6A+qEPSM/rXZWeN1IchbOkgw== To: ptxdist@pengutronix.de Date: Fri, 2 Feb 2024 16:12:06 +0100 Message-Id: <20240202151209.2535721-3-ada@thorsis.com> In-Reply-To: <20240202151209.2535721-1-ada@thorsis.com> References: <20240202151209.2535721-1-ada@thorsis.com> Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-2.8 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Subject: [ptxdist] [PATCH 2/5] kernel-fit: Allow using 'kernel_noload' as sub-image type X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: AVazquez , Enrico Jorns , Roland Hieber , Bastian Krause Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Multi platform kernels built by the kernel-fit rule before are not usable in U-Boot, which adheres more strictly to the Flat Image Tree (FIT) spec than barebox does. For image sub-type 'kernel' U-Boot expects valid 'load' and 'entry' addresses. Setting those addresses to a generic value is impossible however for generic kernels, e.g. the DistroKit v7a kernel needs different addresses on at91 SAMA5 than on i.MX6. barebox circumvents this by ignoring missing 'load' and 'entry' addresses and finding a suitable address by itself. For using generic kernels in U-Boot you need sub-image type 'kernel_noload' and dummy addresses, which is also supported in barebox from v2024.01.0 release onwards. Link: https://github.com/open-source-firmware/flat-image-tree/releases/download/v0.8/fit-specification-v0.8.pdf Link: https://lore.barebox.org/barebox/20231129203106.2417486-1-a.fatoum@pengutronix.de/ Signed-off-by: Alexander Dahl --- platforms/kernel-fit.in | 17 +++++++++++++++++ scripts/lib/ptxd_make_fit_image.sh | 20 +++++++++++++++----- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/platforms/kernel-fit.in b/platforms/kernel-fit.in index 0e82889b9..5b160c57d 100644 --- a/platforms/kernel-fit.in +++ b/platforms/kernel-fit.in @@ -17,14 +17,31 @@ menuconfig KERNEL_FIT if KERNEL_FIT +config KERNEL_FIT_NOLOAD + bool + prompt "Sub-image type 'kernel_noload'" + help + Use 'kernel_noload' as sub-image type for the kernel, setting + the load address and entry address to dummy values as required + by the FIT image specification. + Useful for booting kernels supporting multiple boards with + U-Boot, e.g. the platform-v7a kernel of DistroKit. + U-Boot supports this since release v2011.12. + + Note: barebox added support with release v2024.01.0. + You can leave this option disabled if you only use barebox. + You should not enable this if you use older barebox versions. + config KERNEL_FIT_LOAD string + depends on !KERNEL_FIT_NOLOAD prompt "Kernel load address (optional)" help Required by most bootloaders. Optional for Barebox. config KERNEL_FIT_ENTRY string + depends on !KERNEL_FIT_NOLOAD prompt "Kernel entry address (optional)" help Required by most bootloaders. Optional for Barebox. diff --git a/scripts/lib/ptxd_make_fit_image.sh b/scripts/lib/ptxd_make_fit_image.sh index dd0f63b7b..4b99e6fbf 100644 --- a/scripts/lib/ptxd_make_fit_image.sh +++ b/scripts/lib/ptxd_make_fit_image.sh @@ -19,20 +19,30 @@ ptxd_make_image_fit_its() { kernel { description = "kernel"; data = /incbin/("${image_kernel}"); - type = "kernel"; arch = "$(ptxd_get_ptxconf PTXCONF_ARCH_STRING)"; os = "linux"; compression = "none"; EOF - if [ -n "$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_LOAD)" ]; then + if [ -n "$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_NOLOAD)" ]; then cat << EOF + type = "kernel_noload"; + load = <0x00000000>; + entry = <0x00000000>; +EOF + else + cat << EOF + type = "kernel"; +EOF + if [ -n "$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_LOAD)" ]; then + cat << EOF load = <$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_LOAD)>; EOF - fi - if [ -n "$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_ENTRY)" ]; then - cat << EOF + fi + if [ -n "$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_ENTRY)" ]; then + cat << EOF entry = <$(ptxd_get_ptxconf PTXCONF_KERNEL_FIT_ENTRY)>; EOF + fi fi cat << EOF hash-1 { -- 2.39.2