mtd: bcm47xxpart: support SquashFS with an original magic

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Feb 16 18:59:02 PST 2015


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=0b56d2d45e7c27581ca90f36b4317373f23e7622
Commit:     0b56d2d45e7c27581ca90f36b4317373f23e7622
Parent:     16bd87b3a352b536ffdd7325e3178c4231f3cbf7
Author:     Rafał Miłecki <zajec5 at gmail.com>
AuthorDate: Tue Dec 16 09:50:25 2014 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Wed Jan 7 12:24:23 2015 -0800

    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 at gmail.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/bcm47xxpart.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
index 4ad3928..c0720c1 100644
--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -15,6 +15,8 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 
+#include <uapi/linux/magic.h>
+
 /*
  * NAND flash on Netgear R6250 was verified to contain 15 partitions.
  * This will result in allocating too big array for some old devices, but the
@@ -39,7 +41,7 @@
 #define ML_MAGIC1			0x39685a42
 #define ML_MAGIC2			0x26594131
 #define TRX_MAGIC			0x30524448
-#define SQSH_MAGIC			0x71736873	/* shsq */
+#define SHSQ_MAGIC			0x71736873	/* shsq (weird ZTE H218N endianness) */
 #define UBI_EC_MAGIC			0x23494255	/* UBI# */
 
 struct trx_header {
@@ -233,7 +235,8 @@ static int bcm47xxpart_parse(struct mtd_info *master,
 		}
 
 		/* Squashfs on devices not using TRX */
-		if (buf[0x000 / 4] == SQSH_MAGIC) {
+		if (le32_to_cpu(buf[0x000 / 4]) == SQUASHFS_MAGIC ||
+		    buf[0x000 / 4] == SHSQ_MAGIC) {
 			bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
 					     offset, 0);
 			continue;



More information about the linux-mtd-cvs mailing list