[U-Boot] [PATCH 2/6] env: ubi: support configurable VID offset

Heiko Schocher hs at denx.de
Tue Apr 30 04:57:05 UTC 2019


Hello Markus,

Am 15.04.2019 um 17:32 schrieb Markus Klotzbuecher:
> From: Hamish Guthrie <hamish.guthrie at kistler.com>

Please add a commit message.

> Signed-off-by: Hamish Guthrie <hamish.guthrie at kistler.com>
> Signed-off-by: Markus Klotzbuecher <markus.klotzbuecher at kistler.com>
> Cc: Heiko Schocher <hs at denx.de>
> Cc: Kyungmin Park <kmpark at infradead.org>
> ---
>   env/Kconfig |  6 ++++++
>   env/ubi.c   | 17 +++++++++++++----
>   2 files changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/env/Kconfig b/env/Kconfig
> index 44c47220c2..595b658c26 100644
> --- a/env/Kconfig
> +++ b/env/Kconfig
> @@ -519,6 +519,12 @@ config ENV_UBI_VOLUME_REDUND
>   	help
>   	  Name of the redundant volume that you want to store the environment in.
>   
> +config ENV_UBI_VID_OFFSET
> +	int "ubi environment VID offset"
> +	depends on ENV_IS_IN_UBI
> +	help
> +	  UBI VID offset for environment.
> +
>   endif
>   
>   config USE_DEFAULT_ENV_FILE
> diff --git a/env/ubi.c b/env/ubi.c
> index 1dfdf0a8c8..67379f2557 100644
> --- a/env/ubi.c
> +++ b/env/ubi.c
> @@ -15,6 +15,15 @@
>   #include <ubi_uboot.h>
>   #undef crc32
>   
> +#define _QUOTE(x) #x
> +#define QUOTE(x) _QUOTE(x)
> +
> +#ifdef CONFIG_ENV_UBI_VID_OFFSET
> + #define UBI_VID_OFFSET QUOTE(CONFIG_ENV_UBI_VID_OFFSET)
> +#else
> + #define UBI_VID_OFFSET NULL
> +#endif
> +
>   DECLARE_GLOBAL_DATA_PTR;
>   
>   #ifdef CONFIG_CMD_SAVEENV
> @@ -28,7 +37,7 @@ static int env_ubi_save(void)
>   	if (ret)
>   		return ret;
>   
> -	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
> +	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
>   		printf("\n** Cannot find mtd partition \"%s\"\n",
>   		       CONFIG_ENV_UBI_PART);
>   		return 1;
> @@ -70,7 +79,7 @@ static int env_ubi_save(void)
>   	if (ret)
>   		return ret;
>   
> -	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
> +	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
>   		printf("\n** Cannot find mtd partition \"%s\"\n",
>   		       CONFIG_ENV_UBI_PART);
>   		return 1;
> @@ -111,7 +120,7 @@ static int env_ubi_load(void)
>   	tmp_env1 = (env_t *)env1_buf;
>   	tmp_env2 = (env_t *)env2_buf;
>   
> -	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
> +	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
>   		printf("\n** Cannot find mtd partition \"%s\"\n",
>   		       CONFIG_ENV_UBI_PART);
>   		set_default_env(NULL, 0);
> @@ -148,7 +157,7 @@ static int env_ubi_load(void)
>   	 */
>   	memset(buf, 0x0, CONFIG_ENV_SIZE);
>   
> -	if (ubi_part(CONFIG_ENV_UBI_PART, NULL)) {
> +	if (ubi_part(CONFIG_ENV_UBI_PART, UBI_VID_OFFSET)) {
>   		printf("\n** Cannot find mtd partition \"%s\"\n",
>   		       CONFIG_ENV_UBI_PART);
>   		set_default_env(NULL, 0);
> 

Reviewed-by: Heiko Schocher <hs at denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list