support loading a devicetree based on GRUB_DEFAULT_DTB in /etc/default/grub

looks in /boot/dtbs/dtbs-${version}/${GRUB_DEFAULT_DTB}

based on https://src.fedoraproject.org/rpms/grub2/blob/rawhide/f/0022-Add-devicetree-loading.patch

--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -255,7 +255,8 @@
   GRUB_ENABLE_CRYPTODISK \
   GRUB_BADRAM \
   GRUB_OS_PROBER_SKIP_LIST \
-  GRUB_DISABLE_SUBMENU
+  GRUB_DISABLE_SUBMENU \
+  GRUB_DEFAULT_DTB
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -129,6 +129,14 @@
 
   echo "	insmod gzio" | sed "s/^/$submenu_indentation/"
 
+  if test -n "${dtb}" ; then
+    message="$(gettext_printf "Loading devicetree ...")"
+    sed "s/^/$submenu_indentation/" << EOF
+	echo	'$(echo "$message" | grub_quote)'
+	devicetree	${rel_dirname}/${dtb}
+EOF
+  fi
+
   if [ x$dirname = x/ ]; then
     if [ -z "${prepare_root_cache}" ]; then
       prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
@@ -250,6 +258,14 @@
     gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
   fi
 
+  dtb=
+  for i in "dtbs-${version}" "dtbs-${alt_version}"; do
+    if test -f "${dirname}/dtbs/${i}/${GRUB_DEFAULT_DTB}" ; then
+      dtb="dtbs/${i}/${GRUB_DEFAULT_DTB}"
+      break
+    fi
+  done
+
   config=
   for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do
     if test -e "${i}" ; then
