* [PATCH] mtd: bcm47xxpart: support SquashFS with an original magic
@ 2014-12-16 7:40 Rafał Miłecki
2014-12-16 8:50 ` [PATCH V2] " Rafał Miłecki
0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-12-16 7:40 UTC (permalink / raw)
To: David Woodhouse, Artem Bityutskiy, Brian Norris, linux-mtd
Cc: Hauke Mehrtens, Rafał Miłecki
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>
---
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..03f645a 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 SQSH_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] == SQSH_MAGIC) {
bcm47xxpart_add_part(&parts[curr_part++], "rootfs",
offset, 0);
continue;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH V2] mtd: bcm47xxpart: support SquashFS with an original magic
2014-12-16 7:40 [PATCH] mtd: bcm47xxpart: support SquashFS with an original magic Rafał Miłecki
@ 2014-12-16 8:50 ` Rafał Miłecki
2015-01-07 20:36 ` Brian Norris
0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-12-16 8:50 UTC (permalink / raw)
To: David Woodhouse, Artem Bityutskiy, Brian Norris, linux-mtd
Cc: Hauke Mehrtens, Rafał Miłecki
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>
---
V2: s/SQSH/SHSQ/ to emphase this weird endianness
---
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;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] mtd: bcm47xxpart: support SquashFS with an original magic
2014-12-16 8:50 ` [PATCH V2] " Rafał Miłecki
@ 2015-01-07 20:36 ` Brian Norris
0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2015-01-07 20:36 UTC (permalink / raw)
To: Rafał Miłecki
Cc: Hauke Mehrtens, linux-mtd, David Woodhouse, Artem Bityutskiy
On Tue, Dec 16, 2014 at 09:50:25AM +0100, Rafał Miłecki wrote:
> 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>
> ---
> V2: s/SQSH/SHSQ/ to emphase this weird endianness
Applied to l2-mtd.git. Thanks.
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-07 20:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-16 7:40 [PATCH] mtd: bcm47xxpart: support SquashFS with an original magic Rafał Miłecki
2014-12-16 8:50 ` [PATCH V2] " Rafał Miłecki
2015-01-07 20:36 ` Brian Norris
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.