summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/distro/ludeos-packages.conf1
-rw-r--r--conf/distro/ludeos.conf18
-rw-r--r--conf/machine/nas100d.conf149
-rw-r--r--packages/linux/nas100d-kernel.inc242
-rw-r--r--packages/linux/nas100d-kernel/.mtn2git_empty0
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/.mtn2git_empty0
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-copy-from.patch73
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-le.patch54
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/10-mtdpart-redboot-fis-byteswap.patch44
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/15-ixp4xx-writesb-l-w.patch31
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/18-ixp4xx-io-h-addr.patch287
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/28-spinlock-up.patch32
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/29-ipv4-route-c-spinlock.patch11
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/90-ixp4xx-pci-le.patch11
-rw-r--r--packages/linux/nas100d-kernel/2.6.14/defconfig1552
-rw-r--r--packages/linux/nas100d-kernel_2.6.14.bb38
-rw-r--r--packages/meta/ludeos-image.bb1
-rw-r--r--packages/meta/ludeos-packages.bb1
18 files changed, 2545 insertions, 0 deletions
diff --git a/conf/distro/ludeos-packages.conf b/conf/distro/ludeos-packages.conf
new file mode 100644
index 0000000000..477ae2e4dd
--- /dev/null
+++ b/conf/distro/ludeos-packages.conf
@@ -0,0 +1 @@
+include conf/distro/openslug-packages.conf
diff --git a/conf/distro/ludeos.conf b/conf/distro/ludeos.conf
new file mode 100644
index 0000000000..7014772740
--- /dev/null
+++ b/conf/distro/ludeos.conf
@@ -0,0 +1,18 @@
+#@TYPE: Distribution
+#@NAME: DeLude
+#@DESCRIPTION: LudeOS Linux Distribution for the Iomega NAS 100d
+
+DISTRO_NAME = "LudeOS"
+DISTRO_VERSION = "0.1-alpha"
+DISTRO_FEED = "unstable"
+DISTRO_TYPE = "beta"
+
+ARCH_BYTE_SEX = "be"
+ARM_INSTRUCTION_SET = "arm"
+TARGET_OS = "linux"
+
+FEED_URIS_append += "cross##http://ipkg.nslu2-linux.org/feeds/slugos-bag/cross/${DISTRO_FEED}"
+FEED_URIS_append += "native##http://ipkg.nslu2-linux.org/feeds/slugos-bag/native/${DISTRO_FEED}"
+
+PREFERRED_PROVIDER_virtual/kernel = "nas100d-kernel"
+include conf/distro/slugos.conf
diff --git a/conf/machine/nas100d.conf b/conf/machine/nas100d.conf
new file mode 100644
index 0000000000..aa37f0920d
--- /dev/null
+++ b/conf/machine/nas100d.conf
@@ -0,0 +1,149 @@
+#@TYPE: Machine
+#@NAME: Iomega NAS 100d
+#@DESCRIPTION: Machine configuration for the Iomega NAS 100d product
+
+#-------------------------------------------------------------------------------
+# INPUTS
+#-------------------------------------------------------------------------------
+# conf/${DISTRO}.conf is included after this file and should be used to modify
+# variables identified as 'INPUTS' to the required values for the DISTRO, this
+# will cause the board specific settings (which depend for the most part on the
+# exact CPU used) to be set correctly within this file. The results are the
+# variables identifies here as 'OUTPUTS'
+#
+#variable = "default"
+# <possible values>
+# description
+
+ARCH_BYTE_SEX = "be"
+# "be" "le"
+# The memory byte sex and (on correctly implemented hardware - the NAS100D is
+# correct) the byte sex of the buses within the system. 'be' (big-endian)
+# means that the first byte is the most significant byte on a bus, 'le'
+# (little-endian) means that the first byte is the least significant byte.
+
+ARM_INSTRUCTION_SET = "arm"
+# "arm" "thumb"
+# The instruction set the compiler should use when generating application
+# code. The kernel is always compiled with arm code at present. arm code
+# is the original 32 bit ARM instruction set, thumb code is the 16 bit
+# encoded RISC sub-set. Thumb code is smaller (maybe 70% of the ARM size)
+# but requires more instructions (140% for 70% smaller code) so may be
+# slower.
+
+THUMB_INTERWORK = "yes"
+# "yes" "no"
+# Whether to compile with code to allow interworking between the two
+# instruction sets. This allows thumb code to be executed on a primarily
+# arm system and vice versa. It is strongly recommended that DISTROs not
+# turn this off - the actual cost is very small.
+
+DISTRO_BASE = ""
+# "" ":<base>"
+# If given this must be the name of a 'distro' to add to the bitbake OVERRIDES
+# after ${DISTRO}, this allows different distros to share a common base of
+# overrides. The value given must include a leading ':' or chaos will result.
+
+#-------------------------------------------------------------------------------
+# OUTPUTS
+#-------------------------------------------------------------------------------
+
+#OVERRIDES
+# The standard ':' separated list of overrides used by bitbake - see the
+# basic setting in bitbake.conf. This list is based on that used for the
+# standard setting however :<base>, :thumb and :thumb-interwork will be
+# inserted at appropriate points if a base distro, default use of thumb or
+# arm/thumb interworking are enabled in the inputs.
+OVERRIDE_THUMB = "${@['', ':thumb'][bb.data.getVar('ARM_INSTRUCTION_SET', d, 1) == 'thumb']}"
+OVERRIDE_INTERWORK = "${@['', ':thumb-interwork'][bb.data.getVar('THUMB_INTERWORK', d, 1) == 'yes']}"
+OVERRIDES = "local:${MACHINE}:${DISTRO}${DISTRO_BASE}:${TARGET_OS}:${TARGET_ARCH}${OVERRIDE_THUMB}${OVERRIDE_INTERWORK}:build-${BUILD_OS}"
+
+# TARGET_CC_ARCH
+# TARGET_CC_KERNEL_ARCH
+# TARGET_LD_ARCH
+# TARGET_LD_KERNEL_ARCH
+# Compiler and linker options for application code and kernel code. These
+# options ensure that the compiler has the correct settings for the selected
+# instruction set and interworking.
+ARM_INTERWORK_M_OPT = "${@['-mno-thumb-interwork', '-mthumb-interwork'][bb.data.getVar('THUMB_INTERWORK', d, 1) == 'yes']}"
+ARM_THUMB_M_OPT = "${@['-mno-thumb', '-mthumb'][bb.data.getVar('ARM_INSTRUCTION_SET', d, 1) == 'thumb']}"
+#
+TARGET_CC_ARCH = "-march=armv5te -mtune=xscale ${ARM_INTERWORK_M_OPT} ${ARM_THUMB_M_OPT}"
+TARGET_CC_KERNEL_ARCH = "-march=armv5te -mtune=xscale -mno-thumb-interwork -mno-thumb"
+TARGET_LD_ARCH = ""
+TARGET_LD_KERNEL_ARCH = ""
+
+# FULL_OPTIMIZATION
+# Optimization settings. Os works fine and is significantly better than O2.
+# The other settings are somewhat arbitrary. The optimisations chosen here
+# include the ones which 'break' symbolic debugging (because the compiler does
+# not include enough information to allow the debugger to know where given
+# values are.) The -fno options are an attempt to cancel explicit use of space
+# consuming options found in some packages (this isn't a complete list, this is
+# just the ones which package writers seem to know about and abuse).
+FULL_OPTIMIZATION = "-Os -fomit-frame-pointer -frename-registers \
+ -fno-unroll-loops -fno-inline-functions \
+ -fweb -funit-at-a-time"
+
+# TARGET_ARCH
+# The correct setting for the system endianness (ARCH_BYTE_SEX). This will
+# be arm (le) or armeb (be) - it is difficult to be more precise in the
+# setting because of the large number of ways it is used within OpenEmbedded.
+TARGET_ARCH = "${@['armeb', 'arm'][bb.data.getVar('ARCH_BYTE_SEX', d, 1) == 'le']}"
+
+# PACKAGE_ARCH
+# The correct setting for the generated packages. This corresponds to the
+# -march flag passed to the compiler because that limits the architectures
+# on which the generated code will run.
+BYTE_SEX_CHAR = "${@['b', 'l'][bb.data.getVar('ARCH_BYTE_SEX', d, 1) == 'le']}"
+PACKAGE_ARCH_BASE = "${@['armv5te', 'thumbv5t'][bb.data.getVar('ARM_INSTRUCTION_SET', d, 1) == 'thumb']}"
+PACKAGE_ARCH = "${PACKAGE_ARCH_BASE}${BYTE_SEX_CHAR}"
+
+# IPKG_ARCHS
+# The full list of package architectures which should run on the system.
+# This takes into account both the board level issues and the INPUTS set
+# by the distro. The arm list is derived from the architecture settings
+# known to gcc, the thumb list is then derived from that (only the 't'
+# architectures of course).
+ARM_ARCHITECTURES = "${TARGET_ARCH} armv2${BYTE_SEX_CHAR} armv2a${BYTE_SEX_CHAR} armv3${BYTE_SEX_CHAR} armv3m${BYTE_SEX_CHAR} armv4${BYTE_SEX_CHAR} armv4t${BYTE_SEX_CHAR} armv5${BYTE_SEX_CHAR} armv5t${BYTE_SEX_CHAR} armv5e${BYTE_SEX_CHAR} armv5te${BYTE_SEX_CHAR} xscale${BYTE_SEX_CHAR}"
+THUMB_ARCHITECTURES = "thumbe${BYTE_SEX_CHAR} thumbv4t${BYTE_SEX_CHAR} thumbv5t${BYTE_SEX_CHAR}"
+
+# NOTE: this list contains just the things which rootfs_ipk.bbclass does
+# not add, rootfs_ipk.bbclass evaluates:
+#
+# ipkgarchs="all any noarch ${TARGET_ARCH} ${IPKG_ARCHS} ${MACHINE}"
+#
+# This is a priority ordered list - most desireable architecture at the end,
+# so put <ARM_INSTRUCTION_SET>_ARCHITECTURES at the end and, if
+# THUMB_INTERWORK precede this with the other architectures.
+IPKG_ARCHS = "${@(lambda arch_thumb, arch_arm, is_arm, interwork: \
+ (interwork and (is_arm and arch_thumb or arch_arm) + ' ' or '') \
+ + (is_arm and arch_arm or arch_thumb)) \
+ (bb.data.getVar('THUMB_ARCHITECTURES', d, 1), \
+ bb.data.getVar('ARM_ARCHITECTURES', d, 1), \
+ bb.data.getVar('ARM_INSTRUCTION_SET', d, 1) != 'thumb', \
+ bb.data.getVar('THUMB_INTERWORK', d, 1) == 'yes')}"
+
+#-------------------------------------------------------------------------------
+# Miscellany
+#-------------------------------------------------------------------------------
+# The correct settings for the NAS100D board:
+SERIAL_CONSOLE = "115200 ttyS0"
+KERNEL_CONSOLE = "ttyS0,115200n8"
+USE_VT = "0"
+
+#-------------------------------------------------------------------------------
+# Package versions
+#-------------------------------------------------------------------------------
+CVSDATE_gnu-config ?= "20050713"
+CVSDATE_gnu-config-native ?= "20050713"
+CVSDATE_ipkg-utils ?= "20050713"
+CVSDATE_ipkg-utils-native ?= "20050713"
+CVSDATE_ipkg-link ?= "20050713"
+CVSDATE_irssi ?= "20050930"
+
+CVS_TARBALL_STASH = "http://sources.nslu2-linux.org/sources/"
+INHERIT += "nslu2-mirrors"
+
+PREFERRED_VERSION_ipkg ?= "0.99.152"
+PREFERRED_VERSION_ipkg-native ?= "0.99.152"
diff --git a/packages/linux/nas100d-kernel.inc b/packages/linux/nas100d-kernel.inc
new file mode 100644
index 0000000000..0c97f3c08a
--- /dev/null
+++ b/packages/linux/nas100d-kernel.inc
@@ -0,0 +1,242 @@
+# nas100d-kernel.inc
+#
+# Standard definitions for any NAS 100d Linux kernel.
+# Include this file in a .bb which specifies, at least,
+# PN,PV,PR for the desired kernel
+#
+# Define the following *before* including this file as
+# required:
+#
+# N1K_FILES - kernel-tree path of files to install
+# N1K_PATCHES - full list of patches to apply
+#
+# N1K_SUFFIX - the suffix to add after 'zImage-' in the
+# deploy/images directory - defaults to "ludeos"
+#
+# --------------------------------------------------------------
+#
+# Within this file bitbake variables local to the file are
+# named N1K_FOO
+#
+SECTION = "kernel"
+DESCRIPTION = "Linux kernel for the Iomega NAS 100d device"
+LICENSE = "GPL"
+MAINTAINER = "John Bowler <jbowler@acm.org>"
+
+DEPENDS += "devio-native"
+
+# Linux kernel source has the general form linux-X.Y.Z-patchP,
+# X.Y is the major version number, Z (which may have multiple
+# parts) is a sub-version and 'patch' is something like 'mm' or
+# 'ac' with a patch version. The original bz2 archive will be
+# in a directory/file vX.Y/linux-X.Y.Z.tar.bz2. The unpacked
+# source will be in the directory linux-X.Y.Z and this directory
+# name corresponds to the module directory (in /lib/modules).
+#
+# The corresponding .bb file should be called:
+#
+# package_X.Y.Z-patchP
+#
+# Giving PN=package PV=X.Y.Z-patchP (and PR is set in the .bb
+# file). Files, including the all important defconfig, are
+# searched for in the following directories (last one first):
+#
+# ludeos-kernel-2.6.11.2
+# nas100d-kernel/files
+# nas100d-kernel/X.Y
+# nas100d-kernel/X.Y.Z
+# nas100d-kernel/X.Y.Z-patch
+# nas100d-kernel/X.Y.Z-patchP
+# package-X.Y.Z-patchP
+#
+# This allows sharing of patch files and other useful source!
+# To share a file or patch with an earlier version put it in
+# the shared directory - e.g. to use foo.patch on 2.6.11.2 and
+# 2.6.11.4 it should be in directory nas100d-kernel/2.6.11.
+#
+# Note that when there are multiple patches the X.Y.Z-patch form
+# uses base-patch (e.g. 2.6.12-mm) whereas X.Y.Z-patchP has the
+# full form, for example 2.6.12-rc3-mm1 (in the same case).
+
+#PN=package-name
+#PV=package-version (full)
+
+# The patch has the general form (rcN|preN|acN|mmN|bkN)* with the
+# separate patch items being separated by '-' characters. The
+# rc patch is first and has the important property that it
+# requires the *preceding* kernel base version and that this
+# will be the source directory name.
+python () {
+ # The patches list may be empty. This code starts with the base
+ # kernel version and steps through the patches. Because the rc and
+ # pre patches actually require the *preceding* kernel version the code
+ # fixes that up appropriately.
+ pv = bb.data.getVar("PV",d,1).split('-')
+ kernel = pv[0].split('.')
+ base = pv[0]
+ name = [base]
+ major = '.'.join(name[0].split('.')[0:2])
+ minor = '.'.join(name[0].split('.')[0:3])
+ patch_uri = [ None ]
+ filedir = "${FILE_DIRNAME}/nas100d-kernel/%s"
+ # This entry will become the last one (everything is inserted before it)
+ filepath = [ filedir % "files" ]
+ for patch in pv[1:]:
+ name.append(patch)
+ pname = '-'.join(name)
+ filepath[0:0] = [ filedir % pname ]
+ base = pname
+
+ base = '.'.join(kernel)
+ patch_uri[0] = "ftp://ftp.kernel.org/pub/linux/kernel/v%s/linux-%s.tar.bz2" % (major, base)
+ filepath[-1:-1] = [ filedir % base ]
+ if base != minor:
+ filepath[-1:-1] = [ filedir % minor ]
+ filepath[-1:-1] = [ filedir % major ]
+
+ bb.data.setVar("N1K_SRCMAJ", major, d)
+ # bb.note("N1K_SRCMAJ := %s" % major)
+ bb.data.setVar("N1K_SRCVER", base, d)
+ # bb.note("N1K_SRCVER := %s" % base)
+ bb.data.setVar("N1K_SRCURI", ' '.join(patch_uri), d)
+ # bb.note("N1K_SRCURI := %s" % ' '.join(patch_uri))
+ bb.data.setVar("N1K_FILESPATH", ':'.join(filepath), d)
+ # bb.note("N1K_FILESPATH := %s" % ' '.join(filepath))
+ bb.data.setVar("DEFAULT_PREFERENCE", pref-mmac, d)
+}
+
+# FILESPATH: this list is in order last-searched-first, therefore
+# the first entry is the *latest* and/or most specific
+FILESPATH = "${N1K_FILESPATH}:${FILE_DIRNAME}/nas100d-kernel/"
+
+# The working directory will be the 'base' version (which may not be the
+# same as implied by the PV variable because it corresponds to the prior
+# minor version for rc and pre patched versions).
+S = "${WORKDIR}/linux-${N1K_SRCVER}"
+
+# N1K_FILES is a list of additional files added to the source, these are
+# put in place before the patches, so may themselves be patched. The list
+# gives the path name relative to the base of the kernel source tree, the
+# base file name is used to *find* the file.
+N1K_FILES ?= ""
+
+N1K_SRCFILES = "${@( ' '.join([ ("file://" + n2k_file.split('/')[-1]) for n2k_file in bb.data.getVar("N1K_FILES",d,1).split(None) ]) )}"
+
+# N1K_PATCHES is a list of additional patches, the list specified
+# here comes from the ludeos-2.6.11.2 kernel, typically extra
+# patches will be required and very often patches will need to
+# be removed (i.e. the default is typically not very useful!)
+N1K_PATCHES ?= ""
+
+N1K_SUFFIX ?= "ludeos"
+
+SRC_URI = "${N1K_SRCURI}"
+SRC_URI += "${N1K_SRCFILES}"
+SRC_URI += "${N1K_PATCHES}"
+SRC_URI += "file://defconfig"
+
+COMPATIBLE_HOST = 'arm.*-linux'
+
+inherit kernel
+
+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.
+CMDLINE_KERNEL_OPTIONS ?= "reboot=s"
+CMDLINE_ROOT ?= "root=/dev/mtdblock4 rw rootfstype=jffs2 mem=32M@0x00000000 init=/linuxrc"
+# Add distro specific debug (or non-debug) options to this
+CMDLINE_DEBUG ?= ""
+CMDLINE = "${CMDLINE_ROOT} ${CMDLINE_KERNEL_OPTIONS} ${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
+# module as well!
+KERNEL_CC += "${TARGET_CC_KERNEL_ARCH}"
+KERNEL_LD += "${TARGET_LD_KERNEL_ARCH}"
+
+# Set EXTRAVERSION and LOCALVERSION to "" so that the kernel version
+# remains pinned to the x.y.z form, also turn off the directory
+# printing which provides almost all the output of an incremental build.
+EXTRA_OEMAKE += "EXTRAVERSION="
+EXTRA_OEMAKE += "LOCALVERSION="
+EXTRA_OEMAKE += "MAKEFLAGS='--no-print-directory'"
+
+# By putting the added files in place in a separate task before
+# do_patch it becomes possible to patch these files.
+do_unpacklocal() {
+ for f in ${N1K_FILES}
+ do
+ s="$(basename "$f")"
+ install -m 0644 "${WORKDIR}/$s" "${S}/$f"
+ done
+}
+
+addtask unpacklocal before do_patch after do_unpack
+
+do_configure_prepend() {
+ install -m 0644 ${WORKDIR}/defconfig ${S}/.config
+ if test '${ARCH_BYTE_SEX}' = le
+ then
+ sed -i '/CONFIG_CPU_BIG_ENDIAN/d' '${S}/.config'
+ else
+ echo 'CONFIG_CPU_BIG_ENDIAN=y' >>'${S}/.config'
+ fi
+ echo "CONFIG_CMDLINE=\"${CMDLINE}\"" >> ${S}/.config
+ rm -rf ${S}/include/asm-arm/arch ${S}/include/asm-arm/proc \
+ ${S}/include/asm-arm/.proc ${S}/include/asm-arm/.arch
+}
+
+# This function adds the required prefix to the image to deal with two
+# problems:
+#
+# 1) The machine type set by RedBoot is wrong - the type for an ixdp425, not an NAS 100d
+# e3a01c02 e3811055
+# 2) For LE kernels it is necessary to prefix change-to-le code to the kernel image:
+# ee110f10 e3c00080 ee010f10
+# and to byte swap the (LE) image to match the BE flash layout
+#
+# The argument to the function is the destination directory
+redboot_fixup_armeb() {
+ rm -f "$1".new
+ devio '<<arch/${ARCH}/boot/${KERNEL_IMAGETYPE}' >"$1".new \
+ 'wb 0xe3a01c02,4' \
+ 'wb 0xe3811055,4' \
+ 'cp$'
+ mv "$1".new "$1"
+}
+
+redboot_fixup_arm() {
+ rm -f "$1".new
+ devio '<<arch/${ARCH}/boot/${KERNEL_IMAGETYPE}' >"$1".new \
+ 'wb 0xe3a01c02,4' \
+ 'wb 0xe3811055,4' \
+ 'wb 0xee110f10,4' \
+ 'wb 0xe3c00080,4' \
+ 'wb 0xee010f10,4' \
+ 'xp $,4' || {
+ echo 'ERROR: arch/${ARCH}/boot/${KERNEL_IMAGETYPE}: failed to byteswap zImage' >&2
+ return 1
+ }
+ mv "$1".new "$1"
+}
+
+do_install_append() {
+ redboot_fixup '${STAGING_KERNEL_DIR}/${KERNEL_IMAGETYPE}'
+}
+
+do_deploy[dirs] = "${S}"
+do_deploy() {
+ install -d ${DEPLOY_DIR}/images
+ redboot_fixup '${DEPLOY_DIR}/images/${KERNEL_IMAGETYPE}-${N1K_SUFFIX}'
+}
+
+addtask deploy before do_build after do_compile
+
+python () {
+ # Don't build the kernel unless we're targeting an nas100d
+ mach = bb.data.getVar("MACHINE", d, 1)
+ if mach != 'nas100d':
+ raise bb.parse.SkipPackage("LudeOS only builds for the Iomega NAS 100d")
+}
diff --git a/packages/linux/nas100d-kernel/.mtn2git_empty b/packages/linux/nas100d-kernel/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/linux/nas100d-kernel/.mtn2git_empty
diff --git a/packages/linux/nas100d-kernel/2.6.14/.mtn2git_empty b/packages/linux/nas100d-kernel/2.6.14/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/.mtn2git_empty
diff --git a/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-copy-from.patch b/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-copy-from.patch
new file mode 100644
index 0000000000..f3da2e093f
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-copy-from.patch
@@ -0,0 +1,73 @@
+--- linux-2.6.14/drivers/mtd/maps/ixp4xx.c 2005-10-27 17:02:08.000000000 -0700
++++ linux-2.6.14/drivers/mtd/maps/ixp4xx.c 2005-10-29 23:11:24.990820968 -0700
+@@ -38,10 +38,14 @@
+ #define BYTE1(h) ((h) & 0xFF)
+ #endif
+
++#define FLASHWORD(a) (*(__u16*)(a))
++#define FLASHVAL(a) FLASHWORD(a)
++#define FLASHSET(a,v) do { FLASHWORD(a) = (v); } while (0)
++
+ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
+ {
+ map_word val;
+- val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
++ val.x[0] = FLASHVAL(map->map_priv_1 + ofs);
+ return val;
+ }
+
+@@ -53,19 +57,25 @@ static map_word ixp4xx_read16(struct map
+ static void ixp4xx_copy_from(struct map_info *map, void *to,
+ unsigned long from, ssize_t len)
+ {
+- int i;
+- u8 *dest = (u8 *) to;
+- u16 *src = (u16 *) (map->map_priv_1 + from);
+- u16 data;
+-
+- for (i = 0; i < (len / 2); i++) {
+- data = src[i];
+- dest[i * 2] = BYTE0(data);
+- dest[i * 2 + 1] = BYTE1(data);
++ u8 *dest, *src;
++
++ if (len <= 0)
++ return;
++
++ dest = (u8 *) to;
++ src = (u8 *) (map->map_priv_1 + from);
++ if (from & 1)
++ *dest++ = BYTE1(FLASHVAL(src-1)), ++src, --len;
++
++ while (len >= 2) {
++ u16 data = FLASHVAL(src); src += 2;
++ *dest++ = BYTE0(data);
++ *dest++ = BYTE1(data);
++ len -= 2;
+ }
+
+- if (len & 1)
+- dest[len - 1] = BYTE0(src[i]);
++ if (len > 0)
++ *dest++ = BYTE0(FLASHVAL(src));
+ }
+
+ /*
+@@ -75,7 +85,7 @@ static void ixp4xx_copy_from(struct map_
+ static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
+ {
+ if (!(adr & 1))
+- *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
++ FLASHSET(map->map_priv_1 + adr, d.x[0]);
+ }
+
+ /*
+@@ -83,7 +93,7 @@ static void ixp4xx_probe_write16(struct
+ */
+ static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
+ {
+- *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
++ FLASHSET(map->map_priv_1 + adr, d.x[0]);
+ }
+
+ struct ixp4xx_flash_info {
diff --git a/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-le.patch b/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-le.patch
new file mode 100644
index 0000000000..0b50e4e1a0
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/10-ixp4xx-le.patch
@@ -0,0 +1,54 @@
+--- linux-2.6.14/drivers/mtd/maps/ixp4xx.c 2005-10-27 17:02:08.000000000 -0700
++++ linux-2.6.14/drivers/mtd/maps/ixp4xx.c 2005-10-29 23:11:24.990820968 -0700
+@@ -22,6 +22,7 @@
+ #include <linux/string.h>
+ #include <linux/mtd/mtd.h>
+ #include <linux/mtd/map.h>
++#include <linux/mtd/cfi_endian.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/ioport.h>
+ #include <linux/device.h>
+@@ -30,17 +31,40 @@
+
+ #include <linux/reboot.h>
+
++/* On a little-endian IXP4XX system (tested on NSLU2) an LDRH or STRH
++ * will flip the second address bit - i.e. XOR the address with 10b.
++ * This causes the cfi commands (sent to the command address, 0xAA for
++ * 16 bit flash) to fail. This is fixed here by XOR'ing the address
++ * before use with 10b. The cost of this is that the flash layout ends
++ * up with pdp-endiannes (on an LE system), however this is not a problem
++ * as the access code consistently only accesses half words - so the
++ * endianness is not determinable on stuff which is written and read
++ * consistently in the little endian world.
++ *
++ * For flash data from the big-endian world, however, the results are
++ * weird - the pdp-endianness results in the data apparently being
++ * 2-byte swapped (as in dd conv=swab). To work round this the 16
++ * bit values are written and read using cpu_to_cfi16 and cfi16_to_cpu,
++ * by default these are no-ops, but if the MTD driver is configed with
++ * CONFIG_MTD_CFI_BE_BYTE_SWAP the macros will byte swap the data,
++ * resulting in a consistently BE view of the flash on both BE (no
++ * op) and LE systems. This config setting also causes the command
++ * data from the CFI implementation to get swapped - as is required
++ * so that this code will *unswap* it and give the correct command
++ * data to the flash.
++ */
+ #ifndef __ARMEB__
+ #define BYTE0(h) ((h) & 0xFF)
+ #define BYTE1(h) (((h) >> 8) & 0xFF)
++#define FLASHWORD(a) (*(__u16*)((u32)(a) ^ 2))
+ #else
+ #define BYTE0(h) (((h) >> 8) & 0xFF)
+ #define BYTE1(h) ((h) & 0xFF)
++#define FLASHWORD(a) (*(__u16*)(a))
+ #endif
+
+-#define FLASHWORD(a) (*(__u16*)(a))
+-#define FLASHVAL(a) FLASHWORD(a)
+-#define FLASHSET(a,v) do { FLASHWORD(a) = (v); } while (0)
++#define FLASHVAL(a) cfi16_to_cpu(FLASHWORD(a))
++#define FLASHSET(a,v) (FLASHWORD(a) = cpu_to_cfi16(v))
+
+ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
+ {
diff --git a/packages/linux/nas100d-kernel/2.6.14/10-mtdpart-redboot-fis-byteswap.patch b/packages/linux/nas100d-kernel/2.6.14/10-mtdpart-redboot-fis-byteswap.patch
new file mode 100644
index 0000000000..37d19bd1b0
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/10-mtdpart-redboot-fis-byteswap.patch
@@ -0,0 +1,44 @@
+On IXP4XX systems the FIS directory is big endian even with a little
+endian kernel. This patch recognises the FIS directory on such a
+system and byte swaps it to obtain a valid table based on the 'size'
+field of the FIS directory (the size field is know to always match the
+erase block size on such systems, and probably all systems.)
+
+--- linux-2.6.13/.pc/10-mtdpart-redboot-fis-byteswap.patch/drivers/mtd/redboot.c 2005-08-28 16:41:01.000000000 -0700
++++ linux-2.6.13/drivers/mtd/redboot.c 2005-10-23 21:44:59.999694674 -0700
+@@ -89,8 +89,34 @@
+ i = numslots;
+ break;
+ }
+- if (!memcmp(buf[i].name, "FIS directory", 14))
++ if (!memcmp(buf[i].name, "FIS directory", 14)) {
++ /* This is apparently the FIS directory entry for the
++ * FIS directory itself. The FIS directory size is
++ * one erase block, if the buf[i].size field is
++ * swab32(erasesize) then we know we are looking at
++ * a byte swapped FIS directory - swap all the entries!
++ * (NOTE: this is 'size' not 'data_length', size is
++ * the full size of the entry.)
++ */
++ if (swab32(buf[i].size) == master->erasesize) {
++ int j;
++ for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
++ /* The unsigned long fields were written with the
++ * wrong byte sex, name and pad have no byte sex.
++ */
++# define do_swab32(x) (x) = swab32(x)
++ do_swab32(buf[j].flash_base);
++ do_swab32(buf[j].mem_base);
++ do_swab32(buf[j].size);
++ do_swab32(buf[j].entry_point);
++ do_swab32(buf[j].data_length);
++ do_swab32(buf[j].desc_cksum);
++ do_swab32(buf[j].file_cksum);
++# undef do_swab32
++ }
++ }
+ break;
++ }
+ }
+ if (i == numslots) {
+ /* Didn't find it */
diff --git a/packages/linux/nas100d-kernel/2.6.14/15-ixp4xx-writesb-l-w.patch b/packages/linux/nas100d-kernel/2.6.14/15-ixp4xx-writesb-l-w.patch
new file mode 100644
index 0000000000..6ac0807f1e
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/15-ixp4xx-writesb-l-w.patch
@@ -0,0 +1,31 @@
+# The inline caller of these APIs were changed to have
+# const vaddr parameters...
+--- linux-2.6.13/include/asm-arm/arch-ixp4xx/io.h.orig 2005-09-24 17:06:19.968099976 -0700
++++ linux-2.6.13/include/asm-arm/arch-ixp4xx/io.h 2005-09-24 17:06:52.542149731 -0700
+@@ -113,7 +113,7 @@
+ }
+
+ static inline void
+-__ixp4xx_writesb(u32 bus_addr, u8 *vaddr, int count)
++__ixp4xx_writesb(u32 bus_addr, const u8 *vaddr, int count)
+ {
+ while (count--)
+ writeb(*vaddr++, bus_addr);
+@@ -136,7 +136,7 @@
+ }
+
+ static inline void
+-__ixp4xx_writesw(u32 bus_addr, u16 *vaddr, int count)
++__ixp4xx_writesw(u32 bus_addr, const u16 *vaddr, int count)
+ {
+ while (count--)
+ writew(*vaddr++, bus_addr);
+@@ -154,7 +154,7 @@
+ }
+
+ static inline void
+-__ixp4xx_writesl(u32 bus_addr, u32 *vaddr, int count)
++__ixp4xx_writesl(u32 bus_addr, const u32 *vaddr, int count)
+ {
+ while (count--)
+ writel(*vaddr++, bus_addr);
diff --git a/packages/linux/nas100d-kernel/2.6.14/18-ixp4xx-io-h-addr.patch b/packages/linux/nas100d-kernel/2.6.14/18-ixp4xx-io-h-addr.patch
new file mode 100644
index 0000000000..5813bbb7ac
--- /dev/null
+++ b/packages/linux/nas100d-kernel/2.6.14/18-ixp4xx-io-h-addr.patch
@@ -0,0 +1,287 @@
+--- linux-2.6.14/include/asm-arm/arch-ixp4xx/io.h 2005-10-29 23:33:21.757679882 -0700
++++ linux-2.6.14/include/asm-arm/arch-ixp4xx/io.h 2005-10-29 23:47:02.581331058 -0700
+@@ -80,9 +80,9 @@ __ixp4xx_iounmap(void __iomem *addr)
+ #define __arch_ioremap(a, s, f, x) __ixp4xx_ioremap(a, s, f, x)
+ #define __arch_iounmap(a) __ixp4xx_iounmap(a)
+
+-#define writeb(p, v) __ixp4xx_writeb(p, v)
+-#define writew(p, v) __ixp4xx_writew(p, v)
+-#define writel(p, v) __ixp4xx_writel(p, v)
++#define writeb(v, p) __ixp4xx_writeb(v, p)
++#define writew(v, p) __ixp4xx_writew(v, p)
++#define writel(v, p) __ixp4xx_writel(v, p)
+
+ #define writesb(p, v, l) __ixp4xx_writesb(p, v, l)
+ #define writesw(p, v, l) __ixp4xx_writesw(p, v, l)
+@@ -97,8 +97,9 @@ __ixp4xx_iounmap(void __iomem *addr)
+ #define readsl(p, v, l) __ixp4xx_readsl(p, v, l)
+
+ static inline void
+-__ixp4xx_writeb(u8 value, u32 addr)
++__ixp4xx_writeb(u8 value, volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ u32 n, byte_enables, data;
+
+ if (addr >= VMALLOC_START) {
+@@ -113,15 +114,16 @@ __ixp4xx_writeb(u8 value, u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_writesb(u32 bus_addr, const u8 *vaddr, int count)
++__ixp4xx_writesb(volatile void __iomem *bus_addr, const u8 *vaddr, int count)
+ {
+ while (count--)
+ writeb(*vaddr++, bus_addr);
+ }
+
+ static inline void
+-__ixp4xx_writew(u16 value, u32 addr)
++__ixp4xx_writew(u16 value, volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ u32 n, byte_enables, data;
+
+ if (addr >= VMALLOC_START) {
+@@ -136,15 +138,16 @@ __ixp4xx_writew(u16 value, u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_writesw(u32 bus_addr, const u16 *vaddr, int count)
++__ixp4xx_writesw(volatile void __iomem *bus_addr, const u16 *vaddr, int count)
+ {
+ while (count--)
+ writew(*vaddr++, bus_addr);
+ }
+
+ static inline void
+-__ixp4xx_writel(u32 value, u32 addr)
++__ixp4xx_writel(u32 value, volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ if (addr >= VMALLOC_START) {
+ __raw_writel(value, addr);
+ return;
+@@ -154,15 +157,16 @@ __ixp4xx_writel(u32 value, u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_writesl(u32 bus_addr, const u32 *vaddr, int count)
++__ixp4xx_writesl(volatile void __iomem *bus_addr, const u32 *vaddr, int count)
+ {
+ while (count--)
+ writel(*vaddr++, bus_addr);
+ }
+
+ static inline unsigned char
+-__ixp4xx_readb(u32 addr)
++__ixp4xx_readb(const volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ u32 n, byte_enables, data;
+
+ if (addr >= VMALLOC_START)
+@@ -177,15 +181,16 @@ __ixp4xx_readb(u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_readsb(u32 bus_addr, u8 *vaddr, u32 count)
++__ixp4xx_readsb(const volatile void __iomem *bus_addr, u8 *vaddr, u32 count)
+ {
+ while (count--)
+ *vaddr++ = readb(bus_addr);
+ }
+
+ static inline unsigned short
+-__ixp4xx_readw(u32 addr)
++__ixp4xx_readw(const volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ u32 n, byte_enables, data;
+
+ if (addr >= VMALLOC_START)
+@@ -200,15 +205,16 @@ __ixp4xx_readw(u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_readsw(u32 bus_addr, u16 *vaddr, u32 count)
++__ixp4xx_readsw(const volatile void __iomem *bus_addr, u16 *vaddr, u32 count)
+ {
+ while (count--)
+ *vaddr++ = readw(bus_addr);
+ }
+
+ static inline unsigned long
+-__ixp4xx_readl(u32 addr)
++__ixp4xx_readl(const volatile void __iomem *p)
+ {
++ u32 addr = (u32)p;
+ u32 data;
+
+ if (addr >= VMALLOC_START)
+@@ -221,7 +227,7 @@ __ixp4xx_readl(u32 addr)
+ }
+
+ static inline void
+-__ixp4xx_readsl(u32 bus_addr, u32 *vaddr, u32 count)
++__ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
+ {
+ while (count--)
+ *vaddr++ = readl(bus_addr);
+@@ -239,7 +245,7 @@ __ixp4xx_readsl(u32 bus_addr, u32 *vaddr
+ eth_copy_and_sum((s),__mem_pci(c),(l),(b))
+
+ static inline int
+-check_signature(unsigned long bus_addr, const unsigned char *signature,
++check_signature(const unsigned char __iomem *bus_addr, const unsigned char *signature,
+ int length)
+ {
+ int retval = 0;
+@@ -389,7 +395,7 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u
+ #define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \
+ ((unsigned long)p <= (PIO_MASK + PIO_OFFSET)))
+ static inline unsigned int
+-__ixp4xx_ioread8(void __iomem *addr)
++__ixp4xx_ioread8(const void __iomem *addr)
+ {
+ unsigned long port = (unsigned long __force)addr;
+ if (__is_io_address(port))
+@@ -398,12 +404,12 @@ __ixp4xx_ioread8(void __iomem *addr)
+ #ifndef CONFIG_IXP4XX_INDIRECT_PCI
+ return (unsigned int)__raw_readb(port);
+ #else
+- return (unsigned int)__ixp4xx_readb(port);
++ return (unsigned int)__ixp4xx_readb(addr);
+ #endif
+ }
+
+ static inline void
+-__ixp4xx_ioread8_rep(void __iomem *addr, void *vaddr, u32 count)
++__ixp4xx_ioread8_rep(const void __iomem *addr, void *vaddr, u32 count)
+ {
+ unsigned long port = (unsigned long __force)addr;
+ if (__is_io_address(port))
+@@ -412,12 +418,12 @@ __ixp4xx_ioread8_rep(void __iomem *addr,
+ #ifndef CONFIG_IXP4XX_INDIRECT_PCI
+ __raw_readsb(addr, vaddr, count);
+ #else
+- __ixp4xx_readsb(port, vaddr, count);
++ __ixp4xx_readsb(addr, vaddr, count);
+ #endif