Skip to content
Snippets Groups Projects
Commit a21b5d4b authored by Holger Brunck's avatar Holger Brunck Committed by Wolfgang Denk
Browse files

ppc, arm: rework and enhance keymile-common.h


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: default avatarHolger 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>
parent f1fef1d8
No related branches found
No related tags found
No related merge requests found
...@@ -39,13 +39,6 @@ ...@@ -39,13 +39,6 @@
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage.cfg #define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage.cfg
#endif /* CONFIG_SYS_KWD_CONFIG */ #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. * Command line configuration.
*/ */
...@@ -144,28 +137,16 @@ ...@@ -144,28 +137,16 @@
#define CONFIG_MTD_DEVICE #define CONFIG_MTD_DEVICE
#define CONFIG_MTD_CONCAT #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 \ #define CONFIG_KM_DEF_ENV_IOMUX \
"stderr=serial \0" \ "stderr=serial \0" \
"stdin=serial \0" \ "stdin=serial \0" \
"stdout=serial \0" "stdout=serial \0"
#endif
#ifndef CONFIG_KM_DEF_ENV_PRIVATE /* common powerpc specific env settings */
#define CONFIG_KM_DEF_ENV_PRIVATE \ #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS
"kmprivate=empty\0" #define CONFIG_KM_DEF_ENV_BOOTPARAMS \
"bootparams=empty\0" \
"initial_boot_bank=0\0"
#endif #endif
#ifndef CONFIG_KM_DEF_NETDEV #ifndef CONFIG_KM_DEF_NETDEV
...@@ -183,18 +164,117 @@ ...@@ -183,18 +164,117 @@
#define xstr(s) str(s) #define xstr(s) str(s)
#define str(s) #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 * bootargs
* - modify 'bootargs' * - modify 'bootargs'
* *
* - 'addip': add ip configuration * - 'addip': add ip configuration
* - 'addmem': limit kernel memory mem=
* - 'addpanic': add kernel panic options * - 'addpanic': add kernel panic options
* - 'addramfs': add phram device for the rootfilesysten in ram * - 'addramfs': add phram device for the rootfilesysten in ram
* - 'addtty': add console=... * - 'addtty': add console=...
* - 'addvar': add phram device for /var
* - 'nfsargs': default arguments for nfs boot * - 'nfsargs': default arguments for nfs boot
* - 'flashargs': defaults arguments for flash base boot * - 'flashargs': defaults arguments for flash base boot
* *
* processor specific settings * processor specific settings
* - 'addbootcount': add boot counter
* - 'addmtdparts': add mtd partition information * - 'addmtdparts': add mtd partition information
*/ */
#define CONFIG_KM_DEF_ENV_BOOTARGS \ #define CONFIG_KM_DEF_ENV_BOOTARGS \
...@@ -204,6 +284,8 @@ ...@@ -204,6 +284,8 @@
"setenv bootargs ${bootargs} " \ "setenv bootargs ${bootargs} " \
"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
":${hostname}:${netdev}:off\0" \ ":${hostname}:${netdev}:off\0" \
"addmem=" \
"setenv bootargs ${bootargs} mem=0x${pnvramaddr}\0" \
"addpanic=" \ "addpanic=" \
"setenv bootargs ${bootargs} " \ "setenv bootargs ${bootargs} " \
"panic=1 panic_on_oops=1\0" \ "panic=1 panic_on_oops=1\0" \
...@@ -214,6 +296,9 @@ ...@@ -214,6 +296,9 @@
"addtty=" \ "addtty=" \
"setenv bootargs ${bootargs}" \ "setenv bootargs ${bootargs}" \
" console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \ " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \
"addvar=" \
"setenv bootargs ${bootargs} phram.phram=phvar," \
"${varaddr},0x" xstr(CONFIG_KM_PHRAM) "\0" \
"nfsargs=" \ "nfsargs=" \
"setenv bootargs " \ "setenv bootargs " \
"ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \
...@@ -226,6 +311,14 @@ ...@@ -226,6 +311,14 @@
"rootfstype=squashfs ro\0" \ "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 \ #define CONFIG_KM_DEF_ENV_COMPUTE_ADDR \
"setboardid=" \ "setboardid=" \
"if test \"x${boardId}\" = \"x\"; then; " \ "if test \"x${boardId}\" = \"x\"; then; " \
...@@ -233,7 +326,15 @@ ...@@ -233,7 +326,15 @@
"setenv hwKey ${IVM_HWKey}; " \ "setenv hwKey ${IVM_HWKey}; " \
"else; " \ "else; " \
"echo \\\\c; " \ "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 * flash_boot
...@@ -264,6 +365,7 @@ ...@@ -264,6 +365,7 @@
* - commands for booting over the network * - commands for booting over the network
* *
* - 'tftpkernel': load a kernel with tftp into ram * - 'tftpkernel': load a kernel with tftp into ram
* - 'tftpramfs': load rootfs with tftp into ram
* *
* processor specific settings * processor specific settings
* - 'tftpfdt': load fdt with tftp into ram * - 'tftpfdt': load fdt with tftp into ram
...@@ -271,7 +373,11 @@ ...@@ -271,7 +373,11 @@
#define CONFIG_KM_DEF_ENV_NET_BOOT \ #define CONFIG_KM_DEF_ENV_NET_BOOT \
"tftpkernel=" \ "tftpkernel=" \
"tftpboot ${kernel_addr_r} ${kernel_file} && " \ "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 * constants
...@@ -294,14 +400,17 @@ ...@@ -294,14 +400,17 @@
#ifndef CONFIG_KM_DEF_ENV #ifndef CONFIG_KM_DEF_ENV
#define CONFIG_KM_DEF_ENV \ #define CONFIG_KM_DEF_ENV \
CONFIG_KM_DEF_ENV_BOOTPARAMS \
CONFIG_KM_DEF_ENV_IOMUX \ CONFIG_KM_DEF_ENV_IOMUX \
CONFIG_KM_DEF_ENV_PRIVATE \
CONFIG_KM_DEF_NETDEV \ CONFIG_KM_DEF_NETDEV \
CONFIG_KM_DEF_ENV_CPU \ CONFIG_KM_DEF_ENV_CPU \
CONFIG_KM_DEF_ENV_BOOTRUNNER \
CONFIG_KM_DEF_ENV_BOOTTARGETS \
CONFIG_KM_DEF_ENV_BOOTARGS \ CONFIG_KM_DEF_ENV_BOOTARGS \
CONFIG_KM_DEF_ENV_COMPUTE_ADDR \ CONFIG_KM_DEF_ENV_COMPUTE_ADDR \
CONFIG_KM_DEF_ENV_FLASH_BOOT \ CONFIG_KM_DEF_ENV_FLASH_BOOT \
CONFIG_KM_DEF_ENV_NET_BOOT \ CONFIG_KM_DEF_ENV_NET_BOOT \
CONFIG_KM_DEF_ENV_CONSTANTS \
"altbootcmd=run bootcmd\0" \ "altbootcmd=run bootcmd\0" \
"bootcmd=run default\0" \ "bootcmd=run default\0" \
"bootlimit=2\0" \ "bootlimit=2\0" \
......
...@@ -260,5 +260,7 @@ int get_scl (void); ...@@ -260,5 +260,7 @@ int get_scl (void);
* 8Mbytes for switch + 4Kbytes for bootcount * 8Mbytes for switch + 4Kbytes for bootcount
*/ */
#define CONFIG_KM_RESERVED_PRAM 0x801000 #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 */ #endif /* _CONFIG_KM_ARM_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment