diff options
author | Samuel Holland | 2021-04-18 22:16:21 -0500 |
---|---|---|
committer | Andre Przywara | 2021-08-01 00:11:34 +0100 |
commit | 1011ebc72bda061cc9d34c1d6ff4506291a88657 (patch) | |
tree | cc6f21bcad1485023f6a5dafa7c2a428242506c4 /board | |
parent | 22ecb12132a2de80a08654f139ff978176034c38 (diff) |
sunxi: Select environment MMC based on boot device
Currently, the environment is always stored in eMMC if eMMC is enabled
in the config. This means images written to SD and eMMC will cross-
contaminate their environments unless the configuration is changed.
By dropping the device number from the environment location string and
implementing mmc_get_env_dev, we will always use the environment from
the boot device when booting from SD/eMMC.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'board')
-rw-r--r-- | board/sunxi/board.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 67acc01d83a..1a46100e408 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -636,6 +636,20 @@ int board_mmc_init(struct bd_info *bis) return 0; } + +#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 +int mmc_get_env_dev(void) +{ + switch (sunxi_get_boot_device()) { + case BOOT_DEVICE_MMC1: + return 0; + case BOOT_DEVICE_MMC2: + return 1; + default: + return CONFIG_SYS_MMC_ENV_DEV; + } +} +#endif #endif #ifdef CONFIG_SPL_BUILD |