All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in
@ 2021-06-18  2:47 Joel Stanley
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 1/2] Makefile: Conditionally add defaultenv_h to envtools target Joel Stanley
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Joel Stanley @ 2021-06-18  2:47 UTC (permalink / raw)
  To: openbmc, Eddie James, Adriana Kobylak; +Cc: Andrew Jeffery

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.

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.

The downside of this approach is we would need to keep the files in
sync, or change the yocto tooling so the in-flash environment is
generated from this copy.

Please respond with your thoughts on this approach.

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       | 9 +++++++++
 configs/ast2600_openbmc_spl_emmc_defconfig | 2 ++
 3 files changed, 13 insertions(+)
 create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt

-- 
2.32.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH u-boot v2019.04-aspeed-openbmc 1/2] Makefile: Conditionally add defaultenv_h to envtools target
  2021-06-18  2:47 [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Joel Stanley
@ 2021-06-18  2:47 ` Joel Stanley
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc Joel Stanley
  2021-06-18  4:12 ` [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Andrew Jeffery
  2 siblings, 0 replies; 10+ messages in thread
From: Joel Stanley @ 2021-06-18  2:47 UTC (permalink / raw)
  To: openbmc, Eddie James, Adriana Kobylak; +Cc: Andrew Jeffery

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"
       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Makefile b/Makefile
index be0d9ea5c5bc..e1fa881b2aa4 100644
--- a/Makefile
+++ b/Makefile
@@ -1581,6 +1581,8 @@ endif
 
 ifeq ($(CONFIG_USE_DEFAULT_ENV_FILE),y)
 prepare1: $(defaultenv_h)
+
+envtools: $(defaultenv_h)
 endif
 
 archprepare: prepare1 scripts_basic
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-18  2:47 [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Joel Stanley
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 1/2] Makefile: Conditionally add defaultenv_h to envtools target Joel Stanley
@ 2021-06-18  2:47 ` Joel Stanley
  2021-06-18  3:12   ` Lei Yu
  2021-06-18 15:51   ` Adriana Kobylak
  2021-06-18  4:12 ` [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Andrew Jeffery
  2 siblings, 2 replies; 10+ messages in thread
From: Joel Stanley @ 2021-06-18  2:47 UTC (permalink / raw)
  To: openbmc, Eddie James, Adriana Kobylak; +Cc: Andrew Jeffery

This adds the default environment from the OpenBMC project.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 board/aspeed/ast2600_openbmc_mmc.txt       | 9 +++++++++
 configs/ast2600_openbmc_spl_emmc_defconfig | 2 ++
 2 files changed, 11 insertions(+)
 create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt

diff --git a/board/aspeed/ast2600_openbmc_mmc.txt b/board/aspeed/ast2600_openbmc_mmc.txt
new file mode 100644
index 000000000000..47a474c92d70
--- /dev/null
+++ b/board/aspeed/ast2600_openbmc_mmc.txt
@@ -0,0 +1,9 @@
+bootargs=console=ttyS4,115200n8
+boota=setenv bootpart 2; setenv rootfs rofs-a; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
+bootb=setenv bootpart 3; setenv rootfs rofs-b; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
+bootcmd=if test "${bootside}" = "b"; then run bootb; run boota; else run boota; run bootb; fi
+bootdelay=2
+bootside=a
+loadaddr=0x83000000
+rootfs=rofs-a
+setmmcargs=setenv bootargs ${bootargs} rootwait root=PARTLABEL=${rootfs}
diff --git a/configs/ast2600_openbmc_spl_emmc_defconfig b/configs/ast2600_openbmc_spl_emmc_defconfig
index c5d03721c97a..344a4d8f9c96 100644
--- a/configs/ast2600_openbmc_spl_emmc_defconfig
+++ b/configs/ast2600_openbmc_spl_emmc_defconfig
@@ -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
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc Joel Stanley
@ 2021-06-18  3:12   ` Lei Yu
  2021-06-21  6:17     ` Joel Stanley
  2021-06-18 15:51   ` Adriana Kobylak
  1 sibling, 1 reply; 10+ messages in thread
From: Lei Yu @ 2021-06-18  3:12 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Andrew Jeffery, openbmc, Adriana Kobylak, Eddie James

On Fri, Jun 18, 2021 at 10:49 AM Joel Stanley <joel@jms.id.au> wrote:
>
> This adds the default environment from the OpenBMC project.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
>  board/aspeed/ast2600_openbmc_mmc.txt       | 9 +++++++++
>  configs/ast2600_openbmc_spl_emmc_defconfig | 2 ++
>  2 files changed, 11 insertions(+)
>  create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt
>
> diff --git a/board/aspeed/ast2600_openbmc_mmc.txt b/board/aspeed/ast2600_openbmc_mmc.txt
> new file mode 100644
> index 000000000000..47a474c92d70
> --- /dev/null
> +++ b/board/aspeed/ast2600_openbmc_mmc.txt
> @@ -0,0 +1,9 @@
> +bootargs=console=ttyS4,115200n8
> +boota=setenv bootpart 2; setenv rootfs rofs-a; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
> +bootb=setenv bootpart 3; setenv rootfs rofs-b; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
> +bootcmd=if test "${bootside}" = "b"; then run bootb; run boota; else run boota; run bootb; fi
> +bootdelay=2
> +bootside=a
> +loadaddr=0x83000000
> +rootfs=rofs-a
> +setmmcargs=setenv bootargs ${bootargs} rootwait root=PARTLABEL=${rootfs}
> diff --git a/configs/ast2600_openbmc_spl_emmc_defconfig b/configs/ast2600_openbmc_spl_emmc_defconfig
> index c5d03721c97a..344a4d8f9c96 100644
> --- a/configs/ast2600_openbmc_spl_emmc_defconfig
> +++ b/configs/ast2600_openbmc_spl_emmc_defconfig
> @@ -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"

This is good, we hit an issue before that is related to the default
env not in the flash.
Could you kindly help to make the same change for other configs?
E.g. for ast2500/ast2600 evb config.

>  CONFIG_NET_RANDOM_ETHADDR=y
>  CONFIG_SPL_DM=y
>  CONFIG_REGMAP=y
> --
> 2.32.0
>


-- 
BRs,
Lei YU

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in
  2021-06-18  2:47 [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Joel Stanley
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 1/2] Makefile: Conditionally add defaultenv_h to envtools target Joel Stanley
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc Joel Stanley
@ 2021-06-18  4:12 ` Andrew Jeffery
  2021-06-18 15:56   ` Adriana Kobylak
  2 siblings, 1 reply; 10+ messages in thread
From: Andrew Jeffery @ 2021-06-18  4:12 UTC (permalink / raw)
  To: Joel Stanley, openbmc, Eddie James, Adriana Kobylak



On Fri, 18 Jun 2021, at 12:17, Joel Stanley wrote:
> 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.
> 
> 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.
> 
> The downside of this approach is we would need to keep the files in
> sync, or change the yocto tooling so the in-flash environment is
> generated from this copy.

I think we just go ahead with your approach here until such time that we get sick of having to manually fix things up. When we get sick of it we figure out how we want to solve the synchronisation problem. What you have here is at least a step in the right direction.

Andrew

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc Joel Stanley
  2021-06-18  3:12   ` Lei Yu
@ 2021-06-18 15:51   ` Adriana Kobylak
  2021-06-21  6:18     ` Joel Stanley
  1 sibling, 1 reply; 10+ messages in thread
From: Adriana Kobylak @ 2021-06-18 15:51 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Andrew Jeffery, OpenBMC, Adriana Kobylak, Eddie James

[-- Attachment #1: Type: text/plain, Size: 2258 bytes --]

Thanks Joel! There are some improvements to the boot command proposed here: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/41778 <https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/41778>
Maybe we pick those changes up in this initial commit so the two environment files are in sync? Otherwise we can submit a follow-up patch latest to update this .txt file.


> On Jun 17, 2021, at 9:47 PM, Joel Stanley <joel@jms.id.au> wrote:
> 
> This adds the default environment from the OpenBMC project.
> 
> Signed-off-by: Joel Stanley <joel@jms.id.au>

Reviewed-by: Adriana Kobylak <anoo@us.ibm.com>

> ---
> board/aspeed/ast2600_openbmc_mmc.txt       | 9 +++++++++
> configs/ast2600_openbmc_spl_emmc_defconfig | 2 ++
> 2 files changed, 11 insertions(+)
> create mode 100644 board/aspeed/ast2600_openbmc_mmc.txt
> 
> diff --git a/board/aspeed/ast2600_openbmc_mmc.txt b/board/aspeed/ast2600_openbmc_mmc.txt
> new file mode 100644
> index 000000000000..47a474c92d70
> --- /dev/null
> +++ b/board/aspeed/ast2600_openbmc_mmc.txt
> @@ -0,0 +1,9 @@
> +bootargs=console=ttyS4,115200n8
> +boota=setenv bootpart 2; setenv rootfs rofs-a; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
> +bootb=setenv bootpart 3; setenv rootfs rofs-b; run setmmcargs; ext4load mmc 0:${bootpart} ${loadaddr} fitImage && bootm; echo Error loading kernel FIT image
> +bootcmd=if test "${bootside}" = "b"; then run bootb; run boota; else run boota; run bootb; fi
> +bootdelay=2
> +bootside=a
> +loadaddr=0x83000000
> +rootfs=rofs-a
> +setmmcargs=setenv bootargs ${bootargs} rootwait root=PARTLABEL=${rootfs}
> diff --git a/configs/ast2600_openbmc_spl_emmc_defconfig b/configs/ast2600_openbmc_spl_emmc_defconfig
> index c5d03721c97a..344a4d8f9c96 100644
> --- a/configs/ast2600_openbmc_spl_emmc_defconfig
> +++ b/configs/ast2600_openbmc_spl_emmc_defconfig
> @@ -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
> -- 
> 2.32.0
> 


[-- Attachment #2: Type: text/html, Size: 3402 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in
  2021-06-18  4:12 ` [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Andrew Jeffery
@ 2021-06-18 15:56   ` Adriana Kobylak
  0 siblings, 0 replies; 10+ messages in thread
From: Adriana Kobylak @ 2021-06-18 15:56 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: OpenBMC, Adriana Kobylak, Eddie James

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]



> On Jun 17, 2021, at 11:12 PM, Andrew Jeffery <andrew@aj.id.au> wrote:
> 
> 
> 
> On Fri, 18 Jun 2021, at 12:17, Joel Stanley wrote:
>> 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.
>> 
>> 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.
>> 
>> The downside of this approach is we would need to keep the files in
>> sync, or change the yocto tooling so the in-flash environment is
>> generated from this copy.
> 
> I think we just go ahead with your approach here until such time that we get sick of having to manually fix things up. When we get sick of it we figure out how we want to solve the synchronisation problem. What you have here is at least a step in the right direction.

Agree we should get this change in, maintaining two files is a small price for being able to boot the BMC if the environment gets corrupted.
The u—boot recipe u-boot-aspeed-sdk_2019.04.bb is the one that installs the txt file into the environment partition, so I’d think it could grab the txt file from the u-boot source code instead. I’ll look at that after the u-boot changes are merged.


> 
> Andrew


[-- Attachment #2: Type: text/html, Size: 5766 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-18  3:12   ` Lei Yu
@ 2021-06-21  6:17     ` Joel Stanley
  2021-06-21  7:33       ` Lei Yu
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Stanley @ 2021-06-21  6:17 UTC (permalink / raw)
  To: Lei Yu; +Cc: Andrew Jeffery, openbmc, Adriana Kobylak, Eddie James

On Fri, 18 Jun 2021 at 03:12, Lei Yu <yulei.sh@bytedance.com> wrote:
>
> On Fri, Jun 18, 2021 at 10:49 AM Joel Stanley <joel@jms.id.au> wrote:
> >
> > This adds the default environment from the OpenBMC project.

> > +CONFIG_DEFAULT_ENV_FILE="board/aspeed/ast2600_openbmc_mmc.txt"
>
> This is good, we hit an issue before that is related to the default
> env not in the flash.
> Could you kindly help to make the same change for other configs?
> E.g. for ast2500/ast2600 evb config.

That's a good idea.

Do you use the mmc or nor flash to boot the ast2600 evb?

For the ast2500, the existing built-in config should work, as long as
it's pointing to the correct flash offset. If it's not, then we can
either update the existing bootcmd, or add a .txt with the desired
config.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-18 15:51   ` Adriana Kobylak
@ 2021-06-21  6:18     ` Joel Stanley
  0 siblings, 0 replies; 10+ messages in thread
From: Joel Stanley @ 2021-06-21  6:18 UTC (permalink / raw)
  To: Adriana Kobylak; +Cc: Andrew Jeffery, OpenBMC, Adriana Kobylak, Eddie James

On Fri, 18 Jun 2021 at 15:52, Adriana Kobylak <anoo@linux.ibm.com> wrote:
>
> Thanks Joel! There are some improvements to the boot command proposed here: https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/41778
> Maybe we pick those changes up in this initial commit so the two environment files are in sync? Otherwise we can submit a follow-up patch latest to update this .txt file.

I didn't want to merge that change as it adds yet another command to
the environment. However, I don't have a suggestion on how to change
it, so I have merged it. I'll send a v2 of this patch set with the
latest commands.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc
  2021-06-21  6:17     ` Joel Stanley
@ 2021-06-21  7:33       ` Lei Yu
  0 siblings, 0 replies; 10+ messages in thread
From: Lei Yu @ 2021-06-21  7:33 UTC (permalink / raw)
  To: Joel Stanley; +Cc: Andrew Jeffery, openbmc, Adriana Kobylak, Eddie James

On Mon, Jun 21, 2021 at 2:17 PM Joel Stanley <joel@jms.id.au> wrote:
>
> On Fri, 18 Jun 2021 at 03:12, Lei Yu <yulei.sh@bytedance.com> wrote:
> >
> > On Fri, Jun 18, 2021 at 10:49 AM Joel Stanley <joel@jms.id.au> wrote:
> > >
> > > This adds the default environment from the OpenBMC project.
>
> > > +CONFIG_DEFAULT_ENV_FILE="board/aspeed/ast2600_openbmc_mmc.txt"
> >
> > This is good, we hit an issue before that is related to the default
> > env not in the flash.
> > Could you kindly help to make the same change for other configs?
> > E.g. for ast2500/ast2600 evb config.
>
> That's a good idea.
>
> Do you use the mmc or nor flash to boot the ast2600 evb?

We use 64M nor flash on ast2600

>
> For the ast2500, the existing built-in config should work, as long as
> it's pointing to the correct flash offset. If it's not, then we can
> either update the existing bootcmd, or add a .txt with the desired
> config.

On ast2500, we hit an issue that is described in the below Discord thread.
https://discord.com/channels/775381525260664832/775381525260664836/847735311290073108
Basically it's related to the default env in the u-boot code is not
sync with the u-boot-env partition.

-- 
BRs,
Lei YU

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-06-21  7:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  2:47 [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Joel Stanley
2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 1/2] Makefile: Conditionally add defaultenv_h to envtools target Joel Stanley
2021-06-18  2:47 ` [PATCH u-boot v2019.04-aspeed-openbmc 2/2] ast2600: Add environment for booting from mmc Joel Stanley
2021-06-18  3:12   ` Lei Yu
2021-06-21  6:17     ` Joel Stanley
2021-06-21  7:33       ` Lei Yu
2021-06-18 15:51   ` Adriana Kobylak
2021-06-21  6:18     ` Joel Stanley
2021-06-18  4:12 ` [PATCH u-boot v2019.04-aspeed-openbmc 0/2] Store default u-boot env in Andrew Jeffery
2021-06-18 15:56   ` Adriana Kobylak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.