[U-Boot] [RFC][PATCH v4] bootm: Add sub commands

Kumar Gala galak at kernel.crashing.org
Mon Oct 13 20:27:46 CEST 2008


On Oct 8, 2008, at 8:48 PM, Jerry Van Baren wrote:

> Kumar Gala wrote:
>> * Use new find_cmd_tbl() to process sub-commands
>>
>> If this looks good I'll go ahead and clean it up for the other  
>> arches and OSes.
>
> Hi Kumar,
>
> Thanks to your sequence hint, interrupt command hint, and one  
> additional
> piece, I have this working now.
>
> The missing piece is reserving memory for the stack before copying the
> ramdisk to high mem.  It looks like this was lost when you  
> consolidated
> the machine-specific lib_*/bootm.c do_bootm_linux() functions into  
> one.
>  Without the reservation code, the copy overwrites the stack.
> Seriously bad karma.
>
> See below for a proof-of-concept hack.
>
>> ---
>> common/cmd_bootm.c |  142 ++++++++++++++++++++++++++++-
>> include/image.h    |   20 ++++-
>> lib_ppc/bootm.c    |  262 +++++++++++++++++++++++++++++++++ 
>> +------------------
>> 3 files changed, 330 insertions(+), 94 deletions(-)
>>
>> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
>> index 19257bb..e6dcb7a 100644
>> --- a/common/cmd_bootm.c
>> +++ b/common/cmd_bootm.c
>> @@ -34,6 +34,7 @@
>> #include <bzlib.h>
>> #include <environment.h>
>> #include <lmb.h>
>> +#include <linux/ctype.h>
>> #include <asm/byteorder.h>
>>
>> #if defined(CONFIG_CMD_USB)
>> @@ -273,7 +274,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int  
>> flag, int argc, char *argv[])
>> 	}
>>
>> 	images.os.start = (ulong)os_hdr;
>> -	images.valid = 1;
>> +	images.state = BOOTM_STATE_START;
>>
>> 	return 0;
>> }
>> @@ -376,6 +377,113 @@ static int bootm_load_os(image_info_t os,  
>> ulong *load_end, int boot_progress)
>> 	return 0;
>> }
>>
>> +/* we over load the cmd field with our state machine info instead  
>> of a
>> + * function pointer */
>
> Nitpick: comment format and s/over load/overload/
> /*
>  * We overload the cmd field with our state machine info instead of a
>  * function pointer
>  */

ack.

> [snip]
>
>> +int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc,  
>> char *argv[])
>> +{
>
> [snip]
>
>>

>> @@ -782,6 +907,21 @@ U_BOOT_CMD(
>> 	"\tUse iminfo command to get the list of existing component\n"
>> 	"\timages and configurations.\n"
>> #endif
>> +	"\nSub-commands to do part of the bootm sequence.  The sub- 
>> commands "
>> +	"must be\n"
>> +	"issued in the order below (its ok to not issue all sub-commands): 
>> \n"
>
> s/its/it's/  (contraction "it is", not possessive like "his")

ack

>
>
>> +	"\tstart [addr [arg ...]]\n"
>
> The following is more descriptive?
> 	start <os_addr> [(-|<ramdisk_addr>) [<fdt_addr>]]

nack.  I left this as is to match the bootm help

>> +	"\tloados  - load OS image\n"
>> +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) ||  
>> defined(CONFIG_SPARC)
>> +	"\tramdisk - relocate initrd, set env initrd_start/initrd_end\n"
>> +#endif
>> +#if defined(CONFIG_OF_LIBFDT)
>> +	"\tfdt     - relocate flat device tree\n"
>> +#endif
>> +	"\tbdt     - OS specific bd_t processing\n"
>> +	"\tcmdline - OS specific command line processing/setup\n"
>> +	"\tprepos  - OS specific prep before relocation or go\n"
>> +	"\tgo      - start OS\n"

- k


More information about the U-Boot mailing list