mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
Clarify bootm OS arguments
At present the arguments to bootm are processed in a somewhat confusing way. Sub-functions must know how many arguments their calling functions have processed, and the OS boot function must also have this information. Also it isn't obvious that 'bootm' and 'bootm start' provide arguments in the same way. Adjust the code so that arguments are removed from the list before calling a sub-function. This means that all functions can know that argv[0] is the first argument of which they need to take notice. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -816,20 +816,23 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
|
||||
ulong default_addr;
|
||||
int rd_noffset;
|
||||
#endif
|
||||
const char *select = NULL;
|
||||
|
||||
*rd_start = 0;
|
||||
*rd_end = 0;
|
||||
|
||||
if (argc >= 2)
|
||||
select = argv[1];
|
||||
/*
|
||||
* Look for a '-' which indicates to ignore the
|
||||
* ramdisk argument
|
||||
*/
|
||||
if ((argc >= 3) && (strcmp(argv[2], "-") == 0)) {
|
||||
if (select && strcmp(select, "-") == 0) {
|
||||
debug("## Skipping init Ramdisk\n");
|
||||
rd_len = rd_data = 0;
|
||||
} else if (argc >= 3 || genimg_has_config(images)) {
|
||||
} else if (select || genimg_has_config(images)) {
|
||||
#if defined(CONFIG_FIT)
|
||||
if (argc >= 3) {
|
||||
if (select) {
|
||||
/*
|
||||
* If the init ramdisk comes from the FIT image and
|
||||
* the FIT image address is omitted in the command
|
||||
@@ -841,12 +844,12 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
|
||||
else
|
||||
default_addr = load_addr;
|
||||
|
||||
if (fit_parse_conf(argv[2], default_addr,
|
||||
&rd_addr, &fit_uname_config)) {
|
||||
if (fit_parse_conf(select, default_addr,
|
||||
&rd_addr, &fit_uname_config)) {
|
||||
debug("* ramdisk: config '%s' from image at "
|
||||
"0x%08lx\n",
|
||||
fit_uname_config, rd_addr);
|
||||
} else if (fit_parse_subimage(argv[2], default_addr,
|
||||
} else if (fit_parse_subimage(select, default_addr,
|
||||
&rd_addr, &fit_uname_ramdisk)) {
|
||||
debug("* ramdisk: subimage '%s' from image at "
|
||||
"0x%08lx\n",
|
||||
@@ -854,7 +857,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
rd_addr = simple_strtoul(argv[2], NULL, 16);
|
||||
rd_addr = simple_strtoul(select, NULL, 16);
|
||||
debug("* ramdisk: cmdline image address = "
|
||||
"0x%08lx\n",
|
||||
rd_addr);
|
||||
@@ -918,7 +921,10 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
|
||||
#endif
|
||||
default:
|
||||
#ifdef CONFIG_SUPPORT_RAW_INITRD
|
||||
if (argc >= 3 && (end = strchr(argv[2], ':'))) {
|
||||
end = NULL;
|
||||
if (select)
|
||||
end = strchr(select, ':');
|
||||
if (end) {
|
||||
rd_len = simple_strtoul(++end, NULL, 16);
|
||||
rd_data = rd_addr;
|
||||
} else
|
||||
|
Reference in New Issue
Block a user