[PATCH V2] mtd: bcm47xxpart: detect block aligned Squashfs partition
Florian Fainelli
f.fainelli at gmail.com
Mon Sep 16 05:31:13 EDT 2013
Hello Rafal,
2013/9/14 Rafał Miłecki <zajec5 at gmail.com>:
> 2013/9/13 Florian Fainelli <f.fainelli at gmail.com>:
>> Le vendredi 13 septembre 2013 22:25:30 Rafał Miłecki a écrit :
>>> diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
>>> index 9279a91..61213f9 100644
>>> --- a/drivers/mtd/bcm47xxpart.c
>>> +++ b/drivers/mtd/bcm47xxpart.c
>>> @@ -32,6 +32,7 @@
>>> #define ML_MAGIC1 0x39685a42
>>> #define ML_MAGIC2 0x26594131
>>> #define TRX_MAGIC 0x30524448
>>> +#define SQSH_MAGIC 0x71736873 /* shsq */
>>
>> You could include uapi/linux/magic.h and use the SQUASHFS_MAGIC constant
>> directly, sorry for not noticing earlier.
>
> OK, I need help with that crazy endianness here... When I look at
> flash dump in hexdump (or Okteta for gui) I see:
> 37:0000 | 73 68 73 71 BB 03 00 00 00 00 00 00 88 1B 00 40 | shsq»..........@
>
> bcm47xx is LE, so reading first 4 bytes results in: 0x71'73'68'73 ([3]
> + [2] + [1] + [0]). That is what I used for my SQSH_MAGIC.
>
> However SQUASHFS_MAGIC is 0x73717368. So I need to read [2] + [3] +
> [0] + [1]... Any help how to achieve that?
My bad, there does not seem to be a good combination of endian
swapping which produces the magic you need.
--
Florian
More information about the linux-mtd
mailing list