summaryrefslogtreecommitdiffstats
path: root/discover/grub2/builtins.c
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2019-11-11 17:10:30 +0800
committerJeremy Kerr <jk@ozlabs.org>2019-11-29 13:54:10 +0800
commit9fc2ac627df17ddc8e7c2735053aeb9e1252ff6e (patch)
tree4db4b90abc303519b2fa702509c697bba0bf8dae /discover/grub2/builtins.c
parent51f71178cd82a1cb7fae1a4e6bf40290e41b7d0e (diff)
downloadtalos-petitboot-9fc2ac627df17ddc8e7c2735053aeb9e1252ff6e.tar.gz
talos-petitboot-9fc2ac627df17ddc8e7c2735053aeb9e1252ff6e.zip
discover/grub2: add support for grub2-style path specifiers in resources
This change incorporates the grub2-style (device)/path specifiers in the grub2 parser's resource code. This allows the boot option paths to use device-specific references. Device names are looked-up using the UUID and kernel IDs, but with the lookup logic specific to a new function (grub2_lookup_device), so that can be extended in a future change. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/grub2/builtins.c')
-rw-r--r--discover/grub2/builtins.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/discover/grub2/builtins.c b/discover/grub2/builtins.c
index 7cac9f1..765c4d7 100644
--- a/discover/grub2/builtins.c
+++ b/discover/grub2/builtins.c
@@ -46,7 +46,6 @@ static int builtin_linux(struct grub2_script *script,
int argc, char *argv[])
{
struct discover_boot_option *opt = script->opt;
- const char *root;
int i;
if (!opt) {
@@ -61,10 +60,7 @@ static int builtin_linux(struct grub2_script *script,
return -1;
}
- root = script_env_get(script, "root");
-
- opt->boot_image = create_grub2_resource(opt, script->ctx->device,
- root, argv[1]);
+ opt->boot_image = create_grub2_resource(script, opt, argv[1]);
opt->option->boot_args = NULL;
if (argc > 2)
@@ -77,8 +73,8 @@ static int builtin_linux(struct grub2_script *script,
char* args_sigfile_default = talloc_asprintf(opt,
"%s.cmdline.sig", argv[1]);
- opt->args_sig_file = create_grub2_resource(opt, script->ctx->device,
- root, args_sigfile_default);
+ opt->args_sig_file = create_grub2_resource(script, opt,
+ args_sigfile_default);
talloc_free(args_sigfile_default);
return 0;
}
@@ -88,7 +84,6 @@ static int builtin_initrd(struct grub2_script *script,
int argc, char *argv[])
{
struct discover_boot_option *opt = script->opt;
- const char *root;
if (!opt) {
pb_log("grub2 syntax error: 'initrd' statement outside "
@@ -102,9 +97,7 @@ static int builtin_initrd(struct grub2_script *script,
return -1;
}
- root = script_env_get(script, "root");
- opt->initrd = create_grub2_resource(opt, script->ctx->device,
- root, argv[1]);
+ opt->initrd = create_grub2_resource(script, opt, argv[1]);
return 0;
}
OpenPOWER on IntegriCloud