From db1098b38f654519a2cea86673b6696d424b262f Mon Sep 17 00:00:00 2001
From: Leif Lindholm <leif.lindholm@linaro.org>
Date: Fri, 8 Aug 2014 16:36:30 +0100
Subject: [PATCH] Hack to build MLO for UEFI on BeagleBoneBlack

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
---
 arch/arm/cpu/armv7/omap-common/boot-common.c |    4 ++++
 boards.cfg                                   |    1 +
 include/configs/am335x_evm.h                 |    2 ++
 include/configs/ti_armv7_common.h            |    4 ++++
 4 files changed, 11 insertions(+)

diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 3033564..e5789d0 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -80,7 +80,11 @@ u32 spl_boot_mode(void)
 	u32 val = gd->arch.omap_boot_params.omap_bootmode;
 
 	if (val == MMCSD_MODE_RAW)
+#ifndef CONFIG_UEFI_BOOT
 		return MMCSD_MODE_RAW;
+#else
+		return MMCSD_MODE_FAT;
+#endif
 	else if (val == MMCSD_MODE_FAT)
 		return MMCSD_MODE_FAT;
 	else
diff --git a/boards.cfg b/boards.cfg
index 1ba2081..2a34b6b 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -279,6 +279,7 @@ Active  arm         armv7          am33xx      ti              am335x
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_uart4                      am335x_evm:SERIAL5,CONS_INDEX=5,NAND                                                                                              Tom Rini <trini@ti.com>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_uart5                      am335x_evm:SERIAL6,CONS_INDEX=6,NAND                                                                                              Tom Rini <trini@ti.com>
 Active  arm         armv7          am33xx      ti              am335x              am335x_evm_usbspl                     am335x_evm:SERIAL1,CONS_INDEX=1,NAND,SPL_USBETH_SUPPORT                                                                           Tom Rini <trini@ti.com>
+Active  arm         armv7          am33xx      ti              am335x              am335x_evm_uefi                       am335x_evm:SERIAL1,CONS_INDEX=1,NAND,UEFI_BOOT                                                                                    Leif Lindholm <leif.lindholm@linaro.org>
 Active  arm         armv7          am33xx      ti              am43xx              am43xx_evm                            am43xx_evm:SERIAL1,CONS_INDEX=1                                                                                                   Lokesh Vutla <lokeshvutla@ti.com>
 Active  arm         armv7          am33xx      ti              am43xx              am43xx_evm_qspiboot                   am43xx_evm:SERIAL1,CONS_INDEX=1,QSPI,QSPI_BOOT                                                                                    Lokesh Vutla <lokeshvutla@ti.com>
 Active  arm         armv7          am33xx      ti              ti814x              ti814x_evm                            -                                                                                                                                 Matt Porter <matt.porter@linaro.org>
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index a48b386..604bbbc 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -306,9 +306,11 @@
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)
 /* disable host part of MUSB in SPL */
 #undef CONFIG_MUSB_HOST
+#ifndef CONFIG_UEFI_BOOT
 /* disable EFI partitions and partition UUID support */
 #undef CONFIG_PARTITION_UUIDS
 #undef CONFIG_EFI_PARTITION
+#endif
 /*
  * Disable CPSW SPL support so we fit within the 101KiB limit.
  */
diff --git a/include/configs/ti_armv7_common.h b/include/configs/ti_armv7_common.h
index 6e0bf09..4dc86fe 100644
--- a/include/configs/ti_armv7_common.h
+++ b/include/configs/ti_armv7_common.h
@@ -231,7 +231,11 @@
 
 /* FAT sd card locations. */
 #define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION	1
+#ifndef CONFIG_UEFI_BOOT
 #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME	"u-boot.img"
+#else
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME	"boot.img"
+#endif
 
 #ifdef CONFIG_SPL_OS_BOOT
 /* FAT */
-- 
1.7.10.4

