[PATCH v3] xload: get barebox size from barebox_arm_head

Sascha Hauer s.hauer at pengutronix.de
Tue Sep 4 05:28:31 EDT 2012


On Tue, Sep 04, 2012 at 09:34:22AM +0200, Jan Weitzel wrote:
> Am Mittwoch, den 29.08.2012, 14:21 +0200 schrieb Jean-Christophe
> > > +unsigned int get_image_size(void *head)
> > > +{
> > > +	unsigned int ret = 0;
> > > +	unsigned int *psize = head + HEAD_SIZE_OFFSET;
> > > +	const char *pmagic = head + HEAD_MAGICWORD_OFFSET;
> > > +
> > > +	if (!strcmp(pmagic, "barebox"))
> > > +		ret = *psize;
> > > +	debug("Detected barebox image size %u\n", ret);
> > factorise the code with filetype
> What exactly do you mean? I could factorise it by boot source (mmc / nand) with complete omap_xload_boot_nand.

He means that you should use file_detect_type() To detect whether it's a
barebox image.
I'm unsure I share this opinion. After detecting that it's a barebox
file you have to look into the header anyway to get the actual size.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list