[PATCH 1/7] arm: export arch_number to env

Sascha Hauer s.hauer at pengutronix.de
Mon Sep 19 05:14:46 EDT 2011


On Fri, Sep 16, 2011 at 02:23:42PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> so we can dynamise the boot depending on the machine
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
>  arch/arm/lib/armlinux.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
> index 5bdbb92..9f2ecd2 100644
> --- a/arch/arm/lib/armlinux.c
> +++ b/arch/arm/lib/armlinux.c
> @@ -184,9 +184,16 @@ void armlinux_set_bootparams(void *params)
>  	armlinux_bootparams = params;
>  }
>  
> +static char *arch_number;
> +
>  void armlinux_set_architecture(int architecture)
>  {
>  	armlinux_architecture = architecture;
> +
> +	kfree(arch_number);
> +	arch_number = asprintf("%d", architecture);
> +	setenv("arch_number", arch_number);
> +	export("arch_number");
>  }

like this please:

void armlinux_set_architecture(int architecture)
{
	char *arch_number = asprintf("%d", architecture);

	armlinux_architecture = architecture;
	setenv("arch_number", arch_number);
	export("arch_number");

	free(arch_number);
}

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list