[PATCH] ARM: put a valid "barebox" signature in the header on big-endian systems.

Krzysztof Halasa khc at pm.waw.pl
Sun May 6 16:19:16 EDT 2012


Sascha Hauer <s.hauer at pengutronix.de> writes:

>> -		".word 0x65726162\n"			/* 'bare' */
>> -		".word 0x00786f62\n"			/* 'box' */
>> +		".asciz \"barebox\"\n"
>>  		".word _text\n"				/* text base. If copied there,
>>  							 * barebox can skip relocation
>
> Does the barebox filetype detection need a fix aswell?

I guess so.

> enum filetype file_detect_type(void *_buf)
> {
>         u32 *buf = _buf;
>         u8 *buf8 = _buf;
>
>         if (strncmp(buf8, "#!/bin/sh", 9) == 0)
>                 return filetype_sh;

BTW there can be a white space between "#!" part and the interpreter
name.

>         if (buf[8] == 0x65726162 && buf[9] == 0x00786f62)
>                 return filetype_arm_barebox;
>
> This seems wrong on big endian systems.

Definitely.
A memcmp() would be better (I don't know about the buffer length).
-- 
Krzysztof Halasa



More information about the barebox mailing list