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

Quentin Schulz foss+uboot at 0leil.net
Wed Nov 8 15:20:29 CET 2023


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, only compile functions in the U-Boot boot phase they are
used in. This fixes an issue where BOOT_TARGETS constant isn't defined
in SPL or TPL and thus failing the build.

Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
---
Quentin Schulz (6):
      env: allow to copy value from default environment into a buffer
      env: migrate env_get_default to call env_get_default_into
      rockchip: puma-rk3399: only declare functions in U-Boot proper
      rockchip: ringneck-px30: only declare functions in U-Boot proper
      rockchip: puma-rk3399: fix modified boot_targets detection
      rockchip: ringneck-px30: fix modified boot_targets detection

 board/theobroma-systems/puma_rk3399/puma-rk3399.c     | 11 +++++++++--
 board/theobroma-systems/ringneck_px30/ringneck-px30.c | 11 +++++++++--
 env/common.c                                          | 16 +++++++++++++---
 include/env.h                                         | 10 ++++++++++
 4 files changed, 41 insertions(+), 7 deletions(-)
---
base-commit: e17d174773e9ba9447596708e702b7382e47a6cf
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