summaryrefslogtreecommitdiffstats
path: root/common/blspec.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-07-20 13:40:51 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-07-26 08:31:35 +0200
commit86a4036ba2c42bd38c87d1770009eab82dff01e3 (patch)
tree66a30d2282b42b5056271244857509d6a09a1932 /common/blspec.c
parente113fa5f1d498f86705bfb53c6ae8b8a8e225173 (diff)
downloadbarebox-86a4036ba2c42bd38c87d1770009eab82dff01e3.tar.gz
blspec: Make blspec_boot static
Since blspec_boot is now only used locally we can make it static. Move it up to avoid a static declaration. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/blspec.c')
-rw-r--r--common/blspec.c156
1 files changed, 78 insertions, 78 deletions
diff --git a/common/blspec.c b/common/blspec.c
index aa70685..6c963df 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -43,6 +43,84 @@ int blspec_entry_var_set(struct blspec_entry *entry, const char *name,
}
/*
+ * blspec_boot - boot an entry
+ *
+ * This boots an entry. On success this function does not return.
+ * In case of an error the error code is returned. This function may
+ * return 0 in case of a succesful dry run.
+ */
+static int blspec_boot(struct bootentry *be, int verbose, int dryrun)
+{
+ struct blspec_entry *entry = container_of(be, struct blspec_entry, entry);
+ int ret;
+ const char *abspath, *devicetree, *options, *initrd, *linuximage;
+ const char *appendroot;
+ struct bootm_data data = {
+ .initrd_address = UIMAGE_INVALID_ADDRESS,
+ .os_address = UIMAGE_SOME_ADDRESS,
+ .verbose = verbose,
+ .dryrun = dryrun,
+ };
+
+ globalvar_set_match("linux.bootargs.dyn.", "");
+ globalvar_set_match("bootm.", "");
+
+ devicetree = blspec_entry_var_get(entry, "devicetree");
+ initrd = blspec_entry_var_get(entry, "initrd");
+ options = blspec_entry_var_get(entry, "options");
+ linuximage = blspec_entry_var_get(entry, "linux");
+
+ if (entry->rootpath)
+ abspath = entry->rootpath;
+ else
+ abspath = "";
+
+ data.os_file = basprintf("%s/%s", abspath, linuximage);
+
+ if (devicetree) {
+ if (!strcmp(devicetree, "none")) {
+ struct device_node *node = of_get_root_node();
+ if (node)
+ of_delete_node(node);
+ } else {
+ data.oftree_file = basprintf("%s/%s", abspath,
+ devicetree);
+ }
+ }
+
+ if (initrd)
+ data.initrd_file = basprintf("%s/%s", abspath, initrd);
+
+ globalvar_add_simple("linux.bootargs.dyn.bootentries", options);
+
+ appendroot = blspec_entry_var_get(entry, "linux-appendroot");
+ if (appendroot) {
+ int val;
+
+ ret = strtobool(appendroot, &val);
+ if (ret) {
+ pr_err("Invalid value \"%s\" for appendroot option\n",
+ appendroot);
+ goto err_out;
+ }
+ data.appendroot = val;
+ }
+
+ pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
+ entry->cdev ? dev_name(entry->cdev->dev) : "none");
+
+ 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);
+
+ return ret;
+}
+
+/*
* blspec_entry_var_get - get the value of a variable
*/
const char *blspec_entry_var_get(struct blspec_entry *entry, const char *name)
@@ -653,81 +731,3 @@ int blspec_scan_devicename(struct bootentries *bootentries, const char *devname)
return blspec_scan_device(bootentries, dev);
}
-
-/*
- * blspec_boot - boot an entry
- *
- * This boots an entry. On success this function does not return.
- * In case of an error the error code is returned. This function may
- * return 0 in case of a succesful dry run.
- */
-int blspec_boot(struct bootentry *be, int verbose, int dryrun)
-{
- struct blspec_entry *entry = container_of(be, struct blspec_entry, entry);
- int ret;
- const char *abspath, *devicetree, *options, *initrd, *linuximage;
- const char *appendroot;
- struct bootm_data data = {
- .initrd_address = UIMAGE_INVALID_ADDRESS,
- .os_address = UIMAGE_SOME_ADDRESS,
- .verbose = verbose,
- .dryrun = dryrun,
- };
-
- globalvar_set_match("linux.bootargs.dyn.", "");
- globalvar_set_match("bootm.", "");
-
- devicetree = blspec_entry_var_get(entry, "devicetree");
- initrd = blspec_entry_var_get(entry, "initrd");
- options = blspec_entry_var_get(entry, "options");
- linuximage = blspec_entry_var_get(entry, "linux");
-
- if (entry->rootpath)
- abspath = entry->rootpath;
- else
- abspath = "";
-
- data.os_file = basprintf("%s/%s", abspath, linuximage);
-
- if (devicetree) {
- if (!strcmp(devicetree, "none")) {
- struct device_node *node = of_get_root_node();
- if (node)
- of_delete_node(node);
- } else {
- data.oftree_file = basprintf("%s/%s", abspath,
- devicetree);
- }
- }
-
- if (initrd)
- data.initrd_file = basprintf("%s/%s", abspath, initrd);
-
- globalvar_add_simple("linux.bootargs.dyn.bootentries", options);
-
- appendroot = blspec_entry_var_get(entry, "linux-appendroot");
- if (appendroot) {
- int val;
-
- ret = strtobool(appendroot, &val);
- if (ret) {
- pr_err("Invalid value \"%s\" for appendroot option\n",
- appendroot);
- goto err_out;
- }
- data.appendroot = val;
- }
-
- pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"),
- entry->cdev ? dev_name(entry->cdev->dev) : "none");
-
- 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);
-
- return ret;
-}