From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cP+6IGMqC2MvuQAAbAwnHQ (envelope-from ) for ; Sun, 28 Aug 2022 10:42:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GJKeIGMqC2PquQAAauVa8A (envelope-from ) for ; Sun, 28 Aug 2022 10:42:11 +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 2CA1E13505 for ; Sun, 28 Aug 2022 10:21:24 +0200 (CEST) Received: from localhost ([::1]:38598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSDXn-0005zC-9n for larch@yhetil.org; Sun, 28 Aug 2022 04:21:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSDXS-0005yx-GW for guix-patches@gnu.org; Sun, 28 Aug 2022 04:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39580) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSDXR-0000Un-W9 for guix-patches@gnu.org; Sun, 28 Aug 2022 04:21:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSDXR-0005a9-Kr for guix-patches@gnu.org; Sun, 28 Aug 2022 04:21: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: Sun, 28 Aug 2022 08:21: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.166167480321327 (code B ref 57070); Sun, 28 Aug 2022 08:21:01 +0000 Received: (at 57070) by debbugs.gnu.org; 28 Aug 2022 08:20:03 +0000 Received: from localhost ([127.0.0.1]:57562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSDWL-0005XO-Lf for submit@debbugs.gnu.org; Sun, 28 Aug 2022 04:20:02 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:46673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSDWG-0005X9-Mr for 57070@debbugs.gnu.org; Sun, 28 Aug 2022 04:19:52 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id A19A35C0098; Sun, 28 Aug 2022 04:19:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Sun, 28 Aug 2022 04:19:43 -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=1661674783; x=1661761183; bh=MZ4qDInLWv ZXsoF5WY7DexVAOEb/IEX0ZaEYbw7tgHM=; b=YMf9svH5CpnjHvtUsPCkHQi+1c wxaV7XtDoXrHy699mzM3drfO+R9QubL1I60awTUNaic019Haq8sXvN74u8w9RXkE B4mFCBW/B29qJhHr+iCaoAOQpUg9I5PdFZA1JKZdBhOyI7O2yYgKsRUgVVVHZPbE Xh1vhvmbeU/wQhXQB0QInExbb29BStGpA3mviN+PS1NGK7doz36AG/OpLc5PCbqd +G4HvxFLwE6amZhd+8tOrGyhNtXUk6FqRE3aIjjSp2EsvLhSiZ8Z8n8o7DoxmcKk YoKahhbnAnDg8dOquQ6ds6ILaUzgxYhLY225TZGwItjUMOOaHLEYXsZuANMA== 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=1661674783; x=1661761183; bh=MZ4qDInLWvZXsoF5WY7DexVAOEb/ IEX0ZaEYbw7tgHM=; b=VbyO2LubIPZrT2SQqn+QNn5yqHpuLtrqnpeTbrsnNHeM 6iQv1aTiBzvo27o3jGPvfYg65IbDGYHhCB+jBD3duqOszegQUcwSZ+OvedkrLzzT CsGxV1G1CZdE86UtsgZsCqcm0pW5+3FgjvJp7UlJnCSPQbHIoT9zrmMg5a1hUoV4 LAdNdc25LKJbwmvlZ7xPYjoJOV6ix00y2lt///l0OidsWq1cCMWb7GG9t6nKmEZP KVm/d/eBBXjMPMsmWjyyX0o81BnnFJSr724fUPcfmjV9bNUPJ4Pa1wnG7sMj0XLh wkSF8kl5NnHXQbFYOHz5hSE1G2wTBf/wqHP99RLx/A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdejledgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkjghfohfogggtsehmtderreertddvnecuhfhrohhmpeftvgii rgcutehlihiirgguvghhucforghjugcuoehrrdhmrghjugesphgrnhhthhgvrhigrdhorh hgqeenucggtffrrghtthgvrhhnpeevhfdvjeeukeehtdfhleekjeejudevuefghefhleet udeiudevhffghfejgfefkeenucffohhmrghinhepphgrnhhthhgvrhigrdhorhhgnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhdrmhgrjhgu sehprghnthhhvghrgidrohhrgh X-ME-Proxy: Feedback-ID: i063944dc:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 28 Aug 2022 04:19:42 -0400 (EDT) Date: Sun, 28 Aug 2022 12:49:38 +0430 From: Reza Alizadeh Majd Message-ID: <20220828124938.0289bd68@pantherx.org> In-Reply-To: <87lerc5iq6.fsf_-_@gnu.org> References: <20220809103044.27964-1-r.majd@pantherx.org> <20220816224004.1744c1d5@pantherx.org> <87lerc5iq6.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_/nd71U4u7Uca52mYRHqIJCak" 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=1661674884; 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=MZ4qDInLWvZXsoF5WY7DexVAOEb/IEX0ZaEYbw7tgHM=; b=mE/XnjKc+ft+3Yz0hydh4AfBJu0XqNpt3hleldKcillw9Z5QMmUwjY4Vd+jns55LknxHIK igr7OnQmolBDp2ODooYcL/hcETmYRptzEQAlqn7tdSd1E1sp16REbJABInlfQ1Igs4cdlE mM1C+G2PJm1glf/EyywcrZLE8i32FDM8UCMFOwvPKvL8/KkVWIlafu8qfgRzPdptWyfR+U T6wOV5NWGN/GuIYs+Sj898uOf5xgnkR7WTwxVevbpl0UlxMGSGAZMihWaI5vOJPiaKZf+8 U8BmSf5F5RWB+zMGBlIxjyamUHuvkNpalsBZQOhC4UcsHE8CPjGI9ZK4k25vXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661674884; a=rsa-sha256; cv=none; b=HF2y+Y85jOKmZ8HZuMK//9b7epHK11CrRnNwaNAfhPjaUct9bc2kr1nTFGtP0fzJIV6bdL 4I0BfRxC8EgbWaMpUZjEeGlAAiCelw6R8EfUU65FiH4RAr1KXmCF6YnAgyfzYgQuQdG77P +kj/jRoxzoQxSi2x3rDo8pzT7dR8+99AW0c8zL06Fm015QLLfd51mh8amwClyDciPYdumm ILWBlodeeHvKxR8P1L7O0bCO7wBXDjXKHD/PiRffPlBKV0LI/LYDcGdZ+0ihK/hwtd1Bjl u9kC/31D/otJyK3a00ajtsybaZd3DiXKJqMuXyqks7NCzSsSGdxB/jFNoRYg8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pantherx.org header.s=fm2 header.b=YMf9svH5; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=VbyO2Lub; 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: 2.60 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=pantherx.org header.s=fm2 header.b=YMf9svH5; dkim=fail ("headers rsa verify failed") header.d=messagingengine.com header.s=fm1 header.b=VbyO2Lub; 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: 2CA1E13505 X-Spam-Score: 2.60 X-Migadu-Scanner: scn1.migadu.com X-TUID: rTb0gSoMA8dW --MP_/nd71U4u7Uca52mYRHqIJCak Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Mathieu, On Thu, 25 Aug 2022 19:35:45 +0200 Mathieu Othacehe wrote: > >> * gnu/bootloader.scm ()[device-tree-support?]: new >> field. > >You need to document this new field in the "Bootloader Configuration" >documentation section. > I just checked the "Bootloader Configuration" section. it describes the "bootloader-configuration" record itself, but the proposed patch adds the "device-tree-supports?" field to the "bootloader" record. unfortunately I couldn't find the section describing the "bootloader" record fields. so I added the documentations as a note for the "bootloader" field of "bootloader-configuration" record. >> * gnu/tests/bootloader.scm: add tests for FDTDIR modification. > >This will test for regressions on an x86_64-linux machine that will >probably never use this FDTDIR thing. As those tests are expensive to >run an maintain we can probably remove the test. > OK, I removed the test from recent patch. Best, Reza -- Reza Alizadeh Majd PantherX Team https://pantherx.org --MP_/nd71U4u7Uca52mYRHqIJCak Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-bootloader-extlinux-support-for-optional-FDTDIR.patch =46rom cbeba372def25a957f5d8942f01fbde6cdc03704 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 paramter is set to #f, the FDTDIR l= ine will be discarded from the and u-boot doesn't load the devi= ce tree automatically. * gnu/bootloader.scm ()[device-tree-support?]: new field. * gnu/bootloader/extlinux.scm (extlinux-configuration-file): add FDTDIR line based on bootloader field of . * doc/guix.texi (Bootloader Configuration)[bootloader]: Add note about bootloader's optional FDTDIR support. --- doc/guix.texi | 9 +++++++++ gnu/bootloader.scm | 6 +++++- gnu/bootloader/extlinux.scm | 13 +++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 023b48ae35..25b336e958 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -36814,6 +36814,15 @@ modules. In particular, @code{(gnu bootloader u-b= oot)} contains definitions of bootloaders for a wide range of ARM and AArch64 systems, using the @uref{https://www.denx.de/wiki/U-Boot/, U-Boot bootloader}. =20 +@quotation Note +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 the @code{device-tree-support?} field of the @code{bootloader} +record to @code{#f}. setting this flag to @code{#f} removes the @code{FDTD= IR} +from the @file{/boot/extlinux/extlinux.conf}. +@end quotation + @vindex grub-efi-bootloader @code{grub-efi-bootloader} allows to boot on modern systems using the @dfn{Unified Extensible Firmware Interface} (UEFI). This is what you shou= ld diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index 70e1836179..32fd7f0c2e 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. ;;; @@ -54,6 +55,7 @@ (define-module (gnu bootloader) bootloader-disk-image-installer bootloader-configuration-file bootloader-configuration-file-generator + bootloader-device-tree-support? =20 bootloader-configuration bootloader-configuration? @@ -172,7 +174,9 @@ (define-record-type* (disk-image-installer bootloader-disk-image-installer (default #f)) (configuration-file bootloader-configuration-file) - (configuration-file-generator bootloader-configuration-file-generator= )) + (configuration-file-generator bootloader-configuration-file-generator) + (device-tree-support? bootloader-device-tree-support? + (default #t))) =20 =0C ;;; diff --git a/gnu/bootloader/extlinux.scm b/gnu/bootloader/extlinux.scm index 6b5ff298e7..f3d69c0cc0 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,10 @@ (define* (extlinux-configuration-file config entries (define all-entries (append entries (bootloader-configuration-menu-entries config))) =20 + (define with-fdtdir? + (let ((bootloader (bootloader-configuration-bootloader config))) + (bootloader-device-tree-support? bootloader))) + (define (menu-entry->gexp entry) (let ((label (menu-entry-label entry)) (kernel (menu-entry-linux entry)) @@ -46,12 +51,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_/nd71U4u7Uca52mYRHqIJCak--