[U-Boot] [PATCH 3/5] smart-gateway-mt7688: Correct build time check for overwriting factory data

Stefan Roese sr at denx.de
Thu Nov 14 16:50:19 UTC 2019


Hi Tom,

On 14.11.19 15:54, Tom Rini wrote:
> The board file has a build time check to ensure that we do not have the
> redundant environment overwriting the factory data.  However,
> multiplying the redundant offset by two isn't correct.  Since we
> correctly confirm that U-Boot itself will not go in to the primary
> environment we only need to next make sure that the redundant
> environment + the size of that does not exceed where the factory data
> is.
> 
> Cc: Stefan Roese <sr at denx.de>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>   board/gardena/smart-gateway-mt7688/board.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
> index 7b9570714342..e9ffd42a8a68 100644
> --- a/board/gardena/smart-gateway-mt7688/board.c
> +++ b/board/gardena/smart-gateway-mt7688/board.c
> @@ -18,7 +18,7 @@
>   
>   #define FACTORY_DATA_OFFS	0xc0000
>   #define FACTORY_DATA_SECT_SIZE	0x10000
> -#if ((CONFIG_ENV_OFFSET_REDUND * 2) > FACTORY_DATA_OFFS)
> +#if ((CONFIG_ENV_OFFSET_REDUND + CONFIG_ENV_SIZE) > FACTORY_DATA_OFFS)
>   #error "U-Boot image with environment too big (overlapping with factory-data)!"
>   #endif
>   #define FACTORY_DATA_USER_OFFS	0x140

Hmmm, the change looks good from looking at your patch and I was
wondering why I did insert such a broken check here. But when looking
at the current mainline code, this is what the code looks like:

#define FACTORY_DATA_OFFS	0xc0000
#define FACTORY_DATA_SECT_SIZE	0x10000
#if ((CONFIG_ENV_OFFSET_REDUND + CONFIG_ENV_SIZE_REDUND) > FACTORY_DATA_OFFS)
#error "U-Boot image with environment too big (overlapping with factory-data)!"
#endif

So its already correct in mainline (current master). I'm wondering on
which git repository you based your patch upon?

Thanks,
Stefan


More information about the U-Boot mailing list