[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] templates: allow loading a Device Tree file from user conf
From: |
Matteo Croce |
Subject: |
[PATCH] templates: allow loading a Device Tree file from user conf |
Date: |
Tue, 8 Dec 2020 00:37:13 +0100 |
From: Matteo Croce <mcroce@microsoft.com>
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 <mcroce@microsoft.com>
---
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] templates: allow loading a Device Tree file from user conf,
Matteo Croce <=