[U-Boot] [PATCH v4 00/10] vexpress64 FVP and Juno configuration updates

This patch series updates the default configuration of the vexpress64 FVP and Juno platforms to allow it to work on a variety of setups without modification by the user.
A propsed change to use a script from NOR as recommended by Liviu Dudau has not been included in this series to limit churn and reduce the chance of messing up another series.
[PATCH v4 01/10] vexpress64: fix checkpatch warnings [PATCH v4 02/10] vexpress64: Kconfig: tidy up [PATCH v4 03/10] vexpress64: increase max gunzip size [PATCH v4 04/10] vexpress64: fvp dram: add DRAM configuration [PATCH v4 05/10] vexpress64: juno: add androidboot.hardware=juno [PATCH v4 06/10] common/armflash: add command to check if image exists [PATCH v4 07/10] common/armflash: load_image returns success or failure [PATCH v4 08/10] vexpress64: juno: add optional initrd [PATCH v4 09/10] vexpress64: juno: add alternate kernel and device tree [PATCH v4 10/10] vexpress64: juno: use /dev/sda2
arch/arm/Kconfig | 4 ++++ board/armltd/vexpress64/Kconfig | 17 ----------------- board/armltd/vexpress64/MAINTAINERS | 5 +++++ common/cmd_armflash.c | 33 +++++++++++++++++++++++++++------ configs/vexpress_aemv8a_dram_defconfig | 19 +++++++++++++++++++ include/configs/vexpress_aemv8a.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 6 files changed, 108 insertions(+), 31 deletions(-)
Changes for v2: - removed the Kconfig changes for CONFIG_SYS_BOOTM_LEN - added CONFIG_SYS_BOOTM_LEN to include/configs/vexpress_aemv8a.h
Changes for v3: - fixed warning in cmd_armflash.c due to missing hunk from patch 07/10: common/cmd_armflash.c:207:4: warning: 'return' with no value, in function returning non-void [-Wreturn-type] - accidentally added back the Kconfig changes from v1
Changes for v4: - added back Kconfig changes from v2 after dropping them in v3 - corrected comment for 09/10 "vexpress64: juno: add alternate kernel and device tree" - added MAINTAINERS update for new dram board config, however, this still generates a checkpatch warning (for patch 04/10) - run checkpatch across series and fixed warning in 04/10 by adding help text. Ignored 1 warning in patch 04/10 asking about updating MAINTAINERS due to adding files.

This patch fixes a couple of checkpatch warnings on the vexpress64 config.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 6107c64..53b0f74 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -194,7 +194,8 @@ #define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 " \ "root=/dev/sda1 rw " \ "rootwait "\ - "earlyprintk=pl011,0x7ff80000 debug user_debug=31 "\ + "earlyprintk=pl011,0x7ff80000 debug "\ + "user_debug=31 "\ "loglevel=9"
/* Copy the kernel and FDT to DRAM memory and boot */ @@ -222,7 +223,8 @@
#define CONFIG_BOOTCOMMAND "smhload ${kernel_name} ${kernel_addr}; " \ "smhload ${fdt_name} ${fdt_addr}; " \ - "smhload ${initrd_name} ${initrd_addr} initrd_end; " \ + "smhload ${initrd_name} ${initrd_addr} "\ + "initrd_end; " \ "fdt addr ${fdt_addr}; fdt resize; " \ "fdt chosen ${initrd_addr} ${initrd_end}; " \ "booti $kernel_addr - $fdt_addr"

On Fri, Oct 09, 2015 at 05:17:59PM +0100, Ryan Harkin wrote:
This patch fixes a couple of checkpatch warnings on the vexpress64 config.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

The FVP and Juno settings were identical, but duplicated, so I removed the duplication with this patch.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- board/armltd/vexpress64/Kconfig | 17 ----------------- 1 file changed, 17 deletions(-)
diff --git a/board/armltd/vexpress64/Kconfig b/board/armltd/vexpress64/Kconfig index f5693ae..8da3bec 100644 --- a/board/armltd/vexpress64/Kconfig +++ b/board/armltd/vexpress64/Kconfig @@ -1,5 +1,3 @@ -if TARGET_VEXPRESS64_BASE_FVP - config SYS_BOARD default "vexpress64"
@@ -8,18 +6,3 @@ config SYS_VENDOR
config SYS_CONFIG_NAME default "vexpress_aemv8a" - -endif - -if TARGET_VEXPRESS64_JUNO - -config SYS_BOARD - default "vexpress64" - -config SYS_VENDOR - default "armltd" - -config SYS_CONFIG_NAME - default "vexpress_aemv8a" - -endif

On Fri, Oct 09, 2015 at 05:18:00PM +0100, Ryan Harkin wrote:
The FVP and Juno settings were identical, but duplicated, so I removed the duplication with this patch.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!
But note that I had to "dirty" up the Kconfig file a bit to not break other boards. I suspect you want to make more clean-ups and model on say ARCH_UNIPHIER stuff instead.

Hi Tom,
On 12 October 2015 at 16:17, Tom Rini trini@konsulko.com wrote:
On Fri, Oct 09, 2015 at 05:18:00PM +0100, Ryan Harkin wrote:
The FVP and Juno settings were identical, but duplicated, so I removed the duplication with this patch.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!
Thanks for applying my series!
But note that I had to "dirty" up the Kconfig file a bit to not break other boards.
I'm sorry about that. I had to look, but now I see that arch/arm/Kconfig is unconditionally including that Kconfig, which I hadn't realised.
I suspect you want to make more clean-ups and model on say ARCH_UNIPHIER stuff instead.
Thanks, I'll check that out. A quick look shows that it seems to cover multiple similar platforms quite well.
Regards, Ryan.
-- Tom

On Mon, Oct 12, 2015 at 05:47:20PM +0100, Ryan Harkin wrote:
Hi Tom,
On 12 October 2015 at 16:17, Tom Rini trini@konsulko.com wrote:
On Fri, Oct 09, 2015 at 05:18:00PM +0100, Ryan Harkin wrote:
The FVP and Juno settings were identical, but duplicated, so I removed the duplication with this patch.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!
Thanks for applying my series!
But note that I had to "dirty" up the Kconfig file a bit to not break other boards.
I'm sorry about that. I had to look, but now I see that arch/arm/Kconfig is unconditionally including that Kconfig, which I hadn't realised.
So here's a thing that buildman can really help with. With just: $ cat ~/.buildman [toolchain] aarch64: /opt/linaro/gcc-linaro-aarch64-linux-gnu-4.8-2013.10_linux
(Aside: I should get a newer aarch64 toolchain, I know..) you can do: $ ./tools/buildman/buildman aarch64
And that will build not just the vexpress64 things but everything aarch64 and that's a small enough subset of boards to not be a "heavy" thing to do prior to submitting patches but wide enough to catch problems like this :)
I suspect you want to make more clean-ups and model on say ARCH_UNIPHIER stuff instead.
Thanks, I'll check that out. A quick look shows that it seems to cover multiple similar platforms quite well.
Yeah. And related, is TARGET_VEXPRESS64_AEMV8A intended to be something like that really? There's no defconfig for "just" that today. I'm guessing it should become ARCH_VEXPRESS64_AEMV8A (or so..) and then further shuffle code and Kconfigs around.

vexpress64 kernels are usually over 8 MBytes in length, so setting the max uImage length to 64 Mbytes should give us plenty of scope for expansion.
I mostly chose this length to match other board configs that use "(64 << 20)".
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 53b0f74..c54baf8 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -41,6 +41,8 @@ #error "Unknown board variant" #endif
+#define CONFIG_SYS_BOOTM_LEN (64 << 20) /* Increase max gunzip size */ + /* Flat Device Tree Definitions */ #define CONFIG_OF_LIBFDT

On Fri, Oct 09, 2015 at 05:18:01PM +0100, Ryan Harkin wrote:
vexpress64 kernels are usually over 8 MBytes in length, so setting the max uImage length to 64 Mbytes should give us plenty of scope for expansion.
I mostly chose this length to match other board configs that use "(64 << 20)".
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

Create an additional FVP configuration to boot images pre-loaded into DRAM.
Sometimes it's preferential to boot the model by loading the files directly into DRAM via model parameters, rather than using SemiHosting.
An example of model parmaters that are used to pre-load the files into DRAM: --data cluster0.cpu0=Image@0x80080000 \ --data cluster0.cpu0=fvp-base-gicv2-psci.dtb@0x83000000 \ --data cluster0.cpu0=uInitrd@0x84000000
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- arch/arm/Kconfig | 9 +++++++++ board/armltd/vexpress64/MAINTAINERS | 5 +++++ configs/vexpress_aemv8a_dram_defconfig | 19 +++++++++++++++++++ include/configs/vexpress_aemv8a.h | 25 +++++++++++++++++++++++-- 4 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0b07e08..9e7be74 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -563,6 +563,15 @@ config TARGET_VEXPRESS64_BASE_FVP select ARM64 select SEMIHOSTING
+config TARGET_VEXPRESS64_BASE_FVP_DRAM + bool "Support Versatile Express ARMv8a FVP BASE model booting from DRAM" + select ARM64 + help + This target is derived from TARGET_VEXPRESS64_BASE_FVP and over-rides + the default config to allow the user to load the images directly into + DRAM using model parameters rather than by using semi-hosting to load + the files from the host filesystem. + config TARGET_VEXPRESS64_JUNO bool "Support Versatile Express Juno Development Platform" select ARM64 diff --git a/board/armltd/vexpress64/MAINTAINERS b/board/armltd/vexpress64/MAINTAINERS index 0ba044d..15b0a08 100644 --- a/board/armltd/vexpress64/MAINTAINERS +++ b/board/armltd/vexpress64/MAINTAINERS @@ -10,6 +10,11 @@ M: Linus Walleij linus.walleij@linaro.org S: Maintained F: configs/vexpress_aemv8a_semi_defconfig
+VEXPRESS_AEMV8A_DRAM BOARD +M: Ryan Harkin ryan.harkin@linaro.org +S: Maintained +F: configs/vexpress_aemv8a_dram_defconfig + JUNO DEVELOPMENT PLATFORM BOARD M: Linus Walleij linus.walleij@linaro.org S: Maintained diff --git a/configs/vexpress_aemv8a_dram_defconfig b/configs/vexpress_aemv8a_dram_defconfig new file mode 100644 index 0000000..e9fc870 --- /dev/null +++ b/configs/vexpress_aemv8a_dram_defconfig @@ -0,0 +1,19 @@ +CONFIG_ARM=y +CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM=y +CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_DEFAULT_DEVICE_TREE="vexpress64" +# CONFIG_CMD_CONSOLE is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_XIMG is not set +# CONFIG_CMD_EDITENV is not set +# CONFIG_CMD_ENV_EXISTS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +# CONFIG_CMD_ITEST is not set +# CONFIG_CMD_SETEXPR is not set +# CONFIG_CMD_NFS is not set +# CONFIG_CMD_MISC is not set +CONFIG_DM=y +CONFIG_DM_SERIAL=y +CONFIG_SYS_PROMPT="VExpress64# " diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index c54baf8..c1e2e11 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -30,7 +30,8 @@ #define CONFIG_BOOTP_VCI_STRING "U-boot.armv8.vexpress_aemv8a"
/* Link Definitions */ -#ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP +#if defined(CONFIG_TARGET_VEXPRESS64_BASE_FVP) || \ + defined(CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM) /* ATF loads u-boot here for BASE_FVP model */ #define CONFIG_SYS_TEXT_BASE 0x88000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f00000) @@ -103,7 +104,8 @@ #define GICR_BASE (0x2f100000) #else
-#ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP +#if defined(CONFIG_TARGET_VEXPRESS64_BASE_FVP) || \ + defined(CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM) #define GICD_BASE (0x2f000000) #define GICC_BASE (0x2c000000) #elif CONFIG_TARGET_VEXPRESS64_JUNO @@ -233,6 +235,25 @@
#define CONFIG_BOOTDELAY 1
+#elif CONFIG_TARGET_VEXPRESS64_BASE_FVP_DRAM +#define CONFIG_EXTRA_ENV_SETTINGS \ + "kernel_addr=0x80080000\0" \ + "initrd_addr=0x84000000\0" \ + "fdt_addr=0x83000000\0" \ + "fdt_high=0xffffffffffffffff\0" \ + "initrd_high=0xffffffffffffffff\0" + +#define CONFIG_BOOTARGS "console=ttyAMA0 earlyprintk=pl011,"\ + "0x1c090000 debug user_debug=31 "\ + "androidboot.hardware=fvpbase "\ + "root=/dev/vda2 rw "\ + "rootwait "\ + "loglevel=9" + +#define CONFIG_BOOTCOMMAND "booti $kernel_addr $initrd_addr $fdt_addr" + +#define CONFIG_BOOTDELAY 1 + #else #error "Unknown board variant" #endif

On Fri, Oct 09, 2015 at 05:18:02PM +0100, Ryan Harkin wrote:
Create an additional FVP configuration to boot images pre-loaded into DRAM.
Sometimes it's preferential to boot the model by loading the files directly into DRAM via model parameters, rather than using SemiHosting.
An example of model parmaters that are used to pre-load the files into DRAM: --data cluster0.cpu0=Image@0x80080000 \ --data cluster0.cpu0=fvp-base-gicv2-psci.dtb@0x83000000 \ --data cluster0.cpu0=uInitrd@0x84000000
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

Linaro's Juno Android builds requires the androidboot.hardware parameter be set to a know board name.
Non-Android kernels ignore this extra parameter because they don't contain code to parse it.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index c1e2e11..f9fa2ce 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -200,6 +200,7 @@ "rootwait "\ "earlyprintk=pl011,0x7ff80000 debug "\ "user_debug=31 "\ + "androidboot.hardware=juno "\ "loglevel=9"
/* Copy the kernel and FDT to DRAM memory and boot */

On Fri, Oct 09, 2015 at 05:18:03PM +0100, Ryan Harkin wrote:
Linaro's Juno Android builds requires the androidboot.hardware parameter be set to a know board name.
Non-Android kernels ignore this extra parameter because they don't contain code to parse it.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

Add a command to the ARM flash support to check if an image exists or not.
If the image is found, it will return CMD_RET_SUCCESS, else CMD_RET_FAILURE. This allows hush scripts to conditionally load images.
A simple example:
if afs exists ${kernel_name}; then echo found; else echo \ not found; fi
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- common/cmd_armflash.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/common/cmd_armflash.c b/common/cmd_armflash.c index 1db92b0..a37f5c4 100644 --- a/common/cmd_armflash.c +++ b/common/cmd_armflash.c @@ -251,10 +251,28 @@ static void print_images(void) } }
+static int exists(const char * const name) +{ + int i; + + parse_flash(); + for (i = 0; i < num_afs_images; i++) { + struct afs_image *afi = &afs_images[i]; + + if (strcmp(afi->name, name) == 0) + return CMD_RET_SUCCESS; + } + return CMD_RET_FAILURE; +} + static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { + int ret = CMD_RET_SUCCESS; + if (argc == 1) { print_images(); + } else if (argc == 3 && !strcmp(argv[1], "exists")) { + ret = exists(argv[2]); } else if (argc == 3 && !strcmp(argv[1], "load")) { load_image(argv[2], 0x0); } else if (argc == 4 && !strcmp(argv[1], "load")) { @@ -266,12 +284,14 @@ static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_USAGE; }
- return 0; + return ret; }
U_BOOT_CMD(afs, 4, 0, do_afs, "show AFS partitions", "no arguments\n" " - list images in flash\n" + "exists <image>\n" + " - returns 1 if an image exists, else 0\n" "load <image>\n" " - load an image to the location indicated in the header\n" "load <image> 0x<address>\n"

On Fri, Oct 09, 2015 at 05:18:04PM +0100, Ryan Harkin wrote:
Add a command to the ARM flash support to check if an image exists or not.
If the image is found, it will return CMD_RET_SUCCESS, else CMD_RET_FAILURE. This allows hush scripts to conditionally load images.
A simple example:
if afs exists ${kernel_name}; then echo found; else echo \ not found; fi
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

Change the load_image so that it returns success or failure of the command (using CMD_RET_SUCCESS or CMD_RET_FAILURE).
This way, hush scripts can optionally load different files depending upon the system configuration.
A simple example:
if afs load ${kernel_name} ${kernel_addr}; then echo loaded; else echo \ not loaded; fi
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- common/cmd_armflash.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/common/cmd_armflash.c b/common/cmd_armflash.c index a37f5c4..af453f7 100644 --- a/common/cmd_armflash.c +++ b/common/cmd_armflash.c @@ -175,7 +175,7 @@ static void parse_flash(void) parse_bank(bank); }
-static void load_image(const char * const name, const ulong address) +static int load_image(const char * const name, const ulong address) { struct afs_image *afi = NULL; int i; @@ -191,7 +191,7 @@ static void load_image(const char * const name, const ulong address) } if (!afi) { printf("image "%s" not found in flash\n", name); - return; + return CMD_RET_FAILURE; }
for (i = 0; i < afi->region_count; i++) { @@ -204,7 +204,7 @@ static void load_image(const char * const name, const ulong address) to = afi->regions[i].load_address; } else { printf("no valid load address\n"); - return; + return CMD_RET_FAILURE; }
memcpy((void *)to, (void *)from, afi->regions[i].size); @@ -215,6 +215,7 @@ static void load_image(const char * const name, const ulong address) to, afi->regions[i].size); } + return CMD_RET_SUCCESS; }
static void print_images(void) @@ -274,12 +275,12 @@ static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } else if (argc == 3 && !strcmp(argv[1], "exists")) { ret = exists(argv[2]); } else if (argc == 3 && !strcmp(argv[1], "load")) { - load_image(argv[2], 0x0); + ret = load_image(argv[2], 0x0); } else if (argc == 4 && !strcmp(argv[1], "load")) { ulong load_addr;
load_addr = simple_strtoul(argv[3], NULL, 16); - load_image(argv[2], load_addr); + ret = load_image(argv[2], load_addr); } else { return CMD_RET_USAGE; }

On Fri, Oct 09, 2015 at 05:18:05PM +0100, Ryan Harkin wrote:
Change the load_image so that it returns success or failure of the command (using CMD_RET_SUCCESS or CMD_RET_FAILURE).
This way, hush scripts can optionally load different files depending upon the system configuration.
A simple example:
if afs load ${kernel_name} ${kernel_addr}; then echo loaded; else echo \ not loaded; fi
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

Some OS images require an initrd on Juno.
If the file ramdisk.img exists in NOR flash, then we load it and pass the address to the kernel. Otherwise, we pass the "-" parameter as before.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index f9fa2ce..99dd8b6 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -189,6 +189,8 @@ #define CONFIG_EXTRA_ENV_SETTINGS \ "kernel_name=Image\0" \ "kernel_addr=0x80000000\0" \ + "initrd_name=ramdisk.img\0" \ + "initrd_addr=0x84000000\0" \ "fdt_name=juno\0" \ "fdt_addr=0x83000000\0" \ "fdt_high=0xffffffffffffffff\0" \ @@ -207,7 +209,12 @@ #define CONFIG_BOOTCOMMAND "afs load ${kernel_name} ${kernel_addr} ; " \ "afs load ${fdt_name} ${fdt_addr} ; " \ "fdt addr ${fdt_addr}; fdt resize; " \ - "booti ${kernel_addr} - ${fdt_addr}" + "if afs load ${initrd_name} ${initrd_addr} ; "\ + "then "\ + " setenv initrd_param ${initrd_addr}; "\ + " else setenv initrd_param -; "\ + "fi ; " \ + "booti ${kernel_addr} ${initrd_param} ${fdt_addr}"
#define CONFIG_BOOTDELAY 1

On Fri, Oct 09, 2015 at 05:18:06PM +0100, Ryan Harkin wrote:
Some OS images require an initrd on Juno.
If the file ramdisk.img exists in NOR flash, then we load it and pass the address to the kernel. Otherwise, we pass the "-" parameter as before.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

The latest Juno firmware stores the files in NOR flash as "norkern" for kernel binary, "board.dtb" for the device tree binary.
The "old" firmware used the name "Image" for the kernel binary and "juno" for the device tree binary.
Rather than just change the default U-Boot configuration to use the new names, breaking users with the old firmware, attempt to load the default filename first. If that fails, attempt to load the alternate filename.
I've echo'd that we are loading the alternate file to counter the output from "afs load" shown if the first load attempt fails. For example, I see output like this on my Juno board when it's configured the with the "old" firmware:
image "norkern" not found in flash Loading Image instead of norkern loaded region 0 from 08500000 to 80000000, 00AB6318 bytes image "board.dtb" not found in flash Loading juno instead of board.dtb loaded region 0 from 0A000000 to 83000000, 00003188 bytes
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 99dd8b6..259f6ac 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -187,11 +187,13 @@ * be copied into DRAM */ #define CONFIG_EXTRA_ENV_SETTINGS \ - "kernel_name=Image\0" \ + "kernel_name=norkern\0" \ + "kernel_alt_name=Image\0" \ "kernel_addr=0x80000000\0" \ "initrd_name=ramdisk.img\0" \ "initrd_addr=0x84000000\0" \ - "fdt_name=juno\0" \ + "fdt_name=board.dtb\0" \ + "fdt_alt_name=juno\0" \ "fdt_addr=0x83000000\0" \ "fdt_high=0xffffffffffffffff\0" \ "initrd_high=0xffffffffffffffff\0" \ @@ -207,7 +209,17 @@
/* Copy the kernel and FDT to DRAM memory and boot */ #define CONFIG_BOOTCOMMAND "afs load ${kernel_name} ${kernel_addr} ; " \ + "if test $? -eq 1; then "\ + " echo Loading ${kernel_alt_name} instead of "\ + "${kernel_name}; "\ + " afs load ${kernel_alt_name} ${kernel_addr};"\ + "fi ; "\ "afs load ${fdt_name} ${fdt_addr} ; " \ + "if test $? -eq 1; then "\ + " echo Loading ${fdt_alt_name} instead of "\ + "${fdt_name}; "\ + " afs load ${fdt_alt_name} ${fdt_addr}; "\ + "fi ; "\ "fdt addr ${fdt_addr}; fdt resize; " \ "if afs load ${initrd_name} ${initrd_addr} ; "\ "then "\

On Fri, Oct 09, 2015 at 05:18:07PM +0100, Ryan Harkin wrote:
The latest Juno firmware stores the files in NOR flash as "norkern" for kernel binary, "board.dtb" for the device tree binary.
The "old" firmware used the name "Image" for the kernel binary and "juno" for the device tree binary.
Rather than just change the default U-Boot configuration to use the new names, breaking users with the old firmware, attempt to load the default filename first. If that fails, attempt to load the alternate filename.
I've echo'd that we are loading the alternate file to counter the output from "afs load" shown if the first load attempt fails. For example, I see output like this on my Juno board when it's configured the with the "old" firmware:
image "norkern" not found in flash Loading Image instead of norkern loaded region 0 from 08500000 to 80000000, 00AB6318 bytes image "board.dtb" not found in flash Loading juno instead of board.dtb loaded region 0 from 0A000000 to 83000000, 00003188 bytes
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!

This patch changes the default "root=" parameter to "/dev/sda2".
Many linux based distros use /dev/sda1 for their boot partition; this is often not a rootfs that can be used by the "root=" parameter.
Linaro images use /dev/sda1 as a boot partition, although this of a different nature to a distro image. Linaro uses /dev/sda2 for the rootfs partition.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org --- include/configs/vexpress_aemv8a.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/vexpress_aemv8a.h b/include/configs/vexpress_aemv8a.h index 259f6ac..ef3014d 100644 --- a/include/configs/vexpress_aemv8a.h +++ b/include/configs/vexpress_aemv8a.h @@ -200,7 +200,7 @@
/* Assume we boot with root on the first partition of a USB stick */ #define CONFIG_BOOTARGS "console=ttyAMA0,115200n8 " \ - "root=/dev/sda1 rw " \ + "root=/dev/sda2 rw " \ "rootwait "\ "earlyprintk=pl011,0x7ff80000 debug "\ "user_debug=31 "\

On Fri, Oct 09, 2015 at 05:18:08PM +0100, Ryan Harkin wrote:
This patch changes the default "root=" parameter to "/dev/sda2".
Many linux based distros use /dev/sda1 for their boot partition; this is often not a rootfs that can be used by the "root=" parameter.
Linaro images use /dev/sda1 as a boot partition, although this of a different nature to a distro image. Linaro uses /dev/sda2 for the rootfs partition.
Signed-off-by: Ryan Harkin ryan.harkin@linaro.org Reviewed-by: Linus Walleij linus.walleij@linaro.org
Applied to u-boot/master, thanks!
participants (2)
-
Ryan Harkin
-
Tom Rini