nslu2-kernel: postprocess the kernel image to set mach-type, support le
authorJohn Bowler <jbowler@nslu2-linux.org>
Wed, 5 Oct 2005 18:11:49 +0000 (18:11 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Wed, 5 Oct 2005 18:11:49 +0000 (18:11 +0000)
The mach-type is now set by instructions appended to the kernel image,
in 2.6.14 kernels the mach-type patch has been removed.  le support is
added by adding the appropriate switch-to-le instructions too (LE support
is incomplete because the flash read patch is not in.)

packages/linux/nslu2-kernel.inc
packages/linux/nslu2-kernel/2.6.14/50-nslu2-arch.patch
packages/linux/nslu2-kernel_2.6.14-rc2.bb
packages/linux/nslu2-kernel_2.6.14-rc3.bb
packages/linux/openslug-kernel-2.6.14-rc3/defconfig

index 695268e..d55d05f 100644 (file)
@@ -54,6 +54,8 @@ DESCRIPTION = "Linux kernel for the Linksys NSLU2 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
@@ -240,15 +242,55 @@ addtask unpacklocal before do_patch after do_unpack
 
 do_configure_prepend() {
        install -m 0644 ${WORKDIR}/defconfig ${S}/.config
+       if test '${NSLU2_ARCH_TYPE}' = l
+       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 NSLU2
+#    e3a01c02 e3811055
+# 2) For LE kernels it is necessary to prefix change-to-le code to the kernel image:
+#    ee110f10 e3c00080 ee010f10
+#
+# 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 \
+               'wl 0xe3a01c02,4' \
+               'wl 0xe3811055,4' \
+               'wl 0xee110f10,4' \
+               'wl 0xe3c00080,4' \
+               'wl 0xee010f10,4' \
+               'cp$'
+       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
-        install -m 0644 arch/${ARCH}/boot/${KERNEL_IMAGETYPE} ${DEPLOY_DIR}/images/${KERNEL_IMAGETYPE}-${N2K_SUFFIX}
+       redboot_fixup '${DEPLOY_DIR}/images/${KERNEL_IMAGETYPE}-${N2K_SUFFIX}'
 }
 
 addtask deploy before do_build after do_compile
index de9499f..33d91aa 100644 (file)
@@ -8,17 +8,6 @@
      defined(CONFIG_ARCH_IXP2000) || \
      defined(CONFIG_ARCH_LH7A40X) || \
      defined(CONFIG_ARCH_OMAP)
---- linux-2.6.11/.pc/2.6.patch/arch/arm/boot/compressed/head-xscale.S  2005-03-01 23:37:52.000000000 -0800
-+++ linux-2.6.11/arch/arm/boot/compressed/head-xscale.S        2005-06-17 17:51:32.546985425 -0700
-@@ -47,3 +47,8 @@
-                orr     r7, r7, #(MACH_TYPE_GTWX5715 & 0xff00)
- #endif
-+#ifdef CONFIG_MACH_NSLU2
-+               mov     r7, #(MACH_TYPE_NSLU2 & 0xff)
-+               orr     r7, r7, #(MACH_TYPE_NSLU2 & 0xff00)
-+#endif
-+
 --- linux-2.6.11/.pc/2.6.patch/arch/arm/mach-ixp4xx/Kconfig    2005-06-17 17:51:27.365770810 -0700
 +++ linux-2.6.11/arch/arm/mach-ixp4xx/Kconfig  2005-06-17 17:51:32.560983303 -0700
 @@ -43,6 +43,12 @@
index 0e70b1e..e843fcf 100644 (file)
@@ -8,7 +8,7 @@ PR_CONFIG = "0"
 # 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 = "r5.${PR_CONFIG}"
+PR = "r6.${PR_CONFIG}"
 
 include nslu2-kernel.inc
 
@@ -43,4 +43,4 @@ N2K_PATCHES = "\
 # specific to the bootstrap of *this* kernel in here - DISTRO specfic
 # config must be in CMDLINE_ROOT (see the full definition of CMDLINE
 # in nslu2-kernel.inc)
-CMDLINE_KERNEL_OPTIONS = ""
+CMDLINE_KERNEL_OPTIONS = "x1205.hctosys=1"
index e6ec498..70962de 100644 (file)
@@ -8,7 +8,7 @@ PR_CONFIG = "0"
 # 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 = "r0.${PR_CONFIG}"
+PR = "r1.${PR_CONFIG}"
 
 include nslu2-kernel.inc
 
@@ -33,7 +33,6 @@ N2K_PATCHES = "\
        file://50-nslu2-arch.patch;patch=1 \
        file://50-nslu2-beeper.patch;patch=1 \
        file://50-nslu2-general.patch;patch=1 \
-       file://90-arm-le.patch;patch=1 \
        file://90-ixp4xx-pci-le.patch;patch=1 \
        file://anonymiser.patch;patch=1 \
 "
@@ -42,4 +41,4 @@ N2K_PATCHES = "\
 # specific to the bootstrap of *this* kernel in here - DISTRO specfic
 # config must be in CMDLINE_ROOT (see the full definition of CMDLINE
 # in nslu2-kernel.inc)
-CMDLINE_KERNEL_OPTIONS = ""
+CMDLINE_KERNEL_OPTIONS = "x1205.hctosys=1"
index 4225342..405a2f4 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.14-rc2
-# Sat Sep 24 16:19:17 2005
+# Linux kernel version: 2.6.14-rc3
+# Tue Oct  4 23:19:43 2005
 #
 CONFIG_ARM=y
 CONFIG_MMU=y
@@ -278,6 +278,7 @@ CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_LOG=m
 CONFIG_IP_NF_TARGET_ULOG=m
 CONFIG_IP_NF_TARGET_TCPMSS=m
+# CONFIG_IP_NF_TARGET_NFQUEUE is not set
 CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -304,6 +305,7 @@ CONFIG_IP_NF_TARGET_CLASSIFY=m
 #
 # CONFIG_IP6_NF_QUEUE is not set
 # CONFIG_IP6_NF_IPTABLES is not set
+# CONFIG_IP6_NF_TARGET_NFQUEUE is not set
 
 #
 # Bridge: Netfilter Configuration
@@ -602,6 +604,7 @@ CONFIG_BLK_DEV_DM=m
 # CONFIG_FUSION is not set
 # CONFIG_FUSION_SPI is not set
 # CONFIG_FUSION_FC is not set
+# CONFIG_FUSION_SAS is not set
 
 #
 # IEEE 1394 (FireWire) support
@@ -639,6 +642,7 @@ CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
+# CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set