[PATCH] ARM: put a valid "barebox" signature in the header on big-endian systems.
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Sat May 12 20:17:31 EDT 2012
On Sun, May 13, 2012 at 03:56:48AM +0400, Antony Pavlov wrote:
> On 13 May 2012 01:38, Uwe Kleine-König <u.kleine-koenig at pengutronix.de> wrote:
> > Hello Krzysztof,
> >
> > On Sat, May 05, 2012 at 11:47:19PM +0200, Krzysztof Halasa wrote:
> >> Signed-off-by: Krzysztof Hałasa <khc at pm.waw.pl>
> >>
> >> diff --git a/arch/arm/include/asm/barebox-arm-head.h b/arch/arm/include/asm/barebox-arm-head.h
> >> index 0dc3074..2c250e9 100644
> >> --- a/arch/arm/include/asm/barebox-arm-head.h
> >> +++ b/arch/arm/include/asm/barebox-arm-head.h
> >> @@ -24,8 +24,7 @@ static inline void barebox_arm_head(void)
> >> "1: b 1b\n"
> >> "1: b 1b\n"
> >> #endif
> >> - ".word 0x65726162\n" /* 'bare' */
> >> - ".word 0x00786f62\n" /* 'box' */
> >> + ".asciz \"barebox\"\n"
> >> ".word _text\n" /* text base. If copied there,
> >> * barebox can skip relocation
> >> */
> > Another downside of this patch (apart from the file type detection that
> > still needs adaption?) is that the magic is different depending on
> > endianess.
>
> Can this addition to the patch fix the endianess issue?
>
> --- a/common/filetype.c
> +++ b/common/filetype.c
> @@ -56,7 +56,7 @@ enum filetype file_detect_type(void *_buf)
>
> if (strncmp(buf8, "#!/bin/sh", 9) == 0)
> return filetype_sh;
> - if (buf[8] == 0x65726162 && buf[9] == 0x00786f62)
> + if (strncmp(buf8 + 0x20, "barebox", 7) == 0)
the original checked 8 bytes, you only check 7. Is this intended?
> return filetype_arm_barebox;
> if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)
> return filetype_arm_zimage;
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
More information about the barebox
mailing list