grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] templates: allow loading a Device Tree file from user conf


From: Dimitri John Ledkov
Subject: Re: [PATCH] templates: allow loading a Device Tree file from user conf
Date: Thu, 10 Jun 2021 13:50:48 +0100

Hi,

I have proposed a more generic patch to handle devicetree stanaza
before see https://lists.gnu.org/archive/html/grub-devel/2019-05/msg00121.html

Fedora separately ships a similarish patch as well

I have no idea why many distributions ship integration to generate
devicetree commands in grub.cfg and yet such patch is not yet in
upstream grub.

I recommend you to look at Ubuntu or Fedora patches to handle
devicetree command generation.

On Mon, Dec 7, 2020 at 11:37 PM Matteo Croce <mcroce@linux.microsoft.com> wrote:
>
> 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
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel



-- 
Regards,

Dimitri.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]