Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: bcm47xxpart: support SquashFS with an original magic

SquashFS is supposed to use magic defined as SQUASHFS_MAGIC. What we
were supporting so far (SQSH_MAGIC) is something ZTE specific.
This patch adds support for Xiaomi R1D.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>

authored by

Rafał Miłecki and committed by
Brian Norris
0b56d2d4 16bd87b3

+5 -2
+5 -2
drivers/mtd/bcm47xxpart.c
··· 15 15 #include <linux/mtd/mtd.h> 16 16 #include <linux/mtd/partitions.h> 17 17 18 + #include <uapi/linux/magic.h> 19 + 18 20 /* 19 21 * NAND flash on Netgear R6250 was verified to contain 15 partitions. 20 22 * This will result in allocating too big array for some old devices, but the ··· 41 39 #define ML_MAGIC1 0x39685a42 42 40 #define ML_MAGIC2 0x26594131 43 41 #define TRX_MAGIC 0x30524448 44 - #define SQSH_MAGIC 0x71736873 /* shsq */ 42 + #define SHSQ_MAGIC 0x71736873 /* shsq (weird ZTE H218N endianness) */ 45 43 #define UBI_EC_MAGIC 0x23494255 /* UBI# */ 46 44 47 45 struct trx_header { ··· 235 233 } 236 234 237 235 /* Squashfs on devices not using TRX */ 238 - if (buf[0x000 / 4] == SQSH_MAGIC) { 236 + if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC || 237 + buf[0x000 / 4] == SHSQ_MAGIC) { 239 238 bcm47xxpart_add_part(&parts[curr_part++], "rootfs", 240 239 offset, 0); 241 240 continue;