Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kmQ4H-0004sK-Ri for mharc-grub-devel@gnu.org; Mon, 07 Dec 2020 18:37:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmQ4G-0004rW-6C for grub-devel@gnu.org; Mon, 07 Dec 2020 18:37:20 -0500 Received: from mail-ej1-f54.google.com ([209.85.218.54]:32877) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmQ4E-0005sF-J7 for grub-devel@gnu.org; Mon, 07 Dec 2020 18:37:19 -0500 Received: by mail-ej1-f54.google.com with SMTP id b9so11686407ejy.0 for ; Mon, 07 Dec 2020 15:37:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=x6CoS8whuLxFWXeOfkhpy+GYTK4x/fzwAOIW8vEwIsI=; b=YR1zYTFgPtr0RRLynNsLKJgr3exK6DipApzQ7ASlGGG+2zs+m+PxErlF3sTb8YrORg 66h8Zve3B7vd9ZBvAwotkXREInHAugDChtpVObp1Vx9ZEvAQyOBRN5pOq6QozAJQ+Ruv /c6kaEfDvbzCXsOskKFDcZcE7R9H6ertzq4H4z0ckawUhtab5hGZEzafz37upQCEV1LS H01ldVNezxeHRKPojXcdWmvFPRpKOwkdWcPNgn3ipAK+wAUIBGm831uBE/zJbhX6SZjz UuyE7kJm6dG5eCCw8umSxqJ92qOdF/7f2yCck90yduD7VycPsboNRTFwVDs52m1QVkgJ pppQ== X-Gm-Message-State: AOAM533wgzT6fj2I4k/p6ckKi/27AGQpORbSwOK+QOKdzy3uPQz9mJ13 XrPp26x8HkQbxvVE1AQ55gzpvKdjRyAFHAlZ X-Google-Smtp-Source: ABdhPJyQAyrH++DH1IJtbtC3b6TAIbZs1+/mGsjKIJjwzEWytMTvQpBhUs1BS7meHsNXCFnKIL23Cw== X-Received: by 2002:a17:906:7813:: with SMTP id u19mr21143950ejm.153.1607384236411; Mon, 07 Dec 2020 15:37:16 -0800 (PST) Received: from msft-t490s.teknoraver.net (net-37-182-2-234.cust.vodafonedsl.it. [37.182.2.234]) by smtp.gmail.com with ESMTPSA id s24sm13768760ejb.20.2020.12.07.15.37.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 15:37:15 -0800 (PST) From: Matteo Croce To: grub-devel@gnu.org Subject: [PATCH] templates: allow loading a Device Tree file from user conf Date: Tue, 8 Dec 2020 00:37:13 +0100 Message-Id: <20201207233713.14617-1-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=209.85.218.54; envelope-from=technoboy85@gmail.com; helo=mail-ej1-f54.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2020 23:37:20 -0000 From: Matteo Croce Some machines rely on Device Tree for hardware discovery, so a .dtb file must be passed to the kernel. GRUB can do this via the `devicetree` command, but it's not possible to do this from the user configuration. Add a GRUB_DEVICETREE_FILE variable which holds the path of the .dtb file relative to the boot partition and, if present, adds the devicetree command to the menuentry. Signed-off-by: Matteo Croce --- util/grub-mkconfig.in | 1 + util/grub.d/10_linux.in | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in index d3e879b8e..3e15e6f20 100644 --- a/util/grub-mkconfig.in +++ b/util/grub-mkconfig.in @@ -228,6 +228,7 @@ export GRUB_DEFAULT \ GRUB_CMDLINE_NETBSD \ GRUB_CMDLINE_NETBSD_DEFAULT \ GRUB_CMDLINE_GNUMACH \ + GRUB_DEVICETREE_FILE \ GRUB_EARLY_INITRD_LINUX_CUSTOM \ GRUB_EARLY_INITRD_LINUX_STOCK \ GRUB_TERMINAL_INPUT \ diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in index e8b01c0d0..fb1bd30f5 100644 --- a/util/grub.d/10_linux.in +++ b/util/grub.d/10_linux.in @@ -143,6 +143,11 @@ linux_entry () echo '$(echo "$message" | grub_quote)' linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} EOF + if [ -n "${GRUB_DEVICETREE_FILE}" ] && test -e "${dirname}/${GRUB_DEVICETREE_FILE}"; then + sed "s/^/$submenu_indentation/" << EOF + devicetree ${rel_dirname}/${GRUB_DEVICETREE_FILE} +EOF + fi if test -n "${initrd}" ; then # TRANSLATORS: ramdisk isn't identifier. Should be translated. message="$(gettext_printf "Loading initial ramdisk ...")" -- 2.28.0