* [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value
@ 2016-04-28 22:44 Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 2/3] SPL: Add CONFIG_SPL_ABORT_ON_RAW_IMAGE Marek Vasut
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Marek Vasut @ 2016-04-28 22:44 UTC (permalink / raw)
To: u-boot
Allow the spl_parse_image_header() to return value. This is convenient
for controlling the SPL boot flow if the loaded image is corrupted.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <van.freenix@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
common/spl/spl.c | 3 ++-
common/spl/spl_ext.c | 6 +++++-
common/spl/spl_fat.c | 4 +++-
common/spl/spl_mmc.c | 6 +++++-
common/spl/spl_nand.c | 9 +++++++--
common/spl/spl_net.c | 4 +---
common/spl/spl_nor.c | 9 +++++++--
common/spl/spl_onenand.c | 5 ++++-
common/spl/spl_ymodem.c | 7 +++++--
drivers/mtd/spi/spi_spl_load.c | 10 ++++++++--
include/spl.h | 2 +-
11 files changed, 48 insertions(+), 17 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 82e7f58..7259619 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -73,7 +73,7 @@ void spl_set_header_raw_uboot(void)
spl_image.name = "U-Boot";
}
-void spl_parse_image_header(const struct image_header *header)
+int spl_parse_image_header(const struct image_header *header)
{
u32 header_size = sizeof(struct image_header);
@@ -118,6 +118,7 @@ void spl_parse_image_header(const struct image_header *header)
spl_set_header_raw_uboot();
#endif
}
+ return 0;
}
__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index b77dbf4..ade5496 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -48,7 +48,11 @@ int spl_load_image_ext(struct blk_desc *block_dev,
goto end;
}
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err < 0) {
+ puts("spl: ext4fs_read failed\n");
+ goto end;
+ }
err = ext4fs_read((char *)spl_image.load_addr, filelen, &actlen);
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index d761b26..338ea2f 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -57,7 +57,9 @@ int spl_load_image_fat(struct blk_desc *block_dev,
if (err <= 0)
goto end;
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err <= 0)
+ goto end;
err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 8d588d1..360c754 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -23,8 +23,12 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
{
u32 image_size_sectors;
unsigned long count;
+ int ret;
+
+ ret = spl_parse_image_header(header);
+ if (ret)
+ return ret;
- spl_parse_image_header(header);
/* convert size to sectors - round up */
image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) /
mmc->read_bl_len;
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 79388ff..bbd9546 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -32,7 +32,10 @@ static int spl_nand_load_element(int offset, struct image_header *header)
if (err)
return err;
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
+
return nand_spl_load_image(offset, spl_image.size,
(void *)(unsigned long)spl_image.load_addr);
}
@@ -77,7 +80,9 @@ int spl_nand_load_image(void)
/* load linux */
nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
sizeof(*header), (void *)header);
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
if (header->ih_os == IH_OS_LINUX) {
/* happy - was a linux */
err = nand_spl_load_image(
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 63b20d8..ae71d26 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -34,7 +34,5 @@ int spl_net_load_image(const char *device)
printf("Problem booting with BOOTP\n");
return rv;
}
- spl_parse_image_header((struct image_header *)load_addr);
-
- return 0;
+ return spl_parse_image_header((struct image_header *)load_addr);
}
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index d0bd0b0..da2422f 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -9,6 +9,7 @@
int spl_nor_load_image(void)
{
+ int ret;
/*
* Loading of the payload to SDRAM is done with skipping of
* the mkimage header in this SPL NOR driver
@@ -28,7 +29,9 @@ int spl_nor_load_image(void)
if (image_get_os(header) == IH_OS_LINUX) {
/* happy - was a Linux */
- spl_parse_image_header(header);
+ ret = spl_parse_image_header(header);
+ if (ret)
+ return ret;
memcpy((void *)spl_image.load_addr,
(void *)(CONFIG_SYS_OS_BASE +
@@ -56,8 +59,10 @@ int spl_nor_load_image(void)
* Load real U-Boot from its location in NOR flash to its
* defined location in SDRAM
*/
- spl_parse_image_header(
+ ret = spl_parse_image_header(
(const struct image_header *)CONFIG_SYS_UBOOT_BASE);
+ if (ret)
+ return ret;
memcpy((void *)(unsigned long)spl_image.load_addr,
(void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
index af7d82e..1a28a84 100644
--- a/common/spl/spl_onenand.c
+++ b/common/spl/spl_onenand.c
@@ -17,6 +17,7 @@
int spl_onenand_load_image(void)
{
struct image_header *header;
+ int ret;
debug("spl: onenand\n");
@@ -25,7 +26,9 @@ int spl_onenand_load_image(void)
/* Load u-boot */
onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
- spl_parse_image_header(header);
+ ret = spl_parse_image_header(header);
+ if (ret)
+ return ret;
onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
spl_image.size, (void *)spl_image.load_addr);
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index 380d8dd..4f26ea5 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -40,8 +40,11 @@ int spl_ymodem_load_image(void)
if (!ret) {
while ((res =
xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) {
- if (addr == 0)
- spl_parse_image_header((struct image_header *)buf);
+ if (addr == 0) {
+ ret = spl_parse_image_header((struct image_header *)buf);
+ if (ret)
+ return ret;
+ }
store_addr = addr + spl_image.load_addr;
size += res;
addr += res;
diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c
index ca56fe9..46c98a9 100644
--- a/drivers/mtd/spi/spi_spl_load.c
+++ b/drivers/mtd/spi/spi_spl_load.c
@@ -23,6 +23,8 @@
static int spi_load_image_os(struct spi_flash *flash,
struct image_header *header)
{
+ int err;
+
/* Read for a header, parse or error out. */
spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, 0x40,
(void *)header);
@@ -30,7 +32,9 @@ static int spi_load_image_os(struct spi_flash *flash,
if (image_get_magic(header) != IH_MAGIC)
return -1;
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
spl_image.size, (void *)spl_image.load_addr);
@@ -81,7 +85,9 @@ int spl_spi_load_image(void)
if (err)
return err;
- spl_parse_image_header(header);
+ err = spl_parse_image_header(header);
+ if (err)
+ return err;
err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
spl_image.size, (void *)spl_image.load_addr);
}
diff --git a/include/spl.h b/include/spl.h
index de4f70a..7edfab4 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -56,7 +56,7 @@ void preloader_console_init(void);
u32 spl_boot_device(void);
u32 spl_boot_mode(void);
void spl_set_header_raw_uboot(void);
-void spl_parse_image_header(const struct image_header *header);
+int spl_parse_image_header(const struct image_header *header);
void spl_board_prepare_for_linux(void);
void __noreturn jump_to_image_linux(void *arg);
int spl_start_uboot(void);
--
2.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 2/3] SPL: Add CONFIG_SPL_ABORT_ON_RAW_IMAGE
2016-04-28 22:44 [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Marek Vasut
@ 2016-04-28 22:44 ` Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 3/3] ARM: mx6: Enable MMC and SATA extfs boot support Marek Vasut
2016-05-20 21:56 ` [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Nishanth Menon
2 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2016-04-28 22:44 UTC (permalink / raw)
To: u-boot
When defined, SPL will proceed to another boot method
if the image it has loaded does not have a signature.
This is useful if the subsequent boot methods are much
more complex.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Peng Fan <van.freenix@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
---
README | 4 ++++
common/spl/spl.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/README b/README
index 88ff837..d881da2 100644
--- a/README
+++ b/README
@@ -3487,6 +3487,10 @@ FIT uImage format:
consider that a completely unreadable NAND block is bad,
and thus should be skipped silently.
+ CONFIG_SPL_ABORT_ON_RAW_IMAGE
+ When defined, SPL will proceed to another boot method
+ if the image it has loaded does not have a signature.
+
CONFIG_SPL_RELOC_STACK
Adress of the start of the stack SPL will use after
relocation. If unspecified, this is equal to
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 7259619..93f9bd1 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -111,6 +111,9 @@ int spl_parse_image_header(const struct image_header *header)
* is bad, and thus should be skipped silently.
*/
panic("** no mkimage signature but raw image not supported");
+#elif defined(CONFIG_SPL_ABORT_ON_RAW_IMAGE)
+ /* Signature not found, proceed to other boot methods. */
+ return -EINVAL;
#else
/* Signature not found - assume u-boot.bin */
debug("mkimage signature not found - ih_magic = %x\n",
--
2.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 3/3] ARM: mx6: Enable MMC and SATA extfs boot support
2016-04-28 22:44 [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 2/3] SPL: Add CONFIG_SPL_ABORT_ON_RAW_IMAGE Marek Vasut
@ 2016-04-28 22:44 ` Marek Vasut
2016-05-20 21:56 ` [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Nishanth Menon
2 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2016-04-28 22:44 UTC (permalink / raw)
To: u-boot
Enable support for booting U-Boot image from ext filesystem when either
SD/MMC or SATA support is compiled into the SPL. This will allow easy
transition from loading U-Boot image from ad-hoc offset on the card to
loading U-Boot image from the filesystem. VFAT support is intently not
enabled. The boot order is tweaked so that raw is tested first and if
the raw has no signature, FS boot is attempted.
To install just the SPL on i.MX6 board, perform the following operation
$ dd if=SPL of=/dev/sdX seek=2 bs=512
To install the U-Boot image, copy u-boot.img to the first partition of
the SD/MMC/SATA drive. The partition must be formated to extfs.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <van.freenix@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@konsulko.com>
---
include/configs/imx6_spl.h | 4 ++++
include/configs/novena.h | 1 -
include/configs/tqma6.h | 1 -
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/configs/imx6_spl.h b/include/configs/imx6_spl.h
index 68d3fd7..9bd9f6e 100644
--- a/include/configs/imx6_spl.h
+++ b/include/configs/imx6_spl.h
@@ -48,12 +48,16 @@
#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 800 /* 400 KB */
#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
#define CONFIG_SYS_MONITOR_LEN (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+#define CONFIG_SPL_EXT_SUPPORT
#endif
/* SATA support */
#if defined(CONFIG_SPL_SATA_SUPPORT)
#define CONFIG_SPL_SATA_BOOT_DEVICE 0
#define CONFIG_SYS_SATA_FAT_BOOT_PARTITION 1
+#define CONFIG_SPL_ABORT_ON_RAW_IMAGE
+#define CONFIG_SPL_EXT_SUPPORT
#endif
/* Define the payload for FAT/EXT support */
diff --git a/include/configs/novena.h b/include/configs/novena.h
index e938fbc..2382951 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -75,7 +75,6 @@
/* SPL */
#define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_EXT_SUPPORT
#define CONFIG_SPL_MMC_SUPPORT
#include "imx6_spl.h" /* common IMX6 SPL configuration */
diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h
index badb955..77ced71 100644
--- a/include/configs/tqma6.h
+++ b/include/configs/tqma6.h
@@ -16,7 +16,6 @@
#define CONFIG_SPL_MMC_SUPPORT
#define CONFIG_SPL_SPI_SUPPORT
#define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_EXT_SUPPORT
/* common IMX6 SPL configuration */
#include "imx6_spl.h"
--
2.7.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value
2016-04-28 22:44 [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 2/3] SPL: Add CONFIG_SPL_ABORT_ON_RAW_IMAGE Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 3/3] ARM: mx6: Enable MMC and SATA extfs boot support Marek Vasut
@ 2016-05-20 21:56 ` Nishanth Menon
2016-05-21 0:22 ` Fabio Estevam
2 siblings, 1 reply; 6+ messages in thread
From: Nishanth Menon @ 2016-05-20 21:56 UTC (permalink / raw)
To: u-boot
Marek,
Just forwarding report from Suman (in CC) reporting that as of u-boot
master 4b6e1fd "Merge git://git.denx.de/u-boot-dm"
It looks like BeagleBoard-X15, DRA7 platforms fail due to this commit.
Fail signature looks like the following:
...
DRA752 ES2.0
Trying to boot from MMC1
reading args
spl_load_image_fat_os: error reading image args, err - -1
reading u-boot.img
spl_load_image_fat: error reading image u-boot.img, err - 0
Failed to mount ext2 filesystem...
spl_load_image_ext_os: ext4fs mount err - 0
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0
...
On Thu, Apr 28, 2016 at 5:44 PM, Marek Vasut <marex@denx.de> wrote:
> Allow the spl_parse_image_header() to return value. This is convenient
> for controlling the SPL boot flow if the loaded image is corrupted.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Fabio Estevam <fabio.estevam@nxp.com>
> Cc: Peng Fan <van.freenix@gmail.com>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> common/spl/spl.c | 3 ++-
> common/spl/spl_ext.c | 6 +++++-
> common/spl/spl_fat.c | 4 +++-
> common/spl/spl_mmc.c | 6 +++++-
> common/spl/spl_nand.c | 9 +++++++--
> common/spl/spl_net.c | 4 +---
> common/spl/spl_nor.c | 9 +++++++--
> common/spl/spl_onenand.c | 5 ++++-
> common/spl/spl_ymodem.c | 7 +++++--
> drivers/mtd/spi/spi_spl_load.c | 10 ++++++++--
> include/spl.h | 2 +-
> 11 files changed, 48 insertions(+), 17 deletions(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 82e7f58..7259619 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -73,7 +73,7 @@ void spl_set_header_raw_uboot(void)
> spl_image.name = "U-Boot";
> }
>
> -void spl_parse_image_header(const struct image_header *header)
> +int spl_parse_image_header(const struct image_header *header)
> {
> u32 header_size = sizeof(struct image_header);
>
> @@ -118,6 +118,7 @@ void spl_parse_image_header(const struct image_header *header)
> spl_set_header_raw_uboot();
> #endif
> }
> + return 0;
> }
>
> __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
> diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
> index b77dbf4..ade5496 100644
> --- a/common/spl/spl_ext.c
> +++ b/common/spl/spl_ext.c
> @@ -48,7 +48,11 @@ int spl_load_image_ext(struct blk_desc *block_dev,
> goto end;
> }
>
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err < 0) {
> + puts("spl: ext4fs_read failed\n");
> + goto end;
> + }
>
> err = ext4fs_read((char *)spl_image.load_addr, filelen, &actlen);
>
> diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
> index d761b26..338ea2f 100644
> --- a/common/spl/spl_fat.c
> +++ b/common/spl/spl_fat.c
> @@ -57,7 +57,9 @@ int spl_load_image_fat(struct blk_desc *block_dev,
> if (err <= 0)
> goto end;
>
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err <= 0)
> + goto end;
>
> err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0);
>
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 8d588d1..360c754 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -23,8 +23,12 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
> {
> u32 image_size_sectors;
> unsigned long count;
> + int ret;
> +
> + ret = spl_parse_image_header(header);
> + if (ret)
> + return ret;
>
> - spl_parse_image_header(header);
> /* convert size to sectors - round up */
> image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) /
> mmc->read_bl_len;
> diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
> index 79388ff..bbd9546 100644
> --- a/common/spl/spl_nand.c
> +++ b/common/spl/spl_nand.c
> @@ -32,7 +32,10 @@ static int spl_nand_load_element(int offset, struct image_header *header)
> if (err)
> return err;
>
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err)
> + return err;
> +
> return nand_spl_load_image(offset, spl_image.size,
> (void *)(unsigned long)spl_image.load_addr);
> }
> @@ -77,7 +80,9 @@ int spl_nand_load_image(void)
> /* load linux */
> nand_spl_load_image(CONFIG_SYS_NAND_SPL_KERNEL_OFFS,
> sizeof(*header), (void *)header);
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err)
> + return err;
> if (header->ih_os == IH_OS_LINUX) {
> /* happy - was a linux */
> err = nand_spl_load_image(
> diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
> index 63b20d8..ae71d26 100644
> --- a/common/spl/spl_net.c
> +++ b/common/spl/spl_net.c
> @@ -34,7 +34,5 @@ int spl_net_load_image(const char *device)
> printf("Problem booting with BOOTP\n");
> return rv;
> }
> - spl_parse_image_header((struct image_header *)load_addr);
> -
> - return 0;
> + return spl_parse_image_header((struct image_header *)load_addr);
> }
> diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
> index d0bd0b0..da2422f 100644
> --- a/common/spl/spl_nor.c
> +++ b/common/spl/spl_nor.c
> @@ -9,6 +9,7 @@
>
> int spl_nor_load_image(void)
> {
> + int ret;
> /*
> * Loading of the payload to SDRAM is done with skipping of
> * the mkimage header in this SPL NOR driver
> @@ -28,7 +29,9 @@ int spl_nor_load_image(void)
> if (image_get_os(header) == IH_OS_LINUX) {
> /* happy - was a Linux */
>
> - spl_parse_image_header(header);
> + ret = spl_parse_image_header(header);
> + if (ret)
> + return ret;
>
> memcpy((void *)spl_image.load_addr,
> (void *)(CONFIG_SYS_OS_BASE +
> @@ -56,8 +59,10 @@ int spl_nor_load_image(void)
> * Load real U-Boot from its location in NOR flash to its
> * defined location in SDRAM
> */
> - spl_parse_image_header(
> + ret = spl_parse_image_header(
> (const struct image_header *)CONFIG_SYS_UBOOT_BASE);
> + if (ret)
> + return ret;
>
> memcpy((void *)(unsigned long)spl_image.load_addr,
> (void *)(CONFIG_SYS_UBOOT_BASE + sizeof(struct image_header)),
> diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
> index af7d82e..1a28a84 100644
> --- a/common/spl/spl_onenand.c
> +++ b/common/spl/spl_onenand.c
> @@ -17,6 +17,7 @@
> int spl_onenand_load_image(void)
> {
> struct image_header *header;
> + int ret;
>
> debug("spl: onenand\n");
>
> @@ -25,7 +26,9 @@ int spl_onenand_load_image(void)
> /* Load u-boot */
> onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
> CONFIG_SYS_ONENAND_PAGE_SIZE, (void *)header);
> - spl_parse_image_header(header);
> + ret = spl_parse_image_header(header);
> + if (ret)
> + return ret;
> onenand_spl_load_image(CONFIG_SYS_ONENAND_U_BOOT_OFFS,
> spl_image.size, (void *)spl_image.load_addr);
>
> diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
> index 380d8dd..4f26ea5 100644
> --- a/common/spl/spl_ymodem.c
> +++ b/common/spl/spl_ymodem.c
> @@ -40,8 +40,11 @@ int spl_ymodem_load_image(void)
> if (!ret) {
> while ((res =
> xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0) {
> - if (addr == 0)
> - spl_parse_image_header((struct image_header *)buf);
> + if (addr == 0) {
> + ret = spl_parse_image_header((struct image_header *)buf);
> + if (ret)
> + return ret;
> + }
> store_addr = addr + spl_image.load_addr;
> size += res;
> addr += res;
> diff --git a/drivers/mtd/spi/spi_spl_load.c b/drivers/mtd/spi/spi_spl_load.c
> index ca56fe9..46c98a9 100644
> --- a/drivers/mtd/spi/spi_spl_load.c
> +++ b/drivers/mtd/spi/spi_spl_load.c
> @@ -23,6 +23,8 @@
> static int spi_load_image_os(struct spi_flash *flash,
> struct image_header *header)
> {
> + int err;
> +
> /* Read for a header, parse or error out. */
> spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS, 0x40,
> (void *)header);
> @@ -30,7 +32,9 @@ static int spi_load_image_os(struct spi_flash *flash,
> if (image_get_magic(header) != IH_MAGIC)
> return -1;
>
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err)
> + return err;
>
> spi_flash_read(flash, CONFIG_SYS_SPI_KERNEL_OFFS,
> spl_image.size, (void *)spl_image.load_addr);
> @@ -81,7 +85,9 @@ int spl_spi_load_image(void)
> if (err)
> return err;
>
> - spl_parse_image_header(header);
> + err = spl_parse_image_header(header);
> + if (err)
> + return err;
> err = spi_flash_read(flash, CONFIG_SYS_SPI_U_BOOT_OFFS,
> spl_image.size, (void *)spl_image.load_addr);
> }
> diff --git a/include/spl.h b/include/spl.h
> index de4f70a..7edfab4 100644
> --- a/include/spl.h
> +++ b/include/spl.h
> @@ -56,7 +56,7 @@ void preloader_console_init(void);
> u32 spl_boot_device(void);
> u32 spl_boot_mode(void);
> void spl_set_header_raw_uboot(void);
> -void spl_parse_image_header(const struct image_header *header);
> +int spl_parse_image_header(const struct image_header *header);
> void spl_board_prepare_for_linux(void);
> void __noreturn jump_to_image_linux(void *arg);
> int spl_start_uboot(void);
> --
> 2.7.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
--
---
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value
2016-05-20 21:56 ` [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Nishanth Menon
@ 2016-05-21 0:22 ` Fabio Estevam
2016-05-23 15:57 ` Suman Anna
0 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2016-05-21 0:22 UTC (permalink / raw)
To: u-boot
On Fri, May 20, 2016 at 6:56 PM, Nishanth Menon <nm@ti.com> wrote:
> Marek,
>
> Just forwarding report from Suman (in CC) reporting that as of u-boot
> master 4b6e1fd "Merge git://git.denx.de/u-boot-dm"
> It looks like BeagleBoard-X15, DRA7 platforms fail due to this commit.
> Fail signature looks like the following:
> ...
> DRA752 ES2.0
> Trying to boot from MMC1
> reading args
> spl_load_image_fat_os: error reading image args, err - -1
> reading u-boot.img
> spl_load_image_fat: error reading image u-boot.img, err - 0
> Failed to mount ext2 filesystem...
> spl_load_image_ext_os: ext4fs mount err - 0
> Failed to mount ext2 filesystem...
> spl_load_image_ext: ext4fs mount err - 0
Looks like this can be fixed with this patch from Marek:
https://patchwork.ozlabs.org/patch/624267/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value
2016-05-21 0:22 ` Fabio Estevam
@ 2016-05-23 15:57 ` Suman Anna
0 siblings, 0 replies; 6+ messages in thread
From: Suman Anna @ 2016-05-23 15:57 UTC (permalink / raw)
To: u-boot
On 05/20/2016 07:22 PM, Fabio Estevam wrote:
> On Fri, May 20, 2016 at 6:56 PM, Nishanth Menon <nm@ti.com> wrote:
>> Marek,
>>
>> Just forwarding report from Suman (in CC) reporting that as of u-boot
>> master 4b6e1fd "Merge git://git.denx.de/u-boot-dm"
>> It looks like BeagleBoard-X15, DRA7 platforms fail due to this commit.
>> Fail signature looks like the following:
>> ...
>> DRA752 ES2.0
>> Trying to boot from MMC1
>> reading args
>> spl_load_image_fat_os: error reading image args, err - -1
>> reading u-boot.img
>> spl_load_image_fat: error reading image u-boot.img, err - 0
>> Failed to mount ext2 filesystem...
>> spl_load_image_ext_os: ext4fs mount err - 0
>> Failed to mount ext2 filesystem...
>> spl_load_image_ext: ext4fs mount err - 0
>
> Looks like this can be fixed with this patch from Marek:
> https://patchwork.ozlabs.org/patch/624267/
Thanks Fabio for pointing out the fix. I have verified that this patch
fixes the boot on both the above platforms.
regards
Suman
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-05-23 15:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 22:44 [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 2/3] SPL: Add CONFIG_SPL_ABORT_ON_RAW_IMAGE Marek Vasut
2016-04-28 22:44 ` [U-Boot] [PATCH 3/3] ARM: mx6: Enable MMC and SATA extfs boot support Marek Vasut
2016-05-20 21:56 ` [U-Boot] [PATCH 1/3] SPL: Let spl_parse_image_header() return value Nishanth Menon
2016-05-21 0:22 ` Fabio Estevam
2016-05-23 15:57 ` Suman Anna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox