* Marc Singer <[EMAIL PROTECTED]> [2008-05-18 14:01]:
> Let me see if I understand.  You want 1.4.15 with Kevin's patch and
> nothing else?

I believe Kevin's patch contains some changes we don't need.

I think this one is what we want:

--- apex-1.4.xx.orig/debian/rules
+++ apex-1.4.xx/debian/rules
@@ -58,6 +58,7 @@
        install -m 0644 src/arch-arm/rom/apex.bin\
                  debian/$(package)/boot/apex.flash
        install -m 0755 usr/apex-env debian/$(package)/usr/sbin
+       install -m 0755 usr/flash-apex debian/$(package)/usr/sbin
        dh_strip
        dh_installchangelogs ChangeLog
        dh_installdocs -a
--- apex-1.4.xx.orig/debian/postinst
+++ apex-1.4.xx/debian/postinst
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = configure ]; then
+       flash-apex
+fi
--- apex-1.4.xx.orig/src/mach-ixp42x/debian-nslu2-arm_config
+++ apex-1.4.xx/src/mach-ixp42x/debian-nslu2-arm_config
@@ -48,7 +48,7 @@
 CONFIG_NOR_BANK0_START=0x50000000
 CONFIG_NOR_BANK0_LENGTH=0x00800000
 CONFIG_MACH="ixp42x"
-CONFIG_RAMDISK_SIZE=0x00400000
+CONFIG_RAMDISK_SIZE=0x005FFFF0
 CONFIG_MACH_NSLU2=y
 # CONFIG_MACH_NAS100D is not set
 # CONFIG_MACH_DSMG600 is not set
--- apex-1.4.xx.orig/src/mach-ixp42x/debian-nslu2-armeb_config
+++ apex-1.4.xx/src/mach-ixp42x/debian-nslu2-armeb_config
@@ -48,7 +48,7 @@
 CONFIG_NOR_BANK0_START=0x50000000
 CONFIG_NOR_BANK0_LENGTH=0x00800000
 CONFIG_MACH="ixp42x"
-CONFIG_RAMDISK_SIZE=0x00400000
+CONFIG_RAMDISK_SIZE=0x005FFFF0
 CONFIG_MACH_NSLU2=y
 # CONFIG_MACH_NAS100D is not set
 # CONFIG_MACH_DSMG600 is not set
--- apex-1.4.xx.orig/usr/flash-apex
+++ apex-1.4.xx/usr/flash-apex
@@ -0,0 +1,92 @@
+#!/bin/sh
+
+# Copyright (C) 2006  Joey Hess  <[EMAIL PROTECTED]>
+# Copyright (C) 2006  Martin Michlmayr <[EMAIL PROTECTED]>
+# Copyright (C) 2007  Gordon Farquharson <[EMAIL PROTECTED]>
+
+# This code is covered by the GNU General Public License.
+
+set -e
+
+error() {
+       echo "$@" >&2
+       exit 1
+}
+
+check_mtd() {
+       if [ ! -e /proc/mtd ]; then
+               error "/proc/mtd doesn't exist"
+       fi
+}
+
+mtdblock() {
+       grep "$1" /proc/mtd | cut -d: -f 1 | sed 's/mtd/\/dev\/mtdblock/'
+}
+
+# See http://www.nslu2-linux.org/wiki/Info/BootFlash -- the NSLU2 uses a
+# 16 byte MTD header, the first four bytes (big endian) give the length of
+# the remainder of the image, and the remaining bytes are zero.  Generate
+# this header.
+sercomm_header() {
+       perl -e 'print pack("N4", shift)' "$1"
+}
+
+nslu2_swap() {
+       if [ "$little_endian" ]; then
+               devio "<<"$1 "xp $,4"
+       else
+               cat $1
+       fi
+}
+
+apex_file=/boot/apex.flash
+
+if [ ! -e $apex_file ]; then
+       error "Can't find $apex_file"
+fi
+
+machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
+case "$machine" in
+       "Linksys NSLU2")
+               check_mtd
+               case "$(dpkg --print-architecture)" in
+                       arm|armel)
+                               little_endian=1
+                       ;;
+                       armeb)
+                               little_endian=0
+                       ;;
+               esac
+               mtdloader=$(mtdblock Loader)
+               if [ -z "$mtdloader" ]; then
+                       error "Cannot find mtd partition 'Loader'"
+               fi
+               lsize=$(wc -c $apex_file | awk '{print $1}')
+               mtdblocksize=131072
+               pad=$(expr $mtdblocksize - $lsize - 16)
+               # Store non-default APEX configuration
+               tmp=$(tempfile)
+               (apex-env printenv | egrep -v '\*=') > $tmp
+               printf "Flashing loader: " >&2
+               (
+                       sercomm_header $(expr $lsize + 16)
+                       nslu2_swap $apex_file
+                       perl -e "print pack(\"C\", 0xff) x $pad"
+               ) > "$mtdloader" || error "failed."
+               # Write the stored APEX configuration. For each line,
+               # remove whitespace from the start and the end of the
+               # line, and use all the characters, including
+               # whitespace, after '=' as the value.
+               while read line
+               do
+                       key=$(echo $line | cut -d '=' -f1 | awk '{print $1}')
+                       val=$(echo $line | awk '{$1=""; $2=""; print 
substr($0,3)}')
+                       apex-env setenv "$key" "$val"
+               done < $tmp
+               rm $tmp
+               echo "done." >&2
+       ;;
+       *)
+               error "Unsupported platform."
+       ;;
+esac

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to