Skip to contentSkip to conversation

Multi uImage support on ARM

PATCH Applied Jean-Christophe PLAGNIOL-VILLARD 2 participants 9 messages Oct 8, 2011 – Oct 12, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover Multi uImage support on ARM

Hi,

This the final patch seires to add the Multi uImage support to barebox

This does not support yet the script type but allow us to boot a uImage with a kernel and an initrd inside

It will be easy to add the DT support too

And enable it on arm.

Jean-Christophe PLAGNIOL-VILLARD (5):
bootm: ensure the uImage is mapped first to allow option to used it
get_fake_image_handle: set nb_data_entries to 1 and update the header size
bootm: add -L option to specify the initrd load address arm/bootm: enable multi uimage support
defaultenv: add bootm_opt var to allow the board to pass parameter to bootm

 arch/arm/lib/bootm.c |    5 -----
 commands/bootm.c     |   42 +++++++++++++++++++++++++++++++++++-------
 defaultenv/bin/boot  |    2 +-
 3 files changed, 36 insertions(+), 13 deletions(-)

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

PATCH 1/5 bootm: ensure the uImage is mapped first to allow option to used it

needed for multi image support

---
 commands/bootm.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
commands/bootm.c +16 -4
index 755932b..f0f64cf 100644
@@ -274,10 +274,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 
 			return 0;
 		default:
-			if (!handler_parse_options(&data, opt, optarg))
-				continue;
-
-			return 1;
+			break;
 		}
 	}
 
@@ -297,6 +294,21 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 		goto err_out;
 	}
 
+	optind = 0;
+
+	while((opt = getopt(argc, argv, options)) > 0) {
+		switch(opt) {
+		case 'h':
+		case 'n':
+			break;
+		default:
+			if (!handler_parse_options(&data, opt, optarg))
+				continue;
+
+			return 1;
+		}
+	}
+
 	/*
 	 * We have reached the point of no return: we are going to
 	 * overwrite all exception vector code, so we cannot easily
Signature · 7 lines
1.7.6.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH 4/5 arm/bootm: enable multi uimage support

In reply to Jean-Christophe PLAGNIOL-VILLARD

tested on imx53 loco board with a Multi uImage file

generate like this

mkimage -A arm -O linux -T multi -C none -a 0x70008000 -e 0x70008000 -n Linux-2.6.35.3-00745-gce4c61a-dirty -d zImage:rootfs.cpio.lzma uImage.Multi

and boot via bootm

bootm -r @1 -L 0x72000000 /dev/ram0.kernel

---
 arch/arm/lib/bootm.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/arm/lib/bootm.c +0 -5
index 7156eea..87bf3b3 100644
@@ -24,11 +24,6 @@ static int do_bootm_linux(struct image_data *data)
 	void (*theKernel)(int zero, int arch, void *params);
 	image_header_t *os_header = &data->os->header;
 
-	if (image_get_type(os_header) == IH_TYPE_MULTI) {
-		printf("Multifile images not handled at the moment\n");
-		return -1;
-	}
-
 	theKernel = (void *)image_get_ep(os_header);
 
 	debug("## Transferring control to Linux (at address 0x%p) ...\n",
Signature · 7 lines
1.7.6.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 2/5 get_fake_image_handle: set nb_data_entries to 1 and update the header size

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 commands/bootm.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
commands/bootm.c +2 -0
index f0f64cf..afb9e06 100644
@@ -181,6 +181,8 @@ static struct image_handle *get_fake_image_handle(struct image_data *data, int n
 	handle = xzalloc(sizeof(struct image_handle));
 	header = &handle->header;
 	handle->data_entries = gen_image_handle_data(iha->data, iha->len);
+	handle->nb_data_entries = 1;
+	header->ih_size = cpu_to_uimage(iha->len);
 	handle->data = handle->data_entries[0].data;
 
 	return handle;
Signature · 7 lines
1.7.6.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH 3/5 bootm: add -L option to specify the initrd load address

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 commands/bootm.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
commands/bootm.c +17 -3
index afb9e06..f11138a 100644
@@ -191,7 +191,18 @@ static struct image_handle *get_fake_image_handle(struct image_data *data, int n
 static int initrd_handler_parse_options(struct image_data *data, int opt,
 		char *optarg)
 {
+	uint32_t initrd_start;
+
 	switch(opt) {
+	case 'L':
+		if (!data->initrd) {
+			eprintf("Warning -L ingnored. Specify the initrd first\n");
+			break;
+		}
+		initrd_start = simple_strtoul(optarg, NULL, 0);
+		printf("initrd_start=0x%x\n", initrd_start);
+		data->initrd->header.ih_load = cpu_to_uimage(initrd_start);
+		break;
 	case 'r':
 		printf("use initrd %s\n", optarg);
 		/* check for multi image @<num> */
@@ -204,16 +215,19 @@ static int initrd_handler_parse_options(struct image_data *data, int opt,
 		}
 		if (!data->initrd)
 			return -1;
-		return 0;
+		break;
 	default:
 		return 1;
 	}
+
+	return 0;
 }
 
 static struct image_handler initrd_handler = {
-	.cmdline_options = "r:",
+	.cmdline_options = "r:L:",
 	.cmdline_parse = initrd_handler_parse_options,
-	.help_string = " -r <initrd>    specify an initrd image",
+	.help_string = " -r <initrd>    specify an initrd image\n"
+		       " -L <load addr> specify initrd load address",
 };
 
 static int initrd_register_image_handler(void)
Signature · 7 lines
1.7.6.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH 5/5 defaultenv: add bootm_opt var to allow the board to pass parameter to bootm

In reply to Jean-Christophe PLAGNIOL-VILLARD
---
 defaultenv/bin/boot |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
defaultenv/bin/boot +1 -1
index 652ae0c..6761d84 100644
@@ -115,7 +115,7 @@ fi
 echo "booting kernel of type $kernelimage_type from $kdev"
 
 if [ x$kernelimage_type = xuimage ]; then
-	bootm $kdev
+	bootm $bootm_opt $kdev
 elif [ x$kernelimage_type = xzimage ]; then
 	bootz $kdev
 elif [ x$kernelimage_type = xraw ]; then
Signature · 7 lines
1.7.6.3


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#6 lore raw
In reply to Jean-Christophe PLAGNIOL-VILLARD
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

This the final patch seires to add the Multi uImage support to barebox

This does not support yet the script type but allow us to boot a uImage with a kernel and an initrd inside

It will be easy to add the DT support too

Quoted 8 lines

And enable it on arm.

Jean-Christophe PLAGNIOL-VILLARD (5):
bootm: ensure the uImage is mapped first to allow option to used it
get_fake_image_handle: set nb_data_entries to 1 and update the header size
bootm: add -L option to specify the initrd load address arm/bootm: enable multi uimage support
defaultenv: add bootm_opt var to allow the board to pass parameter to bootm

Applied to next.

Sascha

Quoted 14 lines
 arch/arm/lib/bootm.c |    5 -----
 commands/bootm.c     |   42 +++++++++++++++++++++++++++++++++++-------
 defaultenv/bin/boot  |    2 +-
 3 files changed, 36 insertions(+), 13 deletions(-)

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw
Quoted 13 lines · Sascha Hauer
Quoted 12 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

This the final patch seires to add the Multi uImage support to barebox

This does not support yet the script type but allow us to boot a uImage with a kernel and an initrd inside

It will be easy to add the DT support too

And enable it on arm.

Quoted 8 lines
Quoted 6 lines

Jean-Christophe PLAGNIOL-VILLARD (5):
bootm: ensure the uImage is mapped first to allow option to used it
get_fake_image_handle: set nb_data_entries to 1 and update the header size
bootm: add -L option to specify the initrd load address arm/bootm: enable multi uimage support
defaultenv: add bootm_opt var to allow the board to pass parameter to bootm

Applied to next.

can we have it on the master it's the second part of the Multi uImage patch series already present in the master

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#8 lore raw
Quoted 21 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 20 lines · Sascha Hauer
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD

Hi,

This the final patch seires to add the Multi uImage support to barebox

This does not support yet the script type but allow us to boot a uImage with a kernel and an initrd inside

It will be easy to add the DT support too

And enable it on arm.

Jean-Christophe PLAGNIOL-VILLARD (5):
bootm: ensure the uImage is mapped first to allow option to used it
get_fake_image_handle: set nb_data_entries to 1 and update the header size
bootm: add -L option to specify the initrd load address arm/bootm: enable multi uimage support
defaultenv: add bootm_opt var to allow the board to pass parameter to bootm

Quoted 3 lines
Quoted 1 line

Applied to next.

can we have it on the master it's the second part of the Multi uImage patch series already present in the master

No. It changes the bootm command which most boards use. A little bit more testing is a good thing for this kind of stuff.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox