commit dfe7228b995837dd939c0a9b4c6124f910f12c37
parent ab147abd9be1d7b5d9e8e6102f8bdaa40e78500b
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 26 Sep 2023 16:40:37 +0100
fix jffs2 mtd partition splitting on little-endian CPU
Diffstat:
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/pkgs/kernel/default.nix b/pkgs/kernel/default.nix
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
patches = [
./cmdline-cookie.patch
+ ./make-mtdsplit-jffs2-endian-agnostic.patch
];
# this is here to work around what I think is a bug in nixpkgs
diff --git a/pkgs/kernel/make-mtdsplit-jffs2-endian-agnostic.patch b/pkgs/kernel/make-mtdsplit-jffs2-endian-agnostic.patch
@@ -0,0 +1,20 @@
+On a little-endian CPU, the little-endian JFFS2 magic
+appears to be word-swapped.
+
+There is probably a better way to implement this; if you are reading
+this patch you are probably well-qualified to do that and upstream it
+to OpenWrt
+
+
+diff --git a/drivers/mtd/mtdsplit/mtdsplit.c b/drivers/mtd/mtdsplit/mtdsplit.c
+index b2e51dcfc6..533af0298e 100644
+--- a/drivers/mtd/mtdsplit/mtdsplit.c
++++ b/drivers/mtd/mtdsplit/mtdsplit.c
+@@ -92,6 +93,6 @@
+ *type = MTDSPLIT_PART_TYPE_SQUASHFS;
+ return 0;
+- } else if (magic == 0x19852003) {
++ } else if ((magic == 0x19852003) || (magic == 0x20031985)) {
+ if (type)
+ *type = MTDSPLIT_PART_TYPE_JFFS2;
+ return 0;