[PATCH 4/5] ds414: Auto-populate env if appropriate

Stefan Roese sr at denx.de
Thu Mar 4 14:06:01 CET 2021


On 03.03.21 01:55, Phil Sutter wrote:
> Define a misc_init_r() which calls "syno populate_env" if the
> environment seems incomplete (or default), indicated by missing
> "ethaddr" variable. With this in place, no random MAC address fallback
> is needed anymore.
> 
> Signed-off-by: Phil Sutter <phil at nwl.cc>
> ---
>   board/Synology/ds414/cmd_syno.c |  2 +-
>   board/Synology/ds414/ds414.c    | 13 +++++++++++++
>   configs/ds414_defconfig         |  4 +---
>   3 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
> index a120c3123ffb3..07bb395da3acc 100644
> --- a/board/Synology/ds414/cmd_syno.c
> +++ b/board/Synology/ds414/cmd_syno.c
> @@ -22,7 +22,7 @@
>   #define SYNO_CHKSUM_TAG		"CHK="
>   
>   
> -static int do_syno_populate(int argc, char *const argv[])
> +int do_syno_populate(int argc, char *const argv[])
>   {
>   	unsigned int bus = CONFIG_SF_DEFAULT_BUS;
>   	unsigned int cs = CONFIG_SF_DEFAULT_CS;
> diff --git a/board/Synology/ds414/ds414.c b/board/Synology/ds414/ds414.c
> index 9c4ce670ddfbd..c2469d6665255 100644
> --- a/board/Synology/ds414/ds414.c
> +++ b/board/Synology/ds414/ds414.c
> @@ -179,6 +179,19 @@ int board_init(void)
>   	return 0;
>   }
>   
> +#ifndef CONFIG_SPL_BUILD
> +int do_syno_populate(int argc, char *const argv[]);

I suspect that this prototype in a C file will trigger at least a
checkpatch warning?

Other than that:

Reviewed-by: Stefan Roese <sr at denx.de>

Thanks,
Stefan


> +
> +int misc_init_r(void)
> +{
> +	if (!env_get("ethaddr")) {
> +		puts("Incomplete environment, populating from SPI flash\n");
> +		do_syno_populate(0, NULL);
> +	}
> +	return 0;
> +}
> +#endif
> +
>   int checkboard(void)
>   {
>   	puts("Board: DS414\n");
> diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig
> index fa9366778748c..948b22f3d1f66 100644
> --- a/configs/ds414_defconfig
> +++ b/configs/ds414_defconfig
> @@ -21,10 +21,9 @@ CONFIG_DEBUG_UART=y
>   CONFIG_BOOTDELAY=3
>   CONFIG_USE_BOOTARGS=y
>   CONFIG_BOOTARGS="console=ttyS0,115200 ip=off initrd=0x8000040,8M root=/dev/md0 rw syno_hw_version=DS414r1 ihd_num=4 netif_num=2 flash_size=8 SataLedSpecial=1 HddHotplug=1"
> -CONFIG_USE_PREBOOT=y
> -CONFIG_PREBOOT="usb start; sf probe"
>   # CONFIG_DISPLAY_BOARDINFO is not set
>   CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_MISC_INIT_R=y
>   CONFIG_SPL_I2C_SUPPORT=y
>   # CONFIG_CMD_FLASH is not set
>   CONFIG_CMD_I2C=y
> @@ -47,7 +46,6 @@ CONFIG_ENV_OVERWRITE=y
>   CONFIG_USE_ENV_SPI_MAX_HZ=y
>   CONFIG_ENV_SPI_MAX_HZ=50000000
>   CONFIG_SYS_RELOC_GD_ENV_ADDR=y
> -CONFIG_NET_RANDOM_ETHADDR=y
>   CONFIG_SPL_OF_TRANSLATE=y
>   CONFIG_BLK=y
>   # CONFIG_MMC is not set
> 


Viele Grüße,
Stefan

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


More information about the U-Boot mailing list