summaryrefslogtreecommitdiff
path: root/tools/fit_image.c
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu.vizoso@collabora.com>2016-11-04 14:22:15 +0100
committerTom Rini <trini@konsulko.com>2016-11-06 07:33:42 -0500
commit0f7c6cdc8143d6cf0577a84bf27bdaadd6229ff4 (patch)
tree5d3ca7131085c25be9ced0bfff7fb9db1709a607 /tools/fit_image.c
parentbaade496d18d9fd80797c09031687ff0af53f69d (diff)
mkimage: Allow including a ramdisk in FIT auto mode
Adds -i option that allows specifying a ramdisk file to be added to the FIT image when we are using the automatic FIT mode (no ITS file). This makes adding Depthcharge support to LAVA much more convenient, as no additional configuration files need to be kept around in the machine that dispatches jobs to the boards. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com> Cc: Simon Glass <sjg@chromium.org> Cc: Matt Hart <matthew.hart@linaro.org> Cc: Neil Williams <codehelp@debian.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/fit_image.c')
-rw-r--r--tools/fit_image.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 10fd6d49293..efd8a97a0b9 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -85,8 +85,15 @@ static int fit_calc_size(struct image_tool_params *params)
size = imagetool_get_filesize(params, params->datafile);
if (size < 0)
return -1;
-
total_size = size;
+
+ if (params->fit_ramdisk) {
+ size = imagetool_get_filesize(params, params->fit_ramdisk);
+ if (size < 0)
+ return -1;
+ total_size += size;
+ }
+
for (cont = params->content_head; cont; cont = cont->next) {
size = imagetool_get_filesize(params, cont->fname);
if (size < 0)
@@ -233,6 +240,20 @@ static int fit_write_images(struct image_tool_params *params, char *fdt)
fdt_end_node(fdt);
}
+ /* And a ramdisk file if available */
+ if (params->fit_ramdisk) {
+ fdt_begin_node(fdt, FIT_RAMDISK_PROP "@1");
+
+ fdt_property_string(fdt, "type", FIT_RAMDISK_PROP);
+ fdt_property_string(fdt, "os", genimg_get_os_short_name(params->os));
+
+ ret = fdt_property_file(params, fdt, "data", params->fit_ramdisk);
+ if (ret)
+ return ret;
+
+ fdt_end_node(fdt);
+ }
+
fdt_end_node(fdt);
return 0;
@@ -272,15 +293,25 @@ static void fit_write_configs(struct image_tool_params *params, char *fdt)
snprintf(str, sizeof(str), "%s@1", typename);
fdt_property_string(fdt, typename, str);
+ if (params->fit_ramdisk)
+ fdt_property_string(fdt, FIT_RAMDISK_PROP,
+ FIT_RAMDISK_PROP "@1");
+
snprintf(str, sizeof(str), FIT_FDT_PROP "@%d", upto);
fdt_property_string(fdt, FIT_FDT_PROP, str);
fdt_end_node(fdt);
}
+
if (!upto) {
fdt_begin_node(fdt, "conf@1");
typename = genimg_get_type_short_name(params->fit_image_type);
snprintf(str, sizeof(str), "%s@1", typename);
fdt_property_string(fdt, typename, str);
+
+ if (params->fit_ramdisk)
+ fdt_property_string(fdt, FIT_RAMDISK_PROP,
+ FIT_RAMDISK_PROP "@1");
+
fdt_end_node(fdt);
}