]> git.sur5r.net Git - u-boot/commitdiff
tegra: bootcmd enhancements
authorStephen Warren <swarren@nvidia.com>
Mon, 4 Jun 2012 10:59:22 +0000 (10:59 +0000)
committerAlbert ARIBAUD (U-Boot) <uboot@lilith.(none)>
Mon, 9 Jul 2012 20:44:33 +0000 (22:44 +0200)
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>
include/configs/tegra2-common-post.h

index 0484a522d5c6f12b49cbed6e99b1ac42b948a3f1..85b037c22d7bf81aa4f7fa2d8acc7cdbf9c21762 100644 (file)
 #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
        "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
        "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
 
                "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