env: CONFIG_DEFAULT_ENV_FILE and CFG_EXTRA_ENV_SETTINGS
Tony Dinh
mibodhi at gmail.com
Fri Jul 12 02:31:27 CEST 2024
Hi Tom,
On Thu, Jul 11, 2024 at 3:46 PM Tom Rini <trini at konsulko.com> wrote:
>
> On Thu, Jul 11, 2024 at 01:31:34PM -0700, Tony Dinh wrote:
> > Hi Tom,
> >
> > I'm trying to move some envs from a board header file to the default
> > env file. I recall that the envs in CONFIG_DEFAULT_ENV_FILE are
> > appended to the envs in CFG_EXTRA_ENV_SETTINGS. As you mentioned here
> > before:
> >
> > https://lore.kernel.org/all/20220810170439.GJ1146598@bill-the-cat/
> >
> > But it looks like envs in CFG_EXTRA_ENV_SETTINGS are completely
> > erased, and then the envs are populated with what's in
> > CONFIG_DEFAULT_ENV_FILE.
> >
> > Did I understand the usage correctly?
>
> Can you please post your I assume non-functioning-correctly patch? For
> example, dragonboard410c has both
> board/qualcomm/dragonboard410c/dragonboard410c.env and sets "#define
> CFG_EXTRA_ENV_SETTINGS BOOTENV" in
> include/configs/dragonboard410c.h
>
Here is the patch. Note that this patch depends on a previous patch
(irrelevant to this test):
https://patchwork.ozlabs.org/project/uboot/patch/20240708043904.5100-1-mibodhi@gmail.com/
diff --git a/board/Synology/ds414/ds414.env b/board/Synology/ds414/ds414.env
new file mode 100644
index 0000000000..03875e4e93
--- /dev/null
+++ b/board/Synology/ds414/ds414.env
@@ -0,0 +1,3 @@
+# Boot to original firmware if bootstd failed
+#
+bootcmd=bootflow scan -lb; run bootcmd_legacy
diff --git a/configs/ds414_defconfig b/configs/ds414_defconfig
index 6391c43474..9dd07f01c9 100644
--- a/configs/ds414_defconfig
+++ b/configs/ds414_defconfig
@@ -55,6 +55,8 @@ CONFIG_CMD_UBI=y
CONFIG_ENV_OVERWRITE=y
CONFIG_ENV_SPI_MAX_HZ=50000000
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="board/Synology/ds414/ds414.env"
CONFIG_ARP_TIMEOUT=200
CONFIG_NET_RETRY_COUNT=50
CONFIG_NET_RANDOM_ETHADDR=y
Now, I kwboot the newly built u-boot. In the serial console, I set the
envs to default expecting only the bootcmd is replaced. But all other
envs that were in CFG_EXTRA_ENV_SETTINGS got erased.
DS414> ver
U-Boot 2024.07-tld-1-g2b2b95c77b37-dirty (Jul 11 2024 - 17:10:09 -0700)
Synology DS214+/DS414 2/4-Bay Diskstation
DS414> env def -a
## Resetting to default environment
DS414> printenv
bootcmd=bootflow scan -lb; run bootcmd_legacy
Environment size: 47/65532 bytes
DS414>
All the best,
Tony
> --
> Tom
More information about the U-Boot
mailing list