summaryrefslogtreecommitdiff
path: root/common/blspec.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-07-06 12:43:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-06 12:43:29 +0200
commitd297851b1a79997b19d9c816ca737f0f48e768dd (patch)
tree9a787a757a463dd5de7a65ae8b2ff205707fc938 /common/blspec.c
parent735c570e5ad87a562dd9a50208a087e105eaecf6 (diff)
parent716fdbf18ca12feb81e26df729a5b8969e394e96 (diff)
downloadbarebox-d297851b1a79997b19d9c816ca737f0f48e768dd.tar.gz
Merge branch 'for-next/blspec'
Diffstat (limited to 'common/blspec.c')
-rw-r--r--common/blspec.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/common/blspec.c b/common/blspec.c
index 7e84ff3cec..ab18602715 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -634,6 +634,29 @@ int blspec_scan_devicename(struct blspec *blspec, const char *devname)
return blspec_scan_device(blspec, dev);
}
+static int blspec_append_root(struct blspec_entry *entry)
+{
+ const char *appendroot;
+ char *rootarg;
+
+ appendroot = blspec_entry_var_get(entry, "linux-appendroot");
+ if (!appendroot || strcmp(appendroot, "true"))
+ return 0;
+
+ rootarg = path_get_linux_rootarg(entry->rootpath);
+ if (IS_ERR(rootarg)) {
+ pr_err("Getting root argument for %s failed with: %s\n",
+ entry->rootpath, strerror(-PTR_ERR(rootarg)));
+ return PTR_ERR(rootarg);
+ }
+
+ globalvar_add_simple("linux.bootargs.dyn.blspec.appendroot", rootarg);
+
+ free(rootarg);
+
+ return 0;
+}
+
/*
* blspec_boot - boot an entry
*
@@ -683,6 +706,10 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun)
globalvar_add_simple("linux.bootargs.dyn.blspec", options);
+ ret = blspec_append_root(entry);
+ if (ret)
+ goto err_out;
+
pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
entry->cdev ? dev_name(entry->cdev->dev) : "none");
@@ -701,7 +728,7 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun)
ret = bootm_boot(&data);
if (ret)
pr_err("Booting failed\n");
-
+err_out:
free((char *)data.oftree_file);
free((char *)data.initrd_file);
free((char *)data.os_file);