[PATCH 05/12] Add compressed image support

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Thu Aug 2 11:34:22 EDT 2012


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

are you really sure about this?

Best Regards,
J.



More information about the barebox mailing list