mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-18 18:59:44 +00:00
36afd45136
Make spl_*_load_image() functions return a value instead of hanging if a problem is encountered. This enables main spl code to make the decision whether to hang or not, thus preparing it to support alternative boot devices. Some boot devices (namely nand and spi) do not hang on error. Instead, they return normally and SPL proceeds to boot the contents of the load address. This is considered a bug and is rectified by hanging on error for these devices as well. Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il> Cc: Igor Grinberg <grinberg@compulab.co.il> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org> Cc: Ian Campbell <ijc@hellion.org.uk> Cc: Hans De Goede <hdegoede@redhat.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Jagan Teki <jteki@openedev.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
40 lines
783 B
C
40 lines
783 B
C
/*
|
|
* (C) Copyright 2000-2004
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
*
|
|
* (C) Copyright 2012
|
|
* Ilya Yanok <ilya.yanok@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
#include <common.h>
|
|
#include <errno.h>
|
|
#include <spl.h>
|
|
#include <net.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
int spl_net_load_image(const char *device)
|
|
{
|
|
int rv;
|
|
|
|
env_init();
|
|
env_relocate();
|
|
setenv("autoload", "yes");
|
|
load_addr = CONFIG_SYS_TEXT_BASE - sizeof(struct image_header);
|
|
rv = eth_initialize();
|
|
if (rv == 0) {
|
|
printf("No Ethernet devices found\n");
|
|
return -ENODEV;
|
|
}
|
|
if (device)
|
|
setenv("ethact", device);
|
|
rv = net_loop(BOOTP);
|
|
if (rv < 0) {
|
|
printf("Problem booting with BOOTP\n");
|
|
return rv;
|
|
}
|
|
spl_parse_image_header((struct image_header *)load_addr);
|
|
|
|
return 0;
|
|
}
|