On Thu, Dec 22, 2016 at 05:53:26AM +0800, Icenowy Zheng wrote: > Some board features different medias available for boot, for example, a > MicroSD slot and an eMMC or two MicroSD slots. > > Add an environment variable which indicates the boot media during boot, > so that the boot script can choose the kernel parameter, device tree > property, etc. according to this environment variable. > > Tested on Lichee Pi One, which features two MicroSD slots (MMC0 and > MMC2) > > Signed-off-by: Icenowy Zheng <icen...@aosc.xyz> > --- > board/sunxi/board.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/board/sunxi/board.c b/board/sunxi/board.c > index 53656383d5..81ca27e16b 100644 > --- a/board/sunxi/board.c > +++ b/board/sunxi/board.c > @@ -694,8 +694,26 @@ int misc_init_r(void) > /* determine if we are running in FEL mode */ > if (!is_boot0_magic(SPL_ADDR + 4)) { /* eGON.BT0 */ > setenv("fel_booted", "1"); > + setenv("boot_media", "fel"); > parse_spl_header(SPL_ADDR); > } > + else switch (readb(SPL_ADDR + 0x28)) { > + case SUNXI_BOOTED_FROM_MMC0: > + setenv("boot_media", "mmc0"); > + break; > + case SUNXI_BOOTED_FROM_NAND: > + setenv("boot_media", "nand"); > + break; > + case SUNXI_BOOTED_FROM_MMC2: > + setenv("boot_media", "mmc2"); > + break; > + case SUNXI_BOOTED_FROM_SPI: > + setenv("boot_media", "spi"); > + break; > + default: > + setenv("boot_media", "unknown"); > + break; > + }
There's really nothing really sunxi-specific about that. This is something that should be made generic, and is kind of redundant with spl_boot_device. I think a good solution could reuse that function to set that variable. Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
signature.asc
Description: PGP signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot