[PATCH 05/12] Add compressed image support

Sascha Hauer s.hauer at pengutronix.de
Fri Aug 3 02:34:33 EDT 2012


On Thu, Aug 02, 2012 at 05:34:22PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 17:30 Thu 02 Aug     , Sascha Hauer wrote:
> > On Mon, Jul 30, 2012 at 12:02:38PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > From: Sascha Hauer <s.hauer at pengutronix.de>
> > > +
> > >  void barebox_pbl(uint32_t offset)
> > >  {
> > > +	uint32_t compressed_start, compressed_end, len;
> > > +	void (*uncompress)(void *compressed_start, unsigned int len);
> > > +
> > > +	compressed_start = (uint32_t)&input_data - offset;
> > > +	compressed_end = (uint32_t)&input_data_end - offset;
> > > +	len = compressed_end - compressed_start;
> > > +
> > > +	/*
> > > +	 * Check if the compressed binary will be overwritten
> > > +	 * by the uncompressed binary
> > > +	 */
> > > +	if (compressed_start >= TEXT_BASE &&
> > > +			compressed_start < TEXT_BASE + len * 4 ) {
> > > +		/*
> > > +		 * copy compressed binary to its link address
> > > +		 */
> > > +		memcpy(&input_data, (void *)compressed_start, len);
> > > +		compressed_start = (uint32_t)&input_data;
> > > +	}
> > > +
> > > +	uncompress = barebox_uncompress;
> > > +
> > > +	/* call barebox_uncompress with its absolute address */
> > > +	__asm__ __volatile__(
> > > +		"mov r0, %1\n"
> > > +		"mov r1, %2\n"
> > > +		"mov pc, %0\n"
> > > +		:
> > > +		: "r"(uncompress), "r"(compressed_start), "r"(len)
> > > +		: "r0", "r1");
> > 
> > When the pbl code runs at its correct address, then we can simply do a
> > barebox_uncompress() here.
> > 
> > Fixed this before applying.
> the code in start does not do this
> 
> we just do a call to barebox_pbl

See my other mails to the other patches.

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