[U-Boot] [PATCH] spl_mmc.c: Detect missing kernel image in RAW MMC
Peter Korsgaard
jacmet at sunsite.dk
Fri Jun 28 20:53:16 CEST 2013
>>>>> "Tom" == Tom Rini <trini at ti.com> writes:
Tom> Currently, we assume that if we can read from MMC correctly, we have
Tom> found a valid image. This is not the case as an empty area will read
Tom> just fine. Add a check for a valid IH_MAGIC.
Tom> Signed-off-by: Tom Rini <trini at ti.com>
Reviewed-by: Peter Korsgaard <jacmet at sunsite.dk>
Tom> ---
Tom> common/spl/spl_mmc.c | 4 ++++
Tom> 1 file changed, 4 insertions(+)
Tom> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
Tom> index 170fa38..d20f45d 100644
Tom> --- a/common/spl/spl_mmc.c
Tom> +++ b/common/spl/spl_mmc.c
Tom> @@ -29,6 +29,7 @@
Tom> #include <mmc.h>
Tom> #include <fat.h>
Tom> #include <version.h>
Tom> +#include <image.h>
Tom> DECLARE_GLOBAL_DATA_PTR;
Tom> @@ -46,6 +47,9 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector)
Tom> if (err == 0)
Tom> goto end;
Tom> + if (image_get_magic(header) != IH_MAGIC)
Tom> + return -1;
Tom> +
Tom> spl_parse_image_header(header);
Tom> /* convert size to sectors - round up */
Tom> --
Tom> 1.7.9.5
Tom> _______________________________________________
Tom> U-Boot mailing list
Tom> U-Boot at lists.denx.de
Tom> http://lists.denx.de/mailman/listinfo/u-boot
--
Bye, Peter Korsgaard
More information about the U-Boot
mailing list