[U-Boot] [PATCH 0/5] ARM: keystone2: Build images by default

Currently we need to build each image(u-boot.uart, u-boot-nand.gph, u-boot-spi.gph) separately for all keystone2 platforms.
This series does the following: - Move SP to end of u-boot section so that u-boot.bin can be used as build target for uart boot. - Renames u-boot-nand.gph to MLO so that the same image can be used for NAND and SD boots. - Includes these images in config.mk so that these images are built automatically upon calling make.
Now the updated build targets are as below: Uart: u-boot.bin SPI: u-boot-spi.gph NAND: MLO SD: MLO
Testing:
k2hk-evm: --------- Uart boot: http://pastebin.ubuntu.com/12106278/ SPI boot: http://pastebin.ubuntu.com/12106315/ NAND boot: http://pastebin.ubuntu.com/12106368/
Lokesh Vutla (4): ARM: keystone2: configs: Move SP to end of u-boot section ARM: keystone2: Rename u-boot-nand.gph to MLO ARM: keystone2: Build MLO by default ARM: keystone2: Update README
Nishanth Menon (1): ARM: keystone2: move the custom build rules out to keystone specific makefile
Makefile | 16 ---------------- arch/arm/mach-keystone/config.mk | 28 ++++++++++++++++++++++++++++ board/ti/ks2_evm/README | 32 ++++++++++++++++++-------------- include/configs/ti_armv7_keystone2.h | 4 ++-- 4 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 arch/arm/mach-keystone/config.mk

Currently u-boot stack is defined at the beginning of MSMC RAM. This is a problem for uart boot mode as ROM downloads directly to starting of MSMC RAM. Fixing it by moving stack to the end of u-boot section and shifting SYS_TEXT_BASE to the start of MSMC RAM. Updated division of MSMC RAM is shown below: ----------------------------------------- | | | | | U-Boot text |U-Boot | SPL text | | download | Stack | Download + | | | | SPL_BSS + | | | | SPL_STACK | ----------------------------------------- [1] [2] [3] [4]
[1] SYS_TEXT_BASE (Start of MSMC RAM) [2] SPL_TEXT_BASE - GBL_DATA_SIZE [3] SPL_TEXT_BASE [4] END of SPL
[1] + [2] is at least 1M on all platforms, so no chance of overlap.
Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- include/configs/ti_armv7_keystone2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h index b441590..58c98ce 100644 --- a/include/configs/ti_armv7_keystone2.h +++ b/include/configs/ti_armv7_keystone2.h @@ -20,7 +20,7 @@ /* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT #define CONFIG_SYS_ARCH_TIMER -#define CONFIG_SYS_TEXT_BASE 0x0c001000 +#define CONFIG_SYS_TEXT_BASE 0x0c000000 #define CONFIG_SPL_TARGET "u-boot-spi.gph" #define CONFIG_SYS_DCACHE_OFF
@@ -29,7 +29,7 @@ #define CONFIG_SYS_LPAE_SDRAM_BASE 0x800000000 #define CONFIG_MAX_RAM_BANK_SIZE (2 << 30) /* 2GB */ #define CONFIG_STACKSIZE (512 << 10) /* 512 KiB */ -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - \ +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SPL_TEXT_BASE - \ GENERATED_GBL_DATA_SIZE)
/* SPL SPI Loader Configuration */

On Mon, Aug 17, 2015 at 9:24 AM, Lokesh Vutla lokeshvutla@ti.com wrote:
Currently u-boot stack is defined at the beginning of MSMC RAM. This is a problem for uart boot mode as ROM downloads directly to starting of MSMC RAM. Fixing it by moving stack to the end of u-boot section and shifting SYS_TEXT_BASE to the start of MSMC RAM. Updated division of MSMC RAM is shown below: ----------------------------------------- | | | | | U-Boot text |U-Boot | SPL text | | download | Stack | Download + | | | | SPL_BSS + | | | | SPL_STACK | ----------------------------------------- [1] [2] [3] [4]
[1] SYS_TEXT_BASE (Start of MSMC RAM) [2] SPL_TEXT_BASE - GBL_DATA_SIZE [3] SPL_TEXT_BASE [4] END of SPL
[1] + [2] is at least 1M on all platforms, so no chance of overlap.
Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
include/configs/ti_armv7_keystone2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h index b441590..58c98ce 100644 --- a/include/configs/ti_armv7_keystone2.h +++ b/include/configs/ti_armv7_keystone2.h @@ -20,7 +20,7 @@ /* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT #define CONFIG_SYS_ARCH_TIMER -#define CONFIG_SYS_TEXT_BASE 0x0c001000 +#define CONFIG_SYS_TEXT_BASE 0x0c000000 #define CONFIG_SPL_TARGET "u-boot-spi.gph" #define CONFIG_SYS_DCACHE_OFF
@@ -29,7 +29,7 @@ #define CONFIG_SYS_LPAE_SDRAM_BASE 0x800000000 #define CONFIG_MAX_RAM_BANK_SIZE (2 << 30) /* 2GB */ #define CONFIG_STACKSIZE (512 << 10) /* 512 KiB */ -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - \ +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SPL_TEXT_BASE - \ GENERATED_GBL_DATA_SIZE)
/* SPL SPI Loader Configuration */
This change is great. Now that this patch is done, I might like to see the documentation of uart download added in as well - the sequence is not really straight forward without documentation to follow
Regards, Nishanth Menon

Hi Nishanth, On Monday 17 August 2015 08:01 PM, menon.nishanth@gmail.com wrote:
On Mon, Aug 17, 2015 at 9:24 AM, Lokesh Vutla lokeshvutla@ti.com wrote:
Currently u-boot stack is defined at the beginning of MSMC RAM. This is a problem for uart boot mode as ROM downloads directly to starting of MSMC RAM. Fixing it by moving stack to the end of u-boot section and shifting SYS_TEXT_BASE to the start of MSMC RAM. Updated division of MSMC RAM is shown below: ----------------------------------------- | | | | | U-Boot text |U-Boot | SPL text | | download | Stack | Download + | | | | SPL_BSS + | | | | SPL_STACK | ----------------------------------------- [1] [2] [3] [4]
[1] SYS_TEXT_BASE (Start of MSMC RAM) [2] SPL_TEXT_BASE - GBL_DATA_SIZE [3] SPL_TEXT_BASE [4] END of SPL
[1] + [2] is at least 1M on all platforms, so no chance of overlap.
Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
include/configs/ti_armv7_keystone2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h index b441590..58c98ce 100644 --- a/include/configs/ti_armv7_keystone2.h +++ b/include/configs/ti_armv7_keystone2.h @@ -20,7 +20,7 @@ /* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT #define CONFIG_SYS_ARCH_TIMER -#define CONFIG_SYS_TEXT_BASE 0x0c001000 +#define CONFIG_SYS_TEXT_BASE 0x0c000000 #define CONFIG_SPL_TARGET "u-boot-spi.gph" #define CONFIG_SYS_DCACHE_OFF
@@ -29,7 +29,7 @@ #define CONFIG_SYS_LPAE_SDRAM_BASE 0x800000000 #define CONFIG_MAX_RAM_BANK_SIZE (2 << 30) /* 2GB */ #define CONFIG_STACKSIZE (512 << 10) /* 512 KiB */ -#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE - \ +#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SPL_TEXT_BASE - \ GENERATED_GBL_DATA_SIZE)
/* SPL SPI Loader Configuration */
This change is great. Now that this patch is done, I might like to see the documentation of uart download added in as well - the sequence is not really straight forward without documentation to follow
Patch 5/5 does the update in the README.
Thanks and regards, Lokesh
Regards, Nishanth Menon

On Mon, Aug 17, 2015 at 9:34 AM, Lokesh Vutla a0131933@ti.com wrote:
Hi Nishanth,
[..]
/* SPL SPI Loader Configuration */
This change is great. Now that this patch is done, I might like to see the documentation of uart download added in as well - the sequence is not really straight forward without documentation to follow
Patch 5/5 does the update in the README.
Sorry about that. looks like my mail filters were a little hinky today and patches 4 and 5 seemed to have slipped my folder :(.... Anyways, Thanks for taking care of the same.
Regards, Nishanth Menon

On Mon, Aug 17, 2015 at 07:54:48PM +0530, Lokesh Vutla wrote:
Currently u-boot stack is defined at the beginning of MSMC RAM. This is a problem for uart boot mode as ROM downloads directly to starting of MSMC RAM. Fixing it by moving stack to the end of u-boot section and shifting SYS_TEXT_BASE to the start of MSMC RAM. Updated division of MSMC RAM is shown below:
| | | | | U-Boot text |U-Boot | SPL text | | download | Stack | Download + | | | | SPL_BSS + | | | | SPL_STACK |
[1] [2] [3] [4]
[1] SYS_TEXT_BASE (Start of MSMC RAM) [2] SPL_TEXT_BASE - GBL_DATA_SIZE [3] SPL_TEXT_BASE [4] END of SPL
[1] + [2] is at least 1M on all platforms, so no chance of overlap.
Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

From: Nishanth Menon nm@ti.com
Keystone has build rules introduced by commit ef509b9063fb7 ("k2hk: add support for k2hk SOC and EVM") and commit 0e7f2dbac6ead ("keystone: add support for NAND gpheader image").
These are not reused by other platforms for the build, hence there is no clear benefit is maintaining them in the generic makefile as a build target. move these to the keystone specific make option
Original idea of using config.mk by Lokesh Vutla lokeshvutla@ti.com
Signed-off-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- Makefile | 16 ---------------- arch/arm/mach-keystone/config.mk | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 arch/arm/mach-keystone/config.mk
diff --git a/Makefile b/Makefile index ad51e60..9f44600 100644 --- a/Makefile +++ b/Makefile @@ -1004,22 +1004,6 @@ OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE $(call if_changed,pad_cat)
-MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ - -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL -spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE - $(call if_changed,mkimage) - -OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ - --gap-fill=0 -u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE - $(call if_changed,pad_cat) - -MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \ - -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot -u-boot-nand.gph: u-boot.bin FORCE - $(call if_changed,mkimage) - @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@ - ifneq ($(CONFIG_ARCH_SOCFPGA),) quiet_cmd_socboot = SOCBOOT $@ cmd_socboot = cat spl/u-boot-spl-dtb.sfp spl/u-boot-spl-dtb.sfp \ diff --git a/arch/arm/mach-keystone/config.mk b/arch/arm/mach-keystone/config.mk new file mode 100644 index 0000000..3fcda92 --- /dev/null +++ b/arch/arm/mach-keystone/config.mk @@ -0,0 +1,22 @@ +# Copyright 2015 Texas Instruments Incorporated, <www.ti.com> +# +# Lokesh Vutla lokeshvutla@ti.com +# +# SPDX-License-Identifier: GPL-2.0+ +# + +MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ + -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL +spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE + $(call if_changed,mkimage) + +OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \ + --gap-fill=0 +u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE + $(call if_changed,pad_cat) + +MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \ + -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot +u-boot-nand.gph: u-boot.bin FORCE + $(call if_changed,mkimage) + @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@

On Mon, Aug 17, 2015 at 07:54:49PM +0530, Lokesh Vutla wrote:
From: Nishanth Menon nm@ti.com
Keystone has build rules introduced by commit ef509b9063fb7 ("k2hk: add support for k2hk SOC and EVM") and commit 0e7f2dbac6ead ("keystone: add support for NAND gpheader image").
These are not reused by other platforms for the build, hence there is no clear benefit is maintaining them in the generic makefile as a build target. move these to the keystone specific make option
Original idea of using config.mk by Lokesh Vutla lokeshvutla@ti.com
Signed-off-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

NAND boot mode, ROM expects an image with a gp header in the beginning and an 8bytes filled with zeros at the end. The same is true for SD boot on K2G platforms but the file name should be MLO.
Renaming u-boot-nand.gph to MLO, so that same image can be used for NAND and SD boots. And also not including all the u-boot only images under CONFIG_SPL_BUILD.
Reported-by: Nishanth Menon nm@ti.com Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- arch/arm/mach-keystone/config.mk | 6 ++++-- board/ti/ks2_evm/README | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-keystone/config.mk b/arch/arm/mach-keystone/config.mk index 3fcda92..ff2fa68 100644 --- a/arch/arm/mach-keystone/config.mk +++ b/arch/arm/mach-keystone/config.mk @@ -15,8 +15,10 @@ OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE $(call if_changed,pad_cat)
-MKIMAGEFLAGS_u-boot-nand.gph = -A $(ARCH) -T gpimage -C none \ +ifndef CONFIG_SPL_BUILD +MKIMAGEFLAGS_MLO = -A $(ARCH) -T gpimage -C none \ -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) -n U-Boot -u-boot-nand.gph: u-boot.bin FORCE +MLO: u-boot.bin FORCE $(call if_changed,mkimage) @dd if=/dev/zero bs=8 count=1 2>/dev/null >> $@ +endif diff --git a/board/ti/ks2_evm/README b/board/ti/ks2_evm/README index 6586fab..b824725 100644 --- a/board/ti/ks2_evm/README +++ b/board/ti/ks2_evm/README @@ -61,7 +61,7 @@ Supported image formats: - u-boot.bin: for loading and running u-boot.bin through Texas instruments code composure studio (CCS) - u-boot-spi.gph: gpimage for programming SPI NOR flash for SPI NOR boot - - u-boot-nand.gph: gpimage for programming AEMIF NAND flash for NAND boot + - MLO: gpimage for programming AEMIF NAND flash for NAND boot
Build instructions: =================== @@ -76,9 +76,9 @@ To build u-boot-spi.gph
make k2hk_evm_defconfig make u-boot-spi.gph
-To build u-boot-nand.gph +To build MLO
make k2hk_evm_defconfig
- >make u-boot-nand.gph + >make MLO
Load and Run U-Boot on keystone EVMs using CCS ========================================= @@ -157,12 +157,12 @@ instructions: 1. Start CCS and run U-boot as described above. 2. Suspend Target. Select Run -> Suspend from top level menu CortexA15_1 (Free Running)" -3. Load u-boot-nand.gph binary from build folder on to DDR address 0x87000000 +3. Load MLO binary from build folder on to DDR address 0x87000000 through CCS as described in step 2 of "Load and Run U-Boot on K2HK EVM using CCS", but using address 0x87000000. 4. Free Run the target as described earlier (step 4) to get u-boot prompt 5. At the U-Boot console type following to setup u-boot environment variables. - setenv filesize <size in hex of u-boot-nand.gph rounded to hex 0x10000> + setenv filesize <size in hex of MLO rounded to hex 0x10000> run burn_uboot_nand Once u-boot prompt is available, Power OFF the EVM. Set the SW1 dip switch to "ARM NAND Boot mode" as per instruction at

On Mon, Aug 17, 2015 at 07:54:50PM +0530, Lokesh Vutla wrote:
NAND boot mode, ROM expects an image with a gp header in the beginning and an 8bytes filled with zeros at the end. The same is true for SD boot on K2G platforms but the file name should be MLO.
Renaming u-boot-nand.gph to MLO, so that same image can be used for NAND and SD boots. And also not including all the u-boot only images under CONFIG_SPL_BUILD.
Reported-by: Nishanth Menon nm@ti.com Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

MLO(NAND/MMC boot image), is used for all the ks2 platforms. Enabling it in config.mk so that these images will be automatically built upon calling make. u-boot-spi.gph is already the build target, so not including here.
Reported-by: Nishanth Menon nm@ti.com Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- arch/arm/mach-keystone/config.mk | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-keystone/config.mk b/arch/arm/mach-keystone/config.mk index ff2fa68..ceacffa 100644 --- a/arch/arm/mach-keystone/config.mk +++ b/arch/arm/mach-keystone/config.mk @@ -5,6 +5,10 @@ # SPDX-License-Identifier: GPL-2.0+ #
+ifndef CONFIG_SPL_BUILD +ALL-y += MLO +endif + MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \ -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE

On Mon, Aug 17, 2015 at 07:54:51PM +0530, Lokesh Vutla wrote:
MLO(NAND/MMC boot image), is used for all the ks2 platforms. Enabling it in config.mk so that these images will be automatically built upon calling make. u-boot-spi.gph is already the build target, so not including here.
Reported-by: Nishanth Menon nm@ti.com Reviewed-by: Nishanth Menon nm@ti.com Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!

Update README to include uart boot mode support and makefile changes.
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com --- board/ti/ks2_evm/README | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/board/ti/ks2_evm/README b/board/ti/ks2_evm/README index b824725..b8d55e7 100644 --- a/board/ti/ks2_evm/README +++ b/board/ti/ks2_evm/README @@ -56,10 +56,11 @@ configs/k2l_evm_defconfig Supported boot modes: - SPI NOR boot - AEMIF NAND boot + - UART boot
Supported image formats: - u-boot.bin: for loading and running u-boot.bin through Texas instruments - code composure studio (CCS) + code composure studio (CCS) and for UART boot. - u-boot-spi.gph: gpimage for programming SPI NOR flash for SPI NOR boot - MLO: gpimage for programming AEMIF NAND flash for NAND boot
@@ -68,17 +69,9 @@ Build instructions: Examples for k2hk, for k2e and k2l just replace k2hk prefix accordingly. Don't forget to add ARCH=arm and CROSS_COMPILE.
-To build u-boot.bin +To build u-boot.bin, u-boot-spi.gph, MLO:
make k2hk_evm_defconfig
- >make u-boot.bin - -To build u-boot-spi.gph - >make k2hk_evm_defconfig - >make u-boot-spi.gph - -To build MLO - >make k2hk_evm_defconfig - >make MLO + >make
Load and Run U-Boot on keystone EVMs using CCS ========================================= @@ -168,3 +161,14 @@ instructions: to "ARM NAND Boot mode" as per instruction at http://processors.wiki.ti.com/index.php/*_Hardware_Setup. 6. Power ON the EVM. The EVM now boots with u-boot image on the NAND flash. + +Load and Run U-Boot on keystone EVMs using UART download +======================================================== + +Open BMC and regular UART terminals. + +1. On the regular UART port start xmodem transfer of the u-boot.bin +2. Using BMC terminal set the ARM-UART bootmode and reboot the EVM + BMC> bootmode #4 + MBC> reboot +3. When xmodem is complete you should see the u-boot starts on the UART port

On Mon, Aug 17, 2015 at 07:54:52PM +0530, Lokesh Vutla wrote:
Update README to include uart boot mode support and makefile changes.
Signed-off-by: Lokesh Vutla lokeshvutla@ti.com
Applied to u-boot/master, thanks!
participants (4)
-
Lokesh Vutla
-
Lokesh Vutla
-
menon.nishanth@gmail.com
-
Tom Rini