summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2019-05-31 23:45:25 +0900
committerDongjin Kim <tobetter@hardkernel.com>2019-06-24 22:38:13 +0900
commitc157d5685b0faf44a349993c3b92f8597c8dadd6 (patch)
tree4ef926d9a663f274decace7f4fb5fc2365e94171
parentce0a42b84fb255818ec281ba8199da842d80d4a5 (diff)
downloadu-boot-odroid-c1-c157d5685b0faf44a349993c3b92f8597c8dadd6.tar.gz
ODROID-C3/N2: refactoring the boot devices, scripts and order
This patch is to refactor the boot method defining the boot command per device type, mmc/usb/spi/misc, and boot scripts, boot.ini/boot.scr. Also, they can be customized its order by device types and device number. Boot order per devices can be defined by 'boot_order'; boot_order="mmc rawimage usb pxe spi" In case multiple devices can be existed, they can be order by the device numbers. For example; mmc_list="0 1" usb_list="0 1 2 3" Change-Id: I3a0fad4915a4beb2039d1a1f087e99c91e3e5a31 Signed-off-by: Dongjin Kim <tobetter@gmail.com>
-rw-r--r--board/hardkernel/odroidn2/odroidn2.c2
-rw-r--r--include/configs/odroid-g12-common.h55
2 files changed, 40 insertions, 17 deletions
diff --git a/board/hardkernel/odroidn2/odroidn2.c b/board/hardkernel/odroidn2/odroidn2.c
index 30b7b69386..6e24402c7b 100644
--- a/board/hardkernel/odroidn2/odroidn2.c
+++ b/board/hardkernel/odroidn2/odroidn2.c
@@ -394,7 +394,7 @@ int board_late_init(void)
if (get_boot_device() == BOOT_DEVICE_SPI) {
setenv("bootdelay", "0");
- setenv("bootcmd", "run booting_from_spi");
+ setenv("bootcmd", "run boot_spi");
}
usbhost_early_poweron();
diff --git a/include/configs/odroid-g12-common.h b/include/configs/odroid-g12-common.h
index 86f8122c46..4c0ab8c522 100644
--- a/include/configs/odroid-g12-common.h
+++ b/include/configs/odroid-g12-common.h
@@ -92,34 +92,60 @@
#define ENV_MMC_LIST_DEFAULT "mmc_list=0 1\0"
+#define ENV_USB_LIST_DEFAULT "usb_list=0 1 2 3\0"
+
+#define ENV_BOOT_ORDER_DEFAULT "boot_order=mmc rawimage usb pxe spi\0"
+
+#define ENV_BOOTSCRIPTS_DEFAULT "boot_scripts=boot.ini boot.scr\0"
+
+#define ENV_BOOT_ATTEMPT_DEFAULT \
+ "boot_attempt=" \
+ "for script in ${boot_scripts}; do " \
+ "echo \"## Attempting fetch ${script} in ${devtype}:${devnum}...\"; " \
+ "load ${devtype} ${devnum} ${preloadaddr} ${script}; " \
+ "source ${preloadaddr}; " \
+ "done\0"
+
+
#define ENV_MMC_DEFAULT \
"boot_mmc=" \
"setenv devtype mmc; " \
- "for n in ${mmc_list}; do " \
+ "for n in ${mmc_list}; do " \
"setenv devnum ${n}; " \
"setenv devno ${n}; " \
"setenv mmc_dev ${n}; " \
- "cfgload; " \
+ "run boot_attempt; " \
"done\0"
-#define ENV_MMC_BOOT_DISTRO \
- "boot_mmc_distro=" \
- "setenv devtype mmc; " \
- "for n in ${mmc_list}; do " \
+#define ENV_USB_DEFAULT \
+ "boot_usb=" \
+ "usb start; " \
+ "setenv devtype usb; " \
+ "for n in ${usb_list}; do " \
"setenv devnum ${n}; " \
"setenv devno ${n}; " \
"setenv mmc_dev ${n}; " \
- "load mmc ${n} ${preloadaddr} boot.scr; " \
- "source ${preloadaddr}; " \
- "done\0" \
+ "run boot_attempt; " \
+ "done\0"
+
+#define ENV_BOOT_DEFAULT \
+ "boot_default=" \
+ "for devtype in ${boot_order}; do " \
+ "run boot_${devtype}; " \
+ "done\0"
/* args/envs */
#define CONFIG_SYS_MAXARGS 64
#define CONFIG_EXTRA_ENV_SETTINGS \
ENV_PXE_DEFAULT \
ENV_MMC_DEFAULT \
- ENV_MMC_BOOT_DISTRO \
ENV_MMC_LIST_DEFAULT \
+ ENV_USB_DEFAULT \
+ ENV_USB_LIST_DEFAULT \
+ ENV_BOOTSCRIPTS_DEFAULT \
+ ENV_BOOT_ORDER_DEFAULT \
+ ENV_BOOT_DEFAULT \
+ ENV_BOOT_ATTEMPT_DEFAULT \
"console=" CONFIG_DEFAULT_CONSOLE \
"loadaddr=1080000\0"\
"outputmode=1080p60hz\0" \
@@ -177,7 +203,8 @@
"booti ${loadaddr} - ${dtb_mem_addr}; " \
"bootm;" \
"done\0" \
- "boot_rawimage=setenv bootargs ${initargs} logo=${display_layer},loaded,${fb_addr} " \
+ "boot_rawimage=" \
+ "setenv bootargs ${initargs} logo=${display_layer},loaded,${fb_addr} " \
"vout=${outputmode},enable cvbsmode=${cvbsmode} " \
"hdmimode=${hdmimode} osd_reverse=${osd_reverse} video_reverse=${video_reverse} " \
"androidboot.selinux=permissive androidboot.firstboot=${firstboot} jtag=disable " \
@@ -189,10 +216,6 @@
"booti ${loadaddr} - ${dtb_mem_addr}; " \
"bootm; " \
"done\0" \
- "boot_default="\
- "run boot_mmc; " \
- "run boot_mmc_distro; " \
- "run boot_rawimage\0" \
"init_display="\
"osd open; osd clear; " \
"for n in ${mmc_list}; do " \
@@ -221,7 +244,7 @@
"sf erase 0x0 0x800000; "\
"load mmc 1 ${loadaddr} spiboot.img; "\
"sf write ${loadaddr} 0x0 ${filesize}\0"\
- "booting_from_spi="\
+ "boot_spi="\
"hdmitx edid; "\
"setenv bootargs ${initargs} console=tty0 logo=osd0,loaded,0x3d800000 osd_reverse=0 video_reverse=0; "\
"setenv bootargs ${bootargs} vout=${vout} hdmimode=${hdmimode} modeline=${modeline} voutmode=${voutmode}; "\