[PATCH v4 0/6] rockchip: puma-rk3399/ringneck-px30: fix check against value in default environment variable

Quentin Schulz foss+uboot at 0leil.net
Wed Jan 17 18:59:07 CET 2024


For puma-rk3399 and ringneck-px30, U-Boot proper automatically modifies
boot_targets to swap the order in which MMC storage media are used for
standard boot based on which MMC storage medium was used to load U-Boot
proper. This is however only done if the user has not changed it
manually, therefore a check between the default and current value is
done.

This used to work fine until the migration to standard boot where
boot_targets value size in the default environment went above the 32
characters that env_get_default function can return, thus resulting in a
truncated variable.

Therefore the check between default and current value would always fail.

By adding the env_get_default_into function, a buffer of the appropriate
size can be allocated on the stack to get the whole value of
boot_targets in the default environment and thus fixing the check.

While at it, simplify maintenance by putting this logic in a common file
and stop using hardcoded DT paths for MMC controllers and SPI flash
memory.

Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
---
Changes in v4:
- re-add board/theobroma-systems/puma_rk3399/puma-rk3399.c and
  board/theobroma-systems/ringneck_px30/ringneck-px30.c that somehow
  got deleted in v3,
- Link to v3: https://lore.kernel.org/r/20240117-env_default_theobroma-v3-0-316c25a6733f@theobroma-systems.com

Changes in v3:
- fix compilation issue when ENV_IS_IN_MMC is not selected (undefined
  CONFIG_SYS_MMC_ENV_DEV),
- Link to v2: https://lore.kernel.org/r/20231123-env_default_theobroma-v2-0-a80914c2c114@theobroma-systems.com

Changes in v2:
- added board/theobroma-systems/common putting all storage medium logic
  into a common file,
- adapted the storage medium logic to be device-agnostic,
- added Rbs
- removed patches surrounding all code by an ifndef CONFIG_SPL_BUILD and
  do this at the Makefile level of each board,
- Link to v1: https://lore.kernel.org/r/20231108-env_default_theobroma-v1-0-cb493bfdeffd@theobroma-systems.com

---
Quentin Schulz (6):
      rockchip: ringneck-px30: do not hardcode MMC controller paths
      rockchip: puma-rk3399: do not hardcode MMC controller paths
      rockchip: ringneck-px30/puma-rk3399: factor out storage medium selection
      env: allow to copy value from default environment into a buffer
      env: migrate env_get_default to call env_get_default_into
      rockchip: theobroma-systems: fix modified boot_targets detection

 board/theobroma-systems/common/common.c            | 151 +++++++++++++++++++++
 board/theobroma-systems/common/common.h            |  19 +++
 board/theobroma-systems/puma_rk3399/MAINTAINERS    |   1 +
 board/theobroma-systems/puma_rk3399/Makefile       |   3 +
 board/theobroma-systems/puma_rk3399/puma-rk3399.c  | 143 +------------------
 board/theobroma-systems/ringneck_px30/MAINTAINERS  |   1 +
 board/theobroma-systems/ringneck_px30/Makefile     |   3 +
 .../ringneck_px30/ringneck-px30.c                  | 142 +------------------
 env/common.c                                       |  16 ++-
 include/env.h                                      |  10 ++
 10 files changed, 203 insertions(+), 286 deletions(-)
---
base-commit: 106332d6cc583c4339e07020989d09b567900a59
change-id: 20231108-env_default_theobroma-33774a337fe6

Best regards,
-- 
Quentin Schulz <quentin.schulz at theobroma-systems.com>



More information about the U-Boot mailing list