From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id sL3ODjgDDWPpfgAAbAwnHQ (envelope-from ) for ; Mon, 29 Aug 2022 20:19:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id UNnMDjgDDWNiEwEA9RJhRA (envelope-from ) for ; Mon, 29 Aug 2022 20:19:36 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B596424050 for ; Mon, 29 Aug 2022 20:19:35 +0200 (CEST) Received: from localhost ([::1]:51956 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSjME-0003aM-M3 for larch@yhetil.org; Mon, 29 Aug 2022 14:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSjLi-0003Zd-Gt for guix-patches@gnu.org; Mon, 29 Aug 2022 14:19:15 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44026) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSjLh-0004FO-Ux for guix-patches@gnu.org; Mon, 29 Aug 2022 14:19:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSjLh-00024R-QC for guix-patches@gnu.org; Mon, 29 Aug 2022 14:19:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57070] [PATCH] bootloader: extlinux: support for optional FDTDIR Resent-From: Reza Alizadeh Majd Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 29 Aug 2022 18:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57070 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Mathieu Othacehe Cc: 57070@debbugs.gnu.org Received: via spool by 57070-submit@debbugs.gnu.org id=B57070.16617970827892 (code B ref 57070); Mon, 29 Aug 2022 18:19:01 +0000 Received: (at 57070) by debbugs.gnu.org; 29 Aug 2022 18:18:02 +0000 Received: from localhost ([127.0.0.1]:33775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSjKj-00023D-Tl for submit@debbugs.gnu.org; Mon, 29 Aug 2022 14:18:02 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:33677) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSjKi-00022g-54 for 57070@debbugs.gnu.org; Mon, 29 Aug 2022 14:18:00 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 168F05C00F2; Mon, 29 Aug 2022 14:17:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 14:17:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantherx.org; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm2; t=1661797075; x=1661883475; bh=5GdSEFjI/M 96CLstyrDmveYGM0TQc6l/UWjKuSQtcZA=; b=XsEzUjf4SfvSarPzLMgGQqbQxh 2JA94ECW97QnRU6W2wjOLIl05fFGSklhMXBqCmM/pTCIx8fJ7Pwg0yqVwNIXfWKZ B6vf9foPo/ItT9TG2JNaxcZeu93Y+nPSXp3Ka1F2SLGiRmcahOKB/V9L4cztU8dH LWxvsBRwYoprCcBfn2aylF6Bus7H4CUnUxbFqoLDTMxLvnbgU8/mcB9+WPAPTMPI JVho8UMW/2oRVCas3Sdtu1SO2yLGWZf3c+Sb6pAHs8hvQtrixb3crFS66ISAExDi 5S5F5M4jFAo9PX7UO3dVGr1gIRzruJMXs46HXaNjJBQs5zts/rzMp4CnpogQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; t=1661797075; x=1661883475; bh=5GdSEFjI/M96CLstyrDmveYGM0TQ c6l/UWjKuSQtcZA=; b=AOBaodSHl8SO10chQ7wl+Rkmg9oZRR2WNYsvMKQpfQDj dK/Vrf5y7+VXTzupb76nQYUxHzBPTIfUIXuQhuIWBaLE04MKGJfUSBij179gYJRS ojR+aiWJ8KvRwHP/+6ErKJb+h6E+UaYJeIkaQ4XjIj6gx+Tyc6aBGGKX/787OXvt T2UkPvRZxcSAAbDiltuZVcqaoEAEi7SH5PgjLsu2/07ZtPOVd9FmIAXGHYqUj0vL jJT1pkM2C7Wo3L8UOcyra9Umlxo34Z1YCy7AQrUdWETDUB6kFnSM98AOEc/031UP 2y5XKumXO7YZO71g6Ls7bvS2QqIVnBfTEU/DaVMoZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddguddvgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfgjfhhoofggtgesmhdtreerredtvdenucfhrhhomheptfgv iigrucetlhhiiigruggvhhcuofgrjhguuceorhdrmhgrjhgusehprghnthhhvghrgidroh hrgheqnecuggftrfgrthhtvghrnhepvefhvdejueekhedthfelkeejjeduveeugfehhfel teduieduvefhgffhjefgfeeknecuffhomhgrihhnpehprghnthhhvghrgidrohhrghenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrrdhmrghj ugesphgrnhhthhgvrhigrdhorhhg X-ME-Proxy: Feedback-ID: i063944dc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 14:17:53 -0400 (EDT) Date: Mon, 29 Aug 2022 22:47:44 +0430 From: Reza Alizadeh Majd Message-ID: <20220829224744.3801f469@pantherx.org> In-Reply-To: <87ilmcpdv3.fsf@gnu.org> References: <20220809103044.27964-1-r.majd@pantherx.org> <20220816224004.1744c1d5@pantherx.org> <87lerc5iq6.fsf_-_@gnu.org> <20220828124938.0289bd68@pantherx.org> <87ilmcpdv3.fsf@gnu.org> Organization: PantherX X-Mailer: Claws Mail 4.1.0 (GTK 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/e/O5iL+lbJQHQAPPMkGHYm+" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661797175; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=5GdSEFjI/M96CLstyrDmveYGM0TQc6l/UWjKuSQtcZA=; b=gUuvIY5jGsy5ZoAXjlgRYCpR/3UZZG2RFN4DLFjqOJV83C+eZNKqckNIQxF5c2uTftzOxa Wq3BgqbmFV6NCMugAClAtI0QWwQJv+dbIBqkXSz9pgh+FLkHGig7e1YreKZJBM6ynsIdH+ ZGTLPVSYwH1WXMznYDG/mLs9ox57ahJaHNmrmp+k926UvvMqlL+CHI8NIgaW3TFU5vymIe zw0Ne2f+0Pp3m3rAsDtCRojzr6mOfpOqu6MerOoBLJYkdMQBjZWexuzyHvSIdnMYwuT8lE h+cTAO0OZdygo1/0C4LGDI8SCk5RepA/THyW82RSOyAjDj9marK924cWm0iogQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661797175; a=rsa-sha256; cv=none; b=eIwHIzQvCAjTrUzyJkIEZSmPq5P1nNdYo5wF3ZvyPf3AkfIV7hbOR5wdSPczTR9vwuxr6w LCzlcfgYTAJzPuSmiH3QXRrdi3S3hvt9qnNt19hEklUBzUSfhyaPjfFwHxicpSOcW6IMJc evPoWtHsaw7g0LSy+/wenVwiqpU0XVQOSSZ/S0HUO4wXfXJcl94BYXkIDG8JRWfUK7Nkdz 1N3RMt4wL0tzSypKj8CLo5rGaLiKYAZpyNBWPccfBuqbZ9LwadCwxvFmOEvj8bB0dSJmip gsZHa+9c2rOR2v06w0bnuQk04eruFBO8hygcFqgbdfspyZ0iyFzLLq2tIkkZHQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pantherx.org header.s=fm2 header.b=XsEzUjf4; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=AOBaodSH; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.80 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pantherx.org header.s=fm2 header.b=XsEzUjf4; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=AOBaodSH; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: B596424050 X-Spam-Score: 1.80 X-Migadu-Scanner: scn0.migadu.com X-TUID: oaU547a4F7sT --MP_/e/O5iL+lbJQHQAPPMkGHYm+ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Mathieu, On Sun, 28 Aug 2022 17:49:36 +0200 Mathieu Othacehe wrote: > >About that, any reason not to have this "device-tree-supports?" field >in the record? > >The record is about how to install the bootloader while > is about its configuration. So maybe it >would be a better fit? > I wanted to limit my patch to affect as minimum sections as possible. so I added the field to the record. I'm agree with your proposal, since the removal of FDTDIR is more of a configuration for an existing bootloader. I moved this option to the and submit a new patch. it would be great to have your feedback whenever you had time. Regards, Reza -- Reza Alizadeh Majd PantherX Team https://pantherx.org --MP_/e/O5iL+lbJQHQAPPMkGHYm+ Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-bootloader-extlinux-support-for-optional-FDTDIR.patch =46rom a7e3e9afe22274397634e6dbe4caa9766adfb7a9 Mon Sep 17 00:00:00 2001 From: Reza Alizadeh Majd Date: Sun, 28 Aug 2022 12:34:46 +0430 Subject: [PATCH] bootloader: extlinux: support for optional FDTDIR There are situations that u-boot doesn't have to load from the device tree. some provide the device tree using a vendor bootloader (like what raspberry= -pi does) or with an external bootloader that chainloads the u-boot (what Asahi does for m1n1 bootloader). Unfortunately we couldn't find any reliable document to enforce u-boot to p= ass the device tree via `extlinux.conf`, however during our tests, we found that removing the `FDTDIR` line from the `extlinux.conf` tend us to do so. There is also no reliable way to guess if u-boot bootloader should load dev= ice tree or not on a specific hardware. in addition, there are hardware that can be booted with both firmware device tree on some kernels and with special device tree on other (modified) kernels. the following changes provided to define an optional parameter in record, called which by default is set to #t to keep the current behavior unchanged. if this paramt= er is set to #f, the FDTDIR line will be discarded from the and u-boot doesn't load the device tree automatically. * gnu/bootloader.scm ()[device-tree-support?]: ne= w field. * gnu/bootloader/extlinux.scm (extlinux-configuration-file): add FDTDIR line based on field of . * doc/guix.texi (Bootloader Configuration)[device-tree-support?]: Add documentation for the new field. --- doc/guix.texi | 7 ++++++ gnu/bootloader.scm | 50 ++++++++++++++++++++----------------- gnu/bootloader/extlinux.scm | 12 +++++++-- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 023b48ae35..8171481040 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -36960,6 +36960,13 @@ corresponds to COM1 (@pxref{Serial terminal,,, gru= b,GNU GRUB manual}). The speed of the serial interface, as an integer. For GRUB, the default value is chosen at run-time; currently GRUB chooses 9600@tie{}bps (@pxref{Serial terminal,,, grub,GNU GRUB manual}). + +@item @code{device-tree-support} (default: @code{#t}) +There are situations when @code{u-boot} shouldn't load the device tree from +the file system. because it is either unnecessary for the platform being u= sed +or has already been loaded into RAM earlier in the boot process. in such c= ases +you can set this field to @code{#f}. setting this flag to @code{#f} removes +the @code{FDTDIR} line from the @file{/boot/extlinux/extlinux.conf}. @end table =20 @end deftp diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 70e1836179..335133d224 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -4,6 +4,7 @@ ;;; Copyright =C2=A9 2017 Leo Famulari ;;; Copyright =C2=A9 2019, 2021 Ludovic Court=C3=A8s ;;; Copyright =C2=A9 2020 Jan (janneke) Nieuwenhuizen +;;; Copyright =C2=A9 2022 Reza Alizadeh Majd ;;; ;;; This file is part of GNU Guix. ;;; @@ -69,6 +70,7 @@ (define-module (gnu bootloader) bootloader-configuration-terminal-inputs bootloader-configuration-serial-unit bootloader-configuration-serial-speed + bootloader-configuration-device-tree-support? =20 %bootloaders lookup-bootloader-by-name @@ -193,29 +195,31 @@ (define-with-syntax-properties (warn-target-field-dep= recation (define-record-type* bootloader-configuration make-bootloader-configuration bootloader-configuration? - (bootloader bootloader-configuration-bootloader) ; - (targets %bootloader-configuration-targets ;list of strings - (default #f)) - (target %bootloader-configuration-target ;deprecated - (default #f) (sanitize warn-target-field-deprecation= )) - (menu-entries bootloader-configuration-menu-entries ;list of - (default '())) - (default-entry bootloader-configuration-default-entry ;integer - (default 0)) - (timeout bootloader-configuration-timeout ;seconds as integer - (default 5)) - (keyboard-layout bootloader-configuration-keyboard-layout ; | #f - (default #f)) - (theme bootloader-configuration-theme ;bootloader-specific = theme - (default #f)) - (terminal-outputs bootloader-configuration-terminal-outputs ;list of s= ymbols - (default '(gfxterm))) - (terminal-inputs bootloader-configuration-terminal-inputs ;list of sy= mbols - (default '())) - (serial-unit bootloader-configuration-serial-unit ;integer | #f - (default #f)) - (serial-speed bootloader-configuration-serial-speed ;integer | #f - (default #f))) + (bootloader bootloader-configuration-bootloader) ; + (targets %bootloader-configuration-targets ;list of stri= ngs + (default #f)) + (target %bootloader-configuration-target ;deprecated + (default #f) (sanitize warn-target-field-deprecati= on)) + (menu-entries bootloader-configuration-menu-entries ;list of + (default '())) + (default-entry bootloader-configuration-default-entry ;integer + (default 0)) + (timeout bootloader-configuration-timeout ;seconds as integ= er + (default 5)) + (keyboard-layout bootloader-configuration-keyboard-layout ; | #f + (default #f)) + (theme bootloader-configuration-theme ;bootloader-specifi= c theme + (default #f)) + (terminal-outputs bootloader-configuration-terminal-outputs ;list of= symbols + (default '(gfxterm))) + (terminal-inputs bootloader-configuration-terminal-inputs ;list of = symbols + (default '())) + (serial-unit bootloader-configuration-serial-unit ;integer | #f + (default #f)) + (serial-speed bootloader-configuration-serial-speed ;integer | #f + (default #f)) + (device-tree-support? bootloader-configuration-device-tree-support? + (default #t))) =20 (define-deprecated (bootloader-configuration-target config) bootloader-configuration-targets diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm index 6b5ff298e7..d9b6d8bf8a 100644 --- a/gnu/bootloader/extlinux.scm +++ b/gnu/bootloader/extlinux.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright =C2=A9 2017 David Craven ;;; Copyright =C2=A9 2017 Mathieu Othacehe +;;; Copyright =C2=A9 2022 Reza Alizadeh Majd ;;; ;;; This file is part of GNU Guix. ;;; @@ -38,6 +39,9 @@ (define* (extlinux-configuration-file config entries (define all-entries (append entries (bootloader-configuration-menu-entries config))) =20 + (define with-fdtdir? + (bootloader-configuration-device-tree-support? config)) + (define (menu-entry->gexp entry) (let ((label (menu-entry-label entry)) (kernel (menu-entry-linux entry)) @@ -46,12 +50,16 @@ (define (menu-entry->gexp entry) #~(format port "LABEL ~a MENU LABEL ~a KERNEL ~a - FDTDIR ~a/lib/dtbs + ~a INITRD ~a APPEND ~a ~%" #$label #$label - #$kernel (dirname #$kernel) #$initrd + #$kernel + (if #$with-fdtdir? + (string-append "FDTDIR " (dirname #$kernel) "/lib/dtbs= ") + "") + #$initrd (string-join (list #$@kernel-arguments))))) =20 (define builder --=20 2.37.1 --MP_/e/O5iL+lbJQHQAPPMkGHYm+--