Re: NSLU2 apex boot problems
Hi Brendan
On Jan 30, 2008 9:56 PM, Brendan Moran <annirak.debian@gmail.com> wrote:
> Now, my NSLU2 seems to continuously load and reload the kernel image. When
> it gets to loading the initramfs, it stops, goes back, and loads the kernel
> image again. I can't interrupt the process. What have I done wrong?
I'm not sure what you have done wrong. It could be the copy of APEX
you downloaded. I suggest you reflash a known good image (i.e. your
backup), and then flash the new version of APEX with the script listed
at the end of this email. I have tested it quite thoroughly, and have
submitted it to the APEX maintainer for inclusion in the next version
of apex-nslu2 in Debian. If is based on the flash-kernel script that
Debian currently uses. To use it, copy the version of APEX you want to
flash to /boot/apex.flash and then run the script. APEX will be
written to the NSLU2 flash while preserving any customizations to the
APEX configuration.
Gordon
----
!/bin/sh
# Copyright (C) 2006 Joey Hess <joeyh@debian.org>
# Copyright (C) 2006 Martin Michlmayr <tbm@cyrius.com>
# Copyright (C) 2007 Gordon Farquharson <gordonfarquharson@gmail.com>
# 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
--
Gordon Farquharson
GnuPG Key ID: 32D6D676
Reply to: