summaryrefslogtreecommitdiff
path: root/packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2006-01-17 20:37:52 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-01-17 20:37:52 +0000
commitb4ee48740558a52e411dfbfa26ea61082b52814c (patch)
tree2a1bf1b0689c710072b1d698f4fc6521235150f3 /packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch
parent47252fc24cbfd80630f5a768bd5ac960b47daace (diff)
ixp4xx-kernel: improve fixup patches, remove loft one, add cmdline byteswap in 2.6.15
- the fixup patches for NSLU2 and NAS100D have been slightly simplified. the fixup for Loft has been removed, it isn't useful. code in arch/arm/kernel/setup.c to automagically swap the command line has been added in 48-setup-byteswap-cmdline.patch
Diffstat (limited to 'packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch')
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch b/packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch
new file mode 100644
index 0000000000..34b515a5bf
--- /dev/null
+++ b/packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch
@@ -0,0 +1,48 @@
+When invoking an LE kernel from a BE boot loader or vice versa
+the ATAG_CMDLINE command line will be byte swapped, other ATAGs
+are fine because they are 32 bit values.
+
+This patch adds support for a command line option "swx " - which
+must be at the start of the command line - and which is used to
+detect a need to byte swap the rest of the command line.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/arch/arm/kernel/setup.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/arch/arm/kernel/setup.c 1970-01-01 00:00:00.000000000 +0000
+@@ -659,7 +659,34 @@ __tagtable(ATAG_REVISION, parse_tag_revi
+
+ static int __init parse_tag_cmdline(const struct tag *tag)
+ {
+- strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
++ /* Check the first four bytes for "swx " (swap, but it's
++ * ok) or " xws" (command line is byte swapped)
++ */
++ const char *cmdline = tag->u.cmdline.cmdline;
++ u32 size = tag->hdr.size;
++
++ if (size > 0 && !memcmp(cmdline, " xws", 4)) {
++ cmdline += 4;
++
++ if (--size > 0) {
++ const u32 *from = (const u32*)cmdline;
++ u32 *to = (u32*)default_command_line;
++
++ if (size > COMMAND_LINE_SIZE/4)
++ size = COMMAND_LINE_SIZE/4;
++
++ while (size-- > 0)
++ to[size] = swab32(from[size]);
++
++ default_command_line[COMMAND_LINE_SIZE-1] = 0;
++ return 0;
++ }
++ }
++
++ if (size > 0 && !memcmp(cmdline, "swx ", 4))
++ cmdline += 4;
++
++ strlcpy(default_command_line, cmdline, COMMAND_LINE_SIZE);
+ return 0;
+ }
+