From b4ee48740558a52e411dfbfa26ea61082b52814c Mon Sep 17 00:00:00 2001 From: John Bowler Date: Tue, 17 Jan 2006 20:37:52 +0000 Subject: 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 --- .../2.6.15/48-setup-byteswap-cmdline.patch | 48 ++++++++++++ .../linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch | 87 ---------------------- .../ixp4xx-kernel/2.6.15/94-nas100d-setup.patch | 34 +++++---- .../ixp4xx-kernel/2.6.15/94-nslu2-setup.patch | 55 +++++++------- 4 files changed, 95 insertions(+), 129 deletions(-) create mode 100644 packages/linux/ixp4xx-kernel/2.6.15/48-setup-byteswap-cmdline.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch (limited to 'packages/linux/ixp4xx-kernel') 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 + +--- 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; + } + diff --git a/packages/linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch b/packages/linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch deleted file mode 100644 index 9114f3cddd..0000000000 --- a/packages/linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch +++ /dev/null @@ -1,87 +0,0 @@ -Include a fixup machine start function in the loft part of -ixdp425-setup.c to handle the command line and memory setup -parameters which are not specifiable in the boot loader. - -Signed-off-by: John Bowler - - ---- linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000 -@@ -191,8 +191,8 @@ MACHINE_END - /* - * Loft is functionally equivalent to Avila except that it has a - * different number for the maximum PCI devices. The MACHINE -- * structure below is identical to Avila except for the and -- * the use of a loft specific init. -+ * structure below is derived from the Avila one (and may, in -+ * fact, be useful on Avila in general). - * - * The loft init registers a notifier on the on-board EEPROM to - * detect the MAC addresses. -@@ -201,6 +201,58 @@ MACHINE_END - */ - #ifdef CONFIG_MACH_LOFT - /* -+ * Loft bootstrap may pass in parameters, if these contain an -+ * ATAG_MEM and it appears valid (not the 16MByte one in the -+ * setup/kernel.c default) we use it, otherwise a 64MByte -+ * setting is forced here, this may be overridden on the -+ * command line. -+ */ -+static void __init loft_fixup(struct machine_desc *desc, -+ struct tag *tags, char **cmdline, struct meminfo *mi) -+{ -+ char saved_command_line[COMMAND_LINE_SIZE]; -+ /* Put Loft specific known-required-for-certain stuff here, leave -+ * a trailing space! -+ */ -+ static char loft_command_line[] = -+ "root=/dev/mtdblock2 rw rootfstype=jffs2 init=/linuxrc " -+ "rtc-ds1672.probe=0,0x68 rtc-ds1672.hctosys=1 "; -+ const int len = (sizeof loft_command_line)-1; -+ int memtag = 0; -+ -+ /* The Loft typically has one bank of 64MByte memory. -+ * NOTE: setting nr_banks != 0 causes kernel/setup.c to remove -+ * the mem tags from the tag list, so if there is an entry -+ * there don't remove it! -+ */ -+ if (tags->hdr.tag == ATAG_CORE) do { -+ tags = tag_next(tags); -+ printk(KERN_NOTICE "ATAG[0x%x] size %d\n", tags->hdr.tag, tags->hdr.size); -+ if (tags->hdr.tag == ATAG_MEM && tags->hdr.size == tag_size(tag_mem32) && -+ (tags->u.mem.start != 0 || tags->u.mem.size != (16*1024*1024))) { -+ memtag = 1; -+ printk(KERN_NOTICE " ATAG_MEM base %lx size %lx\n", -+ tags->u.mem.start, tags->u.mem.size); -+ } -+ } while (tags->hdr.size); -+ -+ if (!memtag) { -+ mi->nr_banks=1; -+ mi->bank[0].start = 0; -+ mi->bank[0].size = (64*1024*1024); -+ mi->bank[0].node = PHYS_TO_NID(0); -+ } -+ -+ /* A command line in the ATAG list will override this one, -+ * as is intended. -+ */ -+ memcpy(saved_command_line, *cmdline, COMMAND_LINE_SIZE); -+ memcpy(*cmdline, loft_command_line, len); -+ memcpy(*cmdline + len, saved_command_line, COMMAND_LINE_SIZE - len); -+ *cmdline[COMMAND_LINE_SIZE-1] = 0; -+} -+ -+/* - * When the EEPROM is added the MAC address are read from it. - */ - static void loft_eeprom_add(int address, int kind, struct kobject *kobj, -@@ -252,6 +304,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc - .phys_ram = PHYS_OFFSET, - .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, - .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, -+ .fixup = loft_fixup, - .map_io = ixp4xx_map_io, - .init_irq = ixp4xx_init_irq, - .timer = &ixp4xx_timer, diff --git a/packages/linux/ixp4xx-kernel/2.6.15/94-nas100d-setup.patch b/packages/linux/ixp4xx-kernel/2.6.15/94-nas100d-setup.patch index bd766a3ccc..e451619aa1 100644 --- a/packages/linux/ixp4xx-kernel/2.6.15/94-nas100d-setup.patch +++ b/packages/linux/ixp4xx-kernel/2.6.15/94-nas100d-setup.patch @@ -15,7 +15,7 @@ Signed-off-by: John Bowler #include #include #include -@@ -164,12 +166,49 @@ static void __init nas100d_init(void) +@@ -164,12 +166,53 @@ static void __init nas100d_init(void) platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices)); } @@ -24,20 +24,27 @@ Signed-off-by: John Bowler + * settings to be safe (the box always has 64MByte at 0). The + * passed in command line can override this default, we prepend + * to the config'ed default. ++ * ++ * NOTE: the startup sequence is: ++ * 1) Call the machine fixup ++ * 2) Parse the ATAG list, the ATAG_CMDLINE is copied in ++ * to default_command_line which is the value of *from ++ * 3) Parse the command line in *from (*not* ++ * default_command_line unless they are the same!) ++ * ++ * Setting mi->nr_banks causes (2) to 'squash' (set to ATAG_NONE) ++ * any ATAG_MEM tags, but mem= command line options cause nr_banks ++ * to be reset to 0 (on the first mem=) + */ ++static char nas100d_command_line[] __initdata = ++ "root=/dev/mtdblock2 rootfstype=jffs2 init=/linuxrc " ++ "pcf8563.hctosys=1 " ++ CONFIG_CMDLINE; ++ +static void __init nas100d_fixup(struct machine_desc *desc, + struct tag *tags, char **cmdline, struct meminfo *mi) +{ -+ char saved_command_line[COMMAND_LINE_SIZE]; -+ /* Put NAS100D specific known-required-for-certain stuff here, leave -+ * a trailing space! -+ */ -+ static char nas100d_command_line[] = -+ "root=/dev/mtdblock2 rw rootfstype=jffs2 init=/linuxrc " -+ "pcf8563.hctosys=1 "; -+ const int len = (sizeof nas100d_command_line)-1; -+ -+ /* The NAS100D has one bank of 32MByte memory. ++ /* The NAS100D has one bank of 64MByte memory. + * NOTE: setting nr_banks != 0 causes kernel/setup.c to remove + * the mem tags from the tag list. We need do nothing here! + */ @@ -49,10 +56,7 @@ Signed-off-by: John Bowler + /* A command line in the ATAG list will override this one, + * as is intended. + */ -+ memcpy(saved_command_line, *cmdline, COMMAND_LINE_SIZE); -+ memcpy(*cmdline, nas100d_command_line, len); -+ memcpy(*cmdline + len, saved_command_line, COMMAND_LINE_SIZE - len); -+ *cmdline[COMMAND_LINE_SIZE-1] = 0; ++ strlcpy(*cmdline, nas100d_command_line, COMMAND_LINE_SIZE); +} + MACHINE_START(NAS100D, "Iomega NAS 100d") diff --git a/packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch b/packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch index 0ed39d9302..55aad7c440 100644 --- a/packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch +++ b/packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch @@ -15,47 +15,48 @@ Signed-off-by: John Bowler #include #include #include -@@ -165,12 +167,52 @@ static void __init nslu2_init(void) +@@ -165,12 +167,53 @@ static void __init nslu2_init(void) platform_add_devices(nslu2_devices, ARRAY_SIZE(nslu2_devices)); } +/* -+ * NSLU2 RedBoot passes garbage atag/parameter values - i.e. r2 -+ * on entry is not useable - so we get to set the right values -+ * here... ++ * NSLU2 RedBoot passes garbage atag/parameter values because it copies ++ * the kernel zImage on top of the parameter list before branching into ++ * the zImage. The machine description causes the ATAG list to be ++ * skipped (by setting boot_params to 0) and this code fixes up the ++ * memory info and command line by supplying a command line with the ++ * NSLU2 specific config prepended. ++ * ++ * NOTE: the startup sequence is: ++ * 1) Call the machine fixup ++ * 2) Parse the ATAG list, the ATAG_CMDLINE is copied in ++ * to default_command_line which is the value of *from ++ * 3) Parse the command line in *from (*not* ++ * default_command_line unless they are the same!) ++ * ++ * Setting mi->nr_banks causes (2) to 'squash' (set to ATAG_NONE) ++ * any ATAG_MEM tags, but mem= command line options cause nr_banks ++ * to be reset to 0 (on the first mem=) + */ ++static char nslu2_command_line[] __initdata = ++ "root=/dev/mtdblock4 rootfstype=jffs2 init=/linuxrc " ++ "rtc-x1205.probe=0,0x6f rtc-x1205.hctosys=1 " ++ CONFIG_CMDLINE; ++ +static void __init nslu2_fixup(struct machine_desc *desc, + struct tag *tags, char **cmdline, struct meminfo *mi) +{ -+ char saved_command_line[COMMAND_LINE_SIZE]; -+ /* Put NSLU2 specific known-required-for-certain stuff here, leave -+ * a trailing space! -+ */ -+ static char nslu2_command_line[] = -+ "root=/dev/mtdblock4 rw rootfstype=jffs2 init=/linuxrc " -+ "rtc-x1205.probe=0,0x6f rtc-x1205.hctosys=1 "; -+ const int len = (sizeof nslu2_command_line)-1; -+ + /* The NSLU2 has one bank of 32MByte memory. -+ * NOTE: this will totally destroy attempts to make fatslugs work, -+ * FATSLUG FATSLUG FATSLUG: please parameterise this! -+ * NOTE: setting nr_banks != 0 causes kernel/setup.c to remove -+ * the mem tags from the tag list. We need do nothing here! ++ * NOTE: to make a 'fatslug' work append the appropriate ++ * mem= to the CONFIG_CMDLINE - this will override the ++ * setting below. + */ + mi->nr_banks=1; + mi->bank[0].start = 0; + mi->bank[0].size = (32*1024*1024); + mi->bank[0].node = PHYS_TO_NID(0); + -+ /* The tag list is the one from kernel/setup.c, it has no -+ * command line, so we are free to make one up, do this by -+ * prepending to the default command line which has been -+ * passed in (so that can override if necessary). -+ */ -+ memcpy(saved_command_line, *cmdline, COMMAND_LINE_SIZE); -+ memcpy(*cmdline, nslu2_command_line, len); -+ memcpy(*cmdline + len, saved_command_line, COMMAND_LINE_SIZE - len); -+ *cmdline[COMMAND_LINE_SIZE-1] = 0; ++ strlcpy(*cmdline, nslu2_command_line, COMMAND_LINE_SIZE); +} + MACHINE_START(NSLU2, "Linksys NSLU2") @@ -64,7 +65,7 @@ Signed-off-by: John Bowler .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, - .boot_params = 0x00000100, -+ .boot_params = 0, /* because they are garbage */ ++ .boot_params = 0, /* because they are garbage - see above */ + .fixup = nslu2_fixup, .map_io = ixp4xx_map_io, .init_irq = ixp4xx_init_irq, -- cgit v1.2.3