mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 07/14] bootm: handle initrds inline
Date: Wed, 7 Dec 2011 10:19:17 +0100	[thread overview]
Message-ID: <20111207091917.GO27267@pengutronix.de> (raw)
In-Reply-To: <20111206150820.GD32515@game.jcrosoft.org>

On Tue, Dec 06, 2011 at 04:08:20PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:02 Mon 28 Nov     , Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > +
> > +				data.initrd = get_fake_image_handle(&data, num);
> this can not work
> 
> get_fake_image_handle expect the uImage is mapped

Yes, you're right.

> 
> attached patch fix it
> 

How about the following instead? I think it's a bit cleaner to
completely move the initrd code out of the option parsing.

Sascha

From 5128a2d2badace6102dc5461408ceaa47d0e9cc1 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Tue, 6 Dec 2011 08:44:05 +0100
Subject: [PATCH] bootm: factor out initrd code from option parser

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/bootm.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index 859ec28..f97a842 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -121,6 +121,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 	struct image_handle *os_handle = NULL;
 	struct image_handler *handler;
 	struct image_data data;
+	const char *initrdname = NULL;
 	int ret = 1;
 
 	memset(&data, 0, sizeof(struct image_data));
@@ -136,17 +137,7 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 			data.initrd_address = simple_strtoul(optarg, NULL, 0);
 			break;
 		case 'r':
-			printf("use initrd %s\n", optarg);
-			/* check for multi image @<num> */
-			if (optarg[0] == '@') {
-				int num = simple_strtol(optarg + 1, NULL, 0);
-
-				data.initrd = get_fake_image_handle(&data, num);
-			} else {
-				data.initrd = map_image(optarg, data.verify);
-			}
-			if (!data.initrd)
-				goto err_out;
+			initrdname = optarg;
 			break;
 		default:
 			break;
@@ -171,6 +162,19 @@ static int do_bootm(struct command *cmdtp, int argc, char *argv[])
 		goto err_out;
 	}
 
+	if (initrdname) {
+		/* check for multi image @<num> */
+		if (initrdname[0] == '@') {
+			int num = simple_strtol(optarg + 1, NULL, 0);
+
+			data.initrd = get_fake_image_handle(&data, num);
+		} else {
+			data.initrd = map_image(optarg, data.verify);
+		}
+		if (!data.initrd)
+			goto err_out;
+	}
+
 	/*
 	 * We have reached the point of no return: we are going to
 	 * overwrite all exception vector code, so we cannot easily
-- 
1.7.7.3


-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2011-12-07  9:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-28  8:02 bootm work Sascha Hauer
2011-11-28  8:02 ` [PATCH 01/14] bootm: remove dead code Sascha Hauer
2011-11-28  8:02 ` [PATCH 02/14] factor out iminfo command Sascha Hauer
2011-11-28  8:02 ` [PATCH 03/14] compile in simple_strtoull Sascha Hauer
2011-11-28  8:02 ` [PATCH 04/14] introduce some env helpers Sascha Hauer
2011-11-28  8:02 ` [PATCH 05/14] armlinux: cleanup linux vars Sascha Hauer
2011-11-28 11:03   ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28 11:12     ` Sascha Hauer
2011-11-29  4:38       ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29  7:23         ` Robert Schwebel
2011-11-29  8:13           ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 10:09             ` Sascha Hauer
2011-11-28  8:02 ` [PATCH 06/14] ARM bootm: remove now obsolete args Sascha Hauer
2011-11-28  8:02 ` [PATCH 07/14] bootm: handle initrds inline Sascha Hauer
2011-12-06 15:08   ` Jean-Christophe PLAGNIOL-VILLARD
2011-12-07  9:19     ` Sascha Hauer [this message]
2011-12-07 13:26       ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28  8:02 ` [PATCH 08/14] bootm: remove image handler options Sascha Hauer
2011-11-28  8:02 ` [PATCH 09/14] bootm: fix various memory leaks Sascha Hauer
2011-11-28  8:02 ` [PATCH 10/14] bootm: do not require -L after -r Sascha Hauer
2011-11-28  8:02 ` [PATCH 11/14] bootm: fix typo, update help str Sascha Hauer
2011-11-28 11:00   ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-28  8:02 ` [PATCH 12/14] bootm relocate_image: honour load_address Sascha Hauer
2011-11-28  8:02 ` [PATCH 13/14] bootm: push relocate_image up to the generic command Sascha Hauer
2011-11-28  8:02 ` [PATCH 14/14] bootm: use initrd_address and initrd_size Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111207091917.GO27267@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox