ixp4xx-kernel: fix boot setup parameters in 2.6.15
authorJohn Bowler <jbowler@nslu2-linux.org>
Mon, 16 Jan 2006 10:13:55 +0000 (10:13 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Mon, 16 Jan 2006 10:13:55 +0000 (10:13 +0000)
 - there is now a default machine-specific command line and an override
   for the memory config to provide a useable default per-machine.

conf/machine/nas100d.conf
packages/linux/ixp4xx-kernel.inc
packages/linux/ixp4xx-kernel/2.6.15/94-loft-setup.patch [new file with mode: 0644]
packages/linux/ixp4xx-kernel/2.6.15/94-nas100d-setup.patch [new file with mode: 0644]
packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch [new file with mode: 0644]
packages/linux/ixp4xx-kernel_2.6.15.bb

index 41836c3..29a3b04 100644 (file)
@@ -3,6 +3,3 @@
 #@DESCRIPTION: Machine configuration for the Iomega NAS 100d product
 
 include conf/machine/include/ixp4xx.conf
-
-# TEMPORARY: fixup the command line for nas100d builds
-CMDLINE_ROOT = "root=/dev/mtdblock2 rw rootfstype=jffs2 mem=64M@0x00000000 init=/linuxrc"
index 0f3717c..a0e1496 100644 (file)
@@ -155,31 +155,19 @@ ARCH = "arm"
 KERNEL_IMAGETYPE = "zImage"
 
 # To specify the console set KERNEL_CONSOLE in the .bb file.
-# CMDLINE_ROOT contains the boot options, CMDLINE_KERNEL_OPTIONS
-# contains the things for a specific kernel.
-#
-# These are set from MACHINE specific defaults below, but an override
-# in local.conf will still take precedence.
-#
-# CMDLINE_KERNEL_OPTIONS: overridable in local.conf
-# MACH_KERNEL_OPTIONS: the default, added to so additional stuff can be
-#  put in from local.conf etc.
-MACH_KERNEL_OPTIONS += "rtc-x1205.probe=0,0x6f rtc-x1205.hctosys=1"
-MACH_KERNEL_OPTIONS += "rtc-ds1672.probe=0,0x68 rtc-ds1672.hctosys=1"
-MACH_KERNEL_OPTIONS += "pcf8563.hctosys=1"
-#
-CMDLINE_KERNEL_OPTIONS ?= "${MACH_KERNEL_OPTIONS}"
+# CMDLINE_ROOT contains the boot options, these will be
+# appended to the build in boot options (so it is only necessary
+# to override stuff in the kernel source).
 
 # CMDLINE_ROOT: machine specific boot options - should not be set on a
 #  generic kernel!
-#FIXME: this is to make NSLU2 work (temporary!)
-CMDLINE_ROOT ?= "root=/dev/mtdblock4 rootfstype=jffs2 init=/linuxrc mem=32M"
-#CMDLINE_ROOT ?= "mem=32M"
+CMDLINE_ROOT ?= ""
 
 # CMDLINE_DEBUG: debug options such as noirqdebug, defaults to empty
 # override in local.conf etc
 CMDLINE_DEBUG ?= ""
-CMDLINE = "${CMDLINE_ROOT} ${CMDLINE_KERNEL_OPTIONS} ${CMDLINE_DEBUG} ${CMDLINE_CONSOLE}"
+
+CMDLINE = "${CMDLINE_ROOT} ${CMDLINE_DEBUG} ${CMDLINE_CONSOLE}"
 
 # Add the architecture compiler flags to KERNEL_CC and KERNEL_LD as
 # required.  Notice that this has to be done for each separately built
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
new file mode 100644 (file)
index 0000000..9114f3c
--- /dev/null
@@ -0,0 +1,87 @@
+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 <jbowler@acm.org>
+
+
+--- 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
new file mode 100644 (file)
index 0000000..bd766a3
--- /dev/null
@@ -0,0 +1,67 @@
+Include a fixup machine start function in nas100d-setup.c to handle
+the command line and memory setup parameters which are not specifiable
+in the boot loader.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/arch/arm/mach-ixp4xx/nas100d-setup.c  1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/arch/arm/mach-ixp4xx/nas100d-setup.c  1970-01-01 00:00:00.000000000 +0000
+@@ -17,6 +17,8 @@
+ #include <linux/serial_8250.h>
+ #include <linux/mtd/mtd.h>
++#include <asm/setup.h>
++#include <asm/memory.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/flash.h>
+@@ -164,12 +166,49 @@ static void __init nas100d_init(void)
+       platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
+ }
++/*
++ * NAS100D bootstrap may pass in parameters, but we zap the mem
++ * 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.
++ */
++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.
++       * NOTE: setting nr_banks != 0 causes kernel/setup.c to remove
++       * the mem tags from the tag list.  We need do nothing here!
++       */
++      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, nas100d_command_line, len);
++      memcpy(*cmdline + len, saved_command_line, COMMAND_LINE_SIZE - len);
++      *cmdline[COMMAND_LINE_SIZE-1] = 0;
++}
++
+ MACHINE_START(NAS100D, "Iomega NAS 100d")
+       /* Maintainer: www.nslu2-linux.org */
+       .phys_ram       = PHYS_OFFSET,
+       .phys_io        = IXP4XX_PERIPHERAL_BASE_PHYS,
+       .io_pg_offst    = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
+       .boot_params    = 0x00000100,
++      .fixup          = nas100d_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-nslu2-setup.patch b/packages/linux/ixp4xx-kernel/2.6.15/94-nslu2-setup.patch
new file mode 100644 (file)
index 0000000..0ed39d9
--- /dev/null
@@ -0,0 +1,71 @@
+Include a fixup machine start function in nslu2-setup.c to handle
+the command line and memory setup parameters which are not specifiable
+in the boot loader.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/arch/arm/mach-ixp4xx/nslu2-setup.c    1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/arch/arm/mach-ixp4xx/nslu2-setup.c    1970-01-01 00:00:00.000000000 +0000
+@@ -18,6 +18,8 @@
+ #include <linux/serial_8250.h>
+ #include <linux/mtd/mtd.h>
++#include <asm/setup.h>
++#include <asm/memory.h>
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+ #include <asm/mach/flash.h>
+@@ -165,12 +167,52 @@ 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...
++ */
++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!
++       */
++      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;
++}
++
+ MACHINE_START(NSLU2, "Linksys NSLU2")
+       /* Maintainer: www.nslu2-linux.org */
+       .phys_ram       = PHYS_OFFSET,
+       .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 */
++      .fixup          = nslu2_fixup,
+       .map_io         = ixp4xx_map_io,
+       .init_irq       = ixp4xx_init_irq,
+       .timer          = &ixp4xx_timer,
index 3516413..b4cde1b 100644 (file)
@@ -8,7 +8,7 @@ PR_CONFIG = "1"
 # Increment the number below (i.e. the digits after PR) when
 # making changes within this file or for changes to the patches
 # applied to the kernel.
-PR = "r7.${PR_CONFIG}"
+PR = "r8.${PR_CONFIG}"
 
 include ixp4xx-kernel.inc
 
@@ -37,3 +37,6 @@ IXP4XX_PATCHES += "file://91-maclist.patch;patch=1"
 IXP4XX_PATCHES += "file://92-nas100d-maclist.patch;patch=1"
 IXP4XX_PATCHES += "file://92-nslu2-maclist.patch;patch=1"
 IXP4XX_PATCHES += "file://93-loft-maclist.patch;patch=1"
+IXP4XX_PATCHES += "file://94-loft-setup.patch;patch=1"
+IXP4XX_PATCHES += "file://94-nas100d-setup.patch;patch=1"
+IXP4XX_PATCHES += "file://94-nslu2-setup.patch;patch=1"