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

Jerry Van Baren gvb.uboot at gmail.com
Thu Sep 18 01:57:39 CEST 2008


Kumar Gala wrote:
> Posting this again for discussion.  The two features I'm interested in
> enabling are:
> 
> * Having the ability to modify the device tree before its passed to
>   the kernel but after 'fdt boardsetup'
> 
> * Ability to do all setup but not actually jumping to the kernel.
>   (This is useful as a way to setup the memory image [kernel, ramdisk,
>    fdt, etc] for a different cpu than the boot one)
> 
> Having bootm sub-commands allows both of these as we can break up
> the sequeunce of steps that are part of the bootm process.
> 
> - k

Hi Kumar,

Looks like a good proposal.  I've been rather distracted the last couple 
of weeks, but I'll put some eyeball time and runtime on your changes.

[snip]

> +#if 0
> +are these really common ??? or is there any harm??
> +	/* bd_t setup */
> +	else if (argv[1][0] == 'p') {
> +	}

If we are using a FDT, there is no reason for a bd_t as part of the boot 
process.  I vote for removal.
   (typo s/p/b/?)

> +	/* cmd setup */
> +	else if (argv[1][0] == 'c') {
> +	}

I don't know what "cmd setup" is/was off-hand, have to look into that. 
Probably also a removal.

[snip]

> @@ -782,6 +883,17 @@ U_BOOT_CMD(
>  	"\tUse iminfo command to get the list of existing component\n"
>  	"\timages and configurations.\n"
>  #endif
> +	"\t\nSub-commands to do part of the bootm sequence:\n"
> +	"\tstart [addr [arg ...]]\n"
> +	"\tloados - load OS image\n"
> +	"\tprepos - OS specific prep before relocation or go\n"
> +#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
> +	"\tinitrd - relocate initrd, set env initrd_start/initrd_end\n"
> +#endif
> +#if defined(CONFIG_OF_LIBFDT)
> +	"\tfdt - relocate initrd\n"

Cut'n'paste? s/initrd/the flattened device tree/

[snip]

> diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
> index 38266e1..208ed3b 100644
> --- a/lib_ppc/bootm.c
> +++ b/lib_ppc/bootm.c
> @@ -47,6 +47,7 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> +extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
>  extern ulong get_effective_memsize(void);
>  static ulong get_sp (void);
>  static void set_clocks_in_mhz (bd_t *kbd);
> @@ -55,30 +56,78 @@ static void set_clocks_in_mhz (bd_t *kbd);
>  #define CFG_LINUX_LOWMEM_MAX_SIZE	(768*1024*1024)
>  #endif
>  
> -__attribute__((noinline))
> -int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
> +static void boot_jump_linux(bootm_headers_t *images)
>  {
> -	ulong	sp;
> -
> -	ulong	initrd_start, initrd_end;
> -	ulong	rd_len;
> -	ulong	size;
> -	phys_size_t bootm_size;
> -
> -	ulong	cmd_start, cmd_end, bootmap_base;
> -	bd_t	*kbd;
>  	void	(*kernel)(bd_t *, ulong r4, ulong r5, ulong r6,
>  			  ulong r7, ulong r8, ulong r9);
> -	int	ret;
> -	ulong	of_size = images->ft_len;
> -	struct lmb *lmb = &images->lmb;
> +
> +	kernel = (void (*)(bd_t *, ulong, ulong, ulong,
> +			   ulong, ulong, ulong))images->ep;
> +#ifdef CONFIG_OF_LIBFDT
> +	char *of_flat_tree = images->ft_addr;
> +#endif

This should be moved above the "kernel = " line to keep it with the rest 
of the declarations, yes?

[big snip]

Thanks!
gvb


More information about the U-Boot mailing list