diff options
Diffstat (limited to 'packages/openslug-init')
23 files changed, 387 insertions, 0 deletions
diff --git a/packages/openslug-init/.mtn2git_empty b/packages/openslug-init/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/openslug-init/.mtn2git_empty diff --git a/packages/openslug-init/openslug-init-0.10/.mtn2git_empty b/packages/openslug-init/openslug-init-0.10/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/openslug-init/openslug-init-0.10/.mtn2git_empty diff --git a/packages/openslug-init/openslug-init-0.10/README b/packages/openslug-init/openslug-init-0.10/README index e69de29bb2..264d4d8f85 100644 --- a/packages/openslug-init/openslug-init-0.10/README +++ b/packages/openslug-init/openslug-init-0.10/README @@ -0,0 +1,49 @@ +OpenSlug-1.x Family Release README + +Warning: OpenSlug is not for the faint of heart! In fact, OpenSlug has a +specific target audience. + +Some background first. According to the NSLU2 - Linux developers, there are 4 +specific types ("camps") of NSLU2 - Linux users: + + Camp #1: Users who want full Linksys compatibility (including for future + Linksys firmware releases). They can load firmware images via + the Linksys web interface and telnet in - to load Optware - + Unslung packages with ipkg, but have no idea what RedBoot is or + does. + + Camp #2: "Camp #1 Plus users." They can telnet into RedBoot (ability + to "self-rescue" a non-working NSLU2), and are comfortable + using Linux. + + Camp #3: Power users! Firmware flashing via any interface is a walk + in the park. They aren't just *users*, but are developers or + administrators of computers and/or computer software. + However, they have no JTAG or custom bootloaders. + + Camp #4: Bleeding edge users. They create and use custom bootloaders, + certainly having no need or desire for Linksys compatibility, + modifying and/or changing the hardware as well. + +With those camps in mind, OpenSlug is targetted toward Camp #3 and Camp #4 +users. If you're not in Camps 3 & 4, then you should be looking to use the +Unslung firmware. If you are a Camp #2 user, and still want to use OpenSlug, +you need to practice gaining RedBoot access, and be able to recover from bad +flashes, "drive not formatted" conditions, and other common mistakes/problems +which are documented in the NSLU2-Linux Wiki at http://www.nslu2-linux.org. +Once you are comfortable doing those things, then you may consider using +OpenSlug. + +If you're still reading - and still intent on using OpenSlug, click through +the Intel license, download the latest OpenSlug binary and flash it to your +NSLU2! (Without any HD attached while flashing!!!) Your next stop should be +the OpenSlug Turnip page at: + + http://www.nslu2-linux.org/wiki/OpenSlug/OpenSlugTurnUp + +Please add your name and information to the OpenSlug database at the yahoo +NSLU2-Linux group at: + + http://groups.yahoo.com/group/nslu2-linux/ + +Happy OpenSlugging!
\ No newline at end of file diff --git a/packages/openslug-init/openslug-init-0.10/boot/.mtn2git_empty b/packages/openslug-init/openslug-init-0.10/boot/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/openslug-init/openslug-init-0.10/boot/.mtn2git_empty diff --git a/packages/openslug-init/openslug-init-0.10/boot/disk b/packages/openslug-init/openslug-init-0.10/boot/disk index ede33a3ee6..ede33a3ee6 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/disk +++ b/packages/openslug-init/openslug-init-0.10/boot/disk diff --git a/packages/openslug-init/openslug-init-0.10/boot/flash b/packages/openslug-init/openslug-init-0.10/boot/flash index e69de29bb2..e0bcebc9b8 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/flash +++ b/packages/openslug-init/openslug-init-0.10/boot/flash @@ -0,0 +1,14 @@ +#!/bin/sh +# boot from the current (flash) root partition +# nothing need be done, make the power led flash +# amber to indicate runlevel S +/sbin/leds -A '!gr' +exec /sbin/init +# fallback if /sbin/init has been deleted (bad!) +# flashing amber/red - failed early boot +# disk lights flashing: failed in flash boot! +/sbin/leds +A '!g12' +exec <>/dev/console >&0 2>&0 +exec /sbin/sulogin +exec /bin/sh +exit 1 diff --git a/packages/openslug-init/openslug-init-0.10/boot/network b/packages/openslug-init/openslug-init-0.10/boot/network index e69de29bb2..02b226d1f3 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/network +++ b/packages/openslug-init/openslug-init-0.10/boot/network @@ -0,0 +1,25 @@ +#!/bin/sh +# bring up the network before boot, used to allow +# netconsole logging and NFS boot. This runs out +# of flash, but that's ok because the script doesn't +# leave any process running. +# +# NOTE: /etc/default/functions defines ifup as a shell +# function! +. /etc/default/functions +# +# Now all the information for booting should be in the configuration +# file. Config the loopback and network interfaces. +ifconfig lo 127.0.0.1 up +mac="$(config mac)" +iface="$(config iface)" +if test -n "$mac" -a -n "$iface" -a "$mac" != "00:00:00:00:00:00" -a "$mac" != "FF:FF:FF:FF:FF:FF" +then + if ifconfig "$iface" hw ether "$mac" && + ifup "$iface" + then + exit 0 + fi +fi +# exit code is true only if the interface config has succeeded +exit 1 diff --git a/packages/openslug-init/openslug-init-0.10/boot/nfs b/packages/openslug-init/openslug-init-0.10/boot/nfs index e69de29bb2..534d8b7cb0 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/nfs +++ b/packages/openslug-init/openslug-init-0.10/boot/nfs @@ -0,0 +1,17 @@ +#!/bin/sh +# boot from the nfs partition "$1" (which +# must be given) using options from the rest of +# the command line. +# +/sbin/leds -A '!gr' +# +# Use the standard init path (see /etc/init.d/rcS) +export PATH=/sbin:/bin:/usr/sbin:/usr/bin +if /boot/network +then + # network is up and running, the NFS mount will + # now succeed (possibly), use /boot/disk + exec /boot/disk "$@" +fi +# fallback - use the flash boot +exec /boot/flash diff --git a/packages/openslug-init/openslug-init-0.10/boot/ram b/packages/openslug-init/openslug-init-0.10/boot/ram index 66d46a7089..66d46a7089 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/ram +++ b/packages/openslug-init/openslug-init-0.10/boot/ram diff --git a/packages/openslug-init/openslug-init-0.10/boot/udhcpc.script b/packages/openslug-init/openslug-init-0.10/boot/udhcpc.script index e69de29bb2..3f437e3143 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/boot/udhcpc.script +++ b/packages/openslug-init/openslug-init-0.10/boot/udhcpc.script @@ -0,0 +1,17 @@ +#!/bin/sh +# executed by udhcpc to do the real work of configuring an interface +# writes the result (if any) to file descriptor 9 +case "$1" in +deconfig) # ignored + :;; +renew|bound) # this gives the real information + test -n "$ip" && { + echo "ip='$ip'" + echo "subnet='$subnet'" + echo "broadcast='$broadcast'" + echo "router='$router'" + } >&9;; +leasefail) # ignore - probably no dhcp server + :;; +*) echo "udhcpc: $*: command not recognised" >&2;; +esac diff --git a/packages/openslug-init/openslug-init-0.10/functions b/packages/openslug-init/openslug-init-0.10/functions index ac8e195abd..ac8e195abd 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/functions +++ b/packages/openslug-init/openslug-init-0.10/functions diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/.mtn2git_empty b/packages/openslug-init/openslug-init-0.10/initscripts/.mtn2git_empty new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/openslug-init/openslug-init-0.10/initscripts/.mtn2git_empty diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/leds_startup b/packages/openslug-init/openslug-init-0.10/initscripts/leds_startup index e69de29bb2..945d75bd02 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/initscripts/leds_startup +++ b/packages/openslug-init/openslug-init-0.10/initscripts/leds_startup @@ -0,0 +1,11 @@ +#!/bin/sh +# Bug fix: during the initial boot sysvinit sets PREVLEVEL to +# nothing in rcS and to 'N' in the transition from rcS to the +# user state. This script runs on that transition and, if +# the PREVLEVEL is 'N', sets 'previous' (as in /etc/init.d/rc) +# to 'S' +if test "$PREVLEVEL" = N +then + previous=S exec /etc/init.d/zleds stop +fi +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/rmrecovery b/packages/openslug-init/openslug-init-0.10/initscripts/rmrecovery index e69de29bb2..eec822b154 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/initscripts/rmrecovery +++ b/packages/openslug-init/openslug-init-0.10/initscripts/rmrecovery @@ -0,0 +1,4 @@ +#!/bin/sh +# Run to remove /.recovery if the boot seems to have succeeded +test -e /.recovery && rm -f /.recovery +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.buffer b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.buffer index e69de29bb2..9285c02946 100644 --- a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.buffer +++ b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.buffer @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Invoke the syslog startup if the configuration +# uses (only) 'buffer' as the DESTINATION +DESTINATION= +test -f /etc/syslog.conf && . /etc/syslog.conf +doit= + +for d in $DESTINATION +do + case "$d" in + buffer) doit=1;; + file) exit 0;; + remote) exit 0;; + *) echo "/etc/syslog.conf: $d: unknown destination" >&2 + exit 1;; + esac +done + +test -n "$doit" -a -x /etc/init.d/syslog && + exec /etc/init.d/syslog "$@" + +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.file b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.file index e69de29bb2..80ee5f0174 100644 --- a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.file +++ b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.file @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Invoke the syslog startup if the configuration +# uses 'file' (and, optionally, buffer) as the DESTINATION +DESTINATION= +test -f /etc/syslog.conf && . /etc/syslog.conf +doit= + +for d in $DESTINATION +do + case "$d" in + buffer) :;; + file) doit=1;; + remote) exit 0;; + *) echo "/etc/syslog.conf: $d: unknown destination" >&2 + exit 1;; + esac +done + +test -n "$doit" -a -x /etc/init.d/syslog && + exec /etc/init.d/syslog "$@" + +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.network b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.network index e69de29bb2..3d7f4ab8e6 100644 --- a/packages/openslug-init/openslug-init-0.10/initscripts/syslog.network +++ b/packages/openslug-init/openslug-init-0.10/initscripts/syslog.network @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Invoke the syslog startup if the configuration +# uses 'remote', or doesn't use 'buffer' or 'file' +DESTINATION= +test -f /etc/syslog.conf && . /etc/syslog.conf +doit= +doneit= + +for d in $DESTINATION +do + case "$d" in + buffer) doneit=1;; + file) doneit=1;; + remote) doit=1;; + *) doit=1 + echo "/etc/syslog.conf: $d: unknown destination" >&2 + exit 1;; + esac +done + +# One of doneit or doit is set unless the DESTINATION value +# is empty (which is probably an error), let syslog handle +# the error. +test \( -n "$doit" -o -z "$doneit" \) -a -x /etc/init.d/syslog && + exec /etc/init.d/syslog "$@" + +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/umountinitrd.sh b/packages/openslug-init/openslug-init-0.10/initscripts/umountinitrd.sh index e69de29bb2..b7ae8b76e5 100644 --- a/packages/openslug-init/openslug-init-0.10/initscripts/umountinitrd.sh +++ b/packages/openslug-init/openslug-init-0.10/initscripts/umountinitrd.sh @@ -0,0 +1,5 @@ +#!/bin/sh +# +# umount /mnt, which is where the initrd ends up mounted +# if the directory /initrd is not present +exec umount /mnt 2>/dev/null diff --git a/packages/openslug-init/openslug-init-0.10/initscripts/zleds b/packages/openslug-init/openslug-init-0.10/initscripts/zleds index e69de29bb2..c3ad3d2d64 100644 --- a/packages/openslug-init/openslug-init-0.10/initscripts/zleds +++ b/packages/openslug-init/openslug-init-0.10/initscripts/zleds @@ -0,0 +1,38 @@ +#!/bin/sh +# +# This script is executed at the start and end of each run-level +# transition. It is the first 'stop' script and the last 'start' +# script. +# +# 'stop' sets the correct colour power LED to flash between the +# two colours of the previous and next runlevel. +# 'start' sets the LED to steady +# +# 'red' is the initial setting on kernel boot +# +# 'amber' is used for run levels S (from /linuxrc), 0 (halt), +# 1 (single user) and 6 (reboot). halt and reboot do not +# terminate therefore the LED remains flashing until the +# kernel terminates. +# +# 'green' is used for run levels 2-5 - the normal user run levels. +# +# colours are 'g' (green), 'r' (red) or 'gr' (amber). +colour() { + case "$1" in + S|0|1|6) echo gr;; + 2|3|4|5) echo g;; + N) echo r;; + *) echo "led change: $runlevel: runlevel unknown" >&2 + echo r;; + esac +} + +# leds syntax is -A +<init state> /<new state> +case "$1" in +start) leds -A +"$(colour "$runlevel")";; +stop) leds -A +"$(colour "$previous")" /"$(colour "$runlevel")";; +*) echo "led change: $1: command ignored" >&2;; +esac + +exit 0 diff --git a/packages/openslug-init/openslug-init-0.10/kern_header.c b/packages/openslug-init/openslug-init-0.10/kern_header.c index e69de29bb2..73b46eec0c 100644 --- a/packages/openslug-init/openslug-init-0.10/kern_header.c +++ b/packages/openslug-init/openslug-init-0.10/kern_header.c @@ -0,0 +1,47 @@ + +#include <stdio.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> + + +int main(int argc, char **argv) +{ + struct stat sbuf; + char *devtype; + FILE *headerfile; + unsigned int header[4]; + + + if (argc != 3) { + fprintf(stderr, "usage: %s NSLU2_kernel_file_name prepend_header_filename\nThis program builds a 16 byte header which can be prepended to a NSLU2 Kernel for reflashing\n", argv[0]); + exit (1); + } + + if (stat(argv[1], &sbuf) < 0) { + fprintf(stderr, "%s: stat: %s\n", argv[1], strerror(errno)); + exit (1); + } + + /* printf ("File %s is %d bytes long\n", argv[1], sbuf.st_size); */ + if ((headerfile=fopen(argv[2],"wb"))==NULL) + { + fprintf(stderr,"Error opening file\n"); + exit (1); + } + + if ((sbuf.st_size + 16) > 0x100000) { + fprintf(stderr,"Error Kernel + Header is > 1 MB\n"); + exit (1); + } + + header[0] = (unsigned int)sbuf.st_size + 16; + header[1] = 0; + header[2] = 0; + header[3] = 0; + if (!fwrite(&header, sizeof(unsigned int), 4, headerfile)) + fprintf(stderr,"Error write to headerfile: %s\n", strerror(errno)); + + fclose(headerfile); +} + diff --git a/packages/openslug-init/openslug-init-0.10/linuxrc b/packages/openslug-init/openslug-init-0.10/linuxrc index 7c20a55b65..7c20a55b65 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/linuxrc +++ b/packages/openslug-init/openslug-init-0.10/linuxrc diff --git a/packages/openslug-init/openslug-init-0.10/modprobe.conf b/packages/openslug-init/openslug-init-0.10/modprobe.conf index e69de29bb2..9ed854742e 100644 --- a/packages/openslug-init/openslug-init-0.10/modprobe.conf +++ b/packages/openslug-init/openslug-init-0.10/modprobe.conf @@ -0,0 +1,4 @@ +# Add an alias for eth0 to ixp425_eth to cause the S40networking +# init script to load the ixp425_eth driver on the frist boot +alias eth0 ixp425_eth + diff --git a/packages/openslug-init/openslug-init-0.10/update-kernel b/packages/openslug-init/openslug-init-0.10/update-kernel index e69de29bb2..796d45e953 100644..100755 --- a/packages/openslug-init/openslug-init-0.10/update-kernel +++ b/packages/openslug-init/openslug-init-0.10/update-kernel @@ -0,0 +1,82 @@ +#!/bin/sh + +if [ ! -f /boot/zImage ] ; then + echo "Cannot find kernel to flash in /boot/zImage" + exit 1 +fi + +/bin/rm -f /boot/zImage-partition + +if [ -f /boot/zImage-partition ] ; then + echo "Unable to remove kernel partition file" + exit 1 +fi + +echo "Creating kernel partition header" +/usr/sbin/kern_header /boot/zImage /boot/zImage-partition + +if [ ! -f /boot/zImage-partition ] ; then + echo "Unable to create kernel partition header" + exit 1 +fi + +echo "Creating kernel partition file" +/bin/cat /boot/zImage >> /boot/zImage-partition + +/bin/rm -f /boot/zImage-partition.old + +if [ -f /boot/zImage-partition.old ] ; then + echo "Unable to remove old kernel partition file" + exit 1 +fi + +echo "Saving old kernel partition" +cat /dev/mtdblock2 > /boot/zImage-partition.old + +if [ ! -f /boot/zImage-partition.old ] ; then + echo "Unable to create old kernel partition file" + exit 1 +fi + +/bin/ls -l /boot/zImage /boot/zImage-partition /boot/zImage-partition.old + +echo "Flashing new kernel partition" +cat /boot/zImage-partition > /dev/mtdblock2 + +/bin/rm -f /boot/zImage-partition.verify + +if [ -f /boot/zImage-partition.verify ] ; then + echo "Unable to remove kernel partition verify file" + exit 1 +fi + +echo "Verifing new kernel partition" +/bin/dd if=/dev/mtd2 of=/boot/zImage-partition.verify bs=1 \ + count=`/bin/dd if=/dev/mtd2 bs=4 count=1 2>/dev/null | \ + /usr/bin/hexdump -n 6 -e '"%02d"'` 2>/dev/null + +if [ ! -f /boot/zImage-partition.verify ] ; then + echo "Unable to create kernel partition verify file" + exit 1 +fi + +if cmp /boot/zImage-partition /boot/zImage-partition.verify ; then + echo "Verification successful" + /bin/rm -f /boot/zImage-partition.verify + /bin/rm -f /boot/zImage-partition + /bin/rm -f /boot/zImage-partition.old + exit 0 +fi + +echo "VERIFICATION FAILED - DANGER DANGER DANGER" + +echo "You must now manually reflash the new kernel," +echo "or reflash the old kernel back again." +echo "The kernel partition is /dev/mtdblock2" +echo "The old kernel partition is in /boot/zImage-partition.old" +echo "The present partition contents are in /boot/zImage-partition.verify" +echo "The new kernel partition is in /boot/zImage-partition" + +exit 1 + + |