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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> 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

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox


[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux