[Bug 2080386] [NEW] Enable CONFIG_CMD_ERASEENV by default

Heinrich Schuchardt 2080386 at bugs.launchpad.net
Wed Sep 11 14:37:14 UTC 2024


Public bug reported:

How a board boots is defined by U-Boot environment variables.

If the environment never has been saved, the built in default will be
used. These defaults have been changing a lot especially in 2024.

If a user has saved the environment, he may end up in a situation where
booting does not work correctly anymore. E.g. I was not able to install
Jammy on an SiFive HiFive Unmatched board due to non-matching U-Boot
environment. On the StarFive JH7110 based boards the environment used by
vendor U-Boot are not compatible with upstream U-Boot.

A short term fix is using

env default -f -a
env save

to save the defaults to the environment store.

A better solution is to simply erase the environment to always the
default values. This can be done with the 'env erase' sub-command
enabled by CONFIG_CMD_ERASEENV.

Let us enable this for all RISC-V boards:

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 43f78a5aeb1..45fcf556a18 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -679,6 +679,7 @@ config CMD_SAVEENV
 config CMD_ERASEENV
        bool "eraseenv"
        depends on CMD_SAVEENV
+       default y if RISCV
        help
          Erase environment variables from the compiled-in persistent
          storage.

** Affects: u-boot (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to u-boot in Ubuntu.
https://bugs.launchpad.net/bugs/2080386

Title:
  Enable CONFIG_CMD_ERASEENV by default

Status in u-boot package in Ubuntu:
  New

Bug description:
  How a board boots is defined by U-Boot environment variables.

  If the environment never has been saved, the built in default will be
  used. These defaults have been changing a lot especially in 2024.

  If a user has saved the environment, he may end up in a situation
  where booting does not work correctly anymore. E.g. I was not able to
  install Jammy on an SiFive HiFive Unmatched board due to non-matching
  U-Boot environment. On the StarFive JH7110 based boards the
  environment used by vendor U-Boot are not compatible with upstream
  U-Boot.

  A short term fix is using

  env default -f -a
  env save

  to save the defaults to the environment store.

  A better solution is to simply erase the environment to always the
  default values. This can be done with the 'env erase' sub-command
  enabled by CONFIG_CMD_ERASEENV.

  Let us enable this for all RISC-V boards:

  diff --git a/cmd/Kconfig b/cmd/Kconfig
  index 43f78a5aeb1..45fcf556a18 100644
  --- a/cmd/Kconfig
  +++ b/cmd/Kconfig
  @@ -679,6 +679,7 @@ config CMD_SAVEENV
   config CMD_ERASEENV
          bool "eraseenv"
          depends on CMD_SAVEENV
  +       default y if RISCV
          help
            Erase environment variables from the compiled-in persistent
            storage.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/u-boot/+bug/2080386/+subscriptions




More information about the foundations-bugs mailing list