diff mbox

[U-Boot,v2] board/BuR/kwb: use bootvx(...) (with bootline feature) instead go(...)

Message ID 1443509013-12586-1-git-send-email-oe5hpm@oevsv.at
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Hannes Schmelzer Sept. 29, 2015, 6:43 a.m. UTC
Since we don't have for sure a valid IP-setup during
board_late_init(...) because it maybe allready stored in environment or
not, we cannot form a proper vxWorks bootline at this place.

So we move to the way, forming the bootline just before
executing/launching vxWorks. To do this we use the bootvx command
instead go.

We only have to form the "othbootargs" environment variable, the rest is
done pretty good by the "bootvx" commannd.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
--
---

Changes in v2:
- form only othbootargs instead whole bootline within board-code
- depends now on Bin Mengs changes belong CMD_ELF
http://patchwork.ozlabs.org/patch/523289/
- adapt kwb_defconfig to the new Kconfig defaults
- use bootvx ... instead go ... to launch vxWorks kernel

 board/BuR/kwb/board.c | 27 +++++++++------------------
 configs/kwb_defconfig |  3 +++
 include/configs/kwb.h |  8 +++++---
 3 files changed, 17 insertions(+), 21 deletions(-)

Comments

Bin Meng Sept. 29, 2015, 11:37 a.m. UTC | #1
On Tue, Sep 29, 2015 at 2:43 PM, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
> Since we don't have for sure a valid IP-setup during
> board_late_init(...) because it maybe allready stored in environment or
> not, we cannot form a proper vxWorks bootline at this place.
>
> So we move to the way, forming the bootline just before
> executing/launching vxWorks. To do this we use the bootvx command
> instead go.
>
> We only have to form the "othbootargs" environment variable, the rest is
> done pretty good by the "bootvx" commannd.
>
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
> --
> ---
>
> Changes in v2:
> - form only othbootargs instead whole bootline within board-code
> - depends now on Bin Mengs changes belong CMD_ELF
> http://patchwork.ozlabs.org/patch/523289/
> - adapt kwb_defconfig to the new Kconfig defaults
> - use bootvx ... instead go ... to launch vxWorks kernel
>
>  board/BuR/kwb/board.c | 27 +++++++++------------------
>  configs/kwb_defconfig |  3 +++
>  include/configs/kwb.h |  8 +++++---
>  3 files changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c
> index 039ec20..ad74ff2 100644
> --- a/board/BuR/kwb/board.c
> +++ b/board/BuR/kwb/board.c
> @@ -47,10 +47,6 @@
>  #define        RSTCTRL_FORCE_PWR_NEN                   0x0404
>  #define        RSTCTRL_CAN_STB                         0x4040
>
> -#define VXWORKS_BOOTLINE                       0x80001100
> -#define DEFAULT_BOOTLINE       "cpsw(0,0):pme/vxWorks"
> -#define VXWORKS_USER           "u=vxWorksFTP pw=vxWorks tn=vxtarget"
> -
>  DECLARE_GLOBAL_DATA_PTR;
>
>  #if defined(CONFIG_SPL_BUILD)
> @@ -281,20 +277,15 @@ int board_late_init(void)
>         } else {
>                 puts("ERROR: i2c_set_bus_speed failed! (scratchregister)\n");
>         }
> -       /* setup vxworks bootline */
> -       char *vxworksbootline = (char *)VXWORKS_BOOTLINE;
> -       sprintf(vxworksbootline,
> -               "%s h=%s e=%s:%s g=%s %s o=0x%08x;0x%08x;0x%08x;0x%08x",
> -               DEFAULT_BOOTLINE,
> -               getenv("serverip"),
> -               getenv("ipaddr"), getenv("netmask"),
> -               getenv("gatewayip"),
> -               VXWORKS_USER,
> -               (unsigned int) gd->fb_base-0x20,
> -               (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
> -               (u32)getenv_ulong("vx_romfsbase", 16, 0),
> -               (u32)getenv_ulong("vx_romfssize", 16, 0));
> -
> +       /* setup othbootargs for bootvx-command (vxWorks bootline) */
> +       char othbootargs[128];
> +       snprintf(othbootargs, sizeof(othbootargs),
> +                "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
> +                (unsigned int) gd->fb_base-0x20,
> +                (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
> +                (u32)getenv_ulong("vx_romfsbase", 16, 0),
> +                (u32)getenv_ulong("vx_romfssize", 16, 0));
> +       setenv("othbootargs", othbootargs);
>         /*
>          * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
>          * expect that vectors are there, original u-boot moves them to _start
> diff --git a/configs/kwb_defconfig b/configs/kwb_defconfig
> index f82fcf3..0bbe0a7 100644
> --- a/configs/kwb_defconfig
> +++ b/configs/kwb_defconfig
> @@ -3,6 +3,9 @@ CONFIG_TARGET_KWB=y
>  CONFIG_SPL=y
>  CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1"
>  CONFIG_SYS_PROMPT="U-Boot (BuR V2.0)# "
> +# CONFIG_CMD_BOOTD is not set
> +# CONFIG_CMD_BOOTM is not set
> +# CONFIG_CMD_GO is not set
>  # CONFIG_CMD_IMI is not set
>  # CONFIG_CMD_IMLS is not set
>  # CONFIG_CMD_XIMG is not set
> diff --git a/include/configs/kwb.h b/include/configs/kwb.h
> index 96f2e9d..45253b8 100644
> --- a/include/configs/kwb.h
> +++ b/include/configs/kwb.h
> @@ -57,6 +57,8 @@
>  #ifndef CONFIG_SPL_BUILD
>  #define CONFIG_EXTRA_ENV_SETTINGS \
>  BUR_COMMON_ENV \
> +"bootaddr=0x80001100\0" \
> +"bootdev=cpsw(0,0)\0" \
>  "vx_romfsbase=0x800E0000\0" \
>  "vx_romfssize=0x20000\0" \
>  "vx_memtop=0x8FBEF000\0" \
> @@ -66,7 +68,7 @@ BUR_COMMON_ENV \
>  "logoaddr=0x82000000\0" \
>  "defaultARlen=0x8000\0" \
>  "loaddefaultAR=mmc read ${loadaddr} 800 ${defaultARlen}\0" \
> -"defaultAR=run loadromfs; run loaddefaultAR; go ${loadaddr}\0" \
> +"defaultAR=run loadromfs; run loaddefaultAR; bootvx ${loadaddr}\0" \
>  "logo0=fatload mmc 0:1 ${logoaddr} SYSTEM/ADDON/Bootlogo/Bootlogo.bmp.gz && " \
>         "bmp display ${logoaddr} 0 0\0" \
>  "logo1=fatload mmc 0:1 ${logoaddr} SYSTEM/BASE/Bootlogo/Bootlogo.bmp.gz && " \
> @@ -74,11 +76,11 @@ BUR_COMMON_ENV \
>  "mmcboot=echo booting AR from eMMC-flash ...; "\
>         "run logo0 || run logo1; " \
>         "run loadromfs; " \
> -       "fatload mmc 0:1 ${loadaddr} arimg && go ${loadaddr}; " \
> +       "fatload mmc 0:1 ${loadaddr} arimg && bootvx ${loadaddr}; " \
>         "run defaultAR;\0" \
>  "netboot=echo booting AR from network ...; " \
>         "run loadromfs; " \
> -       "tftp ${loadaddr} arimg && go ${loadaddr}; " \
> +       "tftp ${loadaddr} arimg && bootvx ${loadaddr}; " \
>         "puts 'networkboot failed!';\0" \
>  "netscript=echo running script from network (tftp) ...; " \
>         "tftp 0x80000000 netscript.img && source; " \
> --

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tom Rini Nov. 13, 2015, 1:26 a.m. UTC | #2
On Tue, Sep 29, 2015 at 08:43:33AM +0200, Hannes Petermaier wrote:

> Since we don't have for sure a valid IP-setup during
> board_late_init(...) because it maybe allready stored in environment or
> not, we cannot form a proper vxWorks bootline at this place.
> 
> So we move to the way, forming the bootline just before
> executing/launching vxWorks. To do this we use the bootvx command
> instead go.
> 
> We only have to form the "othbootargs" environment variable, the rest is
> done pretty good by the "bootvx" commannd.
> 
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/BuR/kwb/board.c b/board/BuR/kwb/board.c
index 039ec20..ad74ff2 100644
--- a/board/BuR/kwb/board.c
+++ b/board/BuR/kwb/board.c
@@ -47,10 +47,6 @@ 
 #define	RSTCTRL_FORCE_PWR_NEN			0x0404
 #define	RSTCTRL_CAN_STB				0x4040
 
-#define VXWORKS_BOOTLINE			0x80001100
-#define DEFAULT_BOOTLINE	"cpsw(0,0):pme/vxWorks"
-#define VXWORKS_USER		"u=vxWorksFTP pw=vxWorks tn=vxtarget"
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #if defined(CONFIG_SPL_BUILD)
@@ -281,20 +277,15 @@  int board_late_init(void)
 	} else {
 		puts("ERROR: i2c_set_bus_speed failed! (scratchregister)\n");
 	}
-	/* setup vxworks bootline */
-	char *vxworksbootline = (char *)VXWORKS_BOOTLINE;
-	sprintf(vxworksbootline,
-		"%s h=%s e=%s:%s g=%s %s o=0x%08x;0x%08x;0x%08x;0x%08x",
-		DEFAULT_BOOTLINE,
-		getenv("serverip"),
-		getenv("ipaddr"), getenv("netmask"),
-		getenv("gatewayip"),
-		VXWORKS_USER,
-		(unsigned int) gd->fb_base-0x20,
-		(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
-		(u32)getenv_ulong("vx_romfsbase", 16, 0),
-		(u32)getenv_ulong("vx_romfssize", 16, 0));
-
+	/* setup othbootargs for bootvx-command (vxWorks bootline) */
+	char othbootargs[128];
+	snprintf(othbootargs, sizeof(othbootargs),
+		 "u=vxWorksFTP pw=vxWorks o=0x%08x;0x%08x;0x%08x;0x%08x",
+		 (unsigned int) gd->fb_base-0x20,
+		 (u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
+		 (u32)getenv_ulong("vx_romfsbase", 16, 0),
+		 (u32)getenv_ulong("vx_romfssize", 16, 0));
+	setenv("othbootargs", othbootargs);
 	/*
 	 * reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
 	 * expect that vectors are there, original u-boot moves them to _start
diff --git a/configs/kwb_defconfig b/configs/kwb_defconfig
index f82fcf3..0bbe0a7 100644
--- a/configs/kwb_defconfig
+++ b/configs/kwb_defconfig
@@ -3,6 +3,9 @@  CONFIG_TARGET_KWB=y
 CONFIG_SPL=y
 CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1"
 CONFIG_SYS_PROMPT="U-Boot (BuR V2.0)# "
+# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTM is not set
+# CONFIG_CMD_GO is not set
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_XIMG is not set
diff --git a/include/configs/kwb.h b/include/configs/kwb.h
index 96f2e9d..45253b8 100644
--- a/include/configs/kwb.h
+++ b/include/configs/kwb.h
@@ -57,6 +57,8 @@ 
 #ifndef CONFIG_SPL_BUILD
 #define CONFIG_EXTRA_ENV_SETTINGS \
 BUR_COMMON_ENV \
+"bootaddr=0x80001100\0" \
+"bootdev=cpsw(0,0)\0" \
 "vx_romfsbase=0x800E0000\0" \
 "vx_romfssize=0x20000\0" \
 "vx_memtop=0x8FBEF000\0" \
@@ -66,7 +68,7 @@  BUR_COMMON_ENV \
 "logoaddr=0x82000000\0" \
 "defaultARlen=0x8000\0" \
 "loaddefaultAR=mmc read ${loadaddr} 800 ${defaultARlen}\0" \
-"defaultAR=run loadromfs; run loaddefaultAR; go ${loadaddr}\0" \
+"defaultAR=run loadromfs; run loaddefaultAR; bootvx ${loadaddr}\0" \
 "logo0=fatload mmc 0:1 ${logoaddr} SYSTEM/ADDON/Bootlogo/Bootlogo.bmp.gz && " \
 	"bmp display ${logoaddr} 0 0\0" \
 "logo1=fatload mmc 0:1 ${logoaddr} SYSTEM/BASE/Bootlogo/Bootlogo.bmp.gz && " \
@@ -74,11 +76,11 @@  BUR_COMMON_ENV \
 "mmcboot=echo booting AR from eMMC-flash ...; "\
 	"run logo0 || run logo1; " \
 	"run loadromfs; " \
-	"fatload mmc 0:1 ${loadaddr} arimg && go ${loadaddr}; " \
+	"fatload mmc 0:1 ${loadaddr} arimg && bootvx ${loadaddr}; " \
 	"run defaultAR;\0" \
 "netboot=echo booting AR from network ...; " \
 	"run loadromfs; " \
-	"tftp ${loadaddr} arimg && go ${loadaddr}; " \
+	"tftp ${loadaddr} arimg && bootvx ${loadaddr}; " \
 	"puts 'networkboot failed!';\0" \
 "netscript=echo running script from network (tftp) ...; " \
 	"tftp 0x80000000 netscript.img && source; " \