summaryrefslogtreecommitdiffstats
path: root/discover/yaboot-parser.c
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:44 -0700
committerGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:44 -0700
commit49ebdeb3ffc0224f3f4bbf1f00beaa5007d38fd5 (patch)
treeece6dbdc30b0429f5f7c818169066d59a4dd80a4 /discover/yaboot-parser.c
parent4d1d4bf2f4c97b489472f6d1db95d15a6e09ea3d (diff)
downloadtalos-petitboot-49ebdeb3ffc0224f3f4bbf1f00beaa5007d38fd5.tar.gz
talos-petitboot-49ebdeb3ffc0224f3f4bbf1f00beaa5007d38fd5.zip
Use yaboot global boot option
Use any yaboot global boot option in preference to the yaboot.conf device path. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Diffstat (limited to 'discover/yaboot-parser.c')
-rw-r--r--discover/yaboot-parser.c51
1 files changed, 44 insertions, 7 deletions
diff --git a/discover/yaboot-parser.c b/discover/yaboot-parser.c
index d589198..1000505 100644
--- a/discover/yaboot-parser.c
+++ b/discover/yaboot-parser.c
@@ -85,6 +85,8 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
/* image */
if (streq(name, "image")) {
+ const char *g_boot = conf_get_global_option(conf, "boot");
+ const char *g_part = conf_get_global_option(conf, "partition");
/* First finish any previous image. */
@@ -93,9 +95,25 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
/* Then start the new image. */
- state->opt->boot_image_file = resolve_path(state->opt, value,
- conf->dc->device_path);
- state->desc_image = talloc_strdup(state->opt, value);
+ if (g_boot && g_part) {
+ char* dev = talloc_asprintf(NULL, "%s%s", g_boot,
+ g_part);
+
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, dev);
+ state->desc_image = talloc_asprintf(state->opt,
+ "%s%s", dev, value);
+ talloc_free(dev);
+ } else if (g_boot) {
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, g_boot);
+ state->desc_image = talloc_asprintf(state->opt,
+ "%s%s", g_boot, value);
+ } else {
+ state->opt->boot_image_file = resolve_path(state->opt,
+ value, conf->dc->device_path);
+ state->desc_image = talloc_strdup(state->opt, value);
+ }
return;
}
@@ -144,10 +162,29 @@ static void yaboot_process_pair(struct conf_context *conf, const char *name,
/* initrd */
if (streq(name, "initrd")) {
- state->opt->initrd_file = resolve_path(state->opt,
- value, conf->dc->device_path);
- state->desc_initrd = talloc_asprintf(state, "initrd=%s",
- value);
+ const char *g_boot = conf_get_global_option(conf, "boot");
+ const char *g_part = conf_get_global_option(conf, "partition");
+
+ if (g_boot && g_part) {
+ char* dev = talloc_asprintf(NULL, "%s%s", g_boot,
+ g_part);
+
+ state->opt->initrd_file = resolve_path(state->opt,
+ value, dev);
+ state->desc_initrd = talloc_asprintf(state,
+ "initrd=%s%s", dev, value);
+ talloc_free(dev);
+ } else if (g_boot) {
+ state->opt->initrd_file = resolve_path(state->opt,
+ value, g_boot);
+ state->desc_initrd = talloc_asprintf(state,
+ "initrd=%s%s", g_boot, value);
+ } else {
+ state->opt->initrd_file = resolve_path(state->opt,
+ value, conf->dc->device_path);
+ state->desc_initrd = talloc_asprintf(state, "initrd=%s",
+ value);
+ }
return;
}
OpenPOWER on IntegriCloud