summaryrefslogtreecommitdiffstats
path: root/common/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-01-29 10:10:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-02-08 08:55:57 +0100
commitd2411eaf76ef52f2ccf7f3e39226082fbdd3dcd1 (patch)
tree4ea2845c64579b6b24d3927ed00c68d3916a5762 /common/bootm.c
parentea76b402ece8cbecc85d573bcacf5652dba7f590 (diff)
downloadbarebox-d2411eaf76ef52f2ccf7f3e39226082fbdd3dcd1.tar.gz
barebox-d2411eaf76ef52f2ccf7f3e39226082fbdd3dcd1.tar.xz
FIT: Let user specify the configuration to use
The images in FIT images can be opened in two different ways. They can be either opened directly based on their names in the images/ node or as part of a configuration based on their names in the corresponding /configuration/ node. So far we only supported the latter. To prepare supporting the former we return a cookie belonging to the configuration from fit_open_configuration() which we use in fit_open_image() to refer to the desired configuration. While at it document fit_open_configuration(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/bootm.c')
-rw-r--r--common/bootm.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/common/bootm.c b/common/bootm.c
index 0ec7584952..3e48ca1d88 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -152,7 +152,7 @@ bool bootm_has_initrd(struct image_data *data)
return false;
if (IS_ENABLED(CONFIG_FITIMAGE) && data->os_fit &&
- fit_has_image(data->os_fit, "ramdisk"))
+ fit_has_image(data->os_fit, data->fit_config, "ramdisk"))
return true;
if (data->initrd_file)
@@ -214,12 +214,12 @@ int bootm_load_initrd(struct image_data *data, unsigned long load_address)
return 0;
if (IS_ENABLED(CONFIG_FITIMAGE) && data->os_fit &&
- fit_has_image(data->os_fit, "ramdisk")) {
+ fit_has_image(data->os_fit, data->fit_config, "ramdisk")) {
const void *initrd;
unsigned long initrd_size;
- ret = fit_open_image(data->os_fit, "ramdisk", &initrd,
- &initrd_size);
+ ret = fit_open_image(data->os_fit, data->fit_config, "ramdisk",
+ &initrd, &initrd_size);
data->initrd_res = request_sdram_region("initrd",
load_address,
@@ -344,11 +344,12 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address)
return 0;
if (IS_ENABLED(CONFIG_FITIMAGE) && data->os_fit &&
- fit_has_image(data->os_fit, "fdt")) {
+ fit_has_image(data->os_fit, data->fit_config, "fdt")) {
const void *of_tree;
unsigned long of_size;
- ret = fit_open_image(data->os_fit, "fdt", &of_tree, &of_size);
+ ret = fit_open_image(data->os_fit, data->fit_config, "fdt",
+ &of_tree, &of_size);
if (ret)
return ret;
@@ -591,17 +592,19 @@ int bootm_boot(struct bootm_data *bootm_data)
data->os_fit = fit;
- ret = fit_open_configuration(data->os_fit, data->os_part);
- if (ret) {
+ data->fit_config = fit_open_configuration(data->os_fit,
+ data->os_part);
+ if (IS_ERR(data->fit_config)) {
printf("Cannot open FIT image configuration '%s'\n",
data->os_part ? data->os_part : "default");
+ ret = PTR_ERR(data->fit_config);
goto err_out;
}
- ret = fit_open_image(data->os_fit, "kernel", &data->fit_kernel,
- &data->fit_kernel_size);
+ ret = fit_open_image(data->os_fit, data->fit_config, "kernel",
+ &data->fit_kernel, &data->fit_kernel_size);
if (ret)
- goto err_out;;
+ goto err_out;
}
if (os_type == filetype_uimage) {