grub2: add support for devicetree
Similar as available for u-boot (ce2995e1dc) and syslinux (c5112c25e4), enable parsing and writing devicetree filename into grub.cfg. This is required by arm64-based devices running edk2 instead of u-boot as the main bootloader (e.g. 96boards HiKey and HiKey960). Signed-off-by: Ricardo Salveti <ricardo@foundries.io> Closes: #1790 Approved by: cgwalters
This commit is contained in:
parent
ee988f69aa
commit
b6795c93ea
|
|
@ -33,6 +33,7 @@ read_config()
|
||||||
initrd=""
|
initrd=""
|
||||||
options=""
|
options=""
|
||||||
linux=""
|
linux=""
|
||||||
|
devicetree=""
|
||||||
|
|
||||||
while read -r line
|
while read -r line
|
||||||
do
|
do
|
||||||
|
|
@ -48,6 +49,9 @@ read_config()
|
||||||
"linux")
|
"linux")
|
||||||
linux=${value}
|
linux=${value}
|
||||||
;;
|
;;
|
||||||
|
"devicetree")
|
||||||
|
devicetree=${value}
|
||||||
|
;;
|
||||||
"options")
|
"options")
|
||||||
options=${value}
|
options=${value}
|
||||||
;;
|
;;
|
||||||
|
|
@ -74,6 +78,9 @@ populate_menu()
|
||||||
if [ -n "${initrd}" ] ; then
|
if [ -n "${initrd}" ] ; then
|
||||||
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
menu="${menu}\t initrd ${boot_prefix}${initrd}\n"
|
||||||
fi
|
fi
|
||||||
|
if [ -n "${devicetree}" ] ; then
|
||||||
|
menu="${menu}\t devicetree ${boot_prefix}${devicetree}\n"
|
||||||
|
fi
|
||||||
menu="${menu}}\n\n"
|
menu="${menu}}\n\n"
|
||||||
done
|
done
|
||||||
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
# The printf command seems to be more reliable across shells for special character (\n, \t) evaluation
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,7 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
|
||||||
const char *options;
|
const char *options;
|
||||||
const char *kernel;
|
const char *kernel;
|
||||||
const char *initrd;
|
const char *initrd;
|
||||||
|
const char *devicetree;
|
||||||
char *quoted_title = NULL;
|
char *quoted_title = NULL;
|
||||||
char *uuid = NULL;
|
char *uuid = NULL;
|
||||||
char *quoted_uuid = NULL;
|
char *quoted_uuid = NULL;
|
||||||
|
|
@ -246,6 +247,15 @@ _ostree_bootloader_grub2_generate_config (OstreeSysroot *sysroot
|
||||||
g_string_append_c (output, '\n');
|
g_string_append_c (output, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
devicetree = ostree_bootconfig_parser_get (config, "devicetree");
|
||||||
|
if (devicetree)
|
||||||
|
{
|
||||||
|
g_string_append (output, "devicetree");
|
||||||
|
g_string_append_c (output, ' ');
|
||||||
|
g_string_append (output, devicetree);
|
||||||
|
g_string_append_c (output, '\n');
|
||||||
|
}
|
||||||
|
|
||||||
g_string_append (output, "}\n");
|
g_string_append (output, "}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue