[PATCH] riscv: sifive: fu540: Enable saving environment in MMC

David Abdurachmanov david.abdurachmanov at gmail.com
Thu Jan 16 09:22:30 CET 2020


On Thu, Jan 16, 2020 at 9:21 AM Bin Meng <bmeng.cn at gmail.com> wrote:
>
> At present U-Boot environment is not saved so it's a little bit
> inconvenient if booting kernel via network as each time we need
> input the network environment variables from U-Boot shell.
>
> We already have the MMC support and let's enable saveenv with that.

Does this also mean we can use fw_setenv and fw_printenv from the
Linux user-space?
How does one need to format partitions / prepare uSD card for this?

Currently I have 4 GPT partitions:
- /boot (ext4)
- FSBL (raw)
- OpenSBI + U-Boot (raw)
- rootfs (ext4)

david

>
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
>
>  configs/sifive_fu540_defconfig | 2 ++
>  include/configs/sifive-fu540.h | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
> index 7d38ec9..6f9e619 100644
> --- a/configs/sifive_fu540_defconfig
> +++ b/configs/sifive_fu540_defconfig
> @@ -1,5 +1,6 @@
>  CONFIG_RISCV=y
>  CONFIG_ENV_SIZE=0x20000
> +CONFIG_ENV_OFFSET=0x1000000
>  CONFIG_NR_DRAM_BANKS=1
>  CONFIG_TARGET_SIFIVE_FU540=y
>  CONFIG_ARCH_RV64I=y
> @@ -11,5 +12,6 @@ CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00"
>  CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
>  CONFIG_OF_SEPARATE=y
> +CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>  CONFIG_DM_MTD=y
> diff --git a/include/configs/sifive-fu540.h b/include/configs/sifive-fu540.h
> index 2756ed5..fb829be 100644
> --- a/include/configs/sifive-fu540.h
> +++ b/include/configs/sifive-fu540.h
> @@ -24,6 +24,8 @@
>
>  /* Environment options */
>
> +#define CONFIG_SYS_MMC_ENV_DEV         0
> +
>  #define BOOT_TARGET_DEVICES(func) \
>         func(MMC, mmc, 0) \
>         func(DHCP, dhcp, na)
> --
> 2.7.4
>


More information about the U-Boot mailing list