[PATCH 01/12] env: Complete generic support for writable list

Marek Vasut marex at denx.de
Sun May 29 03:46:14 CEST 2022


On 5/28/22 15:02, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka at siemens.com>
> 
> This completes what 890feecaab72 started by selecting ENV_APPEND and
> ENV_IS_NOWHERE and by moving this driver to top if the list. This

s at if the list at of the list@

> ensures that load operations pick up both the default env and the
> permitted parts of the next-prio location. When writing though, we must
> not use NOWHERE and rather need to forward directly to the first
> external location.

Isn't the env load order a board-specific setting ?

> With this change, boards only need to define the list of writable
> variables but no longer have to provide a custom env_get_location
> implementation.

This also brings in a lot of ifdeffery and extra complexity. If you 
implement this as a board-specific env_get_location() override, you can 
avoid that. Try:

enum env_location env_get_location(enum env_operation op, int prio)
{
          if (op == ENVOP_SAVE) {
                  if (prio == 0)
                          return ENVL_SPI_FLASH;
          } else {
                  if (prio == 0)
                          return ENVL_NOWHERE;
                  if (prio == 1)
                          return ENVL_SPI_FLASH;
          }

          return ENVL_UNKNOWN;
}


More information about the U-Boot mailing list