]> git.sur5r.net Git - u-boot/commitdiff
ARM: rpi_b: rework boot scripts, enable sysboot
authorStephen Warren <swarren@wwwdotorg.org>
Fri, 14 Feb 2014 03:44:07 +0000 (20:44 -0700)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 22 Feb 2014 13:06:51 +0000 (14:06 +0100)
Rework rpi_b's bootcmd (and sub-commands) to match Tegra's bootcmd as
much as possible. This will aid in a future patch which will create a
common header e.g. config_distro_bootcmd.h.

While at it, enable booting from extlinux.conf using the sysboot command.

The iteration and componentization currently makes a little more sense
for Tegra than RPi, but I'd still like to keep the two as similar as
possible. USB and networking support is coming to the RPi in due course,
and it'll all make more sense then anyway.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
include/configs/rpi_b.h

index 4b5a0c2150fb10dce6708cfe6a62c104c01a6fa0..6306d61bb2736db10b3f44c4ec180ce41b199f68 100644 (file)
                "env import -t ${loadaddr} ${filesize}; " \
        "fi"
 
+#define ENV_DEVICE_SETTINGS \
+       "stdin=serial,lcd\0" \
+       "stdout=serial,lcd\0" \
+       "stderr=serial,lcd\0"
+
 /*
  * Memory layout for where various images get loaded by boot scripts:
  *
  * scriptaddr can be pretty much anywhere that doesn't conflict with something
  *   else. Put it low in memory to avoid conflicts.
  *
+ * pxefile_addr_r can be pretty much anywhere that doesn't conflict with
+ *   something else. Put it low in memory to avoid conflicts.
+ *
  * kernel_addr_r must be within the first 128M of RAM in order for the
  *   kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
  *   decompress itself to 0x8000 after the start of RAM, kernel_addr_r
  * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows
  *   for the FDT/DTB to be up to 1M, which is hopefully plenty.
  */
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "stdin=serial\0" \
-       "stderr=serial,lcd\0" \
-       "stdout=serial,lcd\0" \
+#define ENV_MEM_LAYOUT_SETTINGS \
        "scriptaddr=0x00000000\0" \
+       "pxefile_addr_r=0x00100000\0" \
        "kernel_addr_r=0x01000000\0" \
        "fdt_addr_r=0x02000000\0" \
        "fdtfile=bcm2835-rpi-b.dtb\0" \
        "ramdisk_addr_r=0x02100000\0" \
-       "boot_targets=mmc0\0" \
-       \
-       "script_boot=" \
-               "if fatload ${devtype} ${devnum}:1 " \
-                                       "${scriptaddr} boot.scr.uimg; then " \
-                       "source ${scriptaddr}; " \
-               "fi;\0" \
-       \
+
+#define BOOTCMDS_MMC \
        "mmc_boot=" \
                "setenv devtype mmc; " \
                "if mmc dev ${devnum}; then " \
-                       "run script_boot; " \
+                       "run scan_boot; " \
                "fi\0" \
+       "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0"
+#define BOOT_TARGETS_MMC "mmc0"
+
+#define BOOTCMDS_COMMON \
+       "rootpart=1\0" \
+       \
+       "do_script_boot="                                                 \
+               "load ${devtype} ${devnum}:${rootpart} "                  \
+                       "${scriptaddr} ${prefix}${script}; "              \
+               "source ${scriptaddr}\0"                                  \
+       \
+       "script_boot="                                                    \
+               "for script in ${boot_scripts}; do "                      \
+                       "if test -e ${devtype} ${devnum}:${rootpart} "    \
+                                       "${prefix}${script}; then "       \
+                               "echo Found ${prefix}${script}; "         \
+                               "run do_script_boot; "                    \
+                               "echo SCRIPT FAILED: continuing...; "     \
+                       "fi; "                                            \
+               "done\0"                                                  \
        \
-       "bootcmd_mmc0=setenv devnum 0; run mmc_boot\0" \
+       "do_sysboot_boot="                                                \
+               "sysboot ${devtype} ${devnum}:${rootpart} any "           \
+                       "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
+       \
+       "sysboot_boot="                                                   \
+               "if test -e ${devtype} ${devnum}:${rootpart} "            \
+                               "${prefix}extlinux/extlinux.conf; then "  \
+                       "echo Found ${prefix}extlinux/extlinux.conf; "    \
+                       "run do_sysboot_boot; "                           \
+                       "echo SCRIPT FAILED: continuing...; "             \
+               "fi\0"                                                    \
+       \
+       "scan_boot="                                                      \
+               "echo Scanning ${devtype} ${devnum}...; "                 \
+               "for prefix in ${boot_prefixes}; do "                     \
+                       "run sysboot_boot; "                              \
+                       "run script_boot; "                               \
+               "done\0"                                                  \
+       \
+       "boot_targets=" \
+               BOOT_TARGETS_MMC " " \
+               "\0" \
+       \
+       "boot_prefixes=/\0" \
+       \
+       "boot_scripts=boot.scr.uimg\0" \
+       \
+       BOOTCMDS_MMC
 
 #define CONFIG_BOOTCOMMAND \
        "for target in ${boot_targets}; do run bootcmd_${target}; done"
 
-#define CONFIG_BOOTDELAY               2
+#define CONFIG_BOOTCOMMAND \
+       "for target in ${boot_targets}; do run bootcmd_${target}; done"
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       ENV_DEVICE_SETTINGS \
+       ENV_MEM_LAYOUT_SETTINGS \
+       BOOTCMDS_COMMON
+
+#define CONFIG_BOOTDELAY 2
 
 /* Shell */
 #define CONFIG_SYS_MAXARGS             8