Skip to contentSkip to conversation

Store default u-boot env in

PATCH In review Joel Stanley 2 participants 4 messages Jun 21, 2021 – Jul 8, 2021

Subsystems (2)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

v2 cover Store default u-boot env in

This patch adds the u-boot environment to the u-boot binary, and a build fix for the new configuration that I have also sent upstream.

v2 uses the latest boot commands from openbmc.

We currently rely on the default environment being populated in the image. This has the downside that if something corrupts the environment, the system won't know how to boot itself.

The ast2600_openbmc_mmc.txt is copied from meta-aspeed/recipes-bsp/u-boot/files/u-boot-env-ast2600.txt.

Adriana has indicated she will update openbmc to use the .txt from the u-boot tree to generate the filesystem image (or we could stop doing that, and simply use the default?).

Joel Stanley (2):
Makefile: Conditionally add defaultenv_h to envtools target
ast2600: Add environment for booting from mmc

 Makefile                                   |  2 ++
 board/aspeed/ast2600_openbmc_mmc.txt       | 11 +++++++++++
 configs/ast2600_openbmc_spl_emmc_defconfig |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt
Signature · 1 line
2.32.0
author maintainer
#1 lore raw

PATCH v2 1/2 Makefile: Conditionally add defaultenv_h to envtools target

When building the envtools target with CONFIG_USE_DEFAULT_ENV_FILE=y, the tools require generated/defaultenv_autogenerated.h.

In file included from tools/env/fw_env.c:126:
include/env_default.h:115:10: fatal error: generated/defaultenv_autogenerated.h: No such file or directory
115 | #include "generated/defaultenv_autogenerated.h"

       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)
Makefile +2 -0
index be0d9ea5c5bc..e1fa881b2aa4 100644
@@ -1581,6 +1581,8 @@ endif
 
 ifeq ($(CONFIG_USE_DEFAULT_ENV_FILE),y)
 prepare1: $(defaultenv_h)
+
+envtools: $(defaultenv_h)
 endif
 
 archprepare: prepare1 scripts_basic
Signature · 1 line
2.32.0
author maintainer
#2 lore raw

PATCH v2 2/2 ast2600: Add environment for booting from mmc

In reply to Joel Stanley

This adds the default environment from the OpenBMC project.

---
v2: Add latest environment from openbmc

---
 board/aspeed/ast2600_openbmc_mmc.txt       | 11 +++++++++++
 configs/ast2600_openbmc_spl_emmc_defconfig |  2 ++
 2 files changed, 13 insertions(+)
 create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt
board/aspeed/ast2600_openbmc_mmc.txt new file +11 -0
new file mode 100644
index 000000000000..15dd2f5227ee
@@ -0,0 +1,11 @@
+bootargs=console=ttyS4,115200n8
+boota=setenv bootpart 2; setenv rootfs rofs-a; run bootmmc
+bootb=setenv bootpart 3; setenv rootfs rofs-b; run bootmmc
+bootcmd=setenv origbootargs ${bootargs}; run bootconfcmd; run bootsidecmd
+bootconfcmd=if test ${fitconfig} -n; then setenv bootmconf "#${fitconfig}"; fi
+bootdelay=2
+bootmmc=run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm ${loadaddr}${bootmconf}; echo Error loading kernel FIT image with fitconfig ${fitconfig}; bootm ${loadaddr}; echo Error loading kernel FIT image
+bootside=a
+bootsidecmd=if test ${bootside} = b; then run bootb; run boota; else run boota; run bootb; fi
+loadaddr=0x83000000
+setmmcargs=setenv bootargs ${origbootargs} rootwait root=PARTLABEL=${rootfs}
configs/ast2600_openbmc_spl_emmc_defconfig +2 -0
index c5d03721c97a..344a4d8f9c96 100644
@@ -83,6 +83,8 @@ CONFIG_CMD_MTDPARTS=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_USE_DEFAULT_ENV_FILE=y
+CONFIG_DEFAULT_ENV_FILE="board/aspeed/ast2600_openbmc_mmc.txt"
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM=y
 CONFIG_REGMAP=y
Signature · 1 line
2.32.0
#3 lore raw
In reply to Joel Stanley
Quoted 4 lines · Joel Stanley

This patch adds the u-boot environment to the u-boot binary, and a build fix for the new configuration that I have also sent upstream.

Quoted 9 lines

v2 uses the latest boot commands from openbmc.

We currently rely on the default environment being populated in the image. This has the downside that if something corrupts the environment, the system won't know how to boot itself.

The ast2600_openbmc_mmc.txt is copied from meta-aspeed/recipes-bsp/u-boot/files/u-boot-env-ast2600.txt.

Just a note because I just stumbled on this, when these commits hit OpenBMC there will need to be an xxd-native package added as xxd is a build requirement for this.

Graeme

Quoted 17 lines

Adriana has indicated she will update openbmc to use the .txt from the u-boot tree to generate the filesystem image (or we could stop doing that, and simply use the default?).

Joel Stanley (2):
Makefile: Conditionally add defaultenv_h to envtools target
ast2600: Add environment for booting from mmc

 Makefile                                   |  2 ++
 board/aspeed/ast2600_openbmc_mmc.txt       | 11 +++++++++++
 configs/ast2600_openbmc_spl_emmc_defconfig |  2 ++
 3 files changed, 15 insertions(+)
 create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt
Signature · 1 line
2.32.0