summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-06-04 10:59:22 +0000
committerAlbert ARIBAUD (U-Boot) <uboot@lilith.(none)>2012-07-09 22:44:33 +0200
commit03cddf28ebbaf402cdac495b71d7fb1bc5fa252f (patch)
tree384b97039c6d14c68329e409fc0b520b9dfb211c
parent9cd3f3adf03bdbc5ea4514f00e2cfacfb1ae5bed (diff)
downloadu-boot-imx-03cddf28ebbaf402cdac495b71d7fb1bc5fa252f.zip
u-boot-imx-03cddf28ebbaf402cdac495b71d7fb1bc5fa252f.tar.gz
u-boot-imx-03cddf28ebbaf402cdac495b71d7fb1bc5fa252f.tar.bz2
tegra: bootcmd enhancements
Place the list of searched boot devices, file-system types, boot file locations/prefixes, and boot script names into variables. This allows the user to override them directly (e.g. to change boot order, or select the specific values they use) without having to edit the main bootcmd and script_boot variables. The default boot order is changed from USB, MMC, DHCP to MMC, USB, DHCP. This speeds up the typical MMC boot case. People who want USB boot can now edit variable boot_targets appropriately. Also, reformat BOOTCMDS_COMMON to fit within 80 columns. Potential future enhancements might be: * Allow boards to specify which of bootcmd_mmc0/... should be defined, based on the HW they contain. * Allow boards to influence the order that the boot targets are added into the boot_targets variable. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
-rw-r--r--include/configs/tegra2-common-post.h82
1 files changed, 52 insertions, 30 deletions
diff --git a/include/configs/tegra2-common-post.h b/include/configs/tegra2-common-post.h
index 0484a52..85b037c 100644
--- a/include/configs/tegra2-common-post.h
+++ b/include/configs/tegra2-common-post.h
@@ -31,15 +31,15 @@
#else
#ifdef CONFIG_CMD_EXT2
-#define BOOTCMD_FS_EXT2 "ext2 "
+#define BOOT_FSTYPE_EXT2 "ext2 "
#else
-#define BOOTCMD_FS_EXT2 ""
+#define BOOT_FSTYPE_EXT2 ""
#endif
#ifdef CONFIG_CMD_FAT
-#define BOOTCMD_FS_FAT "fat"
+#define BOOT_FSTYPE_FAT "fat"
#else
-#define BOOTCMD_FS_FAT ""
+#define BOOT_FSTYPE_FAT ""
#endif
#ifdef CONFIG_CMD_MMC
@@ -47,15 +47,14 @@
"mmc_boot=" \
"setenv devtype mmc; " \
"if mmc dev ${devnum}; then " \
- "run script_boot; " \
+ "run scan_boot; " \
"fi\0" \
- "mmc0_boot=setenv devnum 0; run mmc_boot;\0" \
- "mmc1_boot=setenv devnum 1; run mmc_boot;\0" \
- "bootcmd_mmc=run mmc1_boot; run mmc0_boot\0"
-#define BOOTCMD_MMC "run bootcmd_mmc; "
+ "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
+ "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
+#define BOOT_TARGETS_MMC "mmc1 mmc0"
#else
#define BOOTCMDS_MMC ""
-#define BOOTCMD_MMC ""
+#define BOOT_TARGETS_MMC ""
#endif
#ifdef CONFIG_CMD_USB
@@ -63,15 +62,14 @@
"usb_boot=" \
"setenv devtype usb; " \
"if usb dev ${devnum}; then " \
- "run script_boot; " \
+ "run scan_boot; " \
"fi\0" \
- "usb0_boot=setenv devnum 0; run usb_boot;\0" \
- "bootcmd_usb=run usb0_boot\0"
-#define BOOTCMD_USB "run bootcmd_usb; "
+ "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
+#define BOOT_TARGETS_USB "usb0"
#define BOOTCMD_INIT_USB "usb start 0; "
#else
#define BOOTCMDS_USB ""
-#define BOOTCMD_USB ""
+#define BOOT_TARGETS_USB ""
#define BOOTCMD_INIT_USB ""
#endif
@@ -81,32 +79,56 @@
"if dhcp ${scriptaddr} boot.scr.uimg; then "\
"source ${scriptaddr}; " \
"fi\0"
-#define BOOTCMD_DHCP "run bootcmd_dhcp; "
+#define BOOT_TARGETS_DHCP "dhcp"
#else
#define BOOTCMDS_DHCP ""
-#define BOOTCMD_DHCP ""
+#define BOOT_TARGETS_DHCP ""
#endif
#define BOOTCMDS_COMMON \
"scriptaddr=0x400000\0" \
+ \
"rootpart=1\0" \
- "script_boot=" \
- "for fs in " BOOTCMD_FS_EXT2 BOOTCMD_FS_FAT "; do " \
- "for prefix in / /boot/; do " \
- "for script in boot.scr.uimg boot.scr; do " \
- "echo Scanning ${devtype} ${devnum}:${rootpart} ${fs} ${prefix}${script} ...; " \
- "if ${fs}load ${devtype} ${devnum}:${rootpart} ${scriptaddr} ${prefix}${script}; then " \
- "echo ${script} found! Executing ...;" \
- "source ${scriptaddr};" \
- "fi; " \
- "done; " \
- "done; " \
- "done;\0" \
+ \
+ "script_boot=" \
+ "if ${fs}load ${devtype} ${devnum}:${rootpart} " \
+ "${scriptaddr} ${prefix}${script}; then " \
+ "echo ${script} found! Executing ...;" \
+ "source ${scriptaddr};" \
+ "fi;\0" \
+ \
+ "scan_boot=" \
+ "echo Scanning ${devtype} ${devnum}...; " \
+ "for fs in ${boot_fstypes}; do " \
+ "for prefix in ${boot_prefixes}; do " \
+ "for script in ${boot_scripts}; do " \
+ "run script_boot; " \
+ "done; " \
+ "done; " \
+ "done;\0" \
+ \
+ "boot_targets=" \
+ BOOT_TARGETS_MMC " " \
+ BOOT_TARGETS_USB " " \
+ BOOT_TARGETS_DHCP " " \
+ "\0" \
+ \
+ "boot_fstypes=" \
+ BOOT_FSTYPE_EXT2 " " \
+ BOOT_FSTYPE_FAT " " \
+ "\0" \
+ \
+ "boot_prefixes=/ /boot/\0" \
+ \
+ "boot_scripts=boot.scr.uimg boot.scr\0" \
+ \
BOOTCMDS_MMC \
BOOTCMDS_USB \
BOOTCMDS_DHCP
-#define CONFIG_BOOTCOMMAND BOOTCMD_INIT_USB BOOTCMD_USB BOOTCMD_MMC BOOTCMD_DHCP
+#define CONFIG_BOOTCOMMAND \
+ BOOTCMD_INIT_USB \
+ "for target in ${boot_targets}; do run bootcmd_${target}; done"
#endif