Skip to contentSkip to conversation

riscv: sifive: fu540: Enable saving environment in MMC

PATCH New Bin Meng 2 participants 2 messages Jan 16, 2020 SiFive drivers

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 riscv: sifive: fu540: Enable saving environment in MMC

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.

---

 configs/sifive_fu540_defconfig | 2 ++
 include/configs/sifive-fu540.h | 2 ++
 2 files changed, 4 insertions(+)
configs/sifive_fu540_defconfig +2 -0
index 7d38ec9..6f9e619 100644
@@ -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
include/configs/sifive-fu540.h +2 -0
index 2756ed5..fb829be 100644
@@ -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)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 riscv: sifive: fu540: Enable saving environment in MMC

Quoted 6 lines · Bin Meng

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

Quoted 42 lines

---

 configs/sifive_fu540_defconfig | 2 ++
 include/configs/sifive-fu540.h | 2 ++
 2 files changed, 4 insertions(+)
configs/sifive_fu540_defconfig +2 -0
index 7d38ec9..6f9e619 100644
@@ -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
include/configs/sifive-fu540.h +2 -1
index 2756ed5..fb829be 100644
@@ -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