mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
spl_mmc.c: Detect missing kernel image in RAW MMC
Currently, we assume that if we can read from MMC correctly, we have found a valid image. This is not the case as an empty area will read just fine. Add a check for a valid IH_MAGIC. Signed-off-by: Tom Rini <trini@ti.com> Reviewed-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
3864cb2133
commit
e4c444b34b
1 changed files with 4 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <mmc.h>
|
||||
#include <fat.h>
|
||||
#include <version.h>
|
||||
#include <image.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
|
@ -30,6 +31,9 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector)
|
|||
if (err == 0)
|
||||
goto end;
|
||||
|
||||
if (image_get_magic(header) != IH_MAGIC)
|
||||
return -1;
|
||||
|
||||
spl_parse_image_header(header);
|
||||
|
||||
/* convert size to sectors - round up */
|
||||
|
|
Loading…
Reference in a new issue