sunxi: use boot source for determining environment location
authorAndre Przywara <andre.przywara@arm.com>
Tue, 11 Jan 2022 12:46:04 +0000 (12:46 +0000)
committerJagan Teki <jagan@amarulasolutions.com>
Thu, 10 Mar 2022 12:03:50 +0000 (17:33 +0530)
commite42dad4168fe7acae810f759078a8cdfe2cd9086
tree9ac33a519377ad5b2304f8a3a895124cccb5f154
parent2bdf213f915e29659b23844a2ef8105fbebd9566
sunxi: use boot source for determining environment location

Currently we only support to load the environment from raw MMC or FAT
locations on Allwinner boards. With the advent of SPI flash we probably
also want to support using the environment there, so we need to become
a bit more flexible.

Change the environment priority function to take the boot source into
account. When booted from eMMC or SD card, we use FAT or MMC, if
configured, as before.
If we are booted from SPI flash, we try to use the environment from
there, if possible. The same is true for NAND flash booting, although
this is somewhat theoretical right now (as untested).

This way we can use the same image for SD and SPI flash booting, which
allows us to simply copy a booted image from SD card to the SPI flash,
for instance.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
board/sunxi/board.c