From: Matteo Croce <mcr...@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 <mcr...@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 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel