[U-Boot] [RFC] Extend 'bootm' to support Linux kernel generated images

Wolfgang Denk wd at denx.de
Wed May 21 22:10:50 CEST 2014


Dear Tom Rini,

In message <20140521195824.GE1752 at bill-the-cat> you wrote:
> 
> Something that Rob mentioned to me at ELC, and others have mentioned
> before is that it would be nice if 'bootm' (which says "boot application
> image stored in memory" in the help, even) would just work with zImage
> or Image or whatever is spit directly out of the kernel.

I don;t think this is a good idea.  "application image" is supposed to
mean "one of the U-Boot image formats", which means the old legacy
image format (with the 64 byte header), or FIT images.  To boot a
zImage file, we have the "bootz" command.

I also think such a patch is pushing into the wrong direction.  We
should rather try and improve the kernel support for FIT images.

> +	zi = (struct zimage_header *)map_sysmem(image, 0);
> +	if (zi->zi_magic == LINUX_ARM_ZIMAGE_MAGIC)
> +		return 0;

I smell endianess issues here?

> +#ifdef CONFIG_BOOTM_LINUX_RAW

LINUX_RAW ?

>  /* Image format types, returned by _get_format() routine */
>  #define IMAGE_FORMAT_INVALID	0x00
> +#define IMAGE_FORMAT_LINUX	0xFF	/* Linux kernel defined formats */
>  #define IMAGE_FORMAT_LEGACY	0x01	/* legacy image_header based format */
>  #define IMAGE_FORMAT_FIT	0x02	/* new, libfdt based format */

This does not look clean to me.

> It of course doesn't work and just shows where I think we would need to
> fill things in and probably provide some __weak functions for other
> arches.  Looking over how we do bootz today, and how I wrote booti for
> arm64, it should be possible to do the correct callouts at the correct
> places for "oh, we don't have a legacy or FIT header, we have a per
> Linux architecture defined header".
>
> What does everyone think about extending things in this direction?

I am no real friend of trying to be clever and automatically guess
image formats.  In my opinion it is more reliable to be able to verify
if an image os OK or corrupted, instead of passing a corrupted image
on to guesswork which might then belive it could be some other image
format (without checksums or such) and try to run it.

The user should give U-Boot a clear hint which image format to expect,
and allow U-Boot to complain otherwise.

If someone really wants such a trial and error approach, he can still
do this without adding code that affects everybody with just a little
scripting - like "bootm $addr || bootz $addr || ...".

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Conscious is when you are aware of something, and conscience is  when
you wish you weren't.


More information about the U-Boot mailing list