mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH RFC 1/2] bootm: Simplify initrd address handling
Date: Thu,  2 May 2013 11:07:11 +0200	[thread overview]
Message-ID: <1367485632-10725-2-git-send-email-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <1367485632-10725-1-git-send-email-u.kleine-koenig@pengutronix.de>

	data.initrd_address = UIMAGE_SOME_ADDRESS;
	...
	if (-L was given to bootm)
		data.initrd_address = address_provided_to_-L;
	...
	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_SOME_ADDRESS)
		data.initrd_address = load_address_from_uInitrd;
	...
	if (data.initrd_address == UIMAGE_SOME_ADDRESS)
		data.initrd_address = UIMAGE_INVALID_ADDRESS;

can be simplified to:

	data.initrd_address = UIMAGE_INVALID_ADDRESS;
	...
	if (-L was given to bootm)
		data.initrd_address = address_provided_to_-L;
	...
	if (initrd is provided as uInitrd && data.initrd_address == UIMAGE_INVALID_ADDRESS)
		data.initrd_address = load_address_from_uInitrd;
	...

The only change introduced by this simplification is for cases where the
user passes -L UIMAGE_SOME_ADDRESS or -L UIMAGE_INVALID_ADDRESS to
bootm. (-L UIMAGE_SOME_ADDRESS is now used literally instead of ignored
before. -L UIMAGE_INVALID_ADDRESS used to skip getting the
initrd-address from the uInitrd, now the uInitrd address is honored.)

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 commands/bootm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/commands/bootm.c b/commands/bootm.c
index e5dfc6a..bb44776 100644
--- a/commands/bootm.c
+++ b/commands/bootm.c
@@ -127,7 +127,7 @@ static int bootm_open_initrd_uimage(struct image_data *data)
 		data->initrd = data->os;
 	}
 
-	if (data->initrd_address == UIMAGE_SOME_ADDRESS)
+	if (data->initrd_address == UIMAGE_INVALID_ADDRESS)
 		data->initrd_address = data->initrd->header.ih_load;
 
 	return 0;
@@ -256,7 +256,7 @@ static int do_bootm(int argc, char *argv[])
 
 	memset(&data, 0, sizeof(struct image_data));
 
-	data.initrd_address = UIMAGE_SOME_ADDRESS;
+	data.initrd_address = UIMAGE_INVALID_ADDRESS;
 	data.os_address = UIMAGE_SOME_ADDRESS;
 	data.verify = 0;
 	data.verbose = 0;
@@ -408,8 +408,6 @@ static int do_bootm(int argc, char *argv[])
 #endif
 	if (data.os_address == UIMAGE_SOME_ADDRESS)
 		data.os_address = UIMAGE_INVALID_ADDRESS;
-	if (data.initrd_address == UIMAGE_SOME_ADDRESS)
-		data.initrd_address = UIMAGE_INVALID_ADDRESS;
 
 	handler = bootm_find_handler(os_type, &data);
 	if (!handler) {
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-05-02  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  9:07 [PATCH RFC 0/2] Fix uInitrd handling Uwe Kleine-König
2013-05-02  9:07 ` Uwe Kleine-König [this message]
2013-05-03  4:24   ` [PATCH RFC 1/2] bootm: Simplify initrd address handling Sascha Hauer
2013-05-02  9:07 ` [PATCH RFC 2/2] Don't honor initrd load address Uwe Kleine-König

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=1367485632-10725-2-git-send-email-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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