[PATCH RFC 1/2] bootm: Simplify initrd address handling
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Thu May 2 05:07:11 EDT 2013
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 at 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
More information about the barebox
mailing list