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);
spl_set_header_raw_uboot();
#endif
}
+ return 0;
}
__weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
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);
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);
{
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;
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);
}
/* 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(
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);
}
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
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 +
* 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)),
int spl_onenand_load_image(void)
{
struct image_header *header;
+ int ret;
debug("spl: onenand\n");
/* 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);
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;
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);
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);
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);
}
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);