summaryrefslogtreecommitdiff
path: root/packages/linux/ixp4xx-kernel/2.6.16/15-jffs2-endian-config.patch
blob: 893353ef4fa466650888c8a1a74a050a213ab051 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
This patch allows the endianness of the JFSS2 filesystem to be
specified by config options.

It defaults to native-endian (the previously hard-coded option).

Some architectures (in particular, the NSLU2) benefit from having a
single known endianness of JFFS2 filesystem (for data, not
executables) independent of the endianness of the processor (ARM
processors can be switched to either endianness at run-time).

Signed-off-by: Rod Whitby <rod@whitby.id.au>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>

 fs/Kconfig          |   25 +++++++++++++++++++++++++
 fs/jffs2/nodelist.h |    8 +++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

--- linux-nslu2.orig/fs/Kconfig	2006-02-06 20:38:09.000000000 +0100
+++ linux-nslu2/fs/Kconfig	2006-02-06 21:49:07.000000000 +0100
@@ -1174,6 +1174,31 @@ config JFFS2_CMODE_SIZE
 
 endchoice
 
+choice
+        prompt "JFFS2 endianness"
+        default JFFS2_NATIVE_ENDIAN
+        depends on JFFS2_FS
+        help
+          You can set here the default endianness of JFFS2 from
+          the available options. Don't touch if unsure.
+
+config JFFS2_NATIVE_ENDIAN
+        bool "native endian"
+        help
+          Uses a native endian bytestream.
+
+config JFFS2_BIG_ENDIAN
+        bool "big endian"
+        help
+          Uses a big endian bytestream.
+
+config JFFS2_LITTLE_ENDIAN
+        bool "little endian"
+        help
+          Uses a little endian bytestream.
+
+endchoice
+
 config CRAMFS
 	tristate "Compressed ROM file system support (cramfs)"
 	select ZLIB_INFLATE
--- linux-nslu2.orig/fs/jffs2/nodelist.h	2006-02-06 20:35:36.000000000 +0100
+++ linux-nslu2/fs/jffs2/nodelist.h	2006-02-06 21:49:07.000000000 +0100
@@ -29,12 +29,10 @@
 #include "os-linux.h"
 #endif
 
-#define JFFS2_NATIVE_ENDIAN
-
 /* Note we handle mode bits conversion from JFFS2 (i.e. Linux) to/from
    whatever OS we're actually running on here too. */
 
-#if defined(JFFS2_NATIVE_ENDIAN)
+#if defined(CONFIG_JFFS2_NATIVE_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){x})
 #define cpu_to_je32(x) ((jint32_t){x})
 #define cpu_to_jemode(x) ((jmode_t){os_to_jffs2_mode(x)})
@@ -42,7 +40,7 @@
 #define je16_to_cpu(x) ((x).v16)
 #define je32_to_cpu(x) ((x).v32)
 #define jemode_to_cpu(x) (jffs2_to_os_mode((x).m))
-#elif defined(JFFS2_BIG_ENDIAN)
+#elif defined(CONFIG_JFFS2_BIG_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){cpu_to_be16(x)})
 #define cpu_to_je32(x) ((jint32_t){cpu_to_be32(x)})
 #define cpu_to_jemode(x) ((jmode_t){cpu_to_be32(os_to_jffs2_mode(x))})
@@ -50,7 +48,7 @@
 #define je16_to_cpu(x) (be16_to_cpu(x.v16))
 #define je32_to_cpu(x) (be32_to_cpu(x.v32))
 #define jemode_to_cpu(x) (be32_to_cpu(jffs2_to_os_mode((x).m)))
-#elif defined(JFFS2_LITTLE_ENDIAN)
+#elif defined(CONFIG_JFFS2_LITTLE_ENDIAN)
 #define cpu_to_je16(x) ((jint16_t){cpu_to_le16(x)})
 #define cpu_to_je32(x) ((jint32_t){cpu_to_le32(x)})
 #define cpu_to_jemode(x) ((jmode_t){cpu_to_le32(os_to_jffs2_mode(x))})