[U-Boot] [PATCH v2 0/8] km/common mainlining

This series is the second effort of merging the Keymile boards support back into mainline. This serie is a smaller serie based on the first patch serie: http://lists.denx.de/pipermail/u-boot/2011-April/090013.html The first large serie was split up to three independent series, which is easier to review and apply for the custodians. This serie adds the keymile common parts of the serie. Only the patch common/hush affects common u-boot code all other changes are km specific. The content of the patches are adapted with the inputs of a review from the ML. The serie relies on the patch lib, vsprintf: introduce strict_strtoul which is already posted (http://lists.denx.de/pipermail/u-boot/2011-May/091972.html) but currently not committed.
Holger Brunck (5): common/hush: make get_local_var visible for other users km/common: implement setboardid command km/common: fix coding style issues in generic header km/common: simplify default environment km/common: add pnvramsize to default environment
Thomas Herzmann (2): km/common: fix initial_boot_bank for bootpackages km/common: implement boardId HWkey checks as u-boot cmd
Valentin Longchamp (1): keymile boards: move keymile specific header in subdir
board/keymile/common/common.c | 173 +++++++++++++++++++++++++++ board/keymile/scripts/README | 25 ++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + common/hush.c | 3 +- include/configs/{ => km}/keymile-common.h | 174 ++++------------------------ include/configs/{ => km}/km-powerpc.h | 12 +-- include/configs/{ => km}/km82xx-common.h | 0 include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 15 +-- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 6 +- include/configs/mgcoge2ne.h | 6 +- include/configs/mgcoge2un.h | 2 +- include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- include/hush.h | 1 + 23 files changed, 261 insertions(+), 183 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt rename include/configs/{ => km}/keymile-common.h (63%) rename include/configs/{ => km}/km-powerpc.h (91%) rename include/configs/{ => km}/km82xx-common.h (100%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (97%)

From: Thomas Herzmann thomas.herzmann@keymile.com
The initial_boot_bank can be set when more than one application is used in a bootpackage. But a value n <> 0 never led to booting from bank n. Instead, bank 0 was booted. This patch fixes this.
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch serie to three independent smaller patch series - no change in the content of this patch
include/configs/keymile-common.h | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index cb6d0fb..bc8a896 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -247,10 +247,10 @@ "printbootargs boot " \ "" && " \ "setenv bootcmd '" \ - "run bootrunner; reset" \ + "run actual bootrunner; reset" \ "' && " \ "setenv altbootcmd '" \ - "run actual0 bootcmd; reset" \ + "run backup bootrunner; reset" \ "' && " \ "saveenv && " \ "reset\0" \ @@ -288,7 +288,7 @@ "addramfs=" \ "setenv bootargs "" \ "${bootargs} phram.phram=" \ - "rootfs${actual_bank},${rootfsaddr},${rootfssize}"\0" \ + "rootfs${boot_bank},${rootfsaddr},${rootfssize}"\0" \ "addtty=" \ "setenv bootargs ${bootargs}" \ " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \ @@ -303,7 +303,7 @@ "flashargs=" \ "setenv bootargs " \ "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ - "root=mtdblock:rootfs${actual_bank} " \ + "root=mtdblock:rootfs${boot_bank} " \ "rootfstype=squashfs ro\0" \ ""
@@ -352,7 +352,7 @@ "cramfsload ${kernel_addr_r} uImage && " \ "setenv actual_kernel_addr ${kernel_addr_r}\0" \ "ubiattach=ubi part ${ubipartition}\0" \ - "ubicopy=ubi read ${cramfsaddr} bootfs${actual_bank}\0" \ + "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \ "ubipartition=" CONFIG_KM_UBI_PARTITION_NAME "\0" \ ""
@@ -382,9 +382,10 @@ * - 'default': setup default environment */ #define CONFIG_KM_DEF_ENV_CONSTANTS \ - "actual=setenv actual_bank ${initial_boot_bank}\0" \ - "actual0=setenv actual_bank 0\0" \ + "actual=setenv boot_bank ${actual_bank}\0" \ + "backup=setenv boot_bank ${backup_bank}\0" \ "actual_bank=${initial_boot_bank}\0" \ + "backup_bank=0\0" \ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \

Dear Holger Brunck,
In message caa5ff7d66fe8127b7d2578024a2a5ae2e9a2989.1304508448.git.holger.brunck@keymile.com you wrote:
From: Thomas Herzmann thomas.herzmann@keymile.com
The initial_boot_bank can be set when more than one application is used in a bootpackage. But a value n <> 0 never led to booting from bank n. Instead, bank 0 was booted. This patch fixes this.
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
include/configs/keymile-common.h | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

We can actually only set from c-code local hush shell variables, with this patch we can also read them from c-code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch serie to three independent smaller patch series - extend commit msg
common/hush.c | 3 +-- include/hush.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/hush.c b/common/hush.c index 8021a68..85a6030 100644 --- a/common/hush.c +++ b/common/hush.c @@ -497,7 +497,6 @@ static void remove_bg_job(struct pipe *pi); /* local variable support */ static char **make_list_in(char **inp, char *name); static char *insert_var_value(char *inp); -static char *get_local_var(const char *var);
#ifndef __U_BOOT__ /* Table of built-in functions. They can be forked or not, depending on @@ -2169,7 +2168,7 @@ static char *get_dollar_var(char ch); #endif
/* This is used to get/check local shell variables */ -static char *get_local_var(const char *s) +char *get_local_var(const char *s) { struct variables *cur;
diff --git a/include/hush.h b/include/hush.h index 0805ff3..5c566cc 100644 --- a/include/hush.h +++ b/include/hush.h @@ -34,6 +34,7 @@ extern int parse_file_outer(void);
int set_local_var(const char *s, int flg_export); void unset_local_var(const char *name); +char *get_local_var(const char *s);
#if defined(CONFIG_HUSH_INIT_VAR) extern int hush_init_var (void);

Dear Holger Brunck,
In message c8c8780016b267bc0d531619e923a95e356cc5d9.1304508448.git.holger.brunck@keymile.com you wrote:
We can actually only set from c-code local hush shell variables, with this patch we can also read them from c-code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- extend commit msg
common/hush.c | 3 +-- include/hush.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Read out board id and HW key from the IVM eeprom and set these values as an environment variable.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com --- Changes for v2: - split up first large patch serie to three independent smaller patch series - rework the patch with inputs from W.Denk: - adapt commit msg - add error handling
board/keymile/common/common.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 4883fe5..68e6b9f 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -26,6 +26,7 @@ #include <mpc8260.h> #endif #include <ioports.h> +#include <command.h> #include <malloc.h> #include <hush.h> #include <net.h> @@ -685,3 +686,36 @@ int board_eth_init(bd_t *bis)
return -1; } + +/* + * do_setboardid command + * read out the board id and the hw key from the intventory EEPROM and set + * this values as environment variables. + */ +static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + unsigned char buf[32]; + char *p; + + p = get_local_var("IVM_BoardId"); + if (p == NULL) { + printf("can't get the IVM_Boardid\n"); + return 1; + } + sprintf((char *)buf, "%s", p); + setenv("boardid", (char *)buf); + + p = get_local_var("IVM_HWKey"); + if (p == NULL) { + printf("can't get the IVM_HWKey\n"); + return 1; + } + sprintf((char *)buf, "%s", p); + setenv("hwkey", (char *)buf); + + return 0; +} + +U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " + "hwkey from IVM and set in environment");

Dear Holger Brunck,
In message 600f7afcb8e770eaaa417db1b119823070b62c48.1304508448.git.holger.brunck@keymile.com you wrote:
Read out board id and HW key from the IVM eeprom and set these values as an environment variable.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- rework the patch with inputs from W.Denk:
- adapt commit msg
- add error handling
board/keymile/common/common.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

From: Thomas Herzmann thomas.herzmann@keymile.com
BoardId and HWKey are used to identify the HW class of a given board. The correct values are stored in the inventory eeprom. During creation time of a boot package the boardId and HWkey for the SW is stored in the default environment and burned into the flash. During boottime the values in the inventory and in the environment are compared to avoid starting of a SW which is not authorized for this board.
Some bootpackages are allowed to run on a set of different boardId hwKey. In this case the environment variable boardIdListHex was added to the default environment. In this case the command iterates over the pair values and compares them with the values read from the inventory eeprom.
The syntax of such a boardIdListHex value is e.g.: 158_1 159_1 159_2
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch series to three independent smaller patch series - give the cmd a more precise name - rework the patch with inputs from W.Denk: - adapt and enhance commit msg - comment the code - add error handling
board/keymile/common/common.c | 139 ++++++++++++++++++++++++++++++++++++++ include/configs/keymile-common.h | 30 +-------- 2 files changed, 140 insertions(+), 29 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 68e6b9f..602ebc8 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -32,6 +32,7 @@ #include <net.h> #include <netdev.h> #include <asm/io.h> +#include <linux/ctype.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) #include <libfdt.h> @@ -719,3 +720,141 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " "hwkey from IVM and set in environment"); + +/* + * command km_checkbidhwk + * if "boardid" and "hwkey" are not already set in the environment, do: + * if a "boardIdListHex" exists in the environment: + * - read ivm data for boardid and hwkey + * - compare each entry of the boardIdListHex with the + * IVM data: + * if match: + * set environment variables boardid, boardId, + * hwkey, hwKey to the found values + * both (boardid and boardId) are set because + * they might be used differently in the + * application and in the init scripts (?) + * return 0 in case of match, 1 if not match or error + */ +int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + unsigned long ivmbid = 0, ivmhwkey = 0; + unsigned long envbid = 0, envhwkey = 0; + char *p; + int verbose = argc > 1 && *argv[1] == 'v'; + int rc = 1; /* default: no match */ + + /* + * first read out the real inventory values, these values are + * already stored in the local hush variables + */ + p = get_local_var("IVM_BoardId"); + if (p == NULL) { + printf("can't get the IVM_Boardid\n"); + return rc; + } + strict_strtoul(p, 16, &ivmbid); + + p = get_local_var("IVM_HWKey"); + if (p == NULL) { + printf("can't get the IVM_HWKey\n"); + return rc; + } + strict_strtoul(p, 16, &ivmhwkey); + + if (!ivmbid || !ivmhwkey) { + printf("Error: IVM_BoardId and/or IVM_HWKey not set!\n"); + return rc; + } + + /* now try to read values from environment if available */ + p = getenv("boardid"); + if (p != NULL) + strict_strtoul(p, 16, &envbid); + p = getenv("hwkey"); + if (p != NULL) + strict_strtoul(p, 16, &envhwkey); + + if (!envbid || !envhwkey) { + /* + * BoardId/HWkey not available in the environment, so try the + * environment variable for BoardId/HWkey list + */ + char *bidhwklist = getenv("boardIdListHex"); + if (bidhwklist) { + int found = 0; + char *rest = bidhwklist; + char *endp; + if (verbose) { + printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n", + ivmbid, ivmhwkey); + printf("boardIdHwKeyList: %s\n", + bidhwklist); + } + while (!found) { + /* loop over each bid/hwkey pair in the list */ + unsigned long bid = 0; + unsigned long hwkey = 0; + while (*rest && !isxdigit(*rest)) + rest++; + bid = simple_strtoul(rest, &endp, 16); + /* BoardId/HWkey is separated with a "_" for one entry */ + if (*endp == '_') { + rest = endp + 1; + hwkey = simple_strtoul(rest, &endp, 16); + rest = endp; + while (*rest && !isxdigit(*rest)) + rest++; + } + if ((!bid) || (!hwkey)) { + /* end of list */ + break; + } + if (verbose) { + printf("trying bid=0x%lX, hwkey=%ld\n", + bid, hwkey); + } + /* + * Compare the values of the found entry in the + * list with the valid values which are stored + * in the inventory eeprom. If they are equal + * store the values in environment variables + * and save the environment. + * This can only happen once for the lifetime + * of a board, because once saved the function + * will never reach the while loop. + */ + if ((bid == ivmbid) && (hwkey == ivmhwkey)) { + char buf[10]; + + found = 1; + envbid = bid; + envhwkey = hwkey; + sprintf(buf, "%lx", bid); + setenv("boardid", buf); + sprintf(buf, "%lx", hwkey); + setenv("hwkey", buf); + saveenv(); + } + } /* end while( ! found ) */ + } + } + + /* compare now the values */ + if ((ivmbid == envbid) && (ivmhwkey == envhwkey)) { + printf("boardid=0x%3lX, hwkey=%ld\n", envbid, envhwkey); + rc = 0; + } else { + printf("Error: env bId=0x%3lX, hwKey=%ld\n", envbid, envhwkey); + printf(" IVM bId=0x%3lX, hwKey=%ld\n", ivmbid, ivmhwkey); + } + return rc; +} + +U_BOOT_CMD(km_checkbidhwk, 2, 0, do_checkboardidhwk, + "check boardid and hwkey", + "[v]\n - check environment parameter "\ + ""boardIdListHex" against stored boardid and hwkey "\ + "from the IVM\n v: verbose output" +); diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index bc8a896..da3711b 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -238,7 +238,6 @@ "release=" \ "setenv actual_bank ${initial_boot_bank} && " \ "setenv subbootcmds "" \ - "checkboardidlist " \ "checkboardid " \ "ubiattach ubicopy " \ "cramfsloadfdt cramfsloadkernel " \ @@ -389,36 +388,9 @@ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \ - "checkboardidlist=" \ - "if test "x${boardIdListHex}" != "x"; then " \ - "IVMbidhwk=${IVM_BoardId}_${IVM_HWKey}; " \ - "found=0; " \ - "for bidhwk in "${boardIdListHex}"; do " \ - "echo trying $bidhwk ...; " \ - "if test "x$bidhwk" = "x$IVMbidhwk"; then " \ - "found=1; " \ - "echo match found for $bidhwk; " \ - "if test "x$bidhwk" != "x${boardId}_${hwKey}";then "\ - "setenv boardid ${IVM_BoardId}; " \ - "setenv boardId ${IVM_BoardId}; " \ - "setenv hwkey ${IVM_HWKey}; " \ - "setenv hwKey ${IVM_HWKey}; " \ - "echo "boardId set to ${boardId}"; " \ - "echo "hwKey set to ${hwKey}"; " \ - "saveenv; " \ - "fi; " \ - "fi; " \ - "done; " \ - "else " \ - "echo "boardIdListHex not set, not checked"; "\ - "found=1; " \ - "fi; " \ - "test "$found" = 1 \0" \ - "checkboardid=" \ - "test "x${boardId}" = "x${IVM_BoardId}" && " \ - "test "x${hwKey}" = "x${IVM_HWKey}"\0" \ "printbootargs=print bootargs\0" \ "rootfsfile="xstr(CONFIG_HOSTNAME) "/rootfsImage\0" \ + "checkboardid=km_checkbidhwk\0" \ ""
#ifndef CONFIG_KM_DEF_ENV

Dear Holger Brunck,
In message 02d1e3f265123ff0296b1c38b227f6d30393ee77.1304508448.git.holger.brunck@keymile.com you wrote:
From: Thomas Herzmann thomas.herzmann@keymile.com
BoardId and HWKey are used to identify the HW class of a given board. The correct values are stored in the inventory eeprom. During creation time of a boot package the boardId and HWkey for the SW is stored in the default environment and burned into the flash. During boottime the values in the inventory and in the environment are compared to avoid starting of a SW which is not authorized for this board.
Some bootpackages are allowed to run on a set of different boardId hwKey. In this case the environment variable boardIdListHex was added to the default environment. In this case the command iterates over the pair values and compares them with the values read from the inventory eeprom.
The syntax of such a boardIdListHex value is e.g.: 158_1 159_1 159_2
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch series to three independent smaller patch series
- give the cmd a more precise name
- rework the patch with inputs from W.Denk:
- adapt and enhance commit msg
- comment the code
- add error handling
This patch has checkpatch warnings. Please fix.
...
- if (!envbid || !envhwkey) {
/*
* BoardId/HWkey not available in the environment, so try the
* environment variable for BoardId/HWkey list
*/
char *bidhwklist = getenv("boardIdListHex");
if (bidhwklist) {
Please insert a blank line after declarations.
Best regards,
Wolfgang Denk

Hi,
On 05/05/2011 12:11 AM, Wolfgang Denk wrote:
Dear Holger Brunck,
In message 02d1e3f265123ff0296b1c38b227f6d30393ee77.1304508448.git.holger.brunck@keymile.com you wrote:
From: Thomas Herzmann thomas.herzmann@keymile.com
BoardId and HWKey are used to identify the HW class of a given board. The correct values are stored in the inventory eeprom. During creation time of a boot package the boardId and HWkey for the SW is stored in the default environment and burned into the flash. During boottime the values in the inventory and in the environment are compared to avoid starting of a SW which is not authorized for this board.
Some bootpackages are allowed to run on a set of different boardId hwKey. In this case the environment variable boardIdListHex was added to the default environment. In this case the command iterates over the pair values and compares them with the values read from the inventory eeprom.
The syntax of such a boardIdListHex value is e.g.: 158_1 159_1 159_2
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch series to three independent smaller patch series
- give the cmd a more precise name
- rework the patch with inputs from W.Denk:
- adapt and enhance commit msg
- comment the code
- add error handling
This patch has checkpatch warnings. Please fix.
Ok the one warning that we exceed 80 characters per line is fixed, sorry for that. But there are two warnings remaining: WARNING: consider using strict_strtoul in preference to simple_strtoul #137: FILE: board/keymile/common/common.c:813: + bid = simple_strtoul(rest, &endp, 16);
WARNING: consider using strict_strtoul in preference to simple_strtoul #141: FILE: board/keymile/common/common.c:817: + hwkey = simple_strtoul(rest, &endp, 16);
I know that we use strict_strtoul in the same patch some lines above, but at this point we need *endp and we know that we got a non numeric character at the end. So using simple_strtoul at this point is exactly what we want here.
Is it ok to ignore this warnings and add a comment above the codeline why we use simple_stroul?
...
- if (!envbid || !envhwkey) {
/*
* BoardId/HWkey not available in the environment, so try the
* environment variable for BoardId/HWkey list
*/
char *bidhwklist = getenv("boardIdListHex");
if (bidhwklist) {
Please insert a blank line after declarations.
Ok fixed.
Best regards Holger Brunck

Dear Holger Brunck,
In message 4DC2AB4A.608@keymile.com you wrote:
This patch has checkpatch warnings. Please fix.
Ok the one warning that we exceed 80 characters per line is fixed, sorry for that. But there are two warnings remaining: WARNING: consider using strict_strtoul in preference to simple_strtoul #137: FILE: board/keymile/common/common.c:813:
bid = simple_strtoul(rest, &endp, 16);
WARNING: consider using strict_strtoul in preference to simple_strtoul #141: FILE: board/keymile/common/common.c:817:
hwkey = simple_strtoul(rest, &endp, 16);
I know that we use strict_strtoul in the same patch some lines above, but at this point we need *endp and we know that we got a non numeric character at the end. So using simple_strtoul at this point is exactly what we want here.
Well, mixing both strict_strtoul() and simple_strtoul() [without any comment] in the same patch was what attracted my attention in the first place.
Is it ok to ignore this warnings and add a comment above the codeline why we use simple_stroul?
Indeed this needs a comment.
Best regards,
Wolfgang Denk

Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch serie to three independent smaller patch series - no change in the content of this patch
include/configs/keymile-common.h | 4 ++-- include/configs/km_arm.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index da3711b..6a5ecc6 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -86,7 +86,7 @@ #define CONFIG_SYS_HZ 1000 /* decr. freq: 1 ms ticks */
#define CONFIG_BAUDRATE 115200 -#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
#define CONFIG_LOADS_ECHO #define CONFIG_SYS_LOADS_BAUD_CHANGE @@ -423,6 +423,6 @@ "" #endif /* CONFIG_KM_DEF_ENV */
-#define CONFIG_VERSION_VARIABLE /* include version env variable */ +#define CONFIG_VERSION_VARIABLE /* include version env variable */
#endif /* __CONFIG_KEYMILE_H */ diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 70113d4..add5624 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -106,7 +106,7 @@ #define CONFIG_BOOTMAPSZ (8 << 20) /* Initial Memmap for Linux */ #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_INITRD_TAG /* enable INITRD tag */ -#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */
/* * Commands configuration @@ -176,10 +176,10 @@ #ifndef __ASSEMBLY__ #include <asm/arch-kirkwood/gpio.h> extern void __set_direction(unsigned pin, int high); -void set_sda (int state); -void set_scl (int state); -int get_sda (void); -int get_scl (void); +void set_sda(int state); +void set_scl(int state); +int get_sda(void); +int get_scl(void); #define KM_KIRKWOOD_SDA_PIN 8 #define KM_KIRKWOOD_SCL_PIN 9 #define KM_KIRKWOOD_ENV_WP 38

Dear Holger Brunck,
In message 80eaff2bd998b8f6ba0da2afc1c103161a2583ab.1304508448.git.holger.brunck@keymile.com you wrote:
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
include/configs/keymile-common.h | 4 ++-- include/configs/km_arm.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
Applied, thanks.
Note: I omitted patch 4/8 as changes are pending to that one. But it appears the remaining patche sof this series do not really depend on this patch, so applied the remaining ones. Hope this is OK - please verify.
Best regards,
Wolfgang Denk

From: Valentin Longchamp valentin.longchamp@keymile.com
Collect all keymile specific common headers in include/configs/km.
Signed-off-by: Heiko Schocher hs@denx.de Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com cc: Kim Phillips kim.phillips@freescale.com cc: Holger Brunck holger.brunck@keymile.com --- Changes for v2: - split up first large patch serie to three independent smaller patch series - no change in the content of this patch
include/configs/{ => km}/keymile-common.h | 0 include/configs/{ => km}/km-powerpc.h | 0 include/configs/{ => km}/km82xx-common.h | 0 include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 0 include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 6 +++--- include/configs/mgcoge2ne.h | 6 +++--- include/configs/mgcoge2un.h | 2 +- include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- 16 files changed, 14 insertions(+), 14 deletions(-) rename include/configs/{ => km}/keymile-common.h (100%) rename include/configs/{ => km}/km-powerpc.h (100%) rename include/configs/{ => km}/km82xx-common.h (100%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (100%)
diff --git a/include/configs/keymile-common.h b/include/configs/km/keymile-common.h similarity index 100% rename from include/configs/keymile-common.h rename to include/configs/km/keymile-common.h diff --git a/include/configs/km-powerpc.h b/include/configs/km/km-powerpc.h similarity index 100% rename from include/configs/km-powerpc.h rename to include/configs/km/km-powerpc.h diff --git a/include/configs/km82xx-common.h b/include/configs/km/km82xx-common.h similarity index 100% rename from include/configs/km82xx-common.h rename to include/configs/km/km82xx-common.h diff --git a/include/configs/km8321-common.h b/include/configs/km/km8321-common.h similarity index 100% rename from include/configs/km8321-common.h rename to include/configs/km/km8321-common.h diff --git a/include/configs/km83xx-common.h b/include/configs/km/km83xx-common.h similarity index 100% rename from include/configs/km83xx-common.h rename to include/configs/km/km83xx-common.h diff --git a/include/configs/km_arm.h b/include/configs/km/km_arm.h similarity index 100% rename from include/configs/km_arm.h rename to include/configs/km/km_arm.h diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h index 2fcecaf..8639ddd 100644 --- a/include/configs/kmeter1.h +++ b/include/configs/kmeter1.h @@ -34,7 +34,7 @@ "netdev=eth2\0" \
/* include common defines/options for all 83xx Keymile boards */ -#include "km83xx-common.h" +#include "km/km83xx-common.h"
#define CONFIG_MISC_INIT_R /* diff --git a/include/configs/kmsupx5.h b/include/configs/kmsupx5.h index 55ed3f6..f8cd8e0 100644 --- a/include/configs/kmsupx5.h +++ b/include/configs/kmsupx5.h @@ -36,7 +36,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
/* * Init Local Bus Memory Controller: diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index dcde76c..3a08294 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -36,8 +36,8 @@ #define CONFIG_SYS_TEXT_BASE 0xFE000000
/* include common defines/options for all Keymile boards */ -#include "keymile-common.h" -#include "km-powerpc.h" +#include "km/keymile-common.h" +#include "km/km-powerpc.h"
#define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_FLASH_BASE 0xFE000000 @@ -59,7 +59,7 @@ #define MTDIDS_DEFAULT "nor3=app"
/* include further common stuff for all keymile 82xx boards */ -#include "km82xx-common.h" +#include "km/km82xx-common.h"
/* bfticu address */ #define CONFIG_SYS_BFTICU_BASE 0x40000000 diff --git a/include/configs/mgcoge2ne.h b/include/configs/mgcoge2ne.h index 287b717..62f227d 100644 --- a/include/configs/mgcoge2ne.h +++ b/include/configs/mgcoge2ne.h @@ -35,8 +35,8 @@ #define CONFIG_SYS_TEXT_BASE 0xFE000000
/* include common defines/options for all Keymile boards */ -#include "keymile-common.h" -#include "km-powerpc.h" +#include "km/keymile-common.h" +#include "km/km-powerpc.h"
#define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_FLASH_BASE 0xFE000000 @@ -59,6 +59,6 @@ #define MTDIDS_DEFAULT "nor2=app"
/* include further common stuff for all keymile 82xx boards */ -#include "km82xx-common.h" +#include "km/km82xx-common.h"
#endif /* __MGCOGE2NE */ diff --git a/include/configs/mgcoge2un.h b/include/configs/mgcoge2un.h index d3c7bdc..6256035 100644 --- a/include/configs/mgcoge2un.h +++ b/include/configs/mgcoge2un.h @@ -35,7 +35,7 @@ #define _CONFIG_MGCOGE2UN_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/suen3.h b/include/configs/suen3.h index 2b6f19e..aa4d778 100644 --- a/include/configs/suen3.h +++ b/include/configs/suen3.h @@ -34,7 +34,7 @@ #define _CONFIG_SUEN3_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/suen8.h b/include/configs/suen8.h index 3f60bc3..b680dfb 100644 --- a/include/configs/suen8.h +++ b/include/configs/suen8.h @@ -35,7 +35,7 @@ #define _CONFIG_SUEN8_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h index d9eb201..0b59d51 100644 --- a/include/configs/suvd3.h +++ b/include/configs/suvd3.h @@ -30,7 +30,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_APP1_BASE 0xA0000000 #define CONFIG_SYS_APP1_SIZE 256 /* Megabytes */ diff --git a/include/configs/tuda1.h b/include/configs/tuda1.h index 1c0b3e0..853c00a 100644 --- a/include/configs/tuda1.h +++ b/include/configs/tuda1.h @@ -33,7 +33,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_APP1_BASE 0xA0000000 /* PAXG */ #define CONFIG_SYS_APP1_SIZE 256 /* Megabytes */ diff --git a/include/configs/tuxa1.h b/include/configs/tuxa1.h index 012db96..ceeb5a3 100644 --- a/include/configs/tuxa1.h +++ b/include/configs/tuxa1.h @@ -33,7 +33,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_LPXF_BASE 0xA0000000 /* LPXF */ #define CONFIG_SYS_LPXF_SIZE 256 /* Megabytes */

Dear Holger Brunck,
In message 18f52ef6949323ac2e59371d0f2a7b67ea8e8c3f.1304508448.git.holger.brunck@keymile.com you wrote:
From: Valentin Longchamp valentin.longchamp@keymile.com
Collect all keymile specific common headers in include/configs/km.
Signed-off-by: Heiko Schocher hs@denx.de Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com cc: Kim Phillips kim.phillips@freescale.com cc: Holger Brunck holger.brunck@keymile.com
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
include/configs/{ => km}/keymile-common.h | 0 include/configs/{ => km}/km-powerpc.h | 0 include/configs/{ => km}/km82xx-common.h | 0 include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 0 include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 6 +++--- include/configs/mgcoge2ne.h | 6 +++--- include/configs/mgcoge2un.h | 2 +- include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- 16 files changed, 14 insertions(+), 14 deletions(-) rename include/configs/{ => km}/keymile-common.h (100%) rename include/configs/{ => km}/km-powerpc.h (100%) rename include/configs/{ => km}/km82xx-common.h (100%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (100%)
Applied, thanks.
Best regards,
Wolfgang Denk

This is a first step to simplify the default environment. Move all the environment variables which are only needed for debugging purpose to textfiles in the scripts directory. In case of debugging these files can be loaded via tftp into RAM and set via the env import command. Other variables are identified as obsolete and were removed.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch serie to three independent smaller patch series - no change in the content of this patch
board/keymile/scripts/README | 23 +++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + include/configs/km/keymile-common.h | 128 +++------------------------- include/configs/km/km-powerpc.h | 12 +-- include/configs/km/km_arm.h | 5 +- 7 files changed, 55 insertions(+), 126 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt
diff --git a/board/keymile/scripts/README b/board/keymile/scripts/README new file mode 100644 index 0000000..ce6d79a --- /dev/null +++ b/board/keymile/scripts/README @@ -0,0 +1,23 @@ +debug-common-env.txt +============================ +This file defines environment variables which are valid for powerpc boards +and for arm boards. + +addramfs: add phram device for the rootfilesysten in ram +develop: for development, laod kernel via tftp and mount rootfs via NFS +nfsargs: default arguments for nfs boot +ramfs: load rootfilesystem in RAM kernel +rootfsfile: loacation of the rootfs file for ramfs +setramfspram: compute PRAM size for ramfs target +setrootfsaddr: compute rootfilesystem address for phram +tftpkernel: load a kernel with tftp into ram +tftpramfs: load rootfs with tftp into ram + +debug-ppc-env.txt +============================ +fdt_file: location of the dtb file on the tftp server +tftpfdt: load dtb file and set fdt address + +debug-arm-env.txt +============================ +tftpfdt: for arm only a dummy variable, because we have no fdt on arm diff --git a/board/keymile/scripts/debug-arm-env.txt b/board/keymile/scripts/debug-arm-env.txt new file mode 100644 index 0000000..84498af --- /dev/null +++ b/board/keymile/scripts/debug-arm-env.txt @@ -0,0 +1,2 @@ +debug_env_common=tftpboot 0x200000 scripts/debug-common-env.txt && env import -t 0x200000 ${filesize} +tftpfdt=true diff --git a/board/keymile/scripts/debug-common-env.txt b/board/keymile/scripts/debug-common-env.txt new file mode 100644 index 0000000..1fd4b0c --- /dev/null +++ b/board/keymile/scripts/debug-common-env.txt @@ -0,0 +1,9 @@ +addramfs=setenv bootargs "${bootargs} phram.phram=rootfs${boot_bank},${rootfsaddr},${rootfssize}" +develop=setenv subbootcmds "tftpfdt tftpkernel nfsargs ${commonargs} boot " && setenv bootcmd 'run bootrunner' && setenv altbootcmd 'run bootcmd' && km_setboardid && saveenv && reset +nfsargs=setenv bootargs ubi.mtd=ubi0 root=/dev/nfs rw nfsroot=${serverip}:${rootpath} +ramfs=setenv actual_bank -1 && setenv subbootcmds "tftpfdt tftpkernel setrootfsaddr tftpramfs flashargs ${commonargs} addpanic addramfs boot " && setenv bootcmd 'run bootrunner' && setenv altbootcmd 'run bootcmd' && run setboardid && run setramfspram && run setpnvramaddr && saveenv && reset +rootfsfile=${hostname}/rootfsImage +setramfspram=setexpr value 0 + ${reservedpram} && setexpr value 0x${value} + ${rootfssize} && setexpr value 0x${value} + ${varsize} && setexpr value 0x${value} + ${pnvramsize} && setexpr value 0x${value} / 0x400 && setenv pram 0x${value} +tftpkernel=tftpboot ${kernel_addr_r} ${hostname}/uImage && setenv actual_kernel_addr ${kernel_addr_r} +tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage && setenv loadaddr +setrootfsaddr=setexpr value ${pnvramsize} - ${rootfssize} && setenv rootfsaddr 0x${value} diff --git a/board/keymile/scripts/debug-ppc-env.txt b/board/keymile/scripts/debug-ppc-env.txt new file mode 100644 index 0000000..3c06ff1 --- /dev/null +++ b/board/keymile/scripts/debug-ppc-env.txt @@ -0,0 +1,2 @@ +debug_env_common=tftpboot 0x200000 scripts/debug-common-env.txt && env import -t 0x200000 ${filesize} +tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb && setenv actual_fdt_addr ${fdt_addr_r} diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index 6a5ecc6..9ad2e5b 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -169,13 +169,8 @@ "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" \ "" @@ -186,8 +181,6 @@ * - 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 */ @@ -201,40 +194,6 @@ "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 "" \ @@ -242,8 +201,7 @@ "ubiattach ubicopy " \ "cramfsloadfdt cramfsloadkernel " \ "flashargs ${commonargs} " \ - "addpanic " \ - "printbootargs boot " \ + "addpanic boot " \ "" && " \ "setenv bootcmd '" \ "run actual bootrunner; reset" \ @@ -251,8 +209,12 @@ "setenv altbootcmd '" \ "run backup bootrunner; reset" \ "' && " \ - "saveenv && " \ + "saveenv && saveenv && " \ "reset\0" \ + "debug_env=" \ + "tftp 200000 " CONFIG_KM_ARCH_DBG_FILE " && " \ + "env import -t 200000 ${filesize} && " \ + "run debug_env_common\0" \ ""
/* @@ -262,10 +224,8 @@ * - '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 @@ -280,25 +240,15 @@ "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ ":${hostname}:${netdev}:off\0" \ "addmem=" \ - "setenv bootargs ${bootargs} mem=0x${pnvramaddr}\0" \ + "setenv bootargs ${bootargs} mem=${pnvramaddr}\0" \ "addpanic=" \ - "setenv bootargs ${bootargs} " \ - "panic=1 panic_on_oops=1\0" \ - "addramfs=" \ - "setenv bootargs "" \ - "${bootargs} phram.phram=" \ - "rootfs${boot_bank},${rootfsaddr},${rootfssize}"\0" \ + "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 " " \ - "root=/dev/nfs rw " \ - "nfsroot=${serverip}:${rootpath}\0" \ + "${varaddr}," xstr(CONFIG_KM_PHRAM) "\0" \ "flashargs=" \ "setenv bootargs " \ "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ @@ -307,71 +257,25 @@ ""
/* - * 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 boardId ${IVM_BoardId} && " \ - "setenv hwKey ${IVM_HWKey}; " \ - "else; " \ - "echo \\c; " \ - "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 from flash * - * - 'cramfsaddr': address to the cramfs (in ram) * - 'cramfsloadkernel': copy kernel from a cramfs to ram * - 'ubiattach': attach ubi partition * - 'ubicopy': copy ubi volume to ram * - volume names: bootfs0, bootfs1, bootfs2, ... - * - 'ubiparition': mtd parition name for ubi * * processor specific settings * - 'cramfsloadfdt': copy fdt from a cramfs to ram */ #define CONFIG_KM_DEF_ENV_FLASH_BOOT \ - "cramfsaddr="xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \ + "cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \ "cramfsloadkernel=" \ "cramfsload ${kernel_addr_r} uImage && " \ "setenv actual_kernel_addr ${kernel_addr_r}\0" \ - "ubiattach=ubi part ${ubipartition}\0" \ - "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \ - "ubipartition=" CONFIG_KM_UBI_PARTITION_NAME "\0" \ - "" - -/* - * net_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" \ - "tftpramfs=" \ - "tftpboot ${rootfsaddr} "\"${rootfsfile}\"" && " \ - "setenv loadaddr\0" \ + "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME "\0" \ + "ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR) \ + " bootfs${boot_bank}\0" \ ""
/* @@ -388,8 +292,6 @@ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \ - "printbootargs=print bootargs\0" \ - "rootfsfile="xstr(CONFIG_HOSTNAME) "/rootfsImage\0" \ "checkboardid=km_checkbidhwk\0" \ ""
@@ -401,17 +303,13 @@ 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" \ "init=/sbin/init-overlay.sh\0" \ "kernel_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0" \ - "kernel_file="xstr(CONFIG_HOSTNAME) "/uImage\0" \ - "kernel_name=uImage\0" \ "load=tftpboot ${u-boot_addr_r} ${u-boot}\0" \ "mtdids=" MTDIDS_DEFAULT "\0" \ "mtdparts=" MTDPARTS_DEFAULT "\0" \ diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h index 3351609..d6db8d7 100644 --- a/include/configs/km/km-powerpc.h +++ b/include/configs/km/km-powerpc.h @@ -67,20 +67,14 @@ #define CONFIG_KM_FDT_ADDR 0x7E0000 /* 128Kbytes */
#define CONFIG_KM_DEF_ENV_CPU \ - "addbootcount=echo \\c\0" \ - "addmtdparts=echo \\c\0" \ + "addbootcount=true\0" \ + "addmtdparts=true\0" \ "boot=bootm ${actual_kernel_addr} - ${actual_fdt_addr}\0" \ "cramfsloadfdt=" \ "cramfsload ${fdt_addr_r} " \ "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb && " \ "setenv actual_fdt_addr ${fdt_addr_r}\0" \ "fdt_addr_r=" xstr(CONFIG_KM_FDT_ADDR) "\0" \ - "fdt_file=" \ - xstr(CONFIG_HOSTNAME) "/" \ - xstr(CONFIG_HOSTNAME) ".dtb\0" \ - "tftpfdt=" \ - "tftpboot ${fdt_addr_r} ${fdt_file} && " \ - "setenv actual_fdt_addr ${fdt_addr_r} \0" \ "update=" \ "protect off " xstr(BOOTFLASH_START) " +${filesize} && "\ "erase " xstr(BOOTFLASH_START) " +${filesize} && " \ @@ -89,4 +83,6 @@ "protect on " xstr(BOOTFLASH_START) " +${filesize}\0" \ ""
+#define CONFIG_KM_ARCH_DBG_FILE "scripts/debug-ppc-env.txt" + #endif /* __CONFIG_KEYMILE_POWERPC_H */ diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index add5624..991ae9f 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -66,12 +66,11 @@ #define CONFIG_KM_DEF_ENV_CPU \ "addmtdparts=setenv bootargs ${bootargs} ${mtdparts}\0" \ "boot=bootm ${actual_kernel_addr} - -\0" \ - "cramfsloadfdt=echo \\c\0" \ - "tftpfdt=echo \\c\0" \ + "cramfsloadfdt=true\0" \ CONFIG_KM_DEF_ENV_UPDATE \ ""
- +#define CONFIG_KM_ARCH_DBG_FILE "scripts/debug-arm-env.txt"
#define CONFIG_MD5 /* get_random_hex on krikwood needs MD5 support */ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */

Dear Holger Brunck,
In message 0bbf514662e171fe0a8ef9b53a4819c7839e187e.1304508448.git.holger.brunck@keymile.com you wrote:
This is a first step to simplify the default environment. Move all the environment variables which are only needed for debugging purpose to textfiles in the scripts directory. In case of debugging these files can be loaded via tftp into RAM and set via the env import command. Other variables are identified as obsolete and were removed.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
board/keymile/scripts/README | 23 +++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + include/configs/km/keymile-common.h | 128 +++------------------------- include/configs/km/km-powerpc.h | 12 +-- include/configs/km/km_arm.h | 5 +- 7 files changed, 55 insertions(+), 126 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt
Applied, thanks.
Best regards,
Wolfgang Denk

Dear Holger Brunck,
In message 0bbf514662e171fe0a8ef9b53a4819c7839e187e.1304508448.git.holger.brunck@keymile.com you wrote:
This is a first step to simplify the default environment. Move all the environment variables which are only needed for debugging purpose to textfiles in the scripts directory. In case of debugging these files can be loaded via tftp into RAM and set via the env import command. Other variables are identified as obsolete and were removed.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
board/keymile/scripts/README | 23 +++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + include/configs/km/keymile-common.h | 128 +++------------------------- include/configs/km/km-powerpc.h | 12 +-- include/configs/km/km_arm.h | 5 +- 7 files changed, 55 insertions(+), 126 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt
This does not apply cleanly:
pplying patch #94008 to current directory Description: [U-Boot,v2,7/8] km/common: simplify default environment Applying: km/common: simplify default environment fatal: sha1 information is lacking or useless (include/configs/km/keymile-common.h). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 km/common: simplify default environment
Stopping here. Please resubmit 4/8, 7/8 and 8/8.
Best regards,
Wolfgang Denk

Hello,
On 05/10/2011 11:24 PM, Wolfgang Denk wrote:
Dear Holger Brunck,
In message 0bbf514662e171fe0a8ef9b53a4819c7839e187e.1304508448.git.holger.brunck@keymile.com you wrote:
This is a first step to simplify the default environment. Move all the environment variables which are only needed for debugging purpose to textfiles in the scripts directory. In case of debugging these files can be loaded via tftp into RAM and set via the env import command. Other variables are identified as obsolete and were removed.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de
Changes for v2:
- split up first large patch serie to three independent smaller patch series
- no change in the content of this patch
board/keymile/scripts/README | 23 +++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + include/configs/km/keymile-common.h | 128 +++------------------------- include/configs/km/km-powerpc.h | 12 +-- include/configs/km/km_arm.h | 5 +- 7 files changed, 55 insertions(+), 126 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt
This does not apply cleanly:
pplying patch #94008 to current directory Description: [U-Boot,v2,7/8] km/common: simplify default environment Applying: km/common: simplify default environment fatal: sha1 information is lacking or useless (include/configs/km/keymile-common.h). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 km/common: simplify default environment
Stopping here. Please resubmit 4/8, 7/8 and 8/8.
Yes there are some dependencies if 4/8 is missing. I fix this an resubmit the missing pieces. I assume that I should only resubmit a patch serie with this three patches and not the whole serie?
Thanks!
Best regards Holger

Dear Holger Brunck,
In message 4DCA3393.5060508@keymile.com you wrote:
Yes there are some dependencies if 4/8 is missing. I fix this an resubmit the missing pieces. I assume that I should only resubmit a patch serie with this three patches and not the whole serie?
Correct. Thanks.
Best regards,
Wolfgang Denk

The pnvram size was used later from start scripts in linux. Therefore it was added to the default environment.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de --- Changes for v2: - split up first large patch serie to three independent smaller patch series - rework the patch with inputs from W.Denk: - move variable from c-code to default env to be present in any case when linux starts
include/configs/km/keymile-common.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index 9ad2e5b..757d23a 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -293,6 +293,7 @@ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \ "checkboardid=km_checkbidhwk\0" \ + "pnvramsize=0x" xstr(CONFIG_KM_PNVRAM) "\0" \ ""
#ifndef CONFIG_KM_DEF_ENV
participants (2)
-
Holger Brunck
-
Wolfgang Denk