]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ppc, arm: rework and enhance keymile-common.h
authorHolger Brunck <holger.brunck@keymile.com>
Fri, 4 Mar 2011 13:56:27 +0000 (14:56 +0100)
committerWolfgang Denk <wd@denx.de>
Fri, 29 Apr 2011 22:45:23 +0000 (00:45 +0200)
Add:
  - introduce "bootrunner" environment variable
    This allows to execute consecutive different commands
    specified in the list "subbootcmd". If one command fails
    the command serie will stop.
  - introduce environment variable "develop", "ramfs" and "release"
    Each variable is one way to boot our linux. "develop" is for
    development purpose and boots the SW via NFS. "release" is for
    booting the linux image from flash, "ramfs" allows to load an SW
    image via tftp into ram and executes from there
  - introduce "addmem" variable, this command adds the used memory
    for linux to the bootargs
  - introduce "addvar" variable, this command adress for the /var
    directory to the kernel command line
  - introduce "setramfspram" and "setrootfsaddr" these calculation
    were done if "ramfs" was used (only for debugging)
  - introduce "tftpramfs" used for "ramfs" to load the image into
    RAM (only for debugging)
Remove unneeded stuff:
   - CONFIG_IO_MUXING is obsolete for keymile boards
   - CONFIG_KM_DEF_ENV_PRIVATE is also obsolete
   - define CONFIG_SYS_TEXT_BASE in board configs only

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Wolfgang Denk <wd@denx.de>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Heiko Schocher <hs@denx.de>

include/configs/keymile-common.h
include/configs/km_arm.h

index da5a4475b051323a44f3ea9bb3eaddbf28f7a1f0..1344ca9a78d734f6a0cfe36ee75340fdbf22f6c4 100644 (file)
 #define        CONFIG_SYS_KWD_CONFIG   $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage.cfg
 #endif /* CONFIG_SYS_KWD_CONFIG */
 
-/*
- * CONFIG_SYS_TEXT_BASE can be defined in board specific header file, if needed
- */
-#ifndef CONFIG_SYS_TEXT_BASE
-#define        CONFIG_SYS_TEXT_BASE    0x00400000
-#endif /* CONFIG_SYS_TEXT_BASE */
-
 /*
  * Command line configuration.
  */
 #define CONFIG_MTD_DEVICE
 #define CONFIG_MTD_CONCAT
 
-/* define this to use the keymile's io muxing feature */
-/*#define CONFIG_IO_MUXING */
-
-#ifdef CONFIG_IO_MUXING
-#define        CONFIG_KM_DEF_ENV_IOMUX \
-       "nc=setenv ethact HDLC \0" \
-       "nce=setenv ethact SCC \0"      \
-       "stderr=serial,nc \0"   \
-       "stdin=serial,nc \0" \
-       "stdout=serial,nc \0" \
-       "tftpsrcp=69 \0" \
-       "tftpdstp=69 \0"
-#else
 #define        CONFIG_KM_DEF_ENV_IOMUX \
        "stderr=serial \0" \
        "stdin=serial \0"        \
        "stdout=serial \0"
-#endif
 
-#ifndef CONFIG_KM_DEF_ENV_PRIVATE
-#define        CONFIG_KM_DEF_ENV_PRIVATE \
-       "kmprivate=empty\0"
+/* common powerpc specific env settings */
+#ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
+#define CONFIG_KM_DEF_ENV_BOOTPARAMS \
+       "bootparams=empty\0"    \
+       "initial_boot_bank=0\0"
 #endif
 
 #ifndef CONFIG_KM_DEF_NETDEV
 #define xstr(s)        str(s)
 #define str(s) #s
 
+/*
+ * bootrunner
+ * - run all commands in 'subbootcmds'
+ * - on error, stop running the remaing commands
+ */
+#define CONFIG_KM_DEF_ENV_BOOTRUNNER                                   \
+       "bootrunner="                                                   \
+               "break=0; "                                             \
+               "for subbootcmd in ${subbootcmds}; do "                 \
+               "if test ${break} -eq 0; then; "                        \
+               "echo \"[INFO] running \\c\"; "                         \
+               "print ${subbootcmd}; "                                 \
+               "run ${subbootcmd} || break=1; "                        \
+               "if test ${break} -eq 1; then; "                        \
+               "echo \"[ERR] failed \\c\"; "                           \
+               "print ${subbootcmd}; "                                 \
+               "fi; "                                                  \
+               "fi; "                                                  \
+               "done\0"                                                \
+       ""
+
+/*
+ * boottargets
+ * - set 'subbootcmds' for the bootrunner
+ * - set 'bootcmd' and 'altbootcmd'
+ * available targets:
+ * - 'release': for a standalone system                kernel/rootfs from flash
+ * - 'develop': for development                        kernel(tftp)/rootfs(NFS)
+ * - 'ramfs': rootfilesystem in RAM            kernel(tftp)/rootfs(RAM)
+ *
+ * - 'commonargs': bootargs common to all targets
+ */
+#define CONFIG_KM_DEF_ENV_BOOTTARGETS                                  \
+       "commonargs="                                                   \
+               "addip "                                                \
+               "addtty "                                               \
+               "addmem "                                               \
+               "addinit "                                              \
+               "addvar "                                               \
+               "addmtdparts "                                          \
+               "addbootcount "                                         \
+               "\0"                                                    \
+       "develop="                                                      \
+               "setenv subbootcmds \""                                 \
+               "tftpfdt tftpkernel "                                   \
+               "nfsargs ${commonargs} "                                \
+               "printbootargs boot "                                   \
+               "\" && "                                                \
+               "setenv bootcmd \'"                                     \
+               "run bootrunner"                                        \
+               "\' && "                                                \
+               "setenv altbootcmd \'"                                  \
+               "run bootcmd"                                           \
+               "\' && "                                                \
+               "run setboardid && "                                    \
+               "saveenv && "                                           \
+               "reset\0"                                               \
+       "ramfs="                                                        \
+               "setenv actual_bank -1 && "                             \
+               "setenv subbootcmds \""                                 \
+               "tftpfdt tftpkernel "                                   \
+               "setrootfsaddr tftpramfs "                              \
+               "flashargs ${commonargs} "                              \
+               "addpanic addramfs "                                    \
+               "printbootargs boot "                                   \
+               "\" && "                                                \
+               "setenv bootcmd \'"                                     \
+               "run bootrunner"                                        \
+               "\' && "                                                \
+               "setenv altbootcmd \'"                                  \
+               "run bootcmd"                                           \
+               "\' && "                                                \
+               "run setboardid && "                                    \
+               "run setramfspram && "                                  \
+               "saveenv && "                                           \
+               "reset\0"                                               \
+       "release="                                                      \
+               "setenv actual_bank ${initial_boot_bank} && "           \
+               "setenv subbootcmds \""                                 \
+               "checkboardid "                                         \
+               "ubiattach ubicopy "                                    \
+               "cramfsloadfdt cramfsloadkernel "                       \
+               "flashargs ${commonargs} "                              \
+               "addpanic "                                             \
+               "printbootargs boot "                                   \
+               "\" && "                                                \
+               "setenv bootcmd \'"                                     \
+               "run bootrunner; reset"                                 \
+               "\' && "                                                \
+               "setenv altbootcmd \'"                                  \
+               "run actual0 bootcmd; reset"                            \
+               "\' && "                                                \
+               "saveenv && "                                           \
+               "reset\0"                                               \
+       ""
+
 /*
  * bootargs
  * - modify 'bootargs'
  *
  * - 'addip': add ip configuration
+ * - 'addmem': limit kernel memory mem=
  * - 'addpanic': add kernel panic options
  * - 'addramfs': add phram device for the rootfilesysten in ram
  * - 'addtty': add console=...
+ * - 'addvar': add phram device for /var
  * - 'nfsargs': default arguments for nfs boot
  * - 'flashargs': defaults arguments for flash base boot
  *
  * processor specific settings
+ * - 'addbootcount': add boot counter
  * - 'addmtdparts': add mtd partition information
  */
 #define CONFIG_KM_DEF_ENV_BOOTARGS                                     \
                "setenv bootargs ${bootargs} "                          \
                "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"      \
                ":${hostname}:${netdev}:off\0"                          \
+       "addmem="                                                       \
+               "setenv bootargs ${bootargs} mem=0x${pnvramaddr}\0"     \
        "addpanic="                                                     \
                "setenv bootargs ${bootargs} "                          \
                "panic=1 panic_on_oops=1\0"                             \
        "addtty="                                                       \
                "setenv bootargs ${bootargs}"                           \
                " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0"      \
+       "addvar="                                                       \
+               "setenv bootargs ${bootargs} phram.phram=phvar,"        \
+               "${varaddr},0x" xstr(CONFIG_KM_PHRAM) "\0"              \
        "nfsargs="                                                      \
                "setenv bootargs "                                      \
                "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " "             \
                "rootfstype=squashfs ro\0"                              \
        ""
 
+/*
+ * compute_addr
+ * - compute addresses and sizes
+ * - addresses are calculated form the end of memory 'memsize'
+ *
+ * - 'setramfspram': compute PRAM size for ramfs target
+ * - 'setrootfsaddr': compute rootfilesystem address for phram
+ */
 #define CONFIG_KM_DEF_ENV_COMPUTE_ADDR                                 \
        "setboardid="                                                   \
                "if test \"x${boardId}\" = \"x\"; then; "               \
                "setenv hwKey ${IVM_HWKey}; "                           \
                "else; "                                                \
                "echo \\\\c; "                                          \
-               "fi\0"
+               "fi\0"                                                  \
+       "setramfspram="                                                 \
+               "setexpr value ${rootfssize} / 0x400 && "               \
+               "setexpr value 0x${value} + ${pram} && "                \
+               "setenv pram 0x${value}\0"                              \
+       "setrootfsaddr="                                                \
+               "setexpr value ${pnvramaddr} - ${rootfssize} && "       \
+               "setenv rootfsaddr 0x${value}\0"                        \
+       ""
 
 /*
  * flash_boot
  * - commands for booting over the network
  *
  * - 'tftpkernel': load a kernel with tftp into ram
+ * - 'tftpramfs': load rootfs with tftp into ram
  *
  * processor specific settings
  * - 'tftpfdt': load fdt with tftp into ram
 #define CONFIG_KM_DEF_ENV_NET_BOOT                                     \
        "tftpkernel="                                                   \
                "tftpboot ${kernel_addr_r} ${kernel_file} && "          \
-               "setenv actual_kernel_addr ${kernel_addr_r} \0"
+               "setenv actual_kernel_addr ${kernel_addr_r}\0"          \
+       "tftpramfs="                                                    \
+               "tftpboot ${rootfsaddr} \"\\\"${rootfsfile}\\\"\" && "  \
+               "setenv loadaddr\0"                                     \
+       ""
 
 /*
  * constants
 
 #ifndef CONFIG_KM_DEF_ENV
 #define CONFIG_KM_DEF_ENV      \
+       CONFIG_KM_DEF_ENV_BOOTPARAMS                                    \
        CONFIG_KM_DEF_ENV_IOMUX                                         \
-       CONFIG_KM_DEF_ENV_PRIVATE                                       \
        CONFIG_KM_DEF_NETDEV                                            \
        CONFIG_KM_DEF_ENV_CPU                                           \
+       CONFIG_KM_DEF_ENV_BOOTRUNNER                                    \
+       CONFIG_KM_DEF_ENV_BOOTTARGETS                                   \
        CONFIG_KM_DEF_ENV_BOOTARGS                                      \
        CONFIG_KM_DEF_ENV_COMPUTE_ADDR                                  \
        CONFIG_KM_DEF_ENV_FLASH_BOOT                                    \
        CONFIG_KM_DEF_ENV_NET_BOOT                                      \
+       CONFIG_KM_DEF_ENV_CONSTANTS                                     \
        "altbootcmd=run bootcmd\0"                                      \
        "bootcmd=run default\0"                                         \
        "bootlimit=2\0"                                                 \
index 9c8d0e7af740a37a4728933e7bb8f65aaea38970..70113d449d62f4d69f432387c4164181bb44b20a 100644 (file)
@@ -260,5 +260,7 @@ int get_scl (void);
  * 8Mbytes for switch + 4Kbytes for bootcount
  */
 #define CONFIG_KM_RESERVED_PRAM 0x801000
+/* address for the bootcount (taken from end of RAM) */
+#define BOOTCOUNT_ADDR          (CONFIG_KM_RESERVED_PRAM)
 
 #endif /* _CONFIG_KM_ARM_H */