public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode
@ 2016-11-04 13:22 Tomeu Vizoso
  2016-11-05 16:12 ` Simon Glass
  2016-11-07  1:16 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Tomeu Vizoso @ 2016-11-04 13:22 UTC (permalink / raw)
  To: u-boot

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>
---
 doc/mkimage.1     |  4 ++++
 tools/fit_image.c | 33 ++++++++++++++++++++++++++++++++-
 tools/imagetool.h |  1 +
 tools/mkimage.c   | 10 +++++++---
 4 files changed, 44 insertions(+), 4 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index e883f07849a6..3dcdcedcefaf 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -138,6 +138,10 @@ This can be used to sign images with additional keys after initial image
 creation.
 
 .TP
+.BI "\-i [" "ramdisk_file" "]"
+Appends the ramdisk file to the FIT.
+
+.TP
 .BI "\-k [" "key_directory" "]"
 Specifies the directory containing keys to use for signing. This directory
 should contain a private key file <name>.key for use with signing and a
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 10fd6d492937..efd8a97a0b92 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 at 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 at 1");
 		typename = genimg_get_type_short_name(params->fit_image_type);
 		snprintf(str, sizeof(str), "%s at 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);
 	}
 
diff --git a/tools/imagetool.h b/tools/imagetool.h
index 6c1a9d376058..15c2a0c0e1c1 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -70,6 +70,7 @@ struct image_tool_params {
 	int orig_file_size;	/* Original size for file before padding */
 	bool auto_its;		/* Automatically create the .its file */
 	int fit_image_type;	/* Image type to put into the FIT */
+	char *fit_ramdisk;	/* Ramdisk file to include */
 	struct content_info *content_head;	/* List of files to include */
 	struct content_info *content_tail;
 	bool external_data;	/* Store data outside the FIT */
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 0c6dba89a099..49d5d1ed70a7 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -88,12 +88,13 @@ static void usage(const char *msg)
 		"          -x ==> set XIP (execute in place)\n",
 		params.cmdname);
 	fprintf(stderr,
-		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] fit-image\n"
+		"       %s [-D dtc_options] [-f fit-image.its|-f auto|-F] [-b <dtb> [-b <dtb>]] [-i <ramdisk.cpio.gz>] fit-image\n"
 		"           <dtb> file is used with -f auto, it may occur multiple times.\n",
 		params.cmdname);
 	fprintf(stderr,
 		"          -D => set all options for device tree compiler\n"
-		"          -f => input filename for FIT source\n");
+		"          -f => input filename for FIT source\n"
+		"          -i => input filename for ramdisk file\n");
 #ifdef CONFIG_FIT_SIGNATURE
 	fprintf(stderr,
 		"Signing / verified boot options: [-E] [-k keydir] [-K dtb] [ -c <comment>] [-p addr] [-r]\n"
@@ -141,7 +142,7 @@ static void process_args(int argc, char **argv)
 	int opt;
 
 	while ((opt = getopt(argc, argv,
-			     "a:A:b:c:C:d:D:e:Ef:Fk:K:ln:p:O:rR:qsT:vVx")) != -1) {
+			     "a:A:b:c:C:d:D:e:Ef:Fk:i:K:ln:p:O:rR:qsT:vVx")) != -1) {
 		switch (opt) {
 		case 'a':
 			params.addr = strtoull(optarg, &ptr, 16);
@@ -207,6 +208,9 @@ static void process_args(int argc, char **argv)
 			params.type = IH_TYPE_FLATDT;
 			params.fflag = 1;
 			break;
+		case 'i':
+			params.fit_ramdisk = optarg;
+			break;
 		case 'k':
 			params.keydir = optarg;
 			break;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode
  2016-11-04 13:22 [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode Tomeu Vizoso
@ 2016-11-05 16:12 ` Simon Glass
  2016-11-07  1:16 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2016-11-05 16:12 UTC (permalink / raw)
  To: u-boot

On 4 November 2016 at 07:22, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> 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>
> ---
>  doc/mkimage.1     |  4 ++++
>  tools/fit_image.c | 33 ++++++++++++++++++++++++++++++++-
>  tools/imagetool.h |  1 +
>  tools/mkimage.c   | 10 +++++++---
>  4 files changed, 44 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] mkimage: Allow including a ramdisk in FIT auto mode
  2016-11-04 13:22 [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode Tomeu Vizoso
  2016-11-05 16:12 ` Simon Glass
@ 2016-11-07  1:16 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-11-07  1:16 UTC (permalink / raw)
  To: u-boot

On Fri, Nov 04, 2016 at 02:22:15PM +0100, Tomeu Vizoso wrote:

> 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>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161106/41f08cfc/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-07  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-04 13:22 [U-Boot] [PATCH] mkimage: Allow including a ramdisk in FIT auto mode Tomeu Vizoso
2016-11-05 16:12 ` Simon Glass
2016-11-07  1:16 ` [U-Boot] " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox