mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
spl_mmc: allow to load raw image
The function spl_parse_image_header() falls back to a raw image if the U-Boot header is missing and CONFIG_SPL_PANIC_ON_RAW_IMAGE is undefined. While, mmc_load_image_raw_sector() only accepts a U-Boot legacy image or an FIT image, preventing us from loading a raw image. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
73b5b27b7a
commit
4976f48275
@ -41,7 +41,6 @@ static int mmc_load_legacy(struct mmc *mmc, ulong sector,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SPL_LOAD_FIT
|
|
||||||
static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
|
static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
|
||||||
ulong count, void *buf)
|
ulong count, void *buf)
|
||||||
{
|
{
|
||||||
@ -49,7 +48,6 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
|
|||||||
|
|
||||||
return mmc->block_dev.block_read(&mmc->block_dev, sector, count, buf);
|
return mmc->block_dev.block_read(&mmc->block_dev, sector, count, buf);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
|
static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
|
||||||
{
|
{
|
||||||
@ -68,12 +66,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (image_get_magic(header)) {
|
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
|
||||||
case IH_MAGIC:
|
image_get_magic(header) == FDT_MAGIC) {
|
||||||
ret = mmc_load_legacy(mmc, sector, header);
|
|
||||||
break;
|
|
||||||
#ifdef CONFIG_SPL_LOAD_FIT
|
|
||||||
case FDT_MAGIC: {
|
|
||||||
struct spl_load_info load;
|
struct spl_load_info load;
|
||||||
|
|
||||||
debug("Found FIT\n");
|
debug("Found FIT\n");
|
||||||
@ -82,12 +76,8 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
|
|||||||
load.bl_len = mmc->read_bl_len;
|
load.bl_len = mmc->read_bl_len;
|
||||||
load.read = h_spl_load_read;
|
load.read = h_spl_load_read;
|
||||||
ret = spl_load_simple_fit(&load, sector, header);
|
ret = spl_load_simple_fit(&load, sector, header);
|
||||||
break;
|
} else {
|
||||||
}
|
ret = mmc_load_legacy(mmc, sector, header);
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
puts("bad magic\n");
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user