[PATCH 2/2] ARM OMAP: add support for loading Environment from UBI

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 25 01:26:44 EDT 2013


On Fri, Jun 21, 2013 at 11:55:56AM +0200, Christoph Fritz wrote:
> This patch adds support to load environment from a static
> UBI volume.
> 
>  	if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
>  		int ret;
>  
> +		if (IS_ENABLED(CONFIG_ENVIRONMENT_IN_UBI)) {
> +#ifdef CONFIG_ENVIRONMENT_IN_UBI
> +			char s[PATH_MAX + 32];
> +			sprintf(s, "%s%s ", "ubiattach ",
> +				CONFIG_ENV_IN_UBI_PARTITION);
> +			ret = run_command(s, 0);
> +			if (ret) {
> +				sprintf(s, "%s%s ", "unable to ubiattach ",
> +					CONFIG_ENV_IN_UBI_PARTITION);
> +				pr_err(s);
> +			} else {
> +				default_environment_path =
> +					CONFIG_ENV_IN_UBI_VOLNAME;
> +			}
> +#endif

You shouldn't need the ifdef here aswell. Also this should be a helper
function called from board code rather than something in generic code.
You can also hardcode the volume name in board code, I don't think this
needs to be configurable.

Configurability of stuff like environment position always has a problem.
If it wasn't you who compiled a particular binary (or it even was you
and you can't remember), you don't know how the binary behaves. For
everything you hardcode the version printout in barebox will exactly
tell you the behaviour.

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