[U-Boot] [PATCH v4 21/23] ppc, arm: rework and enhance keymile-common.h
Heiko Schocher
hs at denx.de
Fri Apr 1 09:16:33 CEST 2011
From: Holger Brunck <holger.brunck at keymile.com>
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 at keymile.com>
cc: Wolfgang Denk <wd at denx.de>
cc: Prafulla Wadaskar <prafulla at marvell.com>
cc: Valentin Longchamp <valentin.longchamp at keymile.com>
cc: Heiko Schocher <hs at denx.de>
---
Changes for v2:
- fix checkpatch.pl errors and warnings
Changes for v3:
- rebased only
include/configs/keymile-common.h | 163 +++++++++++++++++++++++++++++++------
include/configs/km_arm.h | 2 +
2 files changed, 138 insertions(+), 27 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h
index da5a447..1344ca9 100644
--- a/include/configs/keymile-common.h
+++ b/include/configs/keymile-common.h
@@ -40,13 +40,6 @@
#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.
*/
#include <config_cmd_default.h>
@@ -144,28 +137,16 @@
#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
@@ -184,17 +165,116 @@
#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 \
@@ -204,6 +284,8 @@
"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" \
@@ -214,6 +296,9 @@
"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 " " \
@@ -226,6 +311,14 @@
"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; " \
@@ -233,7 +326,15 @@
"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
@@ -264,6 +365,7 @@
* - 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
@@ -271,7 +373,11 @@
#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
@@ -294,14 +400,17 @@
#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" \
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h
index 9c8d0e7..70113d4 100644
--- a/include/configs/km_arm.h
+++ b/include/configs/km_arm.h
@@ -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 */
--
1.7.4
More information about the U-Boot
mailing list