${PKGDIR}/packages/openntpd/*.bb \
${PKGDIR}/packages/openobex-apps/*.bb \
${PKGDIR}/packages/openobex/*.bb \
-${PKGDIR}/packages/openslug-init/*.bb \
${PKGDIR}/packages/opensp/*.bb \
${PKGDIR}/packages/openssh/*.bb \
${PKGDIR}/packages/openssl/*.bb \
${PKGDIR}/packages/setpwc/*.bb \
${PKGDIR}/packages/sgml-common/*.bb \
${PKGDIR}/packages/slugimage/*.bb \
+${PKGDIR}/packages/slugos-init/*.bb \
${PKGDIR}/packages/ssmtp/*.bb \
${PKGDIR}/packages/strace/*.bb \
${PKGDIR}/packages/streamripper/*.bb \
#
# The following names are deprecated:
#
-# openslug - the historical name of a canonical nslu2-bag distro,
-# used generically for NSLU2 specific distro features and
-# the default OVERRIDE for all these NSLU2 builds
+# openslug - the historical name of a canonical nslu2-bag distro
+# also the name of a standard nslu2-bag distro with a package feed
# ucslugc - the historical (and obsolete) name of nslu2-btu
# also the name of a standard nslu2-btu distro with a package feed
#
INHERIT += "package_ipk debian"
-# The value of DISTRO_BASE is set to 'openslug' to pick up the original openslug
-# overrides, slugos is the preferred override!
-#FIXME: remove openslug
-DISTRO_BASE = ":slugos:openslug"
+DISTRO_BASE = ":slugos"
# packages/meta/slugos-image.bb generates a binary image of the root file system
# with a name controlled by the following setting - it defaults to the top level
+++ /dev/null
-rootfs / jffs2 defaults 1 1
-proc /proc proc defaults 0 0
-tmpfs /var tmpfs defaults 0 0
-tmpfs /media/ram tmpfs defaults 0 0
-usbfs /proc/bus/usb usbfs defaults 0 0
--- /dev/null
+rootfs / jffs2 defaults 1 1
+proc /proc proc defaults 0 0
+tmpfs /var tmpfs defaults 0 0
+tmpfs /media/ram tmpfs defaults 0 0
+usbfs /proc/bus/usb usbfs defaults 0 0
+++ /dev/null
-This patch overrides the root-home.patch for DISTRO=openslug
-
-The patch sets a root password on /etc/passwd, this password is
-
-opeNSLUg
-
-This allows ssh (dropbear) login to an OpenSlug NSLU2 using that
-password.
-
-The password is NO MORE SECURE than the previous empty string,
-however, because ssh logins can now succeed the NSLU2 is LESS
-secure! This password must be changed as soon as possible after
-initial configuration of the NSLU2.
+++ /dev/null
---- base-passwd/passwd.master.orig 2005-07-08 06:26:22.000000000 +0200
-+++ base-passwd/passwd.master 2005-07-08 06:31:58.000000000 +0200
-@@ -1,4 +1,4 @@
--root::0:0:root:/root:/bin/sh
-+root:Xm./49bYkrkuo:0:0:root:/root:/bin/sh
- daemon:*:1:1:daemon:/usr/sbin:/bin/sh
- bin:*:2:2:bin:/bin:/bin/sh
- sys:*:3:3:sys:/dev:/bin/sh
--- /dev/null
+This patch overrides the root-home.patch for DISTRO=openslug
+
+The patch sets a root password on /etc/passwd, this password is
+
+opeNSLUg
+
+This allows ssh (dropbear) login to an OpenSlug NSLU2 using that
+password.
+
+The password is NO MORE SECURE than the previous empty string,
+however, because ssh logins can now succeed the NSLU2 is LESS
+secure! This password must be changed as soon as possible after
+initial configuration of the NSLU2.
--- /dev/null
+--- base-passwd/passwd.master.orig 2005-07-08 06:26:22.000000000 +0200
++++ base-passwd/passwd.master 2005-07-08 06:31:58.000000000 +0200
+@@ -1,4 +1,4 @@
+-root::0:0:root:/root:/bin/sh
++root:Xm./49bYkrkuo:0:0:root:/root:/bin/sh
+ daemon:*:1:1:daemon:/usr/sbin:/bin/sh
+ bin:*:2:2:bin:/bin:/bin/sh
+ sys:*:3:3:sys:/dev:/bin/sh
+++ /dev/null
-# Bluetooth configuraton file
-
-# Start of hcid (allowed values are "true" and "false")
-HCID_ENABLE=true
-
-# Config file for hcid
-HCID_CONFIG="/etc/bluetooth/hcid.conf"
-
-# Start sdpd (allowed values are "true" and "false")
-SDPD_ENABLE=true
-
-# Start hidd (allowed values are "true" and "false")
-HIDD_ENABLE=false
-
-# Arguments to hidd
-HIDD_OPTIONS=""
-
-# Run hid2hci (allowed values are "true" and "false")
-HID2HCI_ENABLE=false
-
-# Bind rfcomm devices (allowed values are "true" and "false")
-RFCOMM_ENABLE=true
-
-# Config file for rfcomm
-RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
-
-# Start dund (allowed values are "true" and "false")
-DUND_ENABLE=true
-
-# Arguments to dund
-DUND_OPTIONS="--listen --persist"
-
-# Start pand (allowed values are "true" and "false")
-PAND_ENABLE=true
-
-# Arguments to pand
-PAND_OPTIONS="--listen --role NAP"
+++ /dev/null
-#
-# HCI daemon configuration file.
-#
-# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
-#
-
-# HCId options
-options {
- # Automatically initialize new devices
- autoinit yes;
-
- # Security Manager mode
- # none - Security manager disabled
- # auto - Use local PIN for incoming connections
- # user - Always ask user for a PIN
- #
- security auto;
-
- # Pairing mode
- # none - Pairing disabled
- # multi - Allow pairing with already paired devices
- # once - Pair once and deny successive attempts
- pairing multi;
-
- # PIN helper
- # pin_helper /bin/bluepin;
-
- # D-Bus PIN helper
- # dbus_pin_helper;
-}
-
-# Default settings for HCI devices
-device {
- # Local device name
- # %d - device id
- # %h - host name
- name "%h";
-
- # Local device class
- class 0x820100;
-
- # Default packet type
- #pkt_type DH1,DM1,HV1;
-
- # Inquiry and Page scan
- iscan enable; pscan enable;
-
- # Default link mode
- # none - no specific policy
- # accept - always accept incoming connections
- # master - become master on incoming connections,
- # deny role switch on outgoing connections
- #
- lm accept,master;
-
- # Default link policy
- # none - no specific policy
- # rswitch - allow role switch
- # hold - allow hold mode
- # sniff - allow sniff mode
- # park - allow park mode
- #
- #lp hold,sniff;
- #
- lp rswitch,hold,sniff,park;
-
- # Authentication and Encryption
- auth enable;
- encrypt enable;
-}
--- /dev/null
+# Bluetooth configuraton file
+
+# Start of hcid (allowed values are "true" and "false")
+HCID_ENABLE=true
+
+# Config file for hcid
+HCID_CONFIG="/etc/bluetooth/hcid.conf"
+
+# Start sdpd (allowed values are "true" and "false")
+SDPD_ENABLE=true
+
+# Start hidd (allowed values are "true" and "false")
+HIDD_ENABLE=false
+
+# Arguments to hidd
+HIDD_OPTIONS=""
+
+# Run hid2hci (allowed values are "true" and "false")
+HID2HCI_ENABLE=false
+
+# Bind rfcomm devices (allowed values are "true" and "false")
+RFCOMM_ENABLE=true
+
+# Config file for rfcomm
+RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
+
+# Start dund (allowed values are "true" and "false")
+DUND_ENABLE=true
+
+# Arguments to dund
+DUND_OPTIONS="--listen --persist"
+
+# Start pand (allowed values are "true" and "false")
+PAND_ENABLE=true
+
+# Arguments to pand
+PAND_OPTIONS="--listen --role NAP"
--- /dev/null
+#
+# HCI daemon configuration file.
+#
+# $Id: hcid.conf,v 1.4 2004/04/29 20:14:21 holtmann Exp $
+#
+
+# HCId options
+options {
+ # Automatically initialize new devices
+ autoinit yes;
+
+ # Security Manager mode
+ # none - Security manager disabled
+ # auto - Use local PIN for incoming connections
+ # user - Always ask user for a PIN
+ #
+ security auto;
+
+ # Pairing mode
+ # none - Pairing disabled
+ # multi - Allow pairing with already paired devices
+ # once - Pair once and deny successive attempts
+ pairing multi;
+
+ # PIN helper
+ # pin_helper /bin/bluepin;
+
+ # D-Bus PIN helper
+ # dbus_pin_helper;
+}
+
+# Default settings for HCI devices
+device {
+ # Local device name
+ # %d - device id
+ # %h - host name
+ name "%h";
+
+ # Local device class
+ class 0x820100;
+
+ # Default packet type
+ #pkt_type DH1,DM1,HV1;
+
+ # Inquiry and Page scan
+ iscan enable; pscan enable;
+
+ # Default link mode
+ # none - no specific policy
+ # accept - always accept incoming connections
+ # master - become master on incoming connections,
+ # deny role switch on outgoing connections
+ #
+ lm accept,master;
+
+ # Default link policy
+ # none - no specific policy
+ # rswitch - allow role switch
+ # hold - allow hold mode
+ # sniff - allow sniff mode
+ # park - allow park mode
+ #
+ #lp hold,sniff;
+ #
+ lp rswitch,hold,sniff,park;
+
+ # Authentication and Encryption
+ auth enable;
+ encrypt enable;
+}
+++ /dev/null
-#
-# Automatically generated make config: don't edit
-#
-HAVE_DOT_CONFIG=y
-
-#
-# General Configuration
-#
-# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
-CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
-# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
-CONFIG_FEATURE_VERBOSE_USAGE=y
-# CONFIG_FEATURE_INSTALLER is not set
-# CONFIG_LOCALE_SUPPORT is not set
-CONFIG_FEATURE_DEVFS=y
-CONFIG_FEATURE_DEVPTS=y
-# CONFIG_FEATURE_CLEAN_UP is not set
-# CONFIG_FEATURE_SUID is not set
-# CONFIG_SELINUX is not set
-
-#
-# Build Options
-#
-# CONFIG_STATIC is not set
-CONFIG_LFS=y
-# USING_CROSS_COMPILER is not set
-EXTRA_CFLAGS_OPTIONS=""
-
-#
-# Installation Options
-#
-# CONFIG_INSTALL_NO_USR is not set
-PREFIX="./_install"
-
-#
-# Archival Utilities
-#
-CONFIG_AR=y
-# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
-CONFIG_BUNZIP2=y
-# CONFIG_CPIO is not set
-# CONFIG_DPKG is not set
-# CONFIG_DPKG_DEB is not set
-CONFIG_GUNZIP=y
-# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
-CONFIG_GZIP=y
-# CONFIG_RPM2CPIO is not set
-# CONFIG_RPM is not set
-CONFIG_TAR=y
-CONFIG_FEATURE_TAR_CREATE=y
-CONFIG_FEATURE_TAR_BZIP2=y
-CONFIG_FEATURE_TAR_FROM=y
-CONFIG_FEATURE_TAR_GZIP=y
-# CONFIG_FEATURE_TAR_COMPRESS is not set
-CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
-CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
-# CONFIG_UNCOMPRESS is not set
-CONFIG_UNZIP=y
-
-#
-# Common options for cpio and tar
-#
-# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
-
-#
-# Coreutils
-#
-CONFIG_BASENAME=y
-# CONFIG_CAL is not set
-CONFIG_CAT=y
-CONFIG_CHGRP=y
-CONFIG_CHMOD=y
-CONFIG_CHOWN=y
-CONFIG_CHROOT=y
-# CONFIG_CMP is not set
-CONFIG_CP=y
-CONFIG_CUT=y
-CONFIG_DATE=y
-
-#
-# date (forced enabled for use with watch)
-#
-# CONFIG_FEATURE_DATE_ISOFMT is not set
-CONFIG_DD=y
-CONFIG_DF=y
-CONFIG_DIRNAME=y
-# CONFIG_DOS2UNIX is not set
-CONFIG_DU=y
-CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y
-CONFIG_ECHO=y
-CONFIG_FEATURE_FANCY_ECHO=y
-CONFIG_ENV=y
-CONFIG_EXPR=y
-CONFIG_FALSE=y
-# CONFIG_FOLD is not set
-CONFIG_HEAD=y
-# CONFIG_FEATURE_FANCY_HEAD is not set
-# CONFIG_HOSTID is not set
-CONFIG_ID=y
-# CONFIG_INSTALL is not set
-# CONFIG_LENGTH is not set
-CONFIG_LN=y
-CONFIG_LOGNAME=y
-CONFIG_LS=y
-CONFIG_FEATURE_LS_FILETYPES=y
-CONFIG_FEATURE_LS_FOLLOWLINKS=y
-CONFIG_FEATURE_LS_RECURSIVE=y
-CONFIG_FEATURE_LS_SORTFILES=y
-CONFIG_FEATURE_LS_TIMESTAMPS=y
-CONFIG_FEATURE_LS_USERNAME=y
-CONFIG_FEATURE_LS_COLOR=y
-CONFIG_MD5SUM=y
-CONFIG_MKDIR=y
-CONFIG_MKFIFO=y
-CONFIG_MKNOD=y
-CONFIG_MV=y
-CONFIG_OD=y
-CONFIG_PRINTF=y
-CONFIG_PWD=y
-# CONFIG_REALPATH is not set
-CONFIG_RM=y
-CONFIG_RMDIR=y
-CONFIG_SEQ=y
-# CONFIG_SHA1SUM is not set
-CONFIG_SLEEP=y
-# CONFIG_FEATURE_FANCY_SLEEP is not set
-CONFIG_SORT=y
-CONFIG_STTY=y
-CONFIG_SYNC=y
-CONFIG_TAIL=y
-CONFIG_FEATURE_FANCY_TAIL=y
-CONFIG_TEE=y
-# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
-CONFIG_TEST=y
-
-#
-# test (forced enabled for use with shell)
-#
-# CONFIG_FEATURE_TEST_64 is not set
-CONFIG_TOUCH=y
-CONFIG_TR=y
-CONFIG_TRUE=y
-CONFIG_TTY=y
-CONFIG_UNAME=y
-CONFIG_UNIQ=y
-# CONFIG_USLEEP is not set
-# CONFIG_UUDECODE is not set
-# CONFIG_UUENCODE is not set
-CONFIG_WATCH=y
-CONFIG_WC=y
-CONFIG_WHO=y
-CONFIG_WHOAMI=y
-CONFIG_YES=y
-
-#
-# Common options for cp and mv
-#
-# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
-
-#
-# Common options for ls and more
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
-# Common options for df, du, ls
-#
-CONFIG_FEATURE_HUMAN_READABLE=y
-
-#
-# Common options for md5sum, sha1sum
-#
-# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
-
-#
-# Console Utilities
-#
-CONFIG_CHVT=y
-CONFIG_CLEAR=y
-CONFIG_DEALLOCVT=y
-CONFIG_DUMPKMAP=y
-CONFIG_GETKEY=y
-CONFIG_LOADFONT=y
-CONFIG_LOADKMAP=y
-CONFIG_OPENVT=y
-CONFIG_RESET=y
-# CONFIG_SETKEYCODES is not set
-
-#
-# Debian Utilities
-#
-CONFIG_MKTEMP=y
-# CONFIG_PIPE_PROGRESS is not set
-CONFIG_READLINK=y
-CONFIG_FEATURE_READLINK_FOLLOW=y
-CONFIG_RUN_PARTS=y
-CONFIG_START_STOP_DAEMON=y
-CONFIG_WHICH=y
-
-#
-# Editors
-#
-CONFIG_AWK=y
-CONFIG_FEATURE_AWK_MATH=y
-# CONFIG_PATCH is not set
-CONFIG_SED=y
-CONFIG_VI=y
-CONFIG_FEATURE_VI_COLON=y
-CONFIG_FEATURE_VI_YANKMARK=y
-CONFIG_FEATURE_VI_SEARCH=y
-CONFIG_FEATURE_VI_USE_SIGNALS=y
-# CONFIG_FEATURE_VI_DOT_CMD is not set
-# CONFIG_FEATURE_VI_READONLY is not set
-# CONFIG_FEATURE_VI_SETOPTS is not set
-# CONFIG_FEATURE_VI_SET is not set
-CONFIG_FEATURE_VI_WIN_RESIZE=y
-CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
-
-#
-# Finding Utilities
-#
-# CONFIG_FIND is not set
-CONFIG_GREP=y
-CONFIG_FEATURE_GREP_EGREP_ALIAS=y
-CONFIG_FEATURE_GREP_FGREP_ALIAS=y
-CONFIG_FEATURE_GREP_CONTEXT=y
-# CONFIG_XARGS is not set
-
-#
-# Init Utilities
-#
-# CONFIG_INIT is not set
-# CONFIG_HALT is not set
-# CONFIG_POWEROFF is not set
-# CONFIG_REBOOT is not set
-# CONFIG_MESG is not set
-
-#
-# Login/Password Management Utilities
-#
-# CONFIG_USE_BB_PWD_GRP is not set
-# CONFIG_ADDGROUP is not set
-# CONFIG_DELGROUP is not set
-# CONFIG_ADDUSER is not set
-# CONFIG_DELUSER is not set
-# CONFIG_GETTY is not set
-CONFIG_FEATURE_U_W_TMP=y
-# CONFIG_LOGIN is not set
-# CONFIG_PASSWD is not set
-# CONFIG_SU is not set
-# CONFIG_SULOGIN is not set
-# CONFIG_VLOCK is not set
-
-#
-# Miscellaneous Utilities
-#
-# CONFIG_ADJTIMEX is not set
-# CONFIG_CROND is not set
-# CONFIG_CRONTAB is not set
-CONFIG_DC=y
-# CONFIG_DEVFSD is not set
-# CONFIG_LAST is not set
-# CONFIG_HDPARM is not set
-# CONFIG_MAKEDEVS is not set
-# CONFIG_MT is not set
-# CONFIG_RX is not set
-CONFIG_STRINGS=y
-CONFIG_TIME=y
-# CONFIG_WATCHDOG is not set
-
-#
-# Linux Module Utilities
-#
-# CONFIG_INSMOD is not set
-# CONFIG_LSMOD is not set
-# CONFIG_MODPROBE is not set
-# CONFIG_RMMOD is not set
-
-#
-# Networking Utilities
-#
-CONFIG_FEATURE_IPV6=y
-# CONFIG_ARPING is not set
-# CONFIG_FTPGET is not set
-# CONFIG_FTPPUT is not set
-CONFIG_HOSTNAME=y
-# CONFIG_HTTPD is not set
-CONFIG_IFCONFIG=y
-CONFIG_FEATURE_IFCONFIG_STATUS=y
-# CONFIG_FEATURE_IFCONFIG_SLIP is not set
-# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
-CONFIG_FEATURE_IFCONFIG_HW=y
-# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
-CONFIG_IFUPDOWN=y
-# CONFIG_FEATURE_IFUPDOWN_IP is not set
-CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
-CONFIG_FEATURE_IFUPDOWN_IPV4=y
-CONFIG_FEATURE_IFUPDOWN_IPV6=y
-# CONFIG_FEATURE_IFUPDOWN_IPX is not set
-# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
-# CONFIG_INETD is not set
-CONFIG_IP=y
-CONFIG_FEATURE_IP_ADDRESS=y
-CONFIG_FEATURE_IP_LINK=y
-CONFIG_FEATURE_IP_ROUTE=y
-CONFIG_FEATURE_IP_TUNNEL=y
-# CONFIG_IPCALC is not set
-# CONFIG_IPADDR is not set
-# CONFIG_IPLINK is not set
-# CONFIG_IPROUTE is not set
-# CONFIG_IPTUNNEL is not set
-# CONFIG_NAMEIF is not set
-CONFIG_NC=y
-CONFIG_NETSTAT=y
-CONFIG_NSLOOKUP=y
-CONFIG_PING=y
-CONFIG_FEATURE_FANCY_PING=y
-CONFIG_PING6=y
-CONFIG_FEATURE_FANCY_PING6=y
-CONFIG_ROUTE=y
-CONFIG_TELNET=y
-# CONFIG_FEATURE_TELNET_TTYPE is not set
-CONFIG_FEATURE_TELNET_AUTOLOGIN=y
-# CONFIG_TELNETD is not set
-CONFIG_TFTP=y
-CONFIG_FEATURE_TFTP_GET=y
-CONFIG_FEATURE_TFTP_PUT=y
-# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_FEATURE_TFTP_DEBUG is not set
-CONFIG_TRACEROUTE=y
-# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
-# CONFIG_VCONFIG is not set
-CONFIG_WGET=y
-CONFIG_FEATURE_WGET_STATUSBAR=y
-CONFIG_FEATURE_WGET_AUTHENTICATION=y
-CONFIG_FEATURE_WGET_IP6_LITERAL=y
-
-#
-# udhcp Server/Client
-#
-# CONFIG_UDHCPD is not set
-CONFIG_UDHCPC=y
-CONFIG_FEATURE_UDHCP_SYSLOG=y
-# CONFIG_FEATURE_UDHCP_DEBUG is not set
-
-#
-# Process Utilities
-#
-CONFIG_FREE=y
-CONFIG_KILL=y
-CONFIG_KILLALL=y
-CONFIG_PIDOF=y
-CONFIG_PS=y
-CONFIG_RENICE=y
-CONFIG_TOP=y
-FEATURE_CPU_USAGE_PERCENTAGE=y
-CONFIG_UPTIME=y
-# CONFIG_SYSCTL is not set
-
-#
-# Another Bourne-like Shell
-#
-CONFIG_FEATURE_SH_IS_ASH=y
-# CONFIG_FEATURE_SH_IS_HUSH is not set
-# CONFIG_FEATURE_SH_IS_LASH is not set
-# CONFIG_FEATURE_SH_IS_MSH is not set
-# CONFIG_FEATURE_SH_IS_NONE is not set
-CONFIG_ASH=y
-
-#
-# Ash Shell Options
-#
-CONFIG_ASH_JOB_CONTROL=y
-CONFIG_ASH_PIPE_OPTIMIZATION=y
-CONFIG_FEATURE_BUILTIN_TEST=y
-CONFIG_FEATURE_BUILTIN_ECHO=y
-CONFIG_FEATURE_BUILTIN_PIDOF=y
-CONFIG_ASH_ALIAS=y
-CONFIG_ASH_MATH_SUPPORT=y
-# CONFIG_ASH_MATH_SUPPORT_64 is not set
-CONFIG_ASH_GETOPTS=y
-# CONFIG_ASH_CMDCMD is not set
-# CONFIG_ASH_MAIL is not set
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
-# CONFIG_ASH_RANDOM_SUPPORT is not set
-# CONFIG_HUSH is not set
-# CONFIG_LASH is not set
-# CONFIG_MSH is not set
-
-#
-# Bourne Shell Options
-#
-CONFIG_FEATURE_SH_EXTRA_QUIET=y
-# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
-CONFIG_FEATURE_COMMAND_EDITING=y
-CONFIG_FEATURE_COMMAND_HISTORY=63
-# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
-CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y
-# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
-CONFIG_FEATURE_SH_FANCY_PROMPT=y
-
-#
-# System Logging Utilities
-#
-CONFIG_SYSLOGD=y
-# CONFIG_FEATURE_ROTATE_LOGFILE is not set
-CONFIG_FEATURE_REMOTE_LOG=y
-CONFIG_FEATURE_IPC_SYSLOG=y
-CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
-CONFIG_LOGREAD=y
-# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
-CONFIG_KLOGD=y
-CONFIG_LOGGER=y
-
-#
-# Linux System Utilities
-#
-CONFIG_DMESG=y
-CONFIG_FBSET=y
-CONFIG_FEATURE_FBSET_FANCY=y
-# CONFIG_FEATURE_FBSET_READMODE is not set
-# CONFIG_FDFLUSH is not set
-# CONFIG_FDFORMAT is not set
-CONFIG_FDISK=y
-FDISK_SUPPORT_LARGE_DISKS=y
-CONFIG_FEATURE_FDISK_WRITABLE=y
-# CONFIG_FEATURE_AIX_LABEL is not set
-# CONFIG_FEATURE_SGI_LABEL is not set
-# CONFIG_FEATURE_SUN_LABEL is not set
-# CONFIG_FEATURE_OSF_LABEL is not set
-# CONFIG_FEATURE_FDISK_ADVANCED is not set
-# CONFIG_FREERAMDISK is not set
-# CONFIG_FSCK_MINIX is not set
-# CONFIG_MKFS_MINIX is not set
-# CONFIG_GETOPT is not set
-CONFIG_HEXDUMP=y
-CONFIG_HWCLOCK=y
-CONFIG_FEATURE_HWCLOCK_LONGOPTIONS=y
-CONFIG_LOSETUP=y
-CONFIG_MKSWAP=y
-CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
-CONFIG_PIVOT_ROOT=y
-# CONFIG_RDATE is not set
-CONFIG_SWAPONOFF=y
-CONFIG_MOUNT=y
-CONFIG_NFSMOUNT=y
-CONFIG_UMOUNT=y
-CONFIG_FEATURE_MOUNT_FORCE=y
-
-#
-# Common options for mount/umount
-#
-CONFIG_FEATURE_MOUNT_LOOP=y
-# CONFIG_FEATURE_MTAB_SUPPORT is not set
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG is not set
+++ /dev/null
---- busybox-1.00/.pc/udhcpscript.patch/examples/udhcp/simple.script 2004-10-13 00:18:05.000000000 -0700
-+++ busybox-1.00/examples/udhcp/simple.script 2005-06-05 15:08:28.432605118 -0700
-@@ -1,40 +1,101 @@
- #!/bin/sh
-+# openslug UDHCP client script
-+# this must set the HW address (MAC) on the interface
-+#
-+. /etc/default/functions
-
--# udhcpc script edited by Tim Riker <Tim@Rikers.org>
-
--[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
-+echodns(){
-+ local dns
-+ if test $# -gt 0
-+ then
-+ for dns in "$@"
-+ do
-+ echo "nameserver $dns"
-+ done
-+ fi
-+}
-+
-+# Output the correct contents for resolv.conf
-+mkresolv() {
-+ test -n "$domain" && echo "search $domain"
-+ echodns $dns
-+}
-+
-+# checksum of a file (or stdin if -)
-+md5strm() {
-+ md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p'
-+}
-+
-+bind() {
-+ local B N metric i olddomain
-+ B=
-+ test -n "$broadcast" && B="broadcast $broadcast"
-+ N=
-+ test -n "$subnet" && N="netmask $subnet"
-+ ifconfig "$interface" "$ip" $B $N up
-+
-+ # If given router information delete the old information and
-+ # enter new stuff, routers get metrics incremented by 1
-+ # between each (this is somewhat arbitrary)
-+ if test -n "$router"
-+ then
-+ while route del default gw 0.0.0.0 dev $interface 2>/dev/null
-+ do
-+ :
-+ done
-
--RESOLV_CONF="/etc/resolv.conf"
--[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
--[ -n "$subnet" ] && NETMASK="netmask $subnet"
-+ metric=0
-+ for i in $router
-+ do
-+ route add default gw "$i" dev "$interface" metric $((metric++))
-+ done
-+ fi
-+
-+ olddomain=
-+ test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)"
-+ if test -n "$domain" -a "$domain" != "$olddomain"
-+ then
-+ echo "$domain" >/etc/defaultdomain
-+ # and update the kernel view too
-+ echo "$domain" >/proc/sys/kernel/domainname
-+ fi
-+
-+ # Update /etc/resolv.conf to reflect domain and dns information,
-+ # this always clears resolv.conf if none is given
-+ md5old="$(md5strm /etc/resolv.conf)"
-+ md5new="$(mkresolv | md5strm -)"
-+ test "$md5old" != "$md5new" && mkresolv >/etc/resolv.conf
-+}
-
- case "$1" in
-- deconfig)
-- /sbin/ifconfig $interface 0.0.0.0
-- ;;
--
-- renew|bound)
-- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
--
-- if [ -n "$router" ] ; then
-- echo "deleting routers"
-- while route del default gw 0.0.0.0 dev $interface ; do
-- :
-- done
--
-- metric=0
-- for i in $router ; do
-- route add default gw $i dev $interface metric $((metric++))
-- done
-+deconfig)
-+ # Bring the interface up (without inet at this point)
-+ ifconfig "$interface" up;;
-+
-+renew|bound)
-+ bind;;
-+
-+leasefail)
-+ # Pull the values from the config data if (only only if) this
-+ # is the config interface
-+ if test "$interface" = "$(config iface)"
-+ then
-+ ip="$(config ip)"
-+ if test -n "$ip"
-+ then
-+ router="$(config gateway)"
-+ subnet="$(config netmask)"
-+ broadcast="$(config broadcast)"
-+ domain="$(config domain)"
-+ dns="$(config dns)"
-+
-+ bind
- fi
-+ fi;;
-
-- echo -n > $RESOLV_CONF
-- [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
-- for i in $dns ; do
-- echo adding dns $i
-- echo nameserver $i >> $RESOLV_CONF
-- done
-- ;;
-+*) echo "udhcpc: $*: unknown command" >&2
-+ exit 1;;
- esac
-
- exit 0
--- /dev/null
+#
+# Automatically generated make config: don't edit
+#
+HAVE_DOT_CONFIG=y
+
+#
+# General Configuration
+#
+# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
+CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_FEATURE_VERBOSE_USAGE=y
+# CONFIG_FEATURE_INSTALLER is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_FEATURE_DEVFS=y
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_SELINUX is not set
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+CONFIG_LFS=y
+# USING_CROSS_COMPILER is not set
+EXTRA_CFLAGS_OPTIONS=""
+
+#
+# Installation Options
+#
+# CONFIG_INSTALL_NO_USR is not set
+PREFIX="./_install"
+
+#
+# Archival Utilities
+#
+CONFIG_AR=y
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+CONFIG_BUNZIP2=y
+# CONFIG_CPIO is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+CONFIG_GUNZIP=y
+# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
+CONFIG_GZIP=y
+# CONFIG_RPM2CPIO is not set
+# CONFIG_RPM is not set
+CONFIG_TAR=y
+CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_BZIP2=y
+CONFIG_FEATURE_TAR_FROM=y
+CONFIG_FEATURE_TAR_GZIP=y
+# CONFIG_FEATURE_TAR_COMPRESS is not set
+CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_UNCOMPRESS is not set
+CONFIG_UNZIP=y
+
+#
+# Common options for cpio and tar
+#
+# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+# CONFIG_CAL is not set
+CONFIG_CAT=y
+CONFIG_CHGRP=y
+CONFIG_CHMOD=y
+CONFIG_CHOWN=y
+CONFIG_CHROOT=y
+# CONFIG_CMP is not set
+CONFIG_CP=y
+CONFIG_CUT=y
+CONFIG_DATE=y
+
+#
+# date (forced enabled for use with watch)
+#
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+CONFIG_DD=y
+CONFIG_DF=y
+CONFIG_DIRNAME=y
+# CONFIG_DOS2UNIX is not set
+CONFIG_DU=y
+CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y
+CONFIG_ECHO=y
+CONFIG_FEATURE_FANCY_ECHO=y
+CONFIG_ENV=y
+CONFIG_EXPR=y
+CONFIG_FALSE=y
+# CONFIG_FOLD is not set
+CONFIG_HEAD=y
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+CONFIG_ID=y
+# CONFIG_INSTALL is not set
+# CONFIG_LENGTH is not set
+CONFIG_LN=y
+CONFIG_LOGNAME=y
+CONFIG_LS=y
+CONFIG_FEATURE_LS_FILETYPES=y
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
+CONFIG_FEATURE_LS_RECURSIVE=y
+CONFIG_FEATURE_LS_SORTFILES=y
+CONFIG_FEATURE_LS_TIMESTAMPS=y
+CONFIG_FEATURE_LS_USERNAME=y
+CONFIG_FEATURE_LS_COLOR=y
+CONFIG_MD5SUM=y
+CONFIG_MKDIR=y
+CONFIG_MKFIFO=y
+CONFIG_MKNOD=y
+CONFIG_MV=y
+CONFIG_OD=y
+CONFIG_PRINTF=y
+CONFIG_PWD=y
+# CONFIG_REALPATH is not set
+CONFIG_RM=y
+CONFIG_RMDIR=y
+CONFIG_SEQ=y
+# CONFIG_SHA1SUM is not set
+CONFIG_SLEEP=y
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+CONFIG_SORT=y
+CONFIG_STTY=y
+CONFIG_SYNC=y
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+CONFIG_TEE=y
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+CONFIG_TEST=y
+
+#
+# test (forced enabled for use with shell)
+#
+# CONFIG_FEATURE_TEST_64 is not set
+CONFIG_TOUCH=y
+CONFIG_TR=y
+CONFIG_TRUE=y
+CONFIG_TTY=y
+CONFIG_UNAME=y
+CONFIG_UNIQ=y
+# CONFIG_USLEEP is not set
+# CONFIG_UUDECODE is not set
+# CONFIG_UUENCODE is not set
+CONFIG_WATCH=y
+CONFIG_WC=y
+CONFIG_WHO=y
+CONFIG_WHOAMI=y
+CONFIG_YES=y
+
+#
+# Common options for cp and mv
+#
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+
+#
+# Common options for ls and more
+#
+CONFIG_FEATURE_AUTOWIDTH=y
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
+
+#
+# Common options for md5sum, sha1sum
+#
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_CLEAR=y
+CONFIG_DEALLOCVT=y
+CONFIG_DUMPKMAP=y
+CONFIG_GETKEY=y
+CONFIG_LOADFONT=y
+CONFIG_LOADKMAP=y
+CONFIG_OPENVT=y
+CONFIG_RESET=y
+# CONFIG_SETKEYCODES is not set
+
+#
+# Debian Utilities
+#
+CONFIG_MKTEMP=y
+# CONFIG_PIPE_PROGRESS is not set
+CONFIG_READLINK=y
+CONFIG_FEATURE_READLINK_FOLLOW=y
+CONFIG_RUN_PARTS=y
+CONFIG_START_STOP_DAEMON=y
+CONFIG_WHICH=y
+
+#
+# Editors
+#
+CONFIG_AWK=y
+CONFIG_FEATURE_AWK_MATH=y
+# CONFIG_PATCH is not set
+CONFIG_SED=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_YANKMARK=y
+CONFIG_FEATURE_VI_SEARCH=y
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+CONFIG_GREP=y
+CONFIG_FEATURE_GREP_EGREP_ALIAS=y
+CONFIG_FEATURE_GREP_FGREP_ALIAS=y
+CONFIG_FEATURE_GREP_CONTEXT=y
+# CONFIG_XARGS is not set
+
+#
+# Init Utilities
+#
+# CONFIG_INIT is not set
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+# CONFIG_REBOOT is not set
+# CONFIG_MESG is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_DELUSER is not set
+# CONFIG_GETTY is not set
+CONFIG_FEATURE_U_W_TMP=y
+# CONFIG_LOGIN is not set
+# CONFIG_PASSWD is not set
+# CONFIG_SU is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_CROND is not set
+# CONFIG_CRONTAB is not set
+CONFIG_DC=y
+# CONFIG_DEVFSD is not set
+# CONFIG_LAST is not set
+# CONFIG_HDPARM is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_MT is not set
+# CONFIG_RX is not set
+CONFIG_STRINGS=y
+CONFIG_TIME=y
+# CONFIG_WATCHDOG is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_INSMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_RMMOD is not set
+
+#
+# Networking Utilities
+#
+CONFIG_FEATURE_IPV6=y
+# CONFIG_ARPING is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+CONFIG_HOSTNAME=y
+# CONFIG_HTTPD is not set
+CONFIG_IFCONFIG=y
+CONFIG_FEATURE_IFCONFIG_STATUS=y
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+CONFIG_FEATURE_IFCONFIG_HW=y
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+CONFIG_IFUPDOWN=y
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
+CONFIG_FEATURE_IFUPDOWN_IPV4=y
+CONFIG_FEATURE_IFUPDOWN_IPV6=y
+# CONFIG_FEATURE_IFUPDOWN_IPX is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_INETD is not set
+CONFIG_IP=y
+CONFIG_FEATURE_IP_ADDRESS=y
+CONFIG_FEATURE_IP_LINK=y
+CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_TUNNEL=y
+# CONFIG_IPCALC is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_NAMEIF is not set
+CONFIG_NC=y
+CONFIG_NETSTAT=y
+CONFIG_NSLOOKUP=y
+CONFIG_PING=y
+CONFIG_FEATURE_FANCY_PING=y
+CONFIG_PING6=y
+CONFIG_FEATURE_FANCY_PING6=y
+CONFIG_ROUTE=y
+CONFIG_TELNET=y
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+CONFIG_FEATURE_TELNET_AUTOLOGIN=y
+# CONFIG_TELNETD is not set
+CONFIG_TFTP=y
+CONFIG_FEATURE_TFTP_GET=y
+CONFIG_FEATURE_TFTP_PUT=y
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_FEATURE_TFTP_DEBUG is not set
+CONFIG_TRACEROUTE=y
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_VCONFIG is not set
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+CONFIG_FEATURE_WGET_IP6_LITERAL=y
+
+#
+# udhcp Server/Client
+#
+# CONFIG_UDHCPD is not set
+CONFIG_UDHCPC=y
+CONFIG_FEATURE_UDHCP_SYSLOG=y
+# CONFIG_FEATURE_UDHCP_DEBUG is not set
+
+#
+# Process Utilities
+#
+CONFIG_FREE=y
+CONFIG_KILL=y
+CONFIG_KILLALL=y
+CONFIG_PIDOF=y
+CONFIG_PS=y
+CONFIG_RENICE=y
+CONFIG_TOP=y
+FEATURE_CPU_USAGE_PERCENTAGE=y
+CONFIG_UPTIME=y
+# CONFIG_SYSCTL is not set
+
+#
+# Another Bourne-like Shell
+#
+CONFIG_FEATURE_SH_IS_ASH=y
+# CONFIG_FEATURE_SH_IS_HUSH is not set
+# CONFIG_FEATURE_SH_IS_LASH is not set
+# CONFIG_FEATURE_SH_IS_MSH is not set
+# CONFIG_FEATURE_SH_IS_NONE is not set
+CONFIG_ASH=y
+
+#
+# Ash Shell Options
+#
+CONFIG_ASH_JOB_CONTROL=y
+CONFIG_ASH_PIPE_OPTIMIZATION=y
+CONFIG_FEATURE_BUILTIN_TEST=y
+CONFIG_FEATURE_BUILTIN_ECHO=y
+CONFIG_FEATURE_BUILTIN_PIDOF=y
+CONFIG_ASH_ALIAS=y
+CONFIG_ASH_MATH_SUPPORT=y
+# CONFIG_ASH_MATH_SUPPORT_64 is not set
+CONFIG_ASH_GETOPTS=y
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_MAIL is not set
+CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH is not set
+# CONFIG_LASH is not set
+# CONFIG_MSH is not set
+
+#
+# Bourne Shell Options
+#
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
+# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
+CONFIG_FEATURE_COMMAND_EDITING=y
+CONFIG_FEATURE_COMMAND_HISTORY=63
+# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
+CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y
+# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
+CONFIG_FEATURE_SH_FANCY_PROMPT=y
+
+#
+# System Logging Utilities
+#
+CONFIG_SYSLOGD=y
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+CONFIG_FEATURE_REMOTE_LOG=y
+CONFIG_FEATURE_IPC_SYSLOG=y
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
+CONFIG_LOGREAD=y
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+CONFIG_KLOGD=y
+CONFIG_LOGGER=y
+
+#
+# Linux System Utilities
+#
+CONFIG_DMESG=y
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+# CONFIG_FEATURE_FBSET_READMODE is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FDFORMAT is not set
+CONFIG_FDISK=y
+FDISK_SUPPORT_LARGE_DISKS=y
+CONFIG_FEATURE_FDISK_WRITABLE=y
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_GETOPT is not set
+CONFIG_HEXDUMP=y
+CONFIG_HWCLOCK=y
+CONFIG_FEATURE_HWCLOCK_LONGOPTIONS=y
+CONFIG_LOSETUP=y
+CONFIG_MKSWAP=y
+CONFIG_MORE=y
+CONFIG_FEATURE_USE_TERMIOS=y
+CONFIG_PIVOT_ROOT=y
+# CONFIG_RDATE is not set
+CONFIG_SWAPONOFF=y
+CONFIG_MOUNT=y
+CONFIG_NFSMOUNT=y
+CONFIG_UMOUNT=y
+CONFIG_FEATURE_MOUNT_FORCE=y
+
+#
+# Common options for mount/umount
+#
+CONFIG_FEATURE_MOUNT_LOOP=y
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
--- /dev/null
+--- busybox-1.00/.pc/udhcpscript.patch/examples/udhcp/simple.script 2004-10-13 00:18:05.000000000 -0700
++++ busybox-1.00/examples/udhcp/simple.script 2005-06-05 15:08:28.432605118 -0700
+@@ -1,40 +1,101 @@
+ #!/bin/sh
++# openslug UDHCP client script
++# this must set the HW address (MAC) on the interface
++#
++. /etc/default/functions
+
+-# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+-[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
++echodns(){
++ local dns
++ if test $# -gt 0
++ then
++ for dns in "$@"
++ do
++ echo "nameserver $dns"
++ done
++ fi
++}
++
++# Output the correct contents for resolv.conf
++mkresolv() {
++ test -n "$domain" && echo "search $domain"
++ echodns $dns
++}
++
++# checksum of a file (or stdin if -)
++md5strm() {
++ md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p'
++}
++
++bind() {
++ local B N metric i olddomain
++ B=
++ test -n "$broadcast" && B="broadcast $broadcast"
++ N=
++ test -n "$subnet" && N="netmask $subnet"
++ ifconfig "$interface" "$ip" $B $N up
++
++ # If given router information delete the old information and
++ # enter new stuff, routers get metrics incremented by 1
++ # between each (this is somewhat arbitrary)
++ if test -n "$router"
++ then
++ while route del default gw 0.0.0.0 dev $interface 2>/dev/null
++ do
++ :
++ done
+
+-RESOLV_CONF="/etc/resolv.conf"
+-[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+-[ -n "$subnet" ] && NETMASK="netmask $subnet"
++ metric=0
++ for i in $router
++ do
++ route add default gw "$i" dev "$interface" metric $((metric++))
++ done
++ fi
++
++ olddomain=
++ test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)"
++ if test -n "$domain" -a "$domain" != "$olddomain"
++ then
++ echo "$domain" >/etc/defaultdomain
++ # and update the kernel view too
++ echo "$domain" >/proc/sys/kernel/domainname
++ fi
++
++ # Update /etc/resolv.conf to reflect domain and dns information,
++ # this always clears resolv.conf if none is given
++ md5old="$(md5strm /etc/resolv.conf)"
++ md5new="$(mkresolv | md5strm -)"
++ test "$md5old" != "$md5new" && mkresolv >/etc/resolv.conf
++}
+
+ case "$1" in
+- deconfig)
+- /sbin/ifconfig $interface 0.0.0.0
+- ;;
+-
+- renew|bound)
+- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+-
+- if [ -n "$router" ] ; then
+- echo "deleting routers"
+- while route del default gw 0.0.0.0 dev $interface ; do
+- :
+- done
+-
+- metric=0
+- for i in $router ; do
+- route add default gw $i dev $interface metric $((metric++))
+- done
++deconfig)
++ # Bring the interface up (without inet at this point)
++ ifconfig "$interface" up;;
++
++renew|bound)
++ bind;;
++
++leasefail)
++ # Pull the values from the config data if (only only if) this
++ # is the config interface
++ if test "$interface" = "$(config iface)"
++ then
++ ip="$(config ip)"
++ if test -n "$ip"
++ then
++ router="$(config gateway)"
++ subnet="$(config netmask)"
++ broadcast="$(config broadcast)"
++ domain="$(config domain)"
++ dns="$(config dns)"
++
++ bind
+ fi
++ fi;;
+
+- echo -n > $RESOLV_CONF
+- [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
+- for i in $dns ; do
+- echo adding dns $i
+- echo nameserver $i >> $RESOLV_CONF
+- done
+- ;;
++*) echo "udhcpc: $*: unknown command" >&2
++ exit 1;;
+ esac
+
+ exit 0
+++ /dev/null
-#
-# Automatically generated make config: don't edit
-#
-HAVE_DOT_CONFIG=y
-
-#
-# General Configuration
-#
-# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
-CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
-# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
-CONFIG_FEATURE_VERBOSE_USAGE=y
-# CONFIG_FEATURE_INSTALLER is not set
-# CONFIG_LOCALE_SUPPORT is not set
-CONFIG_FEATURE_DEVFS=y
-CONFIG_FEATURE_DEVPTS=y
-# CONFIG_FEATURE_CLEAN_UP is not set
-# CONFIG_FEATURE_SUID is not set
-# CONFIG_SELINUX is not set
-
-#
-# Build Options
-#
-# CONFIG_STATIC is not set
-CONFIG_LFS=y
-# USING_CROSS_COMPILER is not set
-EXTRA_CFLAGS_OPTIONS=""
-
-#
-# Installation Options
-#
-# CONFIG_INSTALL_NO_USR is not set
-PREFIX="./_install"
-
-#
-# Archival Utilities
-#
-CONFIG_AR=y
-# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
-CONFIG_BUNZIP2=y
-# CONFIG_CPIO is not set
-# CONFIG_DPKG is not set
-# CONFIG_DPKG_DEB is not set
-CONFIG_GUNZIP=y
-# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
-CONFIG_GZIP=y
-# CONFIG_RPM2CPIO is not set
-# CONFIG_RPM is not set
-CONFIG_TAR=y
-CONFIG_FEATURE_TAR_CREATE=y
-CONFIG_FEATURE_TAR_BZIP2=y
-CONFIG_FEATURE_TAR_FROM=y
-CONFIG_FEATURE_TAR_GZIP=y
-# CONFIG_FEATURE_TAR_COMPRESS is not set
-CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
-CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
-# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
-# CONFIG_UNCOMPRESS is not set
-CONFIG_UNZIP=y
-
-#
-# Common options for cpio and tar
-#
-# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
-
-#
-# Coreutils
-#
-CONFIG_BASENAME=y
-# CONFIG_CAL is not set
-CONFIG_CAT=y
-CONFIG_CHGRP=y
-CONFIG_CHMOD=y
-CONFIG_CHOWN=y
-CONFIG_CHROOT=y
-# CONFIG_CMP is not set
-CONFIG_CP=y
-CONFIG_CUT=y
-CONFIG_DATE=y
-
-#
-# date (forced enabled for use with watch)
-#
-# CONFIG_FEATURE_DATE_ISOFMT is not set
-CONFIG_DD=y
-CONFIG_DF=y
-CONFIG_DIRNAME=y
-# CONFIG_DOS2UNIX is not set
-CONFIG_DU=y
-CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y
-CONFIG_ECHO=y
-CONFIG_FEATURE_FANCY_ECHO=y
-CONFIG_ENV=y
-CONFIG_EXPR=y
-CONFIG_FALSE=y
-# CONFIG_FOLD is not set
-CONFIG_HEAD=y
-# CONFIG_FEATURE_FANCY_HEAD is not set
-# CONFIG_HOSTID is not set
-CONFIG_ID=y
-# CONFIG_INSTALL is not set
-# CONFIG_LENGTH is not set
-CONFIG_LN=y
-CONFIG_LOGNAME=y
-CONFIG_LS=y
-CONFIG_FEATURE_LS_FILETYPES=y
-CONFIG_FEATURE_LS_FOLLOWLINKS=y
-CONFIG_FEATURE_LS_RECURSIVE=y
-CONFIG_FEATURE_LS_SORTFILES=y
-CONFIG_FEATURE_LS_TIMESTAMPS=y
-CONFIG_FEATURE_LS_USERNAME=y
-CONFIG_FEATURE_LS_COLOR=y
-CONFIG_MD5SUM=y
-CONFIG_MKDIR=y
-CONFIG_MKFIFO=y
-CONFIG_MKNOD=y
-CONFIG_MV=y
-CONFIG_OD=y
-CONFIG_PRINTF=y
-CONFIG_PWD=y
-# CONFIG_REALPATH is not set
-CONFIG_RM=y
-CONFIG_RMDIR=y
-CONFIG_SEQ=y
-# CONFIG_SHA1SUM is not set
-CONFIG_SLEEP=y
-# CONFIG_FEATURE_FANCY_SLEEP is not set
-CONFIG_SORT=y
-CONFIG_STTY=y
-CONFIG_SYNC=y
-CONFIG_TAIL=y
-CONFIG_FEATURE_FANCY_TAIL=y
-CONFIG_TEE=y
-# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
-CONFIG_TEST=y
-
-#
-# test (forced enabled for use with shell)
-#
-# CONFIG_FEATURE_TEST_64 is not set
-CONFIG_TOUCH=y
-CONFIG_TR=y
-CONFIG_TRUE=y
-CONFIG_TTY=y
-CONFIG_UNAME=y
-CONFIG_UNIQ=y
-# CONFIG_USLEEP is not set
-# CONFIG_UUDECODE is not set
-# CONFIG_UUENCODE is not set
-CONFIG_WATCH=y
-CONFIG_WC=y
-CONFIG_WHO=y
-CONFIG_WHOAMI=y
-CONFIG_YES=y
-
-#
-# Common options for cp and mv
-#
-# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
-
-#
-# Common options for ls and more
-#
-CONFIG_FEATURE_AUTOWIDTH=y
-
-#
-# Common options for df, du, ls
-#
-CONFIG_FEATURE_HUMAN_READABLE=y
-
-#
-# Common options for md5sum, sha1sum
-#
-# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
-
-#
-# Console Utilities
-#
-CONFIG_CHVT=y
-CONFIG_CLEAR=y
-CONFIG_DEALLOCVT=y
-CONFIG_DUMPKMAP=y
-CONFIG_GETKEY=y
-CONFIG_LOADFONT=y
-CONFIG_LOADKMAP=y
-CONFIG_OPENVT=y
-CONFIG_RESET=y
-# CONFIG_SETKEYCODES is not set
-
-#
-# Debian Utilities
-#
-CONFIG_MKTEMP=y
-# CONFIG_PIPE_PROGRESS is not set
-CONFIG_READLINK=y
-CONFIG_FEATURE_READLINK_FOLLOW=y
-CONFIG_RUN_PARTS=y
-CONFIG_START_STOP_DAEMON=y
-CONFIG_WHICH=y
-
-#
-# Editors
-#
-CONFIG_AWK=y
-CONFIG_FEATURE_AWK_MATH=y
-# CONFIG_PATCH is not set
-CONFIG_SED=y
-CONFIG_VI=y
-CONFIG_FEATURE_VI_COLON=y
-CONFIG_FEATURE_VI_YANKMARK=y
-CONFIG_FEATURE_VI_SEARCH=y
-CONFIG_FEATURE_VI_USE_SIGNALS=y
-# CONFIG_FEATURE_VI_DOT_CMD is not set
-# CONFIG_FEATURE_VI_READONLY is not set
-# CONFIG_FEATURE_VI_SETOPTS is not set
-# CONFIG_FEATURE_VI_SET is not set
-CONFIG_FEATURE_VI_WIN_RESIZE=y
-CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
-
-#
-# Finding Utilities
-#
-# CONFIG_FIND is not set
-CONFIG_GREP=y
-CONFIG_FEATURE_GREP_EGREP_ALIAS=y
-CONFIG_FEATURE_GREP_FGREP_ALIAS=y
-CONFIG_FEATURE_GREP_CONTEXT=y
-# CONFIG_XARGS is not set
-
-#
-# Init Utilities
-#
-# CONFIG_INIT is not set
-# CONFIG_HALT is not set
-# CONFIG_POWEROFF is not set
-# CONFIG_REBOOT is not set
-# CONFIG_MESG is not set
-
-#
-# Login/Password Management Utilities
-#
-# CONFIG_USE_BB_PWD_GRP is not set
-# CONFIG_ADDGROUP is not set
-# CONFIG_DELGROUP is not set
-# CONFIG_ADDUSER is not set
-# CONFIG_DELUSER is not set
-# CONFIG_GETTY is not set
-CONFIG_FEATURE_U_W_TMP=y
-# CONFIG_LOGIN is not set
-# CONFIG_PASSWD is not set
-# CONFIG_SU is not set
-# CONFIG_SULOGIN is not set
-# CONFIG_VLOCK is not set
-
-#
-# Miscellaneous Utilities
-#
-# CONFIG_ADJTIMEX is not set
-# CONFIG_CROND is not set
-# CONFIG_CRONTAB is not set
-CONFIG_DC=y
-# CONFIG_DEVFSD is not set
-# CONFIG_LAST is not set
-# CONFIG_HDPARM is not set
-# CONFIG_MAKEDEVS is not set
-# CONFIG_MT is not set
-# CONFIG_RX is not set
-CONFIG_STRINGS=y
-CONFIG_TIME=y
-# CONFIG_WATCHDOG is not set
-
-#
-# Linux Module Utilities
-#
-# CONFIG_INSMOD is not set
-# CONFIG_LSMOD is not set
-# CONFIG_MODPROBE is not set
-# CONFIG_RMMOD is not set
-
-#
-# Networking Utilities
-#
-CONFIG_FEATURE_IPV6=y
-# CONFIG_ARPING is not set
-# CONFIG_FTPGET is not set
-# CONFIG_FTPPUT is not set
-CONFIG_HOSTNAME=y
-# CONFIG_HTTPD is not set
-CONFIG_IFCONFIG=y
-CONFIG_FEATURE_IFCONFIG_STATUS=y
-# CONFIG_FEATURE_IFCONFIG_SLIP is not set
-# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
-CONFIG_FEATURE_IFCONFIG_HW=y
-# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
-CONFIG_IFUPDOWN=y
-# CONFIG_FEATURE_IFUPDOWN_IP is not set
-CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
-CONFIG_FEATURE_IFUPDOWN_IPV4=y
-CONFIG_FEATURE_IFUPDOWN_IPV6=y
-# CONFIG_FEATURE_IFUPDOWN_IPX is not set
-# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
-# CONFIG_INETD is not set
-CONFIG_IP=y
-CONFIG_FEATURE_IP_ADDRESS=y
-CONFIG_FEATURE_IP_LINK=y
-CONFIG_FEATURE_IP_ROUTE=y
-CONFIG_FEATURE_IP_TUNNEL=y
-# CONFIG_IPCALC is not set
-# CONFIG_IPADDR is not set
-# CONFIG_IPLINK is not set
-# CONFIG_IPROUTE is not set
-# CONFIG_IPTUNNEL is not set
-# CONFIG_NAMEIF is not set
-CONFIG_NC=y
-CONFIG_NETSTAT=y
-CONFIG_NSLOOKUP=y
-CONFIG_PING=y
-CONFIG_FEATURE_FANCY_PING=y
-CONFIG_PING6=y
-CONFIG_FEATURE_FANCY_PING6=y
-CONFIG_ROUTE=y
-CONFIG_TELNET=y
-# CONFIG_FEATURE_TELNET_TTYPE is not set
-CONFIG_FEATURE_TELNET_AUTOLOGIN=y
-# CONFIG_TELNETD is not set
-CONFIG_TFTP=y
-CONFIG_FEATURE_TFTP_GET=y
-CONFIG_FEATURE_TFTP_PUT=y
-# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
-# CONFIG_FEATURE_TFTP_DEBUG is not set
-CONFIG_TRACEROUTE=y
-# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
-# CONFIG_VCONFIG is not set
-CONFIG_WGET=y
-CONFIG_FEATURE_WGET_STATUSBAR=y
-CONFIG_FEATURE_WGET_AUTHENTICATION=y
-CONFIG_FEATURE_WGET_IP6_LITERAL=y
-
-#
-# udhcp Server/Client
-#
-# CONFIG_UDHCPD is not set
-CONFIG_UDHCPC=y
-CONFIG_FEATURE_UDHCP_SYSLOG=y
-# CONFIG_FEATURE_UDHCP_DEBUG is not set
-
-#
-# Process Utilities
-#
-CONFIG_FREE=y
-CONFIG_KILL=y
-CONFIG_KILLALL=y
-CONFIG_PIDOF=y
-CONFIG_PS=y
-CONFIG_RENICE=y
-CONFIG_TOP=y
-FEATURE_CPU_USAGE_PERCENTAGE=y
-CONFIG_UPTIME=y
-# CONFIG_SYSCTL is not set
-
-#
-# Another Bourne-like Shell
-#
-CONFIG_FEATURE_SH_IS_ASH=y
-# CONFIG_FEATURE_SH_IS_HUSH is not set
-# CONFIG_FEATURE_SH_IS_LASH is not set
-# CONFIG_FEATURE_SH_IS_MSH is not set
-# CONFIG_FEATURE_SH_IS_NONE is not set
-CONFIG_ASH=y
-
-#
-# Ash Shell Options
-#
-CONFIG_ASH_JOB_CONTROL=y
-CONFIG_ASH_PIPE_OPTIMIZATION=y
-CONFIG_FEATURE_BUILTIN_TEST=y
-CONFIG_FEATURE_BUILTIN_ECHO=y
-CONFIG_FEATURE_BUILTIN_PIDOF=y
-CONFIG_ASH_ALIAS=y
-CONFIG_ASH_MATH_SUPPORT=y
-# CONFIG_ASH_MATH_SUPPORT_64 is not set
-CONFIG_ASH_GETOPTS=y
-# CONFIG_ASH_CMDCMD is not set
-# CONFIG_ASH_MAIL is not set
-CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
-# CONFIG_ASH_RANDOM_SUPPORT is not set
-# CONFIG_HUSH is not set
-# CONFIG_LASH is not set
-# CONFIG_MSH is not set
-
-#
-# Bourne Shell Options
-#
-CONFIG_FEATURE_SH_EXTRA_QUIET=y
-# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
-CONFIG_FEATURE_COMMAND_EDITING=y
-CONFIG_FEATURE_COMMAND_HISTORY=63
-# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
-CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y
-# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
-CONFIG_FEATURE_SH_FANCY_PROMPT=y
-
-#
-# System Logging Utilities
-#
-CONFIG_SYSLOGD=y
-# CONFIG_FEATURE_ROTATE_LOGFILE is not set
-CONFIG_FEATURE_REMOTE_LOG=y
-CONFIG_FEATURE_IPC_SYSLOG=y
-CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
-CONFIG_LOGREAD=y
-# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
-CONFIG_KLOGD=y
-CONFIG_LOGGER=y
-
-#
-# Linux System Utilities
-#
-CONFIG_DMESG=y
-CONFIG_FBSET=y
-CONFIG_FEATURE_FBSET_FANCY=y
-# CONFIG_FEATURE_FBSET_READMODE is not set
-# CONFIG_FDFLUSH is not set
-# CONFIG_FDFORMAT is not set
-CONFIG_FDISK=y
-FDISK_SUPPORT_LARGE_DISKS=y
-CONFIG_FEATURE_FDISK_WRITABLE=y
-# CONFIG_FEATURE_AIX_LABEL is not set
-# CONFIG_FEATURE_SGI_LABEL is not set
-# CONFIG_FEATURE_SUN_LABEL is not set
-# CONFIG_FEATURE_OSF_LABEL is not set
-# CONFIG_FEATURE_FDISK_ADVANCED is not set
-# CONFIG_FREERAMDISK is not set
-# CONFIG_FSCK_MINIX is not set
-# CONFIG_MKFS_MINIX is not set
-# CONFIG_GETOPT is not set
-CONFIG_HEXDUMP=y
-CONFIG_HWCLOCK=y
-CONFIG_FEATURE_HWCLOCK_LONGOPTIONS=y
-CONFIG_LOSETUP=y
-CONFIG_MKSWAP=y
-CONFIG_MORE=y
-CONFIG_FEATURE_USE_TERMIOS=y
-CONFIG_PIVOT_ROOT=y
-# CONFIG_RDATE is not set
-CONFIG_SWAPONOFF=y
-CONFIG_MOUNT=y
-CONFIG_NFSMOUNT=y
-CONFIG_UMOUNT=y
-CONFIG_FEATURE_MOUNT_FORCE=y
-
-#
-# Common options for mount/umount
-#
-CONFIG_FEATURE_MOUNT_LOOP=y
-# CONFIG_FEATURE_MTAB_SUPPORT is not set
-
-#
-# Debugging Options
-#
-# CONFIG_DEBUG is not set
+++ /dev/null
---- busybox-1.00/.pc/udhcpscript.patch/examples/udhcp/simple.script 2004-10-13 00:18:05.000000000 -0700
-+++ busybox-1.00/examples/udhcp/simple.script 2005-06-05 15:08:28.432605118 -0700
-@@ -1,40 +1,101 @@
- #!/bin/sh
-+# openslug UDHCP client script
-+# this must set the HW address (MAC) on the interface
-+#
-+. /etc/default/functions
-
--# udhcpc script edited by Tim Riker <Tim@Rikers.org>
-
--[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
-+echodns(){
-+ local dns
-+ if test $# -gt 0
-+ then
-+ for dns in "$@"
-+ do
-+ echo "nameserver $dns"
-+ done
-+ fi
-+}
-+
-+# Output the correct contents for resolv.conf
-+mkresolv() {
-+ test -n "$domain" && echo "search $domain"
-+ echodns $dns
-+}
-+
-+# checksum of a file (or stdin if -)
-+md5strm() {
-+ md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p'
-+}
-+
-+bind() {
-+ local B N metric i olddomain
-+ B=
-+ test -n "$broadcast" && B="broadcast $broadcast"
-+ N=
-+ test -n "$subnet" && N="netmask $subnet"
-+ ifconfig "$interface" "$ip" $B $N up
-+
-+ # If given router information delete the old information and
-+ # enter new stuff, routers get metrics incremented by 1
-+ # between each (this is somewhat arbitrary)
-+ if test -n "$router"
-+ then
-+ while route del default gw 0.0.0.0 dev $interface 2>/dev/null
-+ do
-+ :
-+ done
-
--RESOLV_CONF="/etc/resolv.conf"
--[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
--[ -n "$subnet" ] && NETMASK="netmask $subnet"
-+ metric=0
-+ for i in $router
-+ do
-+ route add default gw "$i" dev "$interface" metric $((metric++))
-+ done
-+ fi
-+
-+ olddomain=
-+ test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)"
-+ if test -n "$domain" -a "$domain" != "$olddomain"
-+ then
-+ echo "$domain" >/etc/defaultdomain
-+ # and update the kernel view too
-+ echo "$domain" >/proc/sys/kernel/domainname
-+ fi
-+
-+ # Update /etc/resolv.conf to reflect domain and dns information,
-+ # this always clears resolv.conf if none is given
-+ md5old="$(md5strm /etc/resolv.conf)"
-+ md5new="$(mkresolv | md5strm -)"
-+ test "$md5old" != "$md5new" && mkresolv >/etc/resolv.conf
-+}
-
- case "$1" in
-- deconfig)
-- /sbin/ifconfig $interface 0.0.0.0
-- ;;
--
-- renew|bound)
-- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
--
-- if [ -n "$router" ] ; then
-- echo "deleting routers"
-- while route del default gw 0.0.0.0 dev $interface ; do
-- :
-- done
--
-- metric=0
-- for i in $router ; do
-- route add default gw $i dev $interface metric $((metric++))
-- done
-+deconfig)
-+ # Bring the interface up (without inet at this point)
-+ ifconfig "$interface" up;;
-+
-+renew|bound)
-+ bind;;
-+
-+leasefail)
-+ # Pull the values from the config data if (only only if) this
-+ # is the config interface
-+ if test "$interface" = "$(config iface)"
-+ then
-+ ip="$(config ip)"
-+ if test -n "$ip"
-+ then
-+ router="$(config gateway)"
-+ subnet="$(config netmask)"
-+ broadcast="$(config broadcast)"
-+ domain="$(config domain)"
-+ dns="$(config dns)"
-+
-+ bind
- fi
-+ fi;;
-
-- echo -n > $RESOLV_CONF
-- [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
-- for i in $dns ; do
-- echo adding dns $i
-- echo nameserver $i >> $RESOLV_CONF
-- done
-- ;;
-+*) echo "udhcpc: $*: unknown command" >&2
-+ exit 1;;
- esac
-
- exit 0
--- /dev/null
+#
+# Automatically generated make config: don't edit
+#
+HAVE_DOT_CONFIG=y
+
+#
+# General Configuration
+#
+# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
+CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
+# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
+CONFIG_FEATURE_VERBOSE_USAGE=y
+# CONFIG_FEATURE_INSTALLER is not set
+# CONFIG_LOCALE_SUPPORT is not set
+CONFIG_FEATURE_DEVFS=y
+CONFIG_FEATURE_DEVPTS=y
+# CONFIG_FEATURE_CLEAN_UP is not set
+# CONFIG_FEATURE_SUID is not set
+# CONFIG_SELINUX is not set
+
+#
+# Build Options
+#
+# CONFIG_STATIC is not set
+CONFIG_LFS=y
+# USING_CROSS_COMPILER is not set
+EXTRA_CFLAGS_OPTIONS=""
+
+#
+# Installation Options
+#
+# CONFIG_INSTALL_NO_USR is not set
+PREFIX="./_install"
+
+#
+# Archival Utilities
+#
+CONFIG_AR=y
+# CONFIG_FEATURE_AR_LONG_FILENAMES is not set
+CONFIG_BUNZIP2=y
+# CONFIG_CPIO is not set
+# CONFIG_DPKG is not set
+# CONFIG_DPKG_DEB is not set
+CONFIG_GUNZIP=y
+# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set
+CONFIG_GZIP=y
+# CONFIG_RPM2CPIO is not set
+# CONFIG_RPM is not set
+CONFIG_TAR=y
+CONFIG_FEATURE_TAR_CREATE=y
+CONFIG_FEATURE_TAR_BZIP2=y
+CONFIG_FEATURE_TAR_FROM=y
+CONFIG_FEATURE_TAR_GZIP=y
+# CONFIG_FEATURE_TAR_COMPRESS is not set
+CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY=y
+CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y
+# CONFIG_FEATURE_TAR_LONG_OPTIONS is not set
+# CONFIG_UNCOMPRESS is not set
+CONFIG_UNZIP=y
+
+#
+# Common options for cpio and tar
+#
+# CONFIG_FEATURE_UNARCHIVE_TAPE is not set
+
+#
+# Coreutils
+#
+CONFIG_BASENAME=y
+# CONFIG_CAL is not set
+CONFIG_CAT=y
+CONFIG_CHGRP=y
+CONFIG_CHMOD=y
+CONFIG_CHOWN=y
+CONFIG_CHROOT=y
+# CONFIG_CMP is not set
+CONFIG_CP=y
+CONFIG_CUT=y
+CONFIG_DATE=y
+
+#
+# date (forced enabled for use with watch)
+#
+# CONFIG_FEATURE_DATE_ISOFMT is not set
+CONFIG_DD=y
+CONFIG_DF=y
+CONFIG_DIRNAME=y
+# CONFIG_DOS2UNIX is not set
+CONFIG_DU=y
+CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y
+CONFIG_ECHO=y
+CONFIG_FEATURE_FANCY_ECHO=y
+CONFIG_ENV=y
+CONFIG_EXPR=y
+CONFIG_FALSE=y
+# CONFIG_FOLD is not set
+CONFIG_HEAD=y
+# CONFIG_FEATURE_FANCY_HEAD is not set
+# CONFIG_HOSTID is not set
+CONFIG_ID=y
+# CONFIG_INSTALL is not set
+# CONFIG_LENGTH is not set
+CONFIG_LN=y
+CONFIG_LOGNAME=y
+CONFIG_LS=y
+CONFIG_FEATURE_LS_FILETYPES=y
+CONFIG_FEATURE_LS_FOLLOWLINKS=y
+CONFIG_FEATURE_LS_RECURSIVE=y
+CONFIG_FEATURE_LS_SORTFILES=y
+CONFIG_FEATURE_LS_TIMESTAMPS=y
+CONFIG_FEATURE_LS_USERNAME=y
+CONFIG_FEATURE_LS_COLOR=y
+CONFIG_MD5SUM=y
+CONFIG_MKDIR=y
+CONFIG_MKFIFO=y
+CONFIG_MKNOD=y
+CONFIG_MV=y
+CONFIG_OD=y
+CONFIG_PRINTF=y
+CONFIG_PWD=y
+# CONFIG_REALPATH is not set
+CONFIG_RM=y
+CONFIG_RMDIR=y
+CONFIG_SEQ=y
+# CONFIG_SHA1SUM is not set
+CONFIG_SLEEP=y
+# CONFIG_FEATURE_FANCY_SLEEP is not set
+CONFIG_SORT=y
+CONFIG_STTY=y
+CONFIG_SYNC=y
+CONFIG_TAIL=y
+CONFIG_FEATURE_FANCY_TAIL=y
+CONFIG_TEE=y
+# CONFIG_FEATURE_TEE_USE_BLOCK_IO is not set
+CONFIG_TEST=y
+
+#
+# test (forced enabled for use with shell)
+#
+# CONFIG_FEATURE_TEST_64 is not set
+CONFIG_TOUCH=y
+CONFIG_TR=y
+CONFIG_TRUE=y
+CONFIG_TTY=y
+CONFIG_UNAME=y
+CONFIG_UNIQ=y
+# CONFIG_USLEEP is not set
+# CONFIG_UUDECODE is not set
+# CONFIG_UUENCODE is not set
+CONFIG_WATCH=y
+CONFIG_WC=y
+CONFIG_WHO=y
+CONFIG_WHOAMI=y
+CONFIG_YES=y
+
+#
+# Common options for cp and mv
+#
+# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set
+
+#
+# Common options for ls and more
+#
+CONFIG_FEATURE_AUTOWIDTH=y
+
+#
+# Common options for df, du, ls
+#
+CONFIG_FEATURE_HUMAN_READABLE=y
+
+#
+# Common options for md5sum, sha1sum
+#
+# CONFIG_FEATURE_MD5_SHA1_SUM_CHECK is not set
+
+#
+# Console Utilities
+#
+CONFIG_CHVT=y
+CONFIG_CLEAR=y
+CONFIG_DEALLOCVT=y
+CONFIG_DUMPKMAP=y
+CONFIG_GETKEY=y
+CONFIG_LOADFONT=y
+CONFIG_LOADKMAP=y
+CONFIG_OPENVT=y
+CONFIG_RESET=y
+# CONFIG_SETKEYCODES is not set
+
+#
+# Debian Utilities
+#
+CONFIG_MKTEMP=y
+# CONFIG_PIPE_PROGRESS is not set
+CONFIG_READLINK=y
+CONFIG_FEATURE_READLINK_FOLLOW=y
+CONFIG_RUN_PARTS=y
+CONFIG_START_STOP_DAEMON=y
+CONFIG_WHICH=y
+
+#
+# Editors
+#
+CONFIG_AWK=y
+CONFIG_FEATURE_AWK_MATH=y
+# CONFIG_PATCH is not set
+CONFIG_SED=y
+CONFIG_VI=y
+CONFIG_FEATURE_VI_COLON=y
+CONFIG_FEATURE_VI_YANKMARK=y
+CONFIG_FEATURE_VI_SEARCH=y
+CONFIG_FEATURE_VI_USE_SIGNALS=y
+# CONFIG_FEATURE_VI_DOT_CMD is not set
+# CONFIG_FEATURE_VI_READONLY is not set
+# CONFIG_FEATURE_VI_SETOPTS is not set
+# CONFIG_FEATURE_VI_SET is not set
+CONFIG_FEATURE_VI_WIN_RESIZE=y
+CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y
+
+#
+# Finding Utilities
+#
+# CONFIG_FIND is not set
+CONFIG_GREP=y
+CONFIG_FEATURE_GREP_EGREP_ALIAS=y
+CONFIG_FEATURE_GREP_FGREP_ALIAS=y
+CONFIG_FEATURE_GREP_CONTEXT=y
+# CONFIG_XARGS is not set
+
+#
+# Init Utilities
+#
+# CONFIG_INIT is not set
+# CONFIG_HALT is not set
+# CONFIG_POWEROFF is not set
+# CONFIG_REBOOT is not set
+# CONFIG_MESG is not set
+
+#
+# Login/Password Management Utilities
+#
+# CONFIG_USE_BB_PWD_GRP is not set
+# CONFIG_ADDGROUP is not set
+# CONFIG_DELGROUP is not set
+# CONFIG_ADDUSER is not set
+# CONFIG_DELUSER is not set
+# CONFIG_GETTY is not set
+CONFIG_FEATURE_U_W_TMP=y
+# CONFIG_LOGIN is not set
+# CONFIG_PASSWD is not set
+# CONFIG_SU is not set
+# CONFIG_SULOGIN is not set
+# CONFIG_VLOCK is not set
+
+#
+# Miscellaneous Utilities
+#
+# CONFIG_ADJTIMEX is not set
+# CONFIG_CROND is not set
+# CONFIG_CRONTAB is not set
+CONFIG_DC=y
+# CONFIG_DEVFSD is not set
+# CONFIG_LAST is not set
+# CONFIG_HDPARM is not set
+# CONFIG_MAKEDEVS is not set
+# CONFIG_MT is not set
+# CONFIG_RX is not set
+CONFIG_STRINGS=y
+CONFIG_TIME=y
+# CONFIG_WATCHDOG is not set
+
+#
+# Linux Module Utilities
+#
+# CONFIG_INSMOD is not set
+# CONFIG_LSMOD is not set
+# CONFIG_MODPROBE is not set
+# CONFIG_RMMOD is not set
+
+#
+# Networking Utilities
+#
+CONFIG_FEATURE_IPV6=y
+# CONFIG_ARPING is not set
+# CONFIG_FTPGET is not set
+# CONFIG_FTPPUT is not set
+CONFIG_HOSTNAME=y
+# CONFIG_HTTPD is not set
+CONFIG_IFCONFIG=y
+CONFIG_FEATURE_IFCONFIG_STATUS=y
+# CONFIG_FEATURE_IFCONFIG_SLIP is not set
+# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set
+CONFIG_FEATURE_IFCONFIG_HW=y
+# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set
+CONFIG_IFUPDOWN=y
+# CONFIG_FEATURE_IFUPDOWN_IP is not set
+CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
+CONFIG_FEATURE_IFUPDOWN_IPV4=y
+CONFIG_FEATURE_IFUPDOWN_IPV6=y
+# CONFIG_FEATURE_IFUPDOWN_IPX is not set
+# CONFIG_FEATURE_IFUPDOWN_MAPPING is not set
+# CONFIG_INETD is not set
+CONFIG_IP=y
+CONFIG_FEATURE_IP_ADDRESS=y
+CONFIG_FEATURE_IP_LINK=y
+CONFIG_FEATURE_IP_ROUTE=y
+CONFIG_FEATURE_IP_TUNNEL=y
+# CONFIG_IPCALC is not set
+# CONFIG_IPADDR is not set
+# CONFIG_IPLINK is not set
+# CONFIG_IPROUTE is not set
+# CONFIG_IPTUNNEL is not set
+# CONFIG_NAMEIF is not set
+CONFIG_NC=y
+CONFIG_NETSTAT=y
+CONFIG_NSLOOKUP=y
+CONFIG_PING=y
+CONFIG_FEATURE_FANCY_PING=y
+CONFIG_PING6=y
+CONFIG_FEATURE_FANCY_PING6=y
+CONFIG_ROUTE=y
+CONFIG_TELNET=y
+# CONFIG_FEATURE_TELNET_TTYPE is not set
+CONFIG_FEATURE_TELNET_AUTOLOGIN=y
+# CONFIG_TELNETD is not set
+CONFIG_TFTP=y
+CONFIG_FEATURE_TFTP_GET=y
+CONFIG_FEATURE_TFTP_PUT=y
+# CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
+# CONFIG_FEATURE_TFTP_DEBUG is not set
+CONFIG_TRACEROUTE=y
+# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set
+# CONFIG_VCONFIG is not set
+CONFIG_WGET=y
+CONFIG_FEATURE_WGET_STATUSBAR=y
+CONFIG_FEATURE_WGET_AUTHENTICATION=y
+CONFIG_FEATURE_WGET_IP6_LITERAL=y
+
+#
+# udhcp Server/Client
+#
+# CONFIG_UDHCPD is not set
+CONFIG_UDHCPC=y
+CONFIG_FEATURE_UDHCP_SYSLOG=y
+# CONFIG_FEATURE_UDHCP_DEBUG is not set
+
+#
+# Process Utilities
+#
+CONFIG_FREE=y
+CONFIG_KILL=y
+CONFIG_KILLALL=y
+CONFIG_PIDOF=y
+CONFIG_PS=y
+CONFIG_RENICE=y
+CONFIG_TOP=y
+FEATURE_CPU_USAGE_PERCENTAGE=y
+CONFIG_UPTIME=y
+# CONFIG_SYSCTL is not set
+
+#
+# Another Bourne-like Shell
+#
+CONFIG_FEATURE_SH_IS_ASH=y
+# CONFIG_FEATURE_SH_IS_HUSH is not set
+# CONFIG_FEATURE_SH_IS_LASH is not set
+# CONFIG_FEATURE_SH_IS_MSH is not set
+# CONFIG_FEATURE_SH_IS_NONE is not set
+CONFIG_ASH=y
+
+#
+# Ash Shell Options
+#
+CONFIG_ASH_JOB_CONTROL=y
+CONFIG_ASH_PIPE_OPTIMIZATION=y
+CONFIG_FEATURE_BUILTIN_TEST=y
+CONFIG_FEATURE_BUILTIN_ECHO=y
+CONFIG_FEATURE_BUILTIN_PIDOF=y
+CONFIG_ASH_ALIAS=y
+CONFIG_ASH_MATH_SUPPORT=y
+# CONFIG_ASH_MATH_SUPPORT_64 is not set
+CONFIG_ASH_GETOPTS=y
+# CONFIG_ASH_CMDCMD is not set
+# CONFIG_ASH_MAIL is not set
+CONFIG_ASH_OPTIMIZE_FOR_SIZE=y
+# CONFIG_ASH_RANDOM_SUPPORT is not set
+# CONFIG_HUSH is not set
+# CONFIG_LASH is not set
+# CONFIG_MSH is not set
+
+#
+# Bourne Shell Options
+#
+CONFIG_FEATURE_SH_EXTRA_QUIET=y
+# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set
+CONFIG_FEATURE_COMMAND_EDITING=y
+CONFIG_FEATURE_COMMAND_HISTORY=63
+# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set
+CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y
+# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set
+CONFIG_FEATURE_SH_FANCY_PROMPT=y
+
+#
+# System Logging Utilities
+#
+CONFIG_SYSLOGD=y
+# CONFIG_FEATURE_ROTATE_LOGFILE is not set
+CONFIG_FEATURE_REMOTE_LOG=y
+CONFIG_FEATURE_IPC_SYSLOG=y
+CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16
+CONFIG_LOGREAD=y
+# CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set
+CONFIG_KLOGD=y
+CONFIG_LOGGER=y
+
+#
+# Linux System Utilities
+#
+CONFIG_DMESG=y
+CONFIG_FBSET=y
+CONFIG_FEATURE_FBSET_FANCY=y
+# CONFIG_FEATURE_FBSET_READMODE is not set
+# CONFIG_FDFLUSH is not set
+# CONFIG_FDFORMAT is not set
+CONFIG_FDISK=y
+FDISK_SUPPORT_LARGE_DISKS=y
+CONFIG_FEATURE_FDISK_WRITABLE=y
+# CONFIG_FEATURE_AIX_LABEL is not set
+# CONFIG_FEATURE_SGI_LABEL is not set
+# CONFIG_FEATURE_SUN_LABEL is not set
+# CONFIG_FEATURE_OSF_LABEL is not set
+# CONFIG_FEATURE_FDISK_ADVANCED is not set
+# CONFIG_FREERAMDISK is not set
+# CONFIG_FSCK_MINIX is not set
+# CONFIG_MKFS_MINIX is not set
+# CONFIG_GETOPT is not set
+CONFIG_HEXDUMP=y
+CONFIG_HWCLOCK=y
+CONFIG_FEATURE_HWCLOCK_LONGOPTIONS=y
+CONFIG_LOSETUP=y
+CONFIG_MKSWAP=y
+CONFIG_MORE=y
+CONFIG_FEATURE_USE_TERMIOS=y
+CONFIG_PIVOT_ROOT=y
+# CONFIG_RDATE is not set
+CONFIG_SWAPONOFF=y
+CONFIG_MOUNT=y
+CONFIG_NFSMOUNT=y
+CONFIG_UMOUNT=y
+CONFIG_FEATURE_MOUNT_FORCE=y
+
+#
+# Common options for mount/umount
+#
+CONFIG_FEATURE_MOUNT_LOOP=y
+# CONFIG_FEATURE_MTAB_SUPPORT is not set
+
+#
+# Debugging Options
+#
+# CONFIG_DEBUG is not set
--- /dev/null
+--- busybox-1.00/.pc/udhcpscript.patch/examples/udhcp/simple.script 2004-10-13 00:18:05.000000000 -0700
++++ busybox-1.00/examples/udhcp/simple.script 2005-06-05 15:08:28.432605118 -0700
+@@ -1,40 +1,101 @@
+ #!/bin/sh
++# openslug UDHCP client script
++# this must set the HW address (MAC) on the interface
++#
++. /etc/default/functions
+
+-# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+-[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
++echodns(){
++ local dns
++ if test $# -gt 0
++ then
++ for dns in "$@"
++ do
++ echo "nameserver $dns"
++ done
++ fi
++}
++
++# Output the correct contents for resolv.conf
++mkresolv() {
++ test -n "$domain" && echo "search $domain"
++ echodns $dns
++}
++
++# checksum of a file (or stdin if -)
++md5strm() {
++ md5sum $1 2>/dev/null | sed -n 's/^\([0-9A-Za-z]*\).*$/\1/p'
++}
++
++bind() {
++ local B N metric i olddomain
++ B=
++ test -n "$broadcast" && B="broadcast $broadcast"
++ N=
++ test -n "$subnet" && N="netmask $subnet"
++ ifconfig "$interface" "$ip" $B $N up
++
++ # If given router information delete the old information and
++ # enter new stuff, routers get metrics incremented by 1
++ # between each (this is somewhat arbitrary)
++ if test -n "$router"
++ then
++ while route del default gw 0.0.0.0 dev $interface 2>/dev/null
++ do
++ :
++ done
+
+-RESOLV_CONF="/etc/resolv.conf"
+-[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+-[ -n "$subnet" ] && NETMASK="netmask $subnet"
++ metric=0
++ for i in $router
++ do
++ route add default gw "$i" dev "$interface" metric $((metric++))
++ done
++ fi
++
++ olddomain=
++ test -r /etc/defaultdomain && olddomain="$(cat /etc/defaultdomain)"
++ if test -n "$domain" -a "$domain" != "$olddomain"
++ then
++ echo "$domain" >/etc/defaultdomain
++ # and update the kernel view too
++ echo "$domain" >/proc/sys/kernel/domainname
++ fi
++
++ # Update /etc/resolv.conf to reflect domain and dns information,
++ # this always clears resolv.conf if none is given
++ md5old="$(md5strm /etc/resolv.conf)"
++ md5new="$(mkresolv | md5strm -)"
++ test "$md5old" != "$md5new" && mkresolv >/etc/resolv.conf
++}
+
+ case "$1" in
+- deconfig)
+- /sbin/ifconfig $interface 0.0.0.0
+- ;;
+-
+- renew|bound)
+- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+-
+- if [ -n "$router" ] ; then
+- echo "deleting routers"
+- while route del default gw 0.0.0.0 dev $interface ; do
+- :
+- done
+-
+- metric=0
+- for i in $router ; do
+- route add default gw $i dev $interface metric $((metric++))
+- done
++deconfig)
++ # Bring the interface up (without inet at this point)
++ ifconfig "$interface" up;;
++
++renew|bound)
++ bind;;
++
++leasefail)
++ # Pull the values from the config data if (only only if) this
++ # is the config interface
++ if test "$interface" = "$(config iface)"
++ then
++ ip="$(config ip)"
++ if test -n "$ip"
++ then
++ router="$(config gateway)"
++ subnet="$(config netmask)"
++ broadcast="$(config broadcast)"
++ domain="$(config domain)"
++ dns="$(config dns)"
++
++ bind
+ fi
++ fi;;
+
+- echo -n > $RESOLV_CONF
+- [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
+- for i in $dns ; do
+- echo adding dns $i
+- echo nameserver $i >> $RESOLV_CONF
+- done
+- ;;
++*) echo "udhcpc: $*: unknown command" >&2
++ exit 1;;
+ esac
+
+ exit 0
+++ /dev/null
-#!/bin/sh
-#
-# How to handle alignment faults on the ARM
-#
-# 0 - ignore, the value will probably be rotated
-# 1 - warn, a log message will be output
-# 2 - fixup, the kernel will do an expensive aligned read
-# 3 - fixup+warn
-# 4 - signal, the process will get an illegal instruction fault
-# 5 - signal+warn
-# 6 - invalid (has no effect)
-# 7 - invalid (has no effect)
-#
-# Set ALIGN in /etc/default/rcS to override (do not edit this
-# file!) Set ALIGN to empty to avoid changing the kernel
-# default (currently '0').
-ALIGN=1
-. /etc/default/rcS
-test -e /proc/cpu/alignment -a -n "$ALIGN" -a "$ALIGN" -ge 0 -a "$ALIGN" -lt 6 &&
- echo "$ALIGN" >/proc/cpu/alignment
+++ /dev/null
-#!/bin/sh
-#NOTE: this script may execute with absolutely nothing
-# in /dev
-echo "OpenSlug booting..."
+++ /dev/null
-#/dev/ d 775 0 0 - - - - -
-#/dev/msys d 775 0 0 - - - - -
-#/dev/pts d 775 0 0 - - - - -
-#/var d 775 0 0 - - - - -
-/boot/var/empty d 755 0 3 - - - -
-/dev/apm_bios c 660 0 46 10 134 - - -
-/dev/audio c 660 0 29 14 4 - - -
-/dev/audio1 c 660 0 29 14 20 - - -
-/dev/audio2 c 660 0 29 14 36 - - -
-/dev/audio3 c 660 0 29 14 52 - - -
-#/dev/bty c 644 0 0 60 0 0 1 5
-/dev/buzzer c 660 0 0 62 0 - - -
-#/dev/sharp_fl c 640 0 44 254 0 - - -
-/dev/console c 662 0 5 5 1 - -
-/dev/cusa0 c 640 0 0 205 5 - - -
-/dev/cusa1 c 640 0 0 205 6 - - -
-/dev/cusa2 c 640 0 0 205 7 - - -
-/dev/dsp c 660 0 29 14 3 - - -
-/dev/dsp1 c 660 0 29 14 19 - - -
-/dev/dsp2 c 660 0 29 14 35 - - -
-/dev/dsp3 c 660 0 29 14 51 - - -
-/dev/fb c 660 0 44 29 0 0 32 2
-/dev/fb0autodetect c 660 0 44 29 1 - - -
-/dev/fb0current c 660 0 44 29 0 - - -
-#/dev/fb1 c 660 0 44 29 32 - - -
-/dev/fb1autodetect c 660 0 44 29 33 - - -
-/dev/fb1current c 660 0 44 29 32 - - -
-/dev/full c 666 0 7 - - -
-/dev/hda b 660 0 6 3 0 - - -
-/dev/hda b 660 0 6 3 1 1 1 20
-/dev/hdb b 660 0 6 3 64 - - -
-/dev/hdb b 660 0 6 3 65 1 1 20
-/dev/hdc b 660 0 6 22 0 - - -
-/dev/hdc b 660 0 6 22 1 1 1 20
-/dev/initctl p 600 0 0 - - - -
-/dev/i2c0 c 660 0 0 89 0 - - -
-/dev/inportbm c 660 0 0 10 2 - - -
-/dev/input/event c 660 0 0 13 64 0 1 20
-/dev/ircomm0 c 640 0 0 161 0 - - -
-/dev/jbm c 660 0 0 10 4 - - -
-/dev/kmem c 640 0 15 1 2 - - -
-/dev/leds c 660 0 0 126 0 - - -
-#/dev/lirc c 660 0 5 61 0 - - -
-/dev/logibm c 660 0 0 10 0 - - -
-/dev/loop0 b 660 0 11 7 0 - - -
-/dev/loop1 b 660 0 11 7 1 - - -
-/dev/mem c 640 0 15 1 1 - - -
-/dev/mixer c 666 0 0 14 0 - - -
-/dev/mixer1 c 666 0 0 14 16 - - -
-/dev/mixer2 c 666 0 0 14 32 - - -
-/dev/mixer3 c 666 0 0 14 48 - - -
-/dev/mmcda b 640 0 0 60 0 - - -
-/dev/mmcda1 b 640 0 0 60 1 - - -
-/dev/mmcda2 b 640 0 0 60 2 - - -
-/dev/msys/fla b 660 0 11 100 0 - - -
-/dev/msys/fla1 b 660 0 11 100 1 - - -
-/dev/msys/fla2 b 660 0 11 100 2 - - -
-/dev/msys/fla3 b 660 0 11 100 3 - - -
-/dev/msys/fla4 b 660 0 11 100 4 - - -
-/dev/msys/flb b 660 0 11 100 64 - - -
-/dev/msys/flb1 b 660 0 11 100 65 - - -
-/dev/msys/flb2 b 660 0 11 100 66 - - -
-/dev/msys/flb3 b 660 0 11 100 67 - - -
-/dev/msys/flb4 b 660 0 11 100 68 - - -
-/dev/mtd c 660 0 6 90 0 0 2 8
-/dev/mtdblock b 640 0 0 31 0 0 1 8
-/dev/nst0 c 664 0 11 9 128 - - -
-/dev/nst0a c 664 0 11 9 224 - - -
-/dev/nst0l c 664 0 11 9 160 - - -
-/dev/nst0m c 664 0 11 9 192 - - -
-/dev/nst1 c 664 0 11 9 129 - - -
-/dev/nst1a c 664 0 11 9 225 - - -
-/dev/nst1l c 664 0 11 9 161 - - -
-/dev/nst1m c 664 0 11 9 193 - - -
-/dev/null c 666 0 0 1 3 - - -
-/dev/par0 c 660 0 7 6 0 - - -
-/dev/par1 c 660 0 7 6 1 - - -
-/dev/par2 c 660 0 7 6 2 - - -
-/dev/pbuttons c 660 0 0 61 0 - - -
-/dev/port c 640 0 15 1 4 - - -
-/dev/ppp c 640 0 0 108 0 - - -
-/dev/psaux c 660 0 0 10 1 - - -
-/dev/ptmx c 666 0 5 5 2 - - -
-/dev/ptya0 c 660 0 5 2 176 - - -
-/dev/ptya1 c 660 0 5 2 177 - - -
-/dev/ptya2 c 660 0 5 2 178 - - -
-/dev/ptya3 c 660 0 5 2 179 - - -
-/dev/ptya4 c 660 0 5 2 180 - - -
-/dev/ptya5 c 660 0 5 2 181 - - -
-/dev/ptya6 c 660 0 5 2 182 - - -
-/dev/ptya7 c 660 0 5 2 183 - - -
-/dev/ptya8 c 660 0 5 2 184 - - -
-/dev/ptya9 c 660 0 5 2 185 - - -
-/dev/ptyaa c 660 0 5 2 186 - - -
-/dev/ptyab c 660 0 5 2 187 - - -
-/dev/ptyac c 660 0 5 2 188 - - -
-/dev/ptyad c 660 0 5 2 189 - - -
-/dev/ptyae c 660 0 5 2 190 - - -
-/dev/ptyaf c 660 0 5 2 191 - - -
-/dev/ram b 640 0 0 1 0 0 1 4
-/dev/random c 444 0 0 1 8 - - -
-/dev/rbuttons c 660 0 0 60 0 - - -
-/dev/rfcomm c 666 0 0 216 0 0 1 4
-/dev/rmidi0 c 660 0 0 35 64 - - -
-/dev/rmidi1 c 660 0 0 35 65 - - -
-/dev/rmidi2 c 660 0 0 35 66 - - -
-/dev/rmidi3 c 660 0 0 35 67 - - -
-/dev/rtc c 660 0 47 10 135 - - -
-/dev/scd0 b 660 0 6 11 0 - - -
-/dev/scd1 b 660 0 6 11 1 - - -
-/dev/sda b 660 0 6 8 0 - - -
-/dev/sda1 b 660 0 6 8 1 - - -
-/dev/sda2 b 660 0 6 8 2 - - -
-/dev/sda3 b 660 0 6 8 3 - - -
-/dev/sda4 b 660 0 6 8 4 - - -
-/dev/sda5 b 660 0 6 8 5 - - -
-/dev/sda6 b 660 0 6 8 6 - - -
-/dev/sda7 b 660 0 6 8 7 - - -
-/dev/sda8 b 660 0 6 8 8 - - -
-/dev/sda9 b 660 0 6 8 9 - - -
-/dev/sdb b 660 0 6 8 16 - - -
-/dev/sdb1 b 660 0 6 8 17 - - -
-/dev/sdb2 b 660 0 6 8 18 - - -
-/dev/sdb3 b 660 0 6 8 19 - - -
-/dev/sdb4 b 660 0 6 8 20 - - -
-/dev/sdb5 b 660 0 6 8 21 - - -
-/dev/sdb6 b 660 0 6 8 22 - - -
-/dev/sdb7 b 660 0 6 8 23 - - -
-/dev/sdb8 b 660 0 6 8 24 - - -
-/dev/sdb9 b 660 0 6 8 25 - - -
-/dev/sdc b 660 0 6 8 32 - - -
-/dev/sdc1 b 660 0 6 8 33 - - -
-/dev/sdc2 b 660 0 6 8 34 - - -
-/dev/sdc3 b 660 0 6 8 35 - - -
-/dev/sdc4 b 660 0 6 8 36 - - -
-/dev/sdc5 b 660 0 6 8 37 - - -
-/dev/sdc6 b 660 0 6 8 38 - - -
-/dev/sdc7 b 660 0 6 8 39 - - -
-/dev/sdc8 b 660 0 6 8 40 - - -
-/dev/sdc9 b 660 0 6 8 41 - - -
-/dev/sd_slotstat c 660 0 6 10 240 - - -
-#/dev/sharp_audioctl c 660 0 29 10 213 - - -
-#/dev/sharp_buz c 660 0 29 10 211 - - -
-#/dev/sharp_kbdctl c 660 0 45 10 214 - - -
-#/dev/sharp_led c 660 0 48 10 210 - - -
-#/dev/sharp_ts c 640 0 45 11 0 - - -
-/dev/smtpe0 c 640 0 0 35 128 - - -
-/dev/smtpe1 c 640 0 0 35 129 - - -
-/dev/smtpe2 c 640 0 0 35 130 - - -
-/dev/smtpe3 c 640 0 0 35 131 - - -
-/dev/sndstat c 660 0 29 14 6 - - -
-/dev/st0 c 660 0 11 9 0 - - -
-/dev/st0a c 660 0 11 9 96 - - -
-/dev/st0l c 660 0 11 9 32 - - -
-/dev/st0m c 660 0 11 9 64 - - -
-/dev/st1 c 660 0 11 9 1 - - -
-/dev/st1a c 660 0 11 9 97 - - -
-/dev/st1l c 660 0 11 9 33 - - -
-/dev/st1m c 660 0 11 9 65 - - -
-/dev/tty c 666 0 5 5 0 - - -
-/dev/tty c 666 0 5 4 0 0 1 9
-/dev/ttyS c 640 0 5 4 64 0 1 4
-/dev/ttySA c 640 0 5 204 5 0 1 4
-/dev/ttyUSB c 660 0 5 188 0 0 1 2
-/dev/urandom c 644 0 0 1 9 - - -
-/dev/usbmouse c 640 0 45 10 32 - - -
-/dev/video c 644 0 0 81 0 0 1 4
-/dev/zero c 644 0 0 1 5 - - -
-/dev/input/mice c 660 0 0 13 63 - - -
+++ /dev/null
-#
-# Patch to allow /dev to reside permanently in the file
-# system.
-#
---- old/devices 2005-05-28 21:51:39.012078699 -0700
-+++ new/devices 2005-06-12 00:16:29.222686303 -0700
-@@ -6,7 +6,7 @@
- . /etc/default/rcS
-
- # exit without doing anything if udev is active
--if test -e /dev/.udevdb; then
-+if test -e /dev/.udevdb -o -e /dev/.permanent; then
- exit 0
- fi
-
-@@ -37,12 +37,20 @@
- mknod /dev/ppp c 108 0
- if test "$VERBOSE" != "no"; then echo "done"; fi
- else
-- if test "$VERBOSE" != "no"; then echo -n "Mounting /dev ramdisk: "; fi
-- mount -t ramfs ramfs /dev || mount -t tmpfs ramfs /dev
-- if test $? -ne 0; then
-- if test "$VERBOSE" != "no"; then echo "failed"; fi
-+ if test -e /dev/.noram
-+ then
-+ # There should be no files, any files will damage the
-+ # makedevs script below.
-+ rm $(find /dev -type f -print)
-+ :>/dev/.noram
- else
-- if test "$VERBOSE" != "no"; then echo "done"; fi
-+ if test "$VERBOSE" != "no"; then echo -n "Mounting /dev ramdisk: "; fi
-+ mount -t ramfs ramfs /dev || mount -t tmpfs ramfs /dev
-+ if test $? -ne 0; then
-+ if test "$VERBOSE" != "no"; then echo "failed"; fi
-+ else
-+ if test "$VERBOSE" != "no"; then echo "done"; fi
-+ fi
- fi
- if test "$VERBOSE" != "no"; then echo -n "Populating /dev: "; fi
- cd /
-@@ -60,6 +68,10 @@
- if test "$VERBOSE" != "no"; then echo "failed"; fi
- else
- if test "$VERBOSE" != "no"; then echo "done"; fi
-+ if test -e /dev/.noram
-+ then
-+ :>/dev/.permanent
-+ fi
- fi
- fi
-
+++ /dev/null
-#
-# domainname.sh Set the domainname.
-#
-test -r /etc/defaultdomain &&
- cat /etc/defaultdomain >/proc/sys/kernel/domainname
+++ /dev/null
-#
-# Ensure that the root file system is remounted with the correct
-# options from fstab
-#
---- old/checkroot.sh 2005-05-28 19:30:55.488975598 -0700
-+++ new/checkroot.sh 2005-05-28 19:31:32.334390450 -0700
-@@ -149,7 +149,7 @@
- # is on a ro fs until the remount succeeded. Then clean up old mtabs
- # and finally write the new mtab.
- #
--mount -n -o remount,$rootmode /
-+mount -n -o remount,$rootopts /
- if test "$rootmode" = rw
- then
- if test ! -L /etc/mtab
+++ /dev/null
-#! /bin/sh
-#
-# umountfs Turn off swap and unmount all local filesystems.
-#
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-# Ensure /proc is mounted
-test -r /proc/mounts || mount -t proc proc /proc
-
-echo "Deactivating swap..."
-swapoff -a
-
-# We leave /proc mounted, the umount of /dev/devpts seems to fail
-# quite frequently, the busybox umount apparently gives up at the
-# first failure, so it is necessary to go file system by file
-# system. It is necessary to go backward in the /proc list, because
-# later things may have been mounted on earlier mounts.
-devfs=
-unmount() {
- local dev mp type opts
- if read dev mp type opts
- then
- # recurse - unmount later items
- unmount
- # skip /proc and /dev but not the sub-directories
- case "$mp" in
- /|/proc)return 0;;
- /dev) devfs=1
- return 0;;
- esac
- # then unmount this, if possible, otherwise make
- # it read-only
- umount -f -r "$mp"
- fi
-}
-
-echo "Unmounting local filesystems..."
-unmount </proc/mounts
-
-# now /dev and read-only / (halt/reboot may need /proc!)
-test -n "$devfs" && umount -f -r /dev
-mount -o remount,ro /
+++ /dev/null
-#! /bin/sh
-#
-# umountnfs.sh Unmount all network filesystems.
-#
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-# Write a reboot record to /var/log/wtmp before unmounting
-halt -w
-
-# Ensure /proc is mounted
-test -r /proc/mounts || mount -t proc proc /proc
-
-echo "Unmounting remote filesystems..."
-
-#
-# Read the list of mounted file systems and -f umount the
-# known network file systems. -f says umount it even if
-# the server is unreachable. Do not attempt to umount
-# the root file system. Unmount in reverse order from
-# that given by /proc/mounts (otherwise it may not work).
-#
-unmount() {
- local dev mp type opts
- if read dev mp type opts
- then
- # recurse - unmount later items
- unmount
- # skip /, /proc and /dev
- case "$mp" in
- /|/proc)return 0;;
- /dev) return 0;;
- esac
- # then unmount this, if nfs
- case "$type" in
- nfs|smbfs|ncpfs) umount -f "$mp";;
- esac
- fi
-}
-
-unmount </proc/mounts
--- /dev/null
+#!/bin/sh
+#
+# How to handle alignment faults on the ARM
+#
+# 0 - ignore, the value will probably be rotated
+# 1 - warn, a log message will be output
+# 2 - fixup, the kernel will do an expensive aligned read
+# 3 - fixup+warn
+# 4 - signal, the process will get an illegal instruction fault
+# 5 - signal+warn
+# 6 - invalid (has no effect)
+# 7 - invalid (has no effect)
+#
+# Set ALIGN in /etc/default/rcS to override (do not edit this
+# file!) Set ALIGN to empty to avoid changing the kernel
+# default (currently '0').
+ALIGN=1
+. /etc/default/rcS
+test -e /proc/cpu/alignment -a -n "$ALIGN" -a "$ALIGN" -ge 0 -a "$ALIGN" -lt 6 &&
+ echo "$ALIGN" >/proc/cpu/alignment
--- /dev/null
+#!/bin/sh
+#NOTE: this script may execute with absolutely nothing
+# in /dev
+echo "SlugOS booting..."
--- /dev/null
+#/dev/ d 775 0 0 - - - - -
+#/dev/msys d 775 0 0 - - - - -
+#/dev/pts d 775 0 0 - - - - -
+#/var d 775 0 0 - - - - -
+/boot/var/empty d 755 0 3 - - - -
+/dev/apm_bios c 660 0 46 10 134 - - -
+/dev/audio c 660 0 29 14 4 - - -
+/dev/audio1 c 660 0 29 14 20 - - -
+/dev/audio2 c 660 0 29 14 36 - - -
+/dev/audio3 c 660 0 29 14 52 - - -
+#/dev/bty c 644 0 0 60 0 0 1 5
+/dev/buzzer c 660 0 0 62 0 - - -
+#/dev/sharp_fl c 640 0 44 254 0 - - -
+/dev/console c 662 0 5 5 1 - -
+/dev/cusa0 c 640 0 0 205 5 - - -
+/dev/cusa1 c 640 0 0 205 6 - - -
+/dev/cusa2 c 640 0 0 205 7 - - -
+/dev/dsp c 660 0 29 14 3 - - -
+/dev/dsp1 c 660 0 29 14 19 - - -
+/dev/dsp2 c 660 0 29 14 35 - - -
+/dev/dsp3 c 660 0 29 14 51 - - -
+/dev/fb c 660 0 44 29 0 0 32 2
+/dev/fb0autodetect c 660 0 44 29 1 - - -
+/dev/fb0current c 660 0 44 29 0 - - -
+#/dev/fb1 c 660 0 44 29 32 - - -
+/dev/fb1autodetect c 660 0 44 29 33 - - -
+/dev/fb1current c 660 0 44 29 32 - - -
+/dev/full c 666 0 7 - - -
+/dev/hda b 660 0 6 3 0 - - -
+/dev/hda b 660 0 6 3 1 1 1 20
+/dev/hdb b 660 0 6 3 64 - - -
+/dev/hdb b 660 0 6 3 65 1 1 20
+/dev/hdc b 660 0 6 22 0 - - -
+/dev/hdc b 660 0 6 22 1 1 1 20
+/dev/initctl p 600 0 0 - - - -
+/dev/i2c0 c 660 0 0 89 0 - - -
+/dev/inportbm c 660 0 0 10 2 - - -
+/dev/input/event c 660 0 0 13 64 0 1 20
+/dev/ircomm0 c 640 0 0 161 0 - - -
+/dev/jbm c 660 0 0 10 4 - - -
+/dev/kmem c 640 0 15 1 2 - - -
+/dev/leds c 660 0 0 126 0 - - -
+#/dev/lirc c 660 0 5 61 0 - - -
+/dev/logibm c 660 0 0 10 0 - - -
+/dev/loop0 b 660 0 11 7 0 - - -
+/dev/loop1 b 660 0 11 7 1 - - -
+/dev/mem c 640 0 15 1 1 - - -
+/dev/mixer c 666 0 0 14 0 - - -
+/dev/mixer1 c 666 0 0 14 16 - - -
+/dev/mixer2 c 666 0 0 14 32 - - -
+/dev/mixer3 c 666 0 0 14 48 - - -
+/dev/mmcda b 640 0 0 60 0 - - -
+/dev/mmcda1 b 640 0 0 60 1 - - -
+/dev/mmcda2 b 640 0 0 60 2 - - -
+/dev/msys/fla b 660 0 11 100 0 - - -
+/dev/msys/fla1 b 660 0 11 100 1 - - -
+/dev/msys/fla2 b 660 0 11 100 2 - - -
+/dev/msys/fla3 b 660 0 11 100 3 - - -
+/dev/msys/fla4 b 660 0 11 100 4 - - -
+/dev/msys/flb b 660 0 11 100 64 - - -
+/dev/msys/flb1 b 660 0 11 100 65 - - -
+/dev/msys/flb2 b 660 0 11 100 66 - - -
+/dev/msys/flb3 b 660 0 11 100 67 - - -
+/dev/msys/flb4 b 660 0 11 100 68 - - -
+/dev/mtd c 660 0 6 90 0 0 2 8
+/dev/mtdblock b 640 0 0 31 0 0 1 8
+/dev/nst0 c 664 0 11 9 128 - - -
+/dev/nst0a c 664 0 11 9 224 - - -
+/dev/nst0l c 664 0 11 9 160 - - -
+/dev/nst0m c 664 0 11 9 192 - - -
+/dev/nst1 c 664 0 11 9 129 - - -
+/dev/nst1a c 664 0 11 9 225 - - -
+/dev/nst1l c 664 0 11 9 161 - - -
+/dev/nst1m c 664 0 11 9 193 - - -
+/dev/null c 666 0 0 1 3 - - -
+/dev/par0 c 660 0 7 6 0 - - -
+/dev/par1 c 660 0 7 6 1 - - -
+/dev/par2 c 660 0 7 6 2 - - -
+/dev/pbuttons c 660 0 0 61 0 - - -
+/dev/port c 640 0 15 1 4 - - -
+/dev/ppp c 640 0 0 108 0 - - -
+/dev/psaux c 660 0 0 10 1 - - -
+/dev/ptmx c 666 0 5 5 2 - - -
+/dev/ptya0 c 660 0 5 2 176 - - -
+/dev/ptya1 c 660 0 5 2 177 - - -
+/dev/ptya2 c 660 0 5 2 178 - - -
+/dev/ptya3 c 660 0 5 2 179 - - -
+/dev/ptya4 c 660 0 5 2 180 - - -
+/dev/ptya5 c 660 0 5 2 181 - - -
+/dev/ptya6 c 660 0 5 2 182 - - -
+/dev/ptya7 c 660 0 5 2 183 - - -
+/dev/ptya8 c 660 0 5 2 184 - - -
+/dev/ptya9 c 660 0 5 2 185 - - -
+/dev/ptyaa c 660 0 5 2 186 - - -
+/dev/ptyab c 660 0 5 2 187 - - -
+/dev/ptyac c 660 0 5 2 188 - - -
+/dev/ptyad c 660 0 5 2 189 - - -
+/dev/ptyae c 660 0 5 2 190 - - -
+/dev/ptyaf c 660 0 5 2 191 - - -
+/dev/ram b 640 0 0 1 0 0 1 4
+/dev/random c 444 0 0 1 8 - - -
+/dev/rbuttons c 660 0 0 60 0 - - -
+/dev/rfcomm c 666 0 0 216 0 0 1 4
+/dev/rmidi0 c 660 0 0 35 64 - - -
+/dev/rmidi1 c 660 0 0 35 65 - - -
+/dev/rmidi2 c 660 0 0 35 66 - - -
+/dev/rmidi3 c 660 0 0 35 67 - - -
+/dev/rtc c 660 0 47 10 135 - - -
+/dev/scd0 b 660 0 6 11 0 - - -
+/dev/scd1 b 660 0 6 11 1 - - -
+/dev/sda b 660 0 6 8 0 - - -
+/dev/sda1 b 660 0 6 8 1 - - -
+/dev/sda2 b 660 0 6 8 2 - - -
+/dev/sda3 b 660 0 6 8 3 - - -
+/dev/sda4 b 660 0 6 8 4 - - -
+/dev/sda5 b 660 0 6 8 5 - - -
+/dev/sda6 b 660 0 6 8 6 - - -
+/dev/sda7 b 660 0 6 8 7 - - -
+/dev/sda8 b 660 0 6 8 8 - - -
+/dev/sda9 b 660 0 6 8 9 - - -
+/dev/sdb b 660 0 6 8 16 - - -
+/dev/sdb1 b 660 0 6 8 17 - - -
+/dev/sdb2 b 660 0 6 8 18 - - -
+/dev/sdb3 b 660 0 6 8 19 - - -
+/dev/sdb4 b 660 0 6 8 20 - - -
+/dev/sdb5 b 660 0 6 8 21 - - -
+/dev/sdb6 b 660 0 6 8 22 - - -
+/dev/sdb7 b 660 0 6 8 23 - - -
+/dev/sdb8 b 660 0 6 8 24 - - -
+/dev/sdb9 b 660 0 6 8 25 - - -
+/dev/sdc b 660 0 6 8 32 - - -
+/dev/sdc1 b 660 0 6 8 33 - - -
+/dev/sdc2 b 660 0 6 8 34 - - -
+/dev/sdc3 b 660 0 6 8 35 - - -
+/dev/sdc4 b 660 0 6 8 36 - - -
+/dev/sdc5 b 660 0 6 8 37 - - -
+/dev/sdc6 b 660 0 6 8 38 - - -
+/dev/sdc7 b 660 0 6 8 39 - - -
+/dev/sdc8 b 660 0 6 8 40 - - -
+/dev/sdc9 b 660 0 6 8 41 - - -
+/dev/sd_slotstat c 660 0 6 10 240 - - -
+#/dev/sharp_audioctl c 660 0 29 10 213 - - -
+#/dev/sharp_buz c 660 0 29 10 211 - - -
+#/dev/sharp_kbdctl c 660 0 45 10 214 - - -
+#/dev/sharp_led c 660 0 48 10 210 - - -
+#/dev/sharp_ts c 640 0 45 11 0 - - -
+/dev/smtpe0 c 640 0 0 35 128 - - -
+/dev/smtpe1 c 640 0 0 35 129 - - -
+/dev/smtpe2 c 640 0 0 35 130 - - -
+/dev/smtpe3 c 640 0 0 35 131 - - -
+/dev/sndstat c 660 0 29 14 6 - - -
+/dev/st0 c 660 0 11 9 0 - - -
+/dev/st0a c 660 0 11 9 96 - - -
+/dev/st0l c 660 0 11 9 32 - - -
+/dev/st0m c 660 0 11 9 64 - - -
+/dev/st1 c 660 0 11 9 1 - - -
+/dev/st1a c 660 0 11 9 97 - - -
+/dev/st1l c 660 0 11 9 33 - - -
+/dev/st1m c 660 0 11 9 65 - - -
+/dev/tty c 666 0 5 5 0 - - -
+/dev/tty c 666 0 5 4 0 0 1 9
+/dev/ttyS c 640 0 5 4 64 0 1 4
+/dev/ttySA c 640 0 5 204 5 0 1 4
+/dev/ttyUSB c 660 0 5 188 0 0 1 2
+/dev/urandom c 644 0 0 1 9 - - -
+/dev/usbmouse c 640 0 45 10 32 - - -
+/dev/video c 644 0 0 81 0 0 1 4
+/dev/zero c 644 0 0 1 5 - - -
+/dev/input/mice c 660 0 0 13 63 - - -
--- /dev/null
+#
+# Patch to allow /dev to reside permanently in the file
+# system.
+#
+--- old/devices 2005-05-28 21:51:39.012078699 -0700
++++ new/devices 2005-06-12 00:16:29.222686303 -0700
+@@ -6,7 +6,7 @@
+ . /etc/default/rcS
+
+ # exit without doing anything if udev is active
+-if test -e /dev/.udevdb; then
++if test -e /dev/.udevdb -o -e /dev/.permanent; then
+ exit 0
+ fi
+
+@@ -37,12 +37,20 @@
+ mknod /dev/ppp c 108 0
+ if test "$VERBOSE" != "no"; then echo "done"; fi
+ else
+- if test "$VERBOSE" != "no"; then echo -n "Mounting /dev ramdisk: "; fi
+- mount -t ramfs ramfs /dev || mount -t tmpfs ramfs /dev
+- if test $? -ne 0; then
+- if test "$VERBOSE" != "no"; then echo "failed"; fi
++ if test -e /dev/.noram
++ then
++ # There should be no files, any files will damage the
++ # makedevs script below.
++ rm $(find /dev -type f -print)
++ :>/dev/.noram
+ else
+- if test "$VERBOSE" != "no"; then echo "done"; fi
++ if test "$VERBOSE" != "no"; then echo -n "Mounting /dev ramdisk: "; fi
++ mount -t ramfs ramfs /dev || mount -t tmpfs ramfs /dev
++ if test $? -ne 0; then
++ if test "$VERBOSE" != "no"; then echo "failed"; fi
++ else
++ if test "$VERBOSE" != "no"; then echo "done"; fi
++ fi
+ fi
+ if test "$VERBOSE" != "no"; then echo -n "Populating /dev: "; fi
+ cd /
+@@ -60,6 +68,10 @@
+ if test "$VERBOSE" != "no"; then echo "failed"; fi
+ else
+ if test "$VERBOSE" != "no"; then echo "done"; fi
++ if test -e /dev/.noram
++ then
++ :>/dev/.permanent
++ fi
+ fi
+ fi
+
--- /dev/null
+#
+# domainname.sh Set the domainname.
+#
+test -r /etc/defaultdomain &&
+ cat /etc/defaultdomain >/proc/sys/kernel/domainname
--- /dev/null
+#
+# Ensure that the root file system is remounted with the correct
+# options from fstab
+#
+--- old/checkroot.sh 2005-05-28 19:30:55.488975598 -0700
++++ new/checkroot.sh 2005-05-28 19:31:32.334390450 -0700
+@@ -149,7 +149,7 @@
+ # is on a ro fs until the remount succeeded. Then clean up old mtabs
+ # and finally write the new mtab.
+ #
+-mount -n -o remount,$rootmode /
++mount -n -o remount,$rootopts /
+ if test "$rootmode" = rw
+ then
+ if test ! -L /etc/mtab
--- /dev/null
+#! /bin/sh
+#
+# umountfs Turn off swap and unmount all local filesystems.
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# Ensure /proc is mounted
+test -r /proc/mounts || mount -t proc proc /proc
+
+echo "Deactivating swap..."
+swapoff -a
+
+# We leave /proc mounted, the umount of /dev/devpts seems to fail
+# quite frequently, the busybox umount apparently gives up at the
+# first failure, so it is necessary to go file system by file
+# system. It is necessary to go backward in the /proc list, because
+# later things may have been mounted on earlier mounts.
+devfs=
+unmount() {
+ local dev mp type opts
+ if read dev mp type opts
+ then
+ # recurse - unmount later items
+ unmount
+ # skip /proc and /dev but not the sub-directories
+ case "$mp" in
+ /|/proc)return 0;;
+ /dev) devfs=1
+ return 0;;
+ esac
+ # then unmount this, if possible, otherwise make
+ # it read-only
+ umount -f -r "$mp"
+ fi
+}
+
+echo "Unmounting local filesystems..."
+unmount </proc/mounts
+
+# now /dev and read-only / (halt/reboot may need /proc!)
+test -n "$devfs" && umount -f -r /dev
+mount -o remount,ro /
--- /dev/null
+#! /bin/sh
+#
+# umountnfs.sh Unmount all network filesystems.
+#
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# Write a reboot record to /var/log/wtmp before unmounting
+halt -w
+
+# Ensure /proc is mounted
+test -r /proc/mounts || mount -t proc proc /proc
+
+echo "Unmounting remote filesystems..."
+
+#
+# Read the list of mounted file systems and -f umount the
+# known network file systems. -f says umount it even if
+# the server is unreachable. Do not attempt to umount
+# the root file system. Unmount in reverse order from
+# that given by /proc/mounts (otherwise it may not work).
+#
+unmount() {
+ local dev mp type opts
+ if read dev mp type opts
+ then
+ # recurse - unmount later items
+ unmount
+ # skip /, /proc and /dev
+ case "$mp" in
+ /|/proc)return 0;;
+ /dev) return 0;;
+ esac
+ # then unmount this, if nfs
+ case "$type" in
+ nfs|smbfs|ncpfs) umount -f "$mp";;
+ esac
+ fi
+}
+
+unmount </proc/mounts
+++ /dev/null
-# OpenSlug specific stuff for the init scripts.
-#
-# This is, in effect, an extended patch to fix various
-# problems in the initscripts on OpenSlug. The problems
-# mostly come down to the order the scripts are executed
-# in.
-include initscripts_${PV}.bb
-
-MAINTAINER = "John Bowler <jbowler@acm.org>"
-RCONFLICTS = "initscripts"
-# All other standard definitions inherited from initscripts
-# Except the PR which is hacked here. The format used is
-# a suffix
-PR := "${PR}.3"
-
-FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
-
-PACKAGES = "${PN}"
-
-SRC_URI += "file://alignment.sh"
-SRC_URI += "file://domainname.sh"
-SRC_URI += "file://rootopts.patch;patch=1"
-SRC_URI += "file://devices.patch;patch=1"
-
-# Without this it is not possible to patch checkroot.sh
-S = "${WORKDIR}"
-
-do_install_append() {
- install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
- install -m 0755 ${WORKDIR}/domainname.sh ${D}${sysconfdir}/init.d
-
- # Remove the do install links (this detects a change to the
- # initscripts .bb file - it will cause a build failure here.)
- # This is a copy of the ln -sf lines from the initscripts
- # do_install.
- rm ${D}${sysconfdir}/rc2.d/S99rmnologin
- rm ${D}${sysconfdir}/rc3.d/S99rmnologin
- rm ${D}${sysconfdir}/rc4.d/S99rmnologin
- rm ${D}${sysconfdir}/rc5.d/S99rmnologin
- rm ${D}${sysconfdir}/rc6.d/S20sendsigs
-# rm ${D}${sysconfdir}/rc6.d/S30urandom
- rm ${D}${sysconfdir}/rc6.d/S31umountnfs.sh
-# rm ${D}${sysconfdir}/rc6.d/S40umountfs
- rm ${D}${sysconfdir}/rcS.d/S30ramdisk
- rm ${D}${sysconfdir}/rc6.d/S90reboot
- rm ${D}${sysconfdir}/rc0.d/S20sendsigs
-# rm ${D}${sysconfdir}/rc0.d/S30urandom
- rm ${D}${sysconfdir}/rc0.d/S31umountnfs.sh
-# rm ${D}${sysconfdir}/rc0.d/S40umountfs
- rm ${D}${sysconfdir}/rc0.d/S90halt
- rm ${D}${sysconfdir}/rcS.d/S02banner
- rm ${D}${sysconfdir}/rcS.d/S10checkroot.sh
-# rm ${D}${sysconfdir}/rcS.d/S30checkfs.sh
- rm ${D}${sysconfdir}/rcS.d/S35mountall.sh
- rm ${D}${sysconfdir}/rcS.d/S39hostname.sh
- rm ${D}${sysconfdir}/rcS.d/S45mountnfs.sh
- rm ${D}${sysconfdir}/rcS.d/S55bootmisc.sh
-# rm ${D}${sysconfdir}/rcS.d/S55urandom
- rm ${D}${sysconfdir}/rcS.d/S99finish
- rm ${D}${sysconfdir}/rcS.d/S05devices
- # udev will run at S04 if installed
- rm ${D}${sysconfdir}/rcS.d/S03sysfs
- rm ${D}${sysconfdir}/rcS.d/S38devpts.sh
-# rm ${D}${sysconfdir}/rcS.d/S06alignment
-
- # Check the result
- find ${D}${sysconfdir}/rc?.d ! -type d -print | {
- status=0
- while read d
- do
- oenote "initscripts-openslug: unexpected link $f"
- status = 1
- done
- test $status -eq 0 ||
- oefatal "initscripts-openslug: new links break do_install"
- }
-
- # Set the run-level links
- #
- # Startup (S) links - UNCHANGED
- #
- # Keep these in order of startup - S, then 1, 2-5, 0,6
- # according to the level in which the script starts (or stops) first.
- update-rc.d -r ${D} banner start 2 S .
- update-rc.d -r ${D} sysfs.sh start 3 S .
- # udev runs at S 04 .
- update-rc.d -r ${D} devices start 5 S .
- update-rc.d -r ${D} alignment.sh start 7 S .
- # busybox hwclock.sh (openslug-init) starts here (08)
- # openslug-init umountinitrd runs here (09)
-
- update-rc.d -r ${D} checkroot.sh start 10 S .
- # openslug buffer syslog starts here (11)
- # sysconfsetup runs at S 12
- # modutils.sh runs at S 20
- # checkfs.sh is currently disabled from S 30 (and won't work on OpenSlug)
- # ramdisk is not used on OpenSlug, would run at S 30
- update-rc.d -r ${D} mountall.sh start 35 S .
- # base-files populate-volatile.sh runs at S37
- update-rc.d -r ${D} devpts.sh start 38 S .
- # openslug file syslog starts here (39)
-
- # set hostname and domainname before the network script works (by
- # entering them at level 40), networking may reset them.
- update-rc.d -r ${D} domainname.sh start 40 S .
- update-rc.d -r ${D} hostname.sh start 40 S .
- # network runs at S 40
- # openslug network syslog starts here (44)
- update-rc.d -r ${D} mountnfs.sh start 45 S .
-
- update-rc.d -r ${D} bootmisc.sh start 55 S .
- # urandom is currently disabled from S 55 (and won't work with tmpfs /var)
-
- # ipkg-cl configure runs at S 98
- update-rc.d -r ${D} finish start 99 S .
-
- #
- # User (2-5) links - UNCHANGED
- # rmnologin is the only thing added to user levels
- update-rc.d -r ${D} rmnologin start 99 2 3 4 5 .
-
- #
- # Shutdown (0,6) links - !!!CHANGED!!!
- #
- # The problem here is that netbase installs K40networking but portmap
- # installs S32portmap. One of these has to change! The safe change
- # is to make the networking stop at S40, so all network related shutdown
- # must be in a K script or <S40.
- #
- # S20sendsigs is a disaster. It needs to happen before the umounts
- # but after the portmapper (which it would otherwise kill).
- #
- # urandom would stop at (S)30
-
- # This is the special, correct, openslug umountnfs.sh (it looks in
- # the /proc/mounts information, not /etc/fstab)
- update-rc.d -r ${D} umountnfs.sh start 31 0 6 .
- # portmap stops at 32
- # openslug network syslog stops here (39)
- # networking stops at 40 (nothing else does, believe me.)
-
- # busybox hwclock.sh (openslug-init) stops here (45)
- # openslug file syslog stops here (47)
- # openslug buffer syslog stops here (49)
- # Remove any errant processes
- update-rc.d -r ${D} sendsigs start 60 0 6 .
-
- # This is the special, correct, openslug umountfs, it will umount
- # any network file systems which failed to umount before.
- update-rc.d -r ${D} umountfs start 70 0 6 .
-
- update-rc.d -r ${D} halt start 90 0 .
- update-rc.d -r ${D} reboot start 90 6 .
-}
--- /dev/null
+# SlugOS specific stuff for the init scripts.
+#
+# This is, in effect, an extended patch to fix various
+# problems in the initscripts on SlugOS. The problems
+# mostly come down to the order the scripts are executed
+# in.
+include initscripts_${PV}.bb
+
+MAINTAINER = "John Bowler <jbowler@acm.org>"
+RCONFLICTS = "initscripts"
+# All other standard definitions inherited from initscripts
+# Except the PR which is hacked here. The format used is
+# a suffix
+PR := "${PR}.4"
+
+FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/${P}', '${FILE_DIRNAME}/initscripts-${PV}', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}"
+
+PACKAGES = "${PN}"
+
+SRC_URI += "file://alignment.sh"
+SRC_URI += "file://domainname.sh"
+SRC_URI += "file://rootopts.patch;patch=1"
+SRC_URI += "file://devices.patch;patch=1"
+
+# Without this it is not possible to patch checkroot.sh
+S = "${WORKDIR}"
+
+do_install_append() {
+ install -m 0755 ${WORKDIR}/alignment.sh ${D}${sysconfdir}/init.d
+ install -m 0755 ${WORKDIR}/domainname.sh ${D}${sysconfdir}/init.d
+
+ # Remove the do install links (this detects a change to the
+ # initscripts .bb file - it will cause a build failure here.)
+ # This is a copy of the ln -sf lines from the initscripts
+ # do_install.
+ rm ${D}${sysconfdir}/rc2.d/S99rmnologin
+ rm ${D}${sysconfdir}/rc3.d/S99rmnologin
+ rm ${D}${sysconfdir}/rc4.d/S99rmnologin
+ rm ${D}${sysconfdir}/rc5.d/S99rmnologin
+ rm ${D}${sysconfdir}/rc6.d/S20sendsigs
+# rm ${D}${sysconfdir}/rc6.d/S30urandom
+ rm ${D}${sysconfdir}/rc6.d/S31umountnfs.sh
+# rm ${D}${sysconfdir}/rc6.d/S40umountfs
+ rm ${D}${sysconfdir}/rcS.d/S30ramdisk
+ rm ${D}${sysconfdir}/rc6.d/S90reboot
+ rm ${D}${sysconfdir}/rc0.d/S20sendsigs
+# rm ${D}${sysconfdir}/rc0.d/S30urandom
+ rm ${D}${sysconfdir}/rc0.d/S31umountnfs.sh
+# rm ${D}${sysconfdir}/rc0.d/S40umountfs
+ rm ${D}${sysconfdir}/rc0.d/S90halt
+ rm ${D}${sysconfdir}/rcS.d/S02banner
+ rm ${D}${sysconfdir}/rcS.d/S10checkroot.sh
+# rm ${D}${sysconfdir}/rcS.d/S30checkfs.sh
+ rm ${D}${sysconfdir}/rcS.d/S35mountall.sh
+ rm ${D}${sysconfdir}/rcS.d/S39hostname.sh
+ rm ${D}${sysconfdir}/rcS.d/S45mountnfs.sh
+ rm ${D}${sysconfdir}/rcS.d/S55bootmisc.sh
+# rm ${D}${sysconfdir}/rcS.d/S55urandom
+ rm ${D}${sysconfdir}/rcS.d/S99finish
+ rm ${D}${sysconfdir}/rcS.d/S05devices
+ # udev will run at S04 if installed
+ rm ${D}${sysconfdir}/rcS.d/S03sysfs
+ rm ${D}${sysconfdir}/rcS.d/S38devpts.sh
+# rm ${D}${sysconfdir}/rcS.d/S06alignment
+
+ # Check the result
+ find ${D}${sysconfdir}/rc?.d ! -type d -print | {
+ status=0
+ while read d
+ do
+ oenote "initscripts-slugos: unexpected link $f"
+ status = 1
+ done
+ test $status -eq 0 ||
+ oefatal "initscripts-slugos: new links break do_install"
+ }
+
+ # Set the run-level links
+ #
+ # Startup (S) links - UNCHANGED
+ #
+ # Keep these in order of startup - S, then 1, 2-5, 0,6
+ # according to the level in which the script starts (or stops) first.
+ update-rc.d -r ${D} banner start 2 S .
+ update-rc.d -r ${D} sysfs.sh start 3 S .
+ # udev runs at S 04 .
+ update-rc.d -r ${D} devices start 5 S .
+ update-rc.d -r ${D} alignment.sh start 7 S .
+ # busybox hwclock.sh (slugos-init) starts here (08)
+ # slugos-init umountinitrd runs here (09)
+
+ update-rc.d -r ${D} checkroot.sh start 10 S .
+ # slugos buffer syslog starts here (11)
+ # sysconfsetup runs at S 12
+ # modutils.sh runs at S 20
+ # checkfs.sh is currently disabled from S 30 (and won't work on SlugOS)
+ # ramdisk is not used on SlugOS, would run at S 30
+ update-rc.d -r ${D} mountall.sh start 35 S .
+ # base-files populate-volatile.sh runs at S37
+ update-rc.d -r ${D} devpts.sh start 38 S .
+ # slugos file syslog starts here (39)
+
+ # set hostname and domainname before the network script works (by
+ # entering them at level 40), networking may reset them.
+ update-rc.d -r ${D} domainname.sh start 40 S .
+ update-rc.d -r ${D} hostname.sh start 40 S .
+ # network runs at S 40
+ # slugos network syslog starts here (44)
+ update-rc.d -r ${D} mountnfs.sh start 45 S .
+
+ update-rc.d -r ${D} bootmisc.sh start 55 S .
+ # urandom is currently disabled from S 55 (and won't work with tmpfs /var)
+
+ # ipkg-cl configure runs at S 98
+ update-rc.d -r ${D} finish start 99 S .
+
+ #
+ # User (2-5) links - UNCHANGED
+ # rmnologin is the only thing added to user levels
+ update-rc.d -r ${D} rmnologin start 99 2 3 4 5 .
+
+ #
+ # Shutdown (0,6) links - !!!CHANGED!!!
+ #
+ # The problem here is that netbase installs K40networking but portmap
+ # installs S32portmap. One of these has to change! The safe change
+ # is to make the networking stop at S40, so all network related shutdown
+ # must be in a K script or <S40.
+ #
+ # S20sendsigs is a disaster. It needs to happen before the umounts
+ # but after the portmapper (which it would otherwise kill).
+ #
+ # urandom would stop at (S)30
+
+ # This is the special, correct, slugos umountnfs.sh (it looks in
+ # the /proc/mounts information, not /etc/fstab)
+ update-rc.d -r ${D} umountnfs.sh start 31 0 6 .
+ # portmap stops at 32
+ # slugos network syslog stops here (39)
+ # networking stops at 40 (nothing else does, believe me.)
+
+ # busybox hwclock.sh (slugos-init) stops here (45)
+ # slugos file syslog stops here (47)
+ # slugos buffer syslog stops here (49)
+ # Remove any errant processes
+ update-rc.d -r ${D} sendsigs start 60 0 6 .
+
+ # This is the special, correct, slugos umountfs, it will umount
+ # any network file systems which failed to umount before.
+ update-rc.d -r ${D} umountfs start 70 0 6 .
+
+ update-rc.d -r ${D} halt start 90 0 .
+ update-rc.d -r ${D} reboot start 90 6 .
+}
-DEPENDS = openslug-image
\ No newline at end of file
+DEPENDS = slugos-image
\ No newline at end of file
-DEPENDS = openslug-packages
+DEPENDS = slugos-packages
# conf/distro/slugos.conf to get the standard settings).
#
LICENSE = "MIT"
-PR = "r16"
+PR = "r17"
PROVIDES += "${SLUGOS_IMAGENAME}-image"
-#FIXME: backward compatibility with the master makefile
-PROVIDES += "openslug-image"
# SLUGOS_IMAGENAME defines the name of the image to be build, if it
# is not set this package will be skipped!
# absolute minimum to have any chance of a bootable system.
DEPENDS = "${SLUGOS_IMAGE_DEPENDS} \
virtual/kernel base-files base-passwd \
- busybox dropbear hotplug-ng initscripts-openslug netbase \
+ busybox dropbear hotplug-ng initscripts-slugos netbase \
sysvinit tinylogin portmap \
- virtual/ixp-eth openslug-init \
+ virtual/ixp-eth slugos-init \
module-init-tools modutils-initscripts \
ipkg-collateral ipkg ipkg-link \
${SLUGOS_SUPPORT} \
${SLUGOS_NATIVE_DEPENDS}"
IPKG_INSTALL = "base-files base-passwd \
- busybox dropbear hotplug-ng initscripts-openslug netbase \
+ busybox dropbear hotplug-ng initscripts-slugos netbase \
update-modules sysvinit tinylogin portmap \
- ${PREFERRED_PROVIDER_virtual/ixp-eth} openslug-init \
+ ${PREFERRED_PROVIDER_virtual/ixp-eth} slugos-init \
module-init-tools modutils-initscripts \
ipkg-collateral ipkg ipkg-link \
${SLUGOS_SUPPORT} \
# they do not necessarily work.
DESCRIPTION = "Packages that are compatible with the SlugOS firmware"
LICENSE = "MIT"
-PR = "r2"
+PR = "r3"
CONFLICTS = "db3"
PROVIDES += "${SLUGOS_IMAGENAME}-packages"
-#FIXME: backward compatibility with the master makefile
-PROVIDES += "openslug-packages"
EXCLUDE_FROM_WORLD = "1"
INHIBIT_DEFAULT_DEPS = "1"
+++ /dev/null
-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
+++ /dev/null
-#!/bin/sh
-# boot from the hard disk 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
-#
-# Load the helper functions
-. /etc/default/functions
-#
-if test -n "$1"
-then
- device="$1"
- shift
- echo "boot: rootfs: mount $* $device"
- #
- # wait if required
- test "$sleep" -gt 0 && sleep "$sleep"
- #
- # Mount read-write because before exec'ing init
- # this script creates the '.recovery' link to
- # detect failed boot. No file type is given to
- if mount "$@" "$device" /mnt
- then
- # checkmount checks for sh, init and no
- # .recovery plus either mnt or initrd
- if checkmount /mnt && :>/mnt/.recovery
- then
- # sync to ensure .recovery is written
- sync
- # pivot to /initrd if available, else /mnt
- cd /
- if test -d /mnt/initrd
- then
- swivel mnt initrd
- else
- swivel mnt mnt
- fi
- # swivel failed
- fi
- # Failure: unmount the partition
- umount /mnt
- fi
-fi
-# fallback - use the flash boot
-exec /boot/flash
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/sh
-# boot from the hard disk 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
-#
-# Load the helper functions
-. /etc/default/functions
-#
-if test -n "$1"
-then
- device="$1"
- shift
- echo "boot: rootfs: mount $* $device"
- #
- # prepare the device. This uses tmpfs to avoid dependency
- # on non-built-in file systems and because tmpfs can expand
- # to bigger than the 10MByte ram0 partition used before.
- # The 'device' is currently unused.
- if mount -t tmpfs "$@" tmpfs /mnt
- then
- cd /
- # filter out boot (with zimage), linuxrc and anything
- # below /var, keep dev or the boot will fail (note that
- # nothing is mounted this early in the bootstrap).
- find . -mount -print |
- sed '\@^./boot/@d;\@^./boot$@d;\@^./linuxrc@d;\@^./var/@d' |
- cpio -p -d -m -u /mnt
- # checkmount checks for sh, init and no .recovery plus
- # either mnt or initrd, mnt must exist!
- if checkmount /mnt
- then
- # pivot to /mnt
- cd /
- swivel mnt mnt
- # swivel failed
- fi
- # Failure: unmount the partition.
- umount /mnt
- fi
-fi
-# fallback - use the flash boot
-exec /boot/flash
+++ /dev/null
-#!/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
+++ /dev/null
-# conffiles
-# Known OpenSlug configuration files. These files are preserved on
-# a flash upgrade. Other configuration files, found from:
-#
-# /usr/lib/ipkg/*.conffiles
-# /etc/*.conf
-#
-# are preserved too with an operation of 'diff' if they have been
-# changed since /etc/.configured was created.
-#
-# Lines starting with # are comments, other lines have
-# two fields:
-#
-# operation file
-#
-# The file must *NOT* have a leading /
-#
-# operation may be:
-# ignore Do not preserve this file
-# preserve Preserve this file unconditionally
-# diff Compare file with the new version, ask if different
-#
-preserve linuxrc
-preserve etc/.configured
-preserve etc/TZ
-diff etc/default/conffiles
-diff etc/default/devpts
-diff etc/default/rcS
-preserve etc/default/sysconf
-diff etc/default/usbd
-preserve etc/defaultdomain
-preserve etc/dropbear/dropbear_dss_host_key
-preserve etc/dropbear/dropbear_rsa_host_key
-preserve etc/fstab
-preserve etc/group
-preserve etc/gshadow
-preserve etc/hostname
-preserve etc/hosts
-preserve etc/localtime
-ignore etc/modules
-ignore etc/modules.conf
-preserve etc/motd
-preserve etc/network/interfaces
-preserve etc/ntp.drift
-preserve etc/passwd
-preserve etc/profile
-preserve etc/resolv.conf
-preserve etc/shadow
-preserve etc/syslog.conf
-preserve etc/timezone
+++ /dev/null
-# . this file to load the following utility functions
-#
-# mtdev "name"
-# return (output) the character device name for flash parition "name"
-# /proc/mtd has the general form:
-# dev: size erasesize name
-# mtd5: 00020000 00020000 "FIS directory"
-# use this rather than hard-wiring the device because the partition
-# table can change - looking in /proc/mtd is more reliable.
-mtdev(){
- sed -n 's!^\(mtd[0-9][0-9]*\):[^"]*"'"$1"'"$!/dev/\1!p' /proc/mtd
-}
-#
-# mtblockdev "name"
-# as mtdev but output the name of the block (not character) device
-mtblockdev(){
- sed -n 's!^mtd\([0-9][0-9]*\):[^"]*"'"$1"'"$!/dev/mtdblock\1!p' /proc/mtd
-}
-#
-# mtsize "name"
-# the size of the partition as a hexadecimal value (with 0x at the front)
-mtsize(){
- sed -n 's!^mtd[0-9][0-9]*: \([^ ]*\)[^"]*"'"$1"'"$!0x\1!p' /proc/mtd
-}
-#
-# sysvalmatch "section" "name" 'pattern' "configuration file"
-# sysvalof "section" "name" "configuration file"
-# sysval "section" "name"
-# outputs the value of the SysConf variable 'name' from section 'section',
-# this is a bit gross, when it gets a match it copies the value to the
-# hold space, if no match it jumps over the copy, at the end ($) it copies
-# the hold space to the pattern space and prints the result, thus it only
-# ever prints the last match
-# BUG FIX: busybox sed doesn't initialise the hold space and crashes if it
-# is used before initialisation, so temporarily this script does it's own
-# tail by hand.
-# NOTE: these functions should only be used internally, add entries to 'config'
-# below if necessary. This is because 'config' does the defaulting and in the
-# recovering case (zero or absent SysConf) /etc/default/sysconf only contains
-# the hw_addr entry!
-sysvalmatch(){
- # sed -n '/^\['"$1"'\]$/,/^\[.*\]$/s/^'"$2"'=\('"$3"'\)$/\1/;tH;bE;:H;h;:E;$g;$p' "$4"
- sed -n '/^\['"$1"'\]$/,/^\[.*\]$/s/^'"$2"'=\('"$3"'\)$/\1/p' "$4" | sed -n '$p'
-}
-sysvalof(){
- sysvalmatch "$1" "$2" '.*' "$3"
-}
-sysval(){
- sysvalof "$1" "$2" /etc/default/sysconf
-}
-#
-# config "value"
-# convenience callers for specific values to avoid mis-typing in scripts
-# NOTE: this function does the defaulting, 'sysval' does not! Validity
-# of the sysconf file is determined by the presence of the all important
-# hw_addr.
-config(){
- local mac
- mac=
- test -r /etc/default/sysconf &&
- mac="$(sysvalmatch network hw_addr '[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]' /etc/default/sysconf)"
- if test -n "$mac"
- then
- case "$1" in
- mac) echo "$mac";;
- host) if test -n "$(sysval network disk_server_name)"
- then
- sysval network disk_server_name
- elif test -n "$(sysval network default_server_name)"
- then
- sysval network default_server_name
- else
- echo "$mac" | sed -n 's/^..:..:..:\(..\):\(..\):\(..\)$/LKG\1\2\3/p'
- fi;;
- domain) sysval network w_d_name;;
- iface) if test -n "$(sysval network lan_interface)"
- then
- sysval network lan_interface
- else
- echo eth0
- fi;;
- ip) if test -n "$(sysval network ip_addr)"
- then
- sysval network ip_addr
- else
- echo 192.168.1.77
- fi;;
- netmask)sysval network netmask;;
- gateway)sysval network gateway;;
- dns) sysval network dns_server1;;
- dns2) sysval network dns_server2;;
- dns3) sysval network dns_server3;;
- boot) if test -n "$(sysval network bootproto)"
- then
- sysval network bootproto
- else
- echo dhcp
- fi;;
- valid) return 0;;
- *) return 1;;
- esac
- else
- # These are the defaults for an invalid mac address, use the compiled
- # in hardware address.
- case "$1" in
- mac) echo "00:02:B3:02:02:01";;
- host) echo "brokenslug";;
- iface) echo eth0;;
- ip) echo 192.168.1.77;;
- boot) echo dhcp;;
- *) return 1;;
- esac
- fi
-}
-#
-# checkif "iface"
-# Validate an interface name by making sure that it exists
-# in /proc/net/dev (and is not lo). The listing outputs the
-# interface followed by a :, the check function looks for
-# something of the form '$1[a-zA-Z0-9]*:' and outputs the
-# part preceding the ':'
-checkif(){
- sed -n '/^[ ]*lo:/d;s/^[ ]*\('"$1"'[a-zA-Z0-9]*\):.*$/\1/p;tE;d;:E;q' /proc/net/dev
-}
-#
-# checkmount "mountpoint"
-# tests an already mounted mountpoint to see whether to attempt to
-# boot with this as root. Returns success if it appears ok.
-checkmount(){
- # basic test for init (the kernel will try to load this)
- # but require a shell in bin/sh and no .recovery too
- test \( ! -f "$1/.recovery" \) -a \
- \( -d "$1/initrd" -o -d "$1/mnt" \) -a \
- \( -x "$1/bin/sh" -o -h "$1/bin/sh" \) -a \
- \( -x "$1/sbin/init" -o -h "$1/sbin/init" -o \
- -x "$1/etc/init" -o -h "$1/etc/init" -o \
- -x "$1/bin/init" -o -h "$1/bin/init" \)
-}
-#
-# swivel "new root" "old root"
-# NOTE: the arguments must be paths relative to /, bad things
-# will happen if the arguments themselves start with /
-# Pivot to a new root. This does all the fancy pivot_root stuff
-# including closing streams and does a umount /proc - it doesn't
-# matter if this fails (failure codes are ignored), but if /proc
-# was mounted it must be restored by the caller on return.
-# Normally this function never returns!
-# On return 0,1,2 are connected to /dev/console - this may not
-# have been true before!
-swivel() {
- cd "$1"
- exec <&- >&- 2>&-
- # This is just-in-case the called mounted /proc and was
- # unable to close it because of the streams
- umount /proc 2>/dev/null
- if pivot_root . "$2"
- then
- # everything must move out of the old root, this process
- # is $2/bin/sh so it must die, IO is redirected
- # just in case - typically it will be to a device so it
- # won't hold the old root open.
- # the exec here is the first point at which the old root
- # is unused - before the exec regardless of the close of
- # 0,1,2 above ash still has *this* shell script open!
- # (it's on fd 10).
- # init closes all file descriptors, there's no point
- # supplying it with fds.
- # NOTE: this used to use $2/usr/sbin/chroot, however on
- # linux / is already . when the command is executed
- # therefore it is essential to use the local (new root)
- # chroot to ensure it gets the correct shared libraries.
- exec usr/sbin/chroot . bin/sh -c "\
- test -x sbin/init && exec sbin/init
- test -x etc/init && exec etc/init
- test -x bin/init && exec bin/init
- leds -A +gr1 '!g1'
- sleep 10 >/.recovery
- sync;sync;sync
- exit 1"
- fi
- #
- # recovery - must restore the old root
- cd "$2"
- sbin/pivot_root . "$1"
- # cd is back to $1 - either pivot_root doesn't change it and the
- # chroot above was not executed, or pivot_root does change it and
- # has just changed it back!
- exec <>/dev/console >&0 2>&0
-}
-#
-# ifup "interface"
-# bring that interface up with the configured ip and other
-# information
-ifup(){
- local ip hostname router subnet iface HOSTNAME NETMASK BROADCAST
-
- iface="$1"
- ip="$(config ip)"
- hostname="$(config host)"
- router="$(config gateway)"
- broadcast=
-
- if test -n "$ip"
- then
- # only if an ip was specified
- subnet="$(config netmask)"
- else
- ip=192.168.1.77
- fi
-
- # First try udhcpc - note that the /boot/udhcpc.script
- # simply records the values returned and the udhcpc
- # is not left running so this will only work for
- # the lease length time!
- ifconfig "$iface" up
- if test "$(config boot)" != static
- then
- test -n "$hostname" && HOSTNAME="-H $hostname"
- # The script writes the required shell variable assignments
- # to file descriptor 9
- eval $(udhcpc -i "$iface" -n -q -r "$ip" $HOSTNAME -s /boot/udhcpc.script 9>&1 >/dev/null)
- fi
-
- test -n "$broadcast" && BROADCAST="broadcast $broadcast"
- test -n "$subnet" && NETMASK="netmask $subnet"
-
- if ifconfig "$iface" "$ip" $NETMASK $BROADCAST
- then
- for route in $router
- do
- route add default gw "$route" dev "$iface"
- done
- return 0
- else
- ifconfig "$iface" down
- return 1
- fi
-}
-#
-# ifdown "interface"
-# take the interface down
-ifdown(){
- ifconfig "$1" down
-}
-#
-# mountflash "flash device" "flash root directory" {mount options}
-# Finds and mounts the flash file system on the given directory
-mountflash() {
- local ffsdev ffsdir
-
- ffsdev="$1"
- test -n "$ffsdev" -a -b "$ffsdev" || {
- echo "$0: unable to find flash file system to copy ($ffsdev)" >&2
- return 1
- }
- shift
-
- ffsdir="$1"
- test -n "$ffsdir" -a -d "$ffsdir" || {
- echo "$0: mountflash $ffsdir: not a directory (internal error)" >&2
- return 1
- }
- shift
-
- mount -t jffs2 "$@" "$ffsdev" "$ffsdir" || {
- echo "$0: $ffsdev: unable to mount flash file system on $ffsdir" >&2
- return 1
- }
- return 0
-}
-#
-# umountflash [-r] "flash device"
-# unmount any instance of the given flash device, if -r is specified a mount on
-# root is an error, otherwise a mount on root is ignored (and remains).
-umountflash() {
- local rootok ffsno ffsdev
- rootok=1
- case "$1" in
- -r) rootok=
- shift;;
- esac
- #
- # The argument is ffsdev
- ffsdev="$1"
- ffsno="$(devio "<<$ffsdev" prd)"
- test -n "$ffsno" -a "$ffsno" -ge 0 || {
- echo "$0: $ffsdev: device number $ffsno is not valid, cannot continue." >&2
- return 1
- }
- #
- # Make sure that Flashdisk isn't mounted on /
- if test -z "$rootok" -a "$(devio "<</etc/init.d/sysconfsetup" prd)" -eq "$ffsno"
- then
- echo "$0: $ffsdev is mounted on /, use turnup ram" >&2
- return 1
- fi
- #
- # The function is currently always used interactively, so output
- echo "$0: umounting any existing mount of $ffsdev" >&2
- #
- # check each mount point, do this last first because otherwise nested
- # mounts of ffsdev cannot be umounted.
- ffs_umount() {
- local device mp type options stuff
-
- read device mp type options stuff
- test -z "$device" && return 0
-
- # handle following entries first
- ffs_umount || return 1
-
- # handle this entry, since this is currently only used for unmounting
- # the flash root partition we know a file which must exist...
- case "$mp/$type" in
- //jffs2);; # skip /
- */jffs2)test "$(devio "<<$mp/etc/init.d/sysconfsetup" prd 2>/dev/null)" -ne "$ffsno" ||
- umount "$mp" || {
- echo "$0: $mp: unable to umount $ffsdev" >&2
- return 1
- };;
- esac
-
- return 0
- }
- #
- ffs_umount </proc/mounts || {
- echo "$0: umount $ffsdev from all mount points then re-run reflash" >&2
- return 1
- }
-
- return 0
-}
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/sh
-# Run to remove /.recovery if the boot seems to have succeeded
-test -e /.recovery && rm -f /.recovery
-exit 0
+++ /dev/null
-#!/bin/sh
-# This script is run once when the system first boots. Its sole
-# purpose is to create /etc/default/sysconf (the overall system
-# configuration file) and other files derived from this.
-#
-# The script runs immediately after S10checkroot.sh - this is the
-# point at which the rootfs will be mounted rw even if the kernel
-# booted with it ro.
-#
-# rm or mv the file to run this again. If this is done the
-# following configuration files will be rewritten:
-#
-# /etc/default/sysconf
-# /etc/hostname
-# /etc/defaultdomain
-# /etc/network/interfaces
-# /etc/resolv.conf
-#
-# /etc/default/functions contains useful utility functions - it's
-# in a separate file so that it can be loaded by any script
-. /etc/default/functions
-#
-config valid && test "$1" != reload && exit 0
-#
-# Utility to deal with absence of DNS configuration
-echodns(){
- local dns
- if test $# -gt 0
- then
- for dns in "$@"
- do
- echo "nameserver $dns"
- done
- fi
-}
-#
-# The SysConf device must exist in /dev at this point for this script
-# to work.
-#
-# It is important not to hard-wire the name of the device because of
-# the posibility of changing the flash partition layout.
-#
-# The block device is used here because at present udev does not
-# show the character devices
-sysdev=
-config valid || sysdev="$(mtblockdev SysConf)"
-if test -n "$sysdev" -a -b "$sysdev"
-then
- # Read the defined part of SysConf into /etc/default/sysconf.
- # SysConf has lines of two forms:
- #
- # [section]
- # name=value
- #
- # In practice SysConf also contains other stuff, use the command:
- #
- # devio '<</dev/mtd1;cpb'
- #
- # to examine the current settings. The badly formatted stuff
- # is removed (to be exact, the sed script selects only lines
- # which match one of the two above). The lan interface, which
- # defaults to ixp0, is changed to the correct value for openslug,
- # eth0. The bootproto, which LinkSys sets to static in manufacturing,
- # is reset to dhcp if the IP is still the original (192.168.1.77)
- devio "<<$sysdev" cpb fb1,10 | sed -n '/^\[[^][]*\]$/p;
- s/^lan_interface=ixp0$/lan_interface=eth0/;
- /^ip_addr=192\.168\.1\.77$/,/^bootproto/s/^bootproto=static$/bootproto=dhcp/;
- /^[-a-zA-Z0-9_][-a-zA-Z0-9_]*=/p' >/etc/default/sysconf
- #
- # The SysConf must have a hardware id, if it doesn't it has
- # probably been erased or never set in the first place and the
- # hardware id is retrieved from the RedBoot partition. This is
- # the only thing which cannot be defaulted.
-fi
-#
-# Error recovery: no SysConf or invalid SysConf. Make a new one from the
-# RedBoot hardware ID information.
-# NOTE: this block of code overwrites the shell script arguments.
-config valid || {
- reddev="$(mtblockdev RedBoot)"
- initmac=
- if test -n "$reddev" -a -b "$reddev"
- then
- # The hardware id starts 80 bytes before the end of the
- # block, the block ends (or should end) with the signature
- # <4 bytes> sErCoMm <bytes> sErCoMm. Note that devio 'pf'
- # empties the stack.
- set -- $(devio "<<$reddev" '
- <= $80-
- .= @
- pf %02X
- A= 5
- $( 1
- A= @,A1-
- pf :%02X
- $) A
- pn
- <=f4+;cp7;pn
- <=$7-;cp7;pn')
- if test $# -eq 3 -a "$2" = sErCoMm -a "$3" = sErCoMm
- then
- initmac="$1"
- fi
- fi
- #
- # APEX: may need extra code to set initmac here.
- #
- if test -n "$initmac"
- then
- #
- # Generate a complete /etc/default/sysconf based on just
- # one number ;-)
- { echo '[network]'
- echo "hw_addr=$initmac"
- } >/etc/default/sysconf
- #
- # See /etc/default/functions (the config function) for
- # the derivation of the rest of the information.
- fi
-}
-#
-# The config function will now return the correct values - even if sysconf
-# is still missing. 'config valid' says if valid configuration information
-# is available.
-#
-# Set up the 'standard' files in the root file system (these couldn't be set
-# up before because they depend on stuff which RedBoot puts into SysConf from
-# the ID info on the specific machine - in particular the hardware address of
-# eth0, which must be the one assigned for *this* box!)
-#
-# HOSTNAME: defaults to LGK<mac> i.e. something derived from
-# the ethernet hardware. LinkSys documentation explains how
-# to determine this. Set by the user in linksys setup software.
-# DOMAINNAME: LinkSys puts this in w_d_name.
-test -n "$(config host)" && config host >/etc/hostname
-domain="$(config domain)"
-test -n "$domain" && echo "$domain" >/etc/defaultdomain
-#
-# Ethernet information. This goes into /etc/network/interfaces,
-# however this is only used for static setup (and this is not
-# the default). With dhcp the openslug udhcp script,
-# /etc/udhcpc.d/50default, loads the values from sysconf. The
-# lan_interface config value must exist for the file to be
-# overwritten here.
-iface="$(config iface)"
-if test -n "$iface"
-then
- boot="$(config boot)"
- # Only dhcp and static are supported at present - bootp
- # support requires installation of appropriate packages
- # dhcp is the fail-safe
- case "$boot" in
- dhcp|static) ;;
- *) boot=dhcp;;
- esac
- #
- mac="$(config mac)"
- ip="$(config ip)"
- netmask="$(config netmask)"
- gateway="$(config gateway)"
- {
- echo "# /etc/network/interfaces"
- echo "# configuration file for ifup(8), ifdown(8)"
- echo "#"
- echo "# The loopback interface"
- echo "auto lo"
- echo "iface lo inet loopback"
- echo "#"
- echo "# The NSLU2 built-in ethernet"
- echo "auto $iface"
- echo "# Automatically generated from /etc/default/sysconf"
- if config valid
- then
- echo "# The pre-up option must always be supplied, regardless"
- echo "# of configuration, to set the hardware correctly."
- echo "# Severe network problems may result if this option is"
- echo "# removed."
- c=
- else
- echo "# WARNING: improperly configured network interface."
- echo "# WARNING: the pre-up line must be corrected or severe"
- echo "# WARNING: network problems may result."
- c='#'
- mac='<WARNING: unknown hardware address>'
- fi
- echo "iface $iface inet $boot"
- echo "${c} pre-up ifconfig $iface hw ether $mac"
- # The following are ignored for DHCP but are harmless
- test -n "$ip" && echo " address $ip"
- test -n "$netmask" && echo " netmask $netmask"
- test -n "$gateway" && echo " gateway $gateway"
- } >/etc/network/interfaces
-fi
-#
-# The DNS server information gives up to three nameservers, but this
-# currently only binds in the first.
-{
- test -n "$domain" && echo "search $domain"
- echodns $(config dns) $(config dns1) $(config dns2)
-} >/etc/resolv.conf
-#
-# Invalid config must be handled, do this by hacking /etc/motd.
-if config valid
-then
- echo "Host name: $(config host)"
- echo "Host ID: $mac"
- echo "Network boot method: $boot"
- case "$boot" in
- static) echo "Host IP address: $ip";;
- esac
- echo "Use 'turnup init' to reset the configuration"
- echo "Use 'turnup disk|nfs -i <device> options to initialise a non-flash root"
- echo "Use 'turnup help' for more information"
-else
- echo "+=====================================================================+"
- echo "| +-----------------------+ |"
- echo "| | INITIALISATION FAILED | |"
- echo "| +-----------------------+ |"
- echo "| |"
- echo "| This machine has been booted with a temporary ethernet id |"
- echo "| The initialisation failed because the machine id was not available |"
- echo "| within the flash memory of the NSLU2. You must run: |"
- echo "| |"
- echo "| turnup init |"
- echo "| |"
- echo "| To correct this problem. Severe network problems may occur if this |"
- echo "| is not done. |"
- echo "+=====================================================================+"
-fi >/etc/motd
-
-exit 0
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/sh
-#
-# umount /mnt, which is where the initrd ends up mounted
-# if the directory /initrd is not present, if this fails
-# then the /initrd is mounted and we want to remount that
-# ro - this works round the shutdown -r hang problem
-umount /mnt 2>/dev/null || {
- # need the device for a remount
- . /etc/default/functions
- ffspart=Flashdisk
- ffsdev="$(mtblockdev $ffspart)"
- if test -n "$ffsdev" -a -b "$ffsdev"
- then
- mount -o remount,ro "$ffsdev" /initrd
- else
- echo "Flashdisk: $ffsdev: flash device not found" >&2
- fi
-}
+++ /dev/null
-#!/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 -gr +"$(colour "$runlevel")";;
-stop) leds -gr +"$(colour "$previous")" /"$(colour "$runlevel")";;
-*) echo "led change: $1: command ignored" >&2;;
-esac
-
-exit 0
+++ /dev/null
-
-#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);
-}
-
+++ /dev/null
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <errno.h>
- #include <string.h>
- #include <endian.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <sys/ioctl.h>
- #include "leds.h"
-
- static int leds;
- static int reset;
- static int verbose = 0;
- enum {
- off=0, on=1, blink, unknown, transition=unknown
- };
-
-
- void init_leds(void)
- {
- int i;
- if ((leds = open("/dev/leds", O_RDWR)) < 0) {
- int e1 = errno;
- if (e1 != ENOENT) {
-
- fprintf(stderr,"Error: Could not open LEDS device file '/dev/leds' : %s\n",
- strerror(e1));
- if(e1 == EACCES)
- fprintf(stderr,"Run as root\n");
- exit(1);
- }
- }
-
- if (verbose)
- printf("leds: initialized.\n");
- }
-
- void led_ioctl( int cmd, int num )
- {
- int i, st;
-
- if (ioctl(leds, cmd, num) < 0) {
- int e1 = errno;
- fprintf(stderr, "leds: ioctl(%d,%d): failed to set leds: %s\n",
- cmd, num, strerror(e1));
- exit(1);
- }
- }
-
- void led_set( int led, int state )
- {
- switch (state) {
- case off: if (!reset) led_ioctl(N2_LM_OFF, led); break;
- case on: led_ioctl(N2_LM_ON, led); break;
- case blink: /* Ensure any previous timer gets deleted first and that
- * the LED is in a well known state.
- */
- if (!reset) led_ioctl(N2_LM_OFF, led);
- led_ioctl(N2_LM_BLINK, led); break;
- }
- }
-
- int led( int ch ) {
- switch (ch) {
- case 'r': return LED_RS_RED;
- case 'g': return LED_RS_GRN;
- case '1': return LED_DISK1;
- case '2': return LED_DISK2;
- case 'A': reset = 1; return LED_ALL;
- default: fprintf(stderr, "leds: %c: unknown LED (use r,g,0,1 or A)\n", ch);
- exit(1);
- }
- }
-
- int main( int argc, char **argv )
- {
- /* Default: switch green on, red off (-A +g). */
- if (argc == 1) {
- verbose = 1;
- init_leds();
- led_ioctl(N2_LM_ALL_OFF, 0);
- led_ioctl(N2_LM_ON, LED_RS_GRN);
- } else {
- int i, alt=0, state[PHYS_LEDS];
- for(i=0; i<PHYS_LEDS; ++i)
- state[i] = unknown;
- reset = 0;
-
- while (--argc > 0) {
- char *arg = *++argv;
- int st;
- if (strcmp(arg, "-v") == 0) {
- ++verbose;
- continue;
- }
-
- switch (*arg) {
- case '+': st = on; break;
- case '-': st = off; break;
- case '!': st = blink; break;
- case '/': st = transition; break;
- default: fprintf(stderr, "leds: %c: unknown option\n", *arg);
- exit(1);
- }
-
- if (st != transition) {
- while (*++arg) {
- i = led(*arg);
- if (i == LED_ALL)
- for (i=0; i<PHYS_LEDS; ++i) state[i] = st;
- else
- state[i] = st;
- }
- } else {
- int done, newstate[PHYS_LEDS];
- for(i=0; i<PHYS_LEDS; ++i)
- newstate[i] = off;
- while (*++arg) {
- i = led(*arg);
- if (i == LED_ALL)
- for (i=0; i<PHYS_LEDS; ++i) newstate[i] = on;
- else
- newstate[i] = on;
- }
-
- /* Merge the newstate back in. This sets 'alt' if going
- * from an old state of just red to a new of just green
- * or vice versa (and this is the only way of getting
- * 'alt')
- */
- /* Blink anything which changes from off to on or from
- * on to off (this ignores anything already blinking).
- */
- for (done=i=0; i<PHYS_LEDS; ++i) {
- if (state[i] == !newstate[i]) {
- done = 1;
- state[i] = blink;
- }
- }
-
- /* Is anything (new) blinking? If it is then deal
- * with the red/green case - blinking red,green is
- * amber, is that what we want? This could be
- * improved by a better kernel interface - it would
- * be nice just to specify on/off times and a start
- * time for each LED.
- */
- if (done) {
- if (state[LED_RS_RED] == blink && state[LED_RS_GRN] == blink &&
- newstate[LED_RS_RED] == !newstate[LED_RS_GRN]) {
- /* Kernel bug: must switch off r and g first. */
- alt = 1;
- }
- } else {
- for (i=0; i<PHYS_LEDS; ++i) {
- if (newstate[i] == on) {
- state[i] = blink;
- }
- }
- }
- }
- }
-
- /* Go through the list making the required settings. 'alt' is
- * special. 'reset' means A was given and all the settings are
- * known.
- */
- init_leds();
- if (reset)
- led_ioctl(N2_LM_ALL_OFF, 0);
- if (alt) {
- /* Turn the leds off first to get to a known state. */
- led_set(LED_RS_GRN, off);
- led_set(LED_RS_RED, off);
- led_ioctl(N2_LM_ALT, LED_RS_RED);
- } else {
- /* KERNEL BUG: setting the green timer zaps the red behaviour
- * to toggle the green, therefore if red blink is set before
- * green blink no blink will happen!
- */
- led_set(LED_RS_GRN, state[LED_RS_GRN]);
- led_set(LED_RS_RED, state[LED_RS_RED]);
- }
- led_set(LED_DISK1, state[LED_DISK1]);
- led_set(LED_DISK2, state[LED_DISK2]);
- }
-
- return 0;
- }
+++ /dev/null
- void init_leds(void);
- void led_on(int);
- void led_off( int );
- void led_toggle(int num);
-
- // ioctls -- 'M" is used for sound cards...we don't got one so it seems safe
- #define N2_LM_OFF _IOW('M',32,long)
- #define N2_LM_ON _IOW('M',33,long)
- #define N2_LM_BLINK _IOW('M',34,long)
- #define N2_LM_ALT _IOW('M',35,long)
- #define N2_LM_ALL_ON _IO('M',36)
- #define N2_LM_ALL_OFF _IO('M',37)
-
- // The LED names for switches
- #define LED_RS_RED 0
- #define LED_RS_GRN 1
- #define LED_DISK1 2
- #define LED_DISK2 3
- #define LED_ALL 4
-
- #define PHYS_LEDS 4
+++ /dev/null
-# This file does not exist. Please do not ask the debian maintainer about it.
-# You may use it to do strange and wonderful things, at your risk.
-
-# The new RTC class does not create the /dev/rtc symlink, and udev rules don't get run for built-in modules.
-# So it looks like we have to do this here for the moment, until someone comes up with a better idea ...
-L rtc rtc0
+++ /dev/null
-#!/bin/sh
-
-# **** DO NOT EVEN THINK OF EDITING OR REMOVING THIS FILE ****
-# **** UNLESS YOU REALLY KNOW *EXACTLY* WHAT YOU ARE DOING. ****
-
-
-# Determine the desired rootfs based on user flag files.
-
-if [ -f /.ramdisk ] ; then
- /bin/echo "Preferred root device is /dev/ram0 (maintenence)"
- mounted=/mnt
- prefroot=maintenence
-elif [ -f /.sda1root ] ; then
- /bin/echo "Preferred root device is /dev/sda1 (disk 1)"
- mounted=/mnt
- prefroot=sda1
-elif [ -f /.sda2root ] ; then
- /bin/echo "Preferred root device is /dev/sda2 (disk 1)"
- mounted=/mnt
- prefroot=sda2
-elif [ -f /.sdb1root ] ; then
- /bin/echo "Preferred root device is /dev/sdb1 (disk 2)"
- mounted=/mnt
- prefroot=sdb1
-elif [ -f /.sdb2root ] ; then
- /bin/echo "Preferred root device is /dev/sdb2 (disk 2)"
- mounted=/mnt
- prefroot=sdb2
-elif [ -f /.nfsroot ] ; then
- /bin/echo "Preferred root device is NFS"
- mounted=/mnt
- prefroot=nfsroot
-else
- /bin/echo "Preferred root device is jffs2"
- mounted=
- prefroot=jffs2
-fi
-
-
-# Perform prepatory tasks, and determine whether the desired rootfs is viable.
-
-/bin/mount -t proc proc /proc
-
-if [ $prefroot = "sda1" -o $prefroot = "sda2" -o $prefroot = "sdb1" -o $prefroot = "sdb2" ] ; then
- /bin/echo "Sleeping 10sec while waiting for disk..."
- sleep 10
- /bin/mount -rt ext3 /dev/$prefroot /mnt
- if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
- -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
- /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..."
- else
- /bin/umount /mnt
- /bin/echo "Can't find valid rootfs on /dev/$prefroot, using jffs2 ..."
- mounted=
- prefroot=jffs2
- fi
-fi
-
-if [ $prefroot = "maintenence" ] ; then
- /bin/dd if=/dev/zero of=/dev/ram0 bs=1k count=12k 2>/dev/null
- /usr/bin/mke2fs -m 0 /dev/ram0 12288
- /bin/mount -t ext2 /dev/ram0 /mnt
- ( /usr/bin/find . -print0 -mount | /usr/bin/cpio -p -0 -d -m -u /mnt )
- /bin/rm -f /mnt/linuxrc
- /bin/cp /mnt/home/httpd/html/Management/upgrade.cgi /mnt/home/httpd/html/Management/upgrade-real.cgi
- /bin/echo "#!/bin/sh" > /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo >> /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo "/bin/mount -t ramfs none /upload -o size=8196 2>/dev/null" \
- >> /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo "/bin/dd if=/dev/zero of=/upload/free-ram bs=1k count=8k 2>/dev/null" \
- >> /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo "/bin/umount /upload 2>/dev/null" \
- >> /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo "exec /home/httpd/html/Management/upgrade-real.cgi" \
- >> /mnt/home/httpd/html/Management/upgrade.cgi
- /bin/echo "Root filesystem will be mounted from /dev/ram0 (a copy of /dev/mtdblock4) ..."
-fi
-
-if [ $prefroot = "nfsroot" ] ; then
-
- sysconflen=`/bin/dd if=/dev/mtd1 bs=4 count=1 2>/dev/null | /usr/bin/hexdump -n 6 -e '"%02d"'`
- ipaddr=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep ip_addr | sed -e s/ip_addr=//`
- netmask=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep netmask | sed -e s/netmask=//`
- gateway=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep gateway | sed -e s/gateway=//`
-
- /sbin/insmod ixp400
- /sbin/insmod ixp425_eth
- /sbin/ifconfig ixp0 up $ipaddr netmask $netmask
- /sbin/route add default gw $gateway
-
- /sbin/ifconfig lo up 127.0.0.1
-
- # The nfsrootloc and nfsrootopts vars can be overridden here.
- . /.nfsroot
-
- /bin/mount $nfsrootopts $nfsrootloc /mnt
-
- if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
- -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
- /bin/echo "Root filesystem will be mounted from an NFS root ..."
- mounted=/mnt
- else
- /bin/umount /mnt
- /bin/echo "Can't find valid NFS rootfs, using jffs2 ..."
- mounted=
- prefroot=jffs2
- fi
-fi
-
-if [ $prefroot = "jffs2" ] ; then
- /bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..."
- mounted=
-fi
-
-
-/bin/umount /proc
-
-# Pivot to the desired rootfs and run the initial executable.
-
-if [ -n "$mounted" ] ; then
-
- cd $mounted
-
- if [ -x ./sbin/init -o -L ./sbin/init ] ; then
- runboot=/sbin/init
- elif [ -x ./bin/init -o -L ./bin/init ] ; then
- runboot=/bin/init
- else
- runboot=/bin/sh
- fi
-
- /sbin/pivot_root . initrd
-
- exec /usr/sbin/chroot . $runboot < /dev/console 1> /dev/console 2> /dev/console
-
-else
-
- exec /sbin/init
-
-fi
-
-/bin/echo "Can't chroot to $prefroot, using jffs2 ..."
-exec /sbin/init
-
-# Last-resort fall-back - this should never be reached.
-/bin/sh
+++ /dev/null
-# Add an alias for eth0 to MODULE to cause the S40networking
-# init script to load the MODULE driver on the first boot
-alias eth0 MODULE
+++ /dev/null
-# Adding modules to be automatically loaded via update-modules
+++ /dev/null
-#!/bin/sh
-# reflash
-# ensure the flash disk is not mounted
-# save configuration files
-# update the kernel
-# update the flashdisk
-# restore the saved configuration files
-# the set of configuration files is described by
-# /etc/default/conffiles.
-#
-# /etc/default/functions contains useful utility functions
-. /etc/default/functions
-#
-# CHECKING FOR INPUT (ARGUMENTS ETC)
-# ----------------------------------
-#
-# find the kernel and the new flash file system, an image file can
-# be used to specify both images.
-ffsfile=
-kfile=
-imgfile=
-while test $# -gt 0
-do
- case "$1" in
- -k) shift
- test $# -gt 0 || {
- echo "reflash: -k: give the file containing the kernel image" >&2
- exit 1
- }
- kfile="$1"
- shift;;
- -[jr]) shift
- test $# -gt 0 || {
- echo "reflash: -j: give the file containing the root jffs2 image" >&2
- exit 1
- }
- ffsfile="$1"
- shift;;
- -i) shift
- test $# -gt 0 || {
- echo "reflash: -i: give the file containing the complete flash image" >&2
- exit 1
- }
- imgfile="$1"
- shift;;
- *) echo "reflash: usage: $0 [-k kernel] [-j rootfs] [-i image]" >&2
- echo " -k file: the new compressed kernel image ('zImage')" >&2
- echo " -j file: the new root file system (jffs2)" >&2
- echo " -i file: a complete flash image (gives both kernel and jffs2)" >&2
- echo " The current jffs2 will be umounted if mounted." >&2
- exit 1;;
- esac
-done
-#
-# Sanity check on the arguments
-if test -n "$imgfile" -a -n "$ffsfile" -a -n "$kfile"
-then
- echo "reflash: -k,-j,-i: specify at most two files" >&2
- echo " -i has both a kernel and rootfs, the kernel from -k and" >&2
- echo " the rootfs from -j override the one in the image (if given)" >&2
- exit 1
-elif test -z "$imgfile" -a -z "$ffsfile" -a -z "$kfile"
-then
- echo "reflash: -k,-j,-i: specify at least one file to flash" >&2
- exit 1
-fi
-#
-# Perform basic checks on the input (must exist, size must be ok).
-if test -n "$imgfile"
-then
- if test -r "$imgfile"
- then
- # read the partition table and from this find the offset
- # and size of Kernel and Flashdisk partitions. The following
- # devio command just dumps the partition table in a format
- # similar to /proc/mtd (but it outputs decimal values!)
- #NOTE: this uses a here document because this allows the while
- # loop to set the variables, a pipe would put the while in
- # a sub-shell and the variable settings would be lost. This
- # works in ash, no guarantees about other shells!
- while read size base name
- do
- case "$name" in
- Kernel) imgksize="$size"
- imgkoffset="$base";;
- Flashdisk)
- imgffssize="$size"
- imgffsoffset="$base";;
- esac
- done <<EOI
-$(devio "<<$imgfile" '
- <= $ 0x20000 -
- L= 0x1000
- $( 1
- # 0xff byte in name[0] ends the partition table
- $? @ 255 =
- # output size base name
- <= f15+
- .= b 0xfffffff &
- <= f4+
- .= b
- pf "%lu %lu "
- <= f28-
- cp 16
- pn
- <= f240+
- L= L256-
- $) L255>')
-EOI
- # check the result
- test "$imgksize" -gt 0 -a "$imgkoffset" -ge 0 || {
- echo "reflash: $imgfile: failed to find Kernel partition in image" >&2
- exit 1
- }
- # the kernel is after a 16 byte header which holds the
- # values length,0,0,0 Get the true size.
- ktmp="$(devio "<<$imgfile" "L=$imgksize" "O=$imgkoffset" '
- $( OL+$>!
- <= O
- A= b
- $( AL>!
- pr A
- $) 0
- $) 0')"
- test "$ktmp" -gt 0 || {
- echo "reflash: $imgfile($imgkoffset,$imgksize): invalid kernel offset/size" >&2
- exit 1
- }
- # update the size and offset to these values (the offset is 16+ because
- # of the header).
- imgksize="$ktmp"
- imgkoffset="$(devio "O=$imgkoffset" 'pr O16+')"
- # just test the size for the rootfs
- test "$imgffssize" -gt 0 -a "$imgffsoffset" -ge 0 || {
- echo "reflash: $imgfile: failed to find Flashdisk" >&2
- exit 1
- }
- else
- echo "reflash: $imgfile: image file not found" >&2
- exit 1
- fi
-fi
-if test -n "$kfile"
-then
- if test ! -r "$kfile"
- then
- echo "reflash: $kfile: kernel file not found" >&2
- exit 1
- fi
- # the file values override anything from the image.
- imgksize="$(devio "<<$kfile" 'pr$')"
- imgkoffset=0
-else
- kfile="$imgfile"
-fi
-if test -n "$ffsfile"
-then
- if test ! -r "$ffsfile"
- then
- echo "reflash: $ffsfile: root file system image file not found" >&2
- exit 1
- fi
- # values override those from the image
- imgffssize="$(devio "<<$ffsfile" 'pr$')"
- imgffsoffset=0
-else
- ffsfile="$imgfile"
-fi
-#
-# INPUTS OK, CHECKING THE ENVIRONMENT
-# -----------------------------------
-# basic setup. This could be parameterised to use different partitions!
-kpart=Kernel
-ffspart=Flashdisk
-#
-kdev=
-ksize=0
-if test -n "$kfile"
-then
- # we have a new kernel
- kdev="$(mtblockdev $kpart)"
- test -n "$kdev" -a -b "$kdev" || {
- echo "reflash: $kpart($kdev): cannot find $kpart mtd partition." >&2
- echo " check /proc/mtd, either the partition does not exist or there is no" >&2
- echo " corresponding block device." >&2
- exit 1
- }
- ksize="$(devio "<<$kdev" 'pr$')"
- #
- # check the input file size
- test -n "$imgksize" -a "$imgksize" -gt 0 -a "$imgksize" -le "$ksize" || {
- echo "reflash: $kfile: bad Kernel size ($s, max $ksize)" >&2
- exit 1
- }
-fi
-#
-ffsdev=
-ffssize=0
-if test -n "$ffsfile"
-then
- ffsdev="$(mtblockdev $ffspart)"
- test -n "$ffsdev" -a -b "$ffsdev" || {
- echo "reflash: $ffspart($ffsdev): cannot find $ffspart mtd partition." >&2
- echo " check /proc/mtd, either the partition does not exist or there is no" >&2
- echo " corresponding block device." >&2
- exit 1
- }
- ffssize="$(devio "<<$ffsdev" 'pr$')"
- #
- # check the input file size
- test -n "$imgffssize" -a "$imgffssize" -gt 0 -a "$imgffssize" -le "$ffssize" || {
- echo "reflash: $ffsfile: bad Flashdisk size ($s, max $ffssize)" >&2
- exit 1
- }
-fi
-
-#
-# INPUTS OK, ENVIRONMENT OK, UMOUNT ANY EXISTING MOUNT OF THE FLASHDISK
-# ---------------------------------------------------------------------
-# This is only required if the device is going to be used
-if test -n "$ffsdev"
-then
- # -r causes this to fail if the flash device is mounted on /
- umountflash -r "$ffsdev" || exit 1
- #
- # Everything is umounted, now remount on a temporary directory.
- ffsdir="/tmp/flashdisk.$$"
- mkdir "$ffsdir" || {
- echo "reflash: $ffsdir: failed to create temporary directory" >&2
- exit 1
- }
- #
- mountflash "$ffsdev" "$ffsdir" -o ro || {
- rmdir "$ffsdir"
- exit 1
- }
- #
- # this is a utility function to make the cleanup easier
- errorexit() {
- umount "$ffsdir" && rmdir "$ffsdir" ||
- echo "reflash: $ffsdir: temporary directory cleanup failed" >&2
- exit 1
- }
- #
- test -r "$ffsdir/etc/default/conffiles" || {
- echo "reflash: [/initrd]/etc/default/conffiles: file not found" >&2
- errorexit
- }
-else
- errorexit() {
- exit 1
- }
-fi
-#
-# PRESERVE EXISTING CONFIGURATION
-# -------------------------------
-# Only required if the flash partition will be written
-if test -n "$ffsdev"
-then
- echo "reflash: preserving existing configuration file" >&2
- #
- # This step produces /tmp/preserve.$$ and /tmp/cpio.$$, the former is
- # a list of the preserved configuration files together with the processing
- # option, the latter is a directory tree of the preserved files (a directory
- # tree makes the restore step easier.)
- saved=/tmp/cpio.$$
- list=/tmp/preserve.$$
- mkdir "$saved" || {
- echo "reflash: $saved: could not create save directory" >&2
- errorexit
- }
- #
- ( cd "$ffsdir"
- find etc/*.conf $(sed 's!^/!!' usr/lib/ipkg/info/*.conffiles) ! -type d -newer etc/.configured -print |
- sed 's/^/diff /'
- exec sed 's/#.*$//;/^[ ]*$/d' etc/default/conffiles
- ) | sed 's!^/*!!' | awk '{ op=$1; $1=""; file[$0]=op }
- END{ for (f in file) if (file[f] != "ignore") print file[f] f }' |
- while read op file
- do
- if test -e "$ffsdir/$file"
- then
- echo "$op $file" >&3
- echo "$file"
- fi
- done 3>"$list" | (cd "$ffsdir"; exec cpio -p -d -m -u "$saved") || {
- echo "reflash: $saved: copy of saved configuration files failed" >&2
- rm -rf "$saved"
- rm "$list"
- errorexit
- }
- #
- # If this umount fails do not try to continue...
- umount "$ffsdir" || {
- echo "reflash: $ffsdir: temporary mount point umount failed" >&2
- echo " No changes have been made." >&2
- rm -rf "$saved"
- rm "$list"
- exit 1
- }
-fi
-#
-# FLASH THE NEW IMAGES
-# --------------------
-echo "reflash: about to flash new image" >&2
-#
-# There are four possibilities here - kernel only, flashdisk only, then
-# kernel&flashdisk in either one or two different files. The code used
-# to attempt to do everything in one step, but this complicates it,
-# so two steps are used (as required). A failure between the two
-# steps is a problem, but then so is a failure in a partial write.
-# Write the flashdisk first because this is larger (most likely to
-# fail).
-# Temporarily check for devio progress indicator capability this way...
-if devio -p '' 2>/dev/null
-then
- progress=-p
-else
- progress=
-fi
-do_kernel() {
- devio $progress "$@" "<<$kfile" ">>$kdev" '
- # kernel is at imgkoffset[imgksize]
- ' "<= $imgkoffset" "L=$imgksize" '
- # kernel write length,0,0,0 header, then fill
- wb L,4
- fb 12,0
- cp L
- # fill with 255
- fb #t-,255'
-}
-#
-do_ffs() {
- devio $progress "$@" "<<$ffsfile" ">>$ffsdev" '
- # rootfs is at imgffsoffset[imgffssize]
- ' "<= $imgffsoffset" "cp $imgffssize" '
- # fill with 255
- fb #t-,255'
-}
-#
-# check_status $? type file(offset,size) device
-# check the devio status code (given in $1)
-check_status() {
- case "$1" in
- 0) echo " done" >&2;;
- 1) echo " failed" >&2
- echo "reflash: $3: flash $2 failed, no changes have been made to $4" >&2
- if test "$2" = rootfs
- then
- rm -rf "$saved"
- rm "$list"
- exit 1
- else
- echo "reflash: $2: continuing with rootfs changes" >&2
- echo " NOTE: the old kernel is still in $4!" >&2
- fi;;
- 3) echo " failed" >&2
- echo "reflash: $3: WARNING: partial flash of $2 to $4 the system is unbootable" >&2
- echo " Reflash from RedBoot or correct the problem here." >&2
- if test "$2" = rootfs
- then
- exit 3
- else
- echo "reflash: $2: continuing with rootfs changes" >&2
- echo " NOTE: the kernel in $4 must be reflashed!" >&2
- fi;;
- *) echo " failed" >&2
- echo "reflash($1): $3: internal error flashing $2 to $4" >&2
- exit $1;;
- esac
-}
-#
-if test -n "$ffsdev"
-then
- echo -n "reflash: writing rootfs to $ffsdev " >&2
- do_ffs
- check_status $? rootfs "$ffsfile($imgffsoffset,$imgffssize)" "$ffsdev"
-fi
-#
-if test -n "$kdev"
-then
- echo -n "reflash: writing kernel to $kdev " >&2
- do_kernel
- check_status $? kernel "$kfile($imgkoffset,$imgksize)" "$kdev"
-fi
-#
-# verify - this just produces a warning
-if test -n "$ffsdev"
-then
- echo -n "reflash: verifying new flash image " >&2
- if do_ffs -v
- then
- echo " done" >&2
- else
- echo " failed" >&2
- echo "reflash: WARNING: rootfs flash image verification failed" >&2
- echo " The system is probably unbootable." >&2
- echo " System configuration files will be restored but this may fail" >&2
- echo " Starting a shell for user recovery (exit to continue)" >&2
- PS1='badflash$ ' sh -i <>/dev/tty >&0 2>&0
- fi
-fi
-#
-if test -n "$kdev"
-then
- echo -n "reflash: verifying new kernel image " >&2
- if do_kernel -v
- then
- echo " done" >&2
- else
- echo " failed" >&2
- echo "reflash: WARNING: kernel flash image verification failed" >&2
- echo " The system is probably unbootable." >&2
- echo " System configuration files will be restored in the rootfs." >&2
- fi
-fi
-#
-# RESTORE THE OLD CONFIGURATION
-# -----------------------------
-# If not write the rootfs none of the following is required - exit now.
-test -n "$ffsdev" || exit 0
-#
-echo "reflash: restoring saved configuration files" >&2
-#
-# the file /etc/.configured is the datestamp file used to ensure that
-# changed configuration files can be recognised. It is created by
-# /etc/rcS.d/S99finish on first boot (if it does not exist). We need
-# a timestamp earlier than any files we create so touch it here, this
-# also acts as a test on the mounted file system
-mountflash "$ffsdev" "$ffsdir" && :>"$ffsdir/etc/.configured" || {
- rmdir "$ffsdir"
- echo "reflash: mount of new flash root file system failed" >&2
- if test -d "$ffsdir/etc"
- then
- echo " The file system does not seem to be writeable." >&2
- echo " The mounted file system is in $ffsdir" >&2
- fi
- echo " WARNING: the kernel and root file system have been reflashed," >&2
- echo " HOWEVER the new root file system seems to be unuseable." >&2
- echo " Saved configuration files are in $saved" >&2
- echo " The list of saved configuration files is in $list" >&2
- echo " You should determine the reason for the failed mount, mount the new" >&2
- echo " file system and restore the configuration from $saved - it's just a" >&2
- echo " matter of copying the saved files where required." >&2
- exit 1
-}
-#
-# verify file
-# this is called with the name of a 'diff' file which is, indeed,
-# different and with all the std streams connected to the tty. It
-# returns a status code to say whether (0) or not (1) to copy the
-# file over.
-#
-verify_help() {
- echo "Please specify how to handle this file or link, the options are as follows,"
- echo "two character abbreviations may be used:"
- echo
- echo " keep: retain the old file, overwrite the new flash image file"
- echo " upgrade: retain the new file, the old (saved) file is not used"
- echo " diff: display the differences between the old and the new using diff -u"
- echo " shell: temporarily start an interactive shell (sh -i), exit to continue"
- echo " skip: ignore this file for the moment. The file is left in the directory"
- echo " $saved and many be handled after this script has completed"
-}
-#
-verify() {
- local command file
-
- file="$1"
- echo "reflash: $file: configuration file changed."
- verify_help "$file"
- while :
- do
- echo -n "option: "
- read command
- case "$command" in
- ke*) return 0;;
- up*) rm "$saved/$file"
- return 1;;
- di*) echo "DIFF OLD($saved) NEW($ffsdir)"
- diff -u "$saved/$file" "$ffsdir/$file";;
- sh*) PS1="$file: " sh -i;;
- sk*) return 1;;
- *) verify_help "$file";;
- esac
- done
-}
-# the same, but for a link
-verify_link() {
- local command link
-
- link="$1"
- echo "reflash: $link: configuration link changed."
- verify_help "$link"
- while :
- do
- echo -n "option: "
- read command
- case "$command" in
- ke*) return 0;;
- up*) rm "$saved/$link"
- return 1;;
- di*) echo "DIFF:"
- echo "OLD($saved): $link -> $(readlink "$saved/$link")"
- echo "NEW($ffsdir): $link -> $(readlink "$ffsdir/$link")";;
- sh*) PS1="$link: " sh -i;;
- sk*) return 1;;
- *) verify_help "$link";;
- esac
- done
-}
-#
-while read op file
-do
- # handle .configured specially (to preserve the original datestamp)
- if test "$file" = "etc/.configured"
- then
- # this should definately not fail because of the test above!
- if cp -a "$saved/$file" "$ffsdir/$file"
- then
- echo "$file" >&3
- else
- echo "reflash: $file: timestamp copy failed (ignored)" >&2
- fi
- elif test -h "$saved/file" -o -h "$ffsdir/$file"
- then
- # new or old symbolic link
- if test -h "$saved/$file" -a -h "$ffsdir/$file" &&
- test "$(readlink "$saved/$file")" = "$(readlink "$ffsdir/$file")"
- then
- # no change
- echo "$file" >&3
- else
- # assume a change regardless
- case "$op" in
- preserve)
- echo "$file"
- echo "$file" >&3;;
- diff) # need user input
- if verify_link "$file" <>/dev/tty >&0 2>&0
- then
- echo "$file"
- echo "$file" >&3
- fi;;
- esac
- fi
- else
- # only overwrite if necessary
- if test -e "$ffsdir/$file" && cmp -s "$saved/$file" "$ffsdir/$file"
- then
- # do not overwrite
- echo "$file" >&3
- elif test ! -e "$ffsdir/$file"
- then
- # always preserve
- echo "$file"
- echo "$file" >&3
- else
- case "$op" in
- preserve)
- echo "$file"
- echo "$file" >&3;;
- diff) # the files are different, get user input
- if verify "$file" <>/dev/tty >&0 2>&0
- then
- echo "$file"
- echo "$file" >&3
- fi;;
- esac
- fi
- fi
-done <"$list" 3>/tmp/restore.$$ | (cd "$saved"; exec cpio -p -d -u "$ffsdir") || {
- echo "reflash: $saved: restore of saved configuration files failed" >&2
- echo " The new flash file system is mounted on $ffsdir" >&2
- echo " The saved files are in $saved and the list in $list, the list of" >&2
- echo " files selected for restore is in /tmp/restore.$$" >&2
- echo " You should restore any required configuration from $saved," >&2
- echo " then umount $ffsdir and reboot." >&2
- exit 1
-}
-#
-# remove the copied files (i.e. the ones which were preserved)
-( cd "$saved"
- exec rm $(cat /tmp/restore.$$)
-)
-rm /tmp/restore.$$
-#
-# clean up, files left in $saved need to be handled by the user
-files="$(find "$saved" ! -type d -print)"
-if test -n "$files"
-then
- echo "reflash: the following saved configuration files remain:" >&2
- echo "$files" >&2
- echo "The full list of preserved files is in $list. To alter the" >&2
- echo "new root file system use the command:" >&2
- echo "" >&2
- echo " mount -t jffs2 $ffsdev /mnt" >&2
- echo "" >&2
- echo "The saved files are in the temporary directory, they will not" >&2
- echo "be retained across a system boot. Copy them elsewhere if you" >&2
- echo "are unsure whether they are needed" >&2
-else
- rm -rf "$saved"
- rm "$list"
-fi
-#
-# now the final umount
-if umount "$ffsdir"
-then
- rmdir "$ffsdir"
- echo "reflash: system upgrade complete. Reboot to continue." >&2
- exit 0
-else
- echo "reflash: $ffsdir: temporary mount point umount failed" >&2
- echo " ALL changes have been made successfully, however the umount of" >&2
- echo " the new root file system has failed. You should determine the" >&2
- echo " cause of the failure, umount $ffsdir, then reboot the system (this" >&2
- echo " will use the upgraded kernel and root file system)" >&2
- exit 1
-fi
+++ /dev/null
-#!/bin/sh
-# turnup
-# See the help block at the end for documentation.
-#
-. /etc/default/functions
-
-#
-# configuration
-# The following variables control which directories in /var end up on the rootfs
-# and which end up in a temporary file system.
-INRAM_MEMSTICK="/var/cache /var/lock /var/log /var/run /var/tmp /var/lib/ipkg"
-INRAM_NFS="/var/cache /var/lock /var/run /var/tmp"
-INRAM_DISK=""
-#
-# force: override certain checks
-force=
-#
-# fstype new
-# The type of the file system mounted on "new" Outputs the last
-# piece of information found, which should be the one for the
-# currently visible mount!
-fstype() {
- local cwd dev mp type options pass freq result
- cwd="$(cd "$1"; /bin/pwd)"
- result=
- while read dev mp type options pass freq
- do
- case "$mp" in
- "$cwd") result="$type";;
- esac
- done </proc/mounts
- echo "$result"
-}
-#
-# fsoptions arguments
-# Collapses the mount (-o) options into a single list which is
-# printed on stdout. Accepts an arbitrary list of options and
-# just joins them together.
-fsoptions() {
- local options
- options=
- while test $# -gt 1
- do
- case "$1" in
- -t) shift;;
- -o) if test -n "$2"
- then
- if test -n "$options"
- then
- options="$options,$2"
- else
- options="$2"
- fi
- fi
- shift;;
- esac
- shift
- done
- if test -n "$options"
- then
- echo "$options"
- else
- echo defaults
- fi
-}
-#
-# get_flash <directory> {mount options}
-# mount the flash device, writeable, on the given directory
-get_flash() {
- local ffsdir ffsdev
-
- ffsdir="$1"
- shift
- test -n "$ffsdir" -a -d "$ffsdir" || {
- echo "$0: $ffsdir: internal error, flash mount point not a directory" >&2
- return 1
- }
-
- ffsdev="$(mtblockdev Flashdisk)"
- umountflash "$ffsdev" &&
- mountflash "$ffsdev" "$ffsdir" "$@"
-}
-#
-# check_rootfs [-i] <root fs directory>
-# Make sure the candidate rootfs is empty
-check_rootfs() {
- local fcount
-
- case "$1" in
- -i) shift
- case "$force" in
- -f) return 0;;
- esac
-
- fcount="$(find "$1" ! -type d -print | wc -l)"
- test "$fcount" -eq 0 && return 0
-
- echo "turnup: $1: partition contains existing files, specify -f to overwrite" >&2
- return 1;;
- *) checkmount "$1" && return 0
-
- echo "turnup: $1: partition does not seem to be a valid root partition" >&2
- if test -f "$1"/.recovery
- then
- echo " $1/.recovery exists: fix the partition then remove it" >&2
- fi
- return 1;;
- esac
-}
-#
-# copy_rootfs old new
-# Make a copy of the given root file system, copying only the
-# directories needed. The root must be the flash file system
-copy_rootfs() {
- local old new
- old="$1"
- new="$2"
- test -d "$old" -a -d "$new" || {
- echo "turnup: rootfs: copy $old $new: not a directory" >&2
- return 1
- }
- #
- # There are no problem file names in the flash file system, so
- # it is possible to use -print, not -print0. The following
- # files and directories are not copied:
- #
- # /dev/*
- # /boot, /boot/*
- # /linuxrc*
- # /var/*
- echo "turnup: copying root file system" >&2
- ( cd "$1"
- find . -mount -print |
- sed '\@^./dev/@d;\@^./boot/@d;\@^./boot$@d;\@^./linuxrc@d;\@^./var/@d' |
- cpio -p -d -m -u "$2"
- ) || {
- echo "turnup: rootfs: cpio $old $new failed" >&2
- return 1
- }
- echo "done" >&2
-}
-
-#
-# setup_dev new device_table
-# In flash file systems /dev is in ramfs, in disk systems /dev
-# can be populated permanently. This is done by creating a
-# single entry '.noram' in /dev - the devices init script will
-# then populate the directory without overmounting it. The
-# devices in the passed in device table are also created, but
-# note that this is insufficient, /etc/init.d/devices must
-# also run.
-setup_dev() {
- test -n "$1" -a -d "$1"/dev -a -r "$2" || {
- echo "turnup: setup_dev($1,$2): expected a directory and a file" >&2
- return 1
- }
- echo "turnup: initialising dev file system" >&2
- # init tries to open the following devices:
- # /dev/console
- # /dev/tty0
- # /dev/null
- # syslog, and maybe other things, only work if fd 1 is valid, therefore
- # we must create these devices here...
- makedevs --root="$1" --devtable="$2"
- :>"$1"/dev/.noram
- return 0
-}
-
-#
-# setup_bootdev new device_table
-# As above but actually uses the supplied device table - this is possible if
-# the table is just used for boot because the extra setup is not required.
-setup_bootdev() {
- test -n "$1" -a -d "$1"/dev -a -r "$2" || {
- echo "turnup: setup_bootdev($1,$2): expected a directory and a file" >&2
- return 1
- }
- # NOTE: this fails silently with 0 return code(!) when a directory
- # does not exist yet things are created within it.
- makedevs -r "$1" -D "$2"
-}
-
-#
-# setup_var new type
-# Populates /var.
-# Removes the /var tmpfs entry from /etc/fstab.
-# Creates links from /var into /media/ram for NFS and Memstick.
-
-setup_var() {
- test -n "$1" -a -d "$1"/var || {
- echo "turnup: setup_var($1,$2): expected a directory" >&2
- return 1
- }
- case "$2" in
- disk|nfs|memstick);;
- *) echo "turnup: setup_var($1,$2): expected 'disk', 'nfs' or 'memstick'" >&2
- return 1;;
- esac
- #
- # populate /var, there is a shell script to do this, but it uses
- # absolute path names
- chroot "$1" /bin/busybox sh /etc/init.d/populate-volatile.sh || {
- echo "turnup: /var: could not populate directory" >&2
- return 1
- }
-
- case "$2" in
- disk) RAMTARGETS=${INRAM_DISK};;
- nfs) RAMTARGETS=${INRAM_NFS};;
- memstick) RAMTARGETS=${INRAM_MEMSTICK};;
- esac
-
- for d in ${RAMTARGETS}; do
- RAMDIR="/media/ram${d}"
- REALDIR="${d}"
- rm -rf "${1}${REALDIR}"
- ln -s "${RAMDIR}" "${1}${REALDIR}"
- done
- # the startup link is left for the moment, this seems safer
- #rm "$1"/etc/rc?.d/[KS]??populate-var.sh
- # remove the /var tmpfs entry from the new /etc/fstab
- sed -i '\@[ ]/var[ ][ ]*tmpfs[ ]@d' "$1"/etc/fstab
- echo "turnup: tmpfs will no longer be mounted on /var" >&2
- #
- # Previous versions of turnup removed populate-var.sh from the
- # startup links, this one doesn't, so /var can be made back into
- # a tmpfs just by a change to /etc/fstab.
- return 0
-}
-
-#
-# setup_syslog new
-# Moves the syslog to a file - appropriate for disk and nfs types, not
-# otherwise.
-setup_syslog() {
- test -n "$1" -a -d "$1"/etc || {
- echo "turnup: setup_syslog($1): expected a directory" >&2
- return 1
- }
- #
- # if the syslog is to the buffer redirect it to a file
- if egrep -q '^DESTINATION="buffer"' "$1"/etc/syslog.conf
- then
- if cp "$1"/etc/syslog.conf "$1"/etc/syslog.conf.sav
- then
- # the busybox syslog will fail with ROTATESIZE and ROTATEGENS
- sed -i 's!DESTINATION="buffer"!DESTINATION="file"!
- /^ROTATESIZE=/d
- /^ROTATEGENS=/d' "$1"/etc/syslog.conf
- echo "turnup: /etc/syslog.conf: changed to file buffering" >&2
- echo " Old (buffer) version in /etc/syslog.conf.sav" >&2
- echo " Log messages will be in /var/log/messages" >&2
- else
- echo "turnup: /etc/syslog.conf: failed to make a copy" >&2
- echo " syslog will log to a buffer" >&2
- fi
- fi
- return 0
-}
-
-#
-# setup_rootfs type new device_table
-# Populates the /dev and /var directories, alters the startup to
-# not mount or populate them further. Does the right thing according
-# to the given $type
-setup_rootfs() {
- local type new table
- type="$1"
- new="$2"
- table="$3"
-
- test -n "$new" -a -d "$new" -a -f "$table" || {
- echo "turnup: setup_rootfs($type,$new,$table): expected a directory and a file" >&2
- return 1
- }
-
- case "$type" in
- flash) return 0;;
- disk) setup_dev "$new" "$table" &&
- setup_var "$new" "$type" &&
- setup_syslog "$new";;
- memstick)
- setup_bootdev "$new" "$table" &&
- setup_var "$new" "$type" ;;
- nfs) setup_dev "$new" "$table" &&
- setup_var "$new" "$type" &&
- setup_syslog "$new";;
- *) echo "turnup: setup_rootfs: $type: unknown rootfs type" >&2
- return 1;;
- esac
- # return code of last setup function
-}
-
-#
-# setup_fstab new fsdev fstype fsoptions
-# Alters the /etc/fstab entry for / to refer to the correct device and
-# have the correct type and options. Essential for checkroot to remount
-# / with the correct options.
-# bad, since sed won't fail even if it changes nothing.
-setup_fstab() {
- sed -i '\@^[^ ]*[ ][ ]*/[ ]@s@^.*$@'"$2 / $3 $4 1 1"'@' "$1"/etc/fstab
- egrep -q "^$2 / $3 $4 1 1\$" "$1"/etc/fstab || {
- echo "turnup: /etc/fstab: root(/) entry not changed" >&2
- echo " you probably need to check the options in /etc/fstab" >&2
- echo " to ensure that the root partition is mounted correctly" >&2
- return 1
- }
-}
-
-
-#
-# boot_rootfs <boot type> <flash file system> <sleep time> <device> [options]
-# Change the flash partition (not the current root!) to boot off
-# the new root file system
-boot_rootfs() {
- local type ffs sleep device opt
-
- type="$1"
- ffs="$2"
- sleep="$3"
- device="$4"
-
- # test this first as the test does not depend on the correctness
- # of the other arguments
- test -n "$ffs" -a -d "$ffs" || {
- echo "turnup: boot_rootfs($type, $ffs, $device): expected directory" >&2
- return 1
- }
- test -x "$ffs"/boot/"$type" || {
- echo "turnup: boot_rootfs($type, $ffs, $device): invalid boot type $type" >&2
- return 1
- }
- shift
- shift
-
- case "$type" in
- disk) test -n "$device" -a -b "$device" || {
- echo "turnup: boot_rootfs($ffs, $type, $device): expected block device" >&2
- return 1
- }
- shift 2;;
- nfs) shift 2;;
- flash) ;;
- ram) ;;
- *) echo "turnup: boot_rootfs($type, $ffs, $device): unknown type" >&2
- return 1;;
- esac
-
- #
- # The /linuxrc records the correct options to mount the device,
- # since we have already mounted if correctly with these options
- # we can be sure (maybe) that the boot will work. If not /boot/disk
- # falls back to flash.
- #
- # This modifies the boot process, until this point no harm has been
- # done to the system, but at this point the boot rootfs will change
- rm -f "$ffs"/linuxrc.new || {
- echo "turnup: boot_rootfs: failed to remove $ffs/linuxrc.new" >&2
- return 1
- }
- case "$type" in
- flash) ln -s "boot/flash" "$ffs"/linuxrc.new || {
- echo "turnup: boot_rootfs: failed to create $ffs/linuxrc.new" >&2
- return 1
- };;
- ram) { echo '#!/bin/sh'
- echo 'rm -f /linuxrc.new'
- echo 'ln -s boot/flash /linuxrc.new'
- echo 'mv /linuxrc.new /linuxrc'
- echo 'exec /boot/ram /dev/ram0'
- echo 'exec /boot/flash'
- } >"$ffs"/linuxrc.new &&
- chmod 744 "$ffs"/linuxrc.new || {
- echo "turnup: boot_rootfs: failed to write $ffs/linuxrc.new" >&2
- return 1
- };;
- *) { echo '#!/bin/sh'
- test "$sleep" -gt 0 && echo -n "sleep='$sleep' "
- echo -n "exec '/boot/$type' '$device'"
- for opt in "$@"
- do
- echo -n " '$opt'"
- done
- echo
- echo 'exec /boot/flash'
- } >"$ffs"/linuxrc.new &&
- chmod 744 "$ffs"/linuxrc.new || {
- echo "turnup: boot_rootfs: failed to write $ffs/linuxrc.new" >&2
- return 1
- };;
- esac
- rm -f "$ffs"/linuxrc.sav || {
- echo "turnup: boot_rootfs: failed to remove $ffs/linuxrc.sav" >&2
- return 1
- }
- ln "$ffs"/linuxrc "$ffs"/linuxrc.sav || {
- echo "turnup: boot_rootfs: failed to save /linuxrc.sav" >&2
- return 1
- }
- mv -f "$ffs"/linuxrc.new "$ffs"/linuxrc || {
- echo "turnup: boot_rootfs: failed to install new /linuxrc" >&2
- return 1
- }
- return 0
-}
-
-#
-# disk [-m] [-i] [-s<time>] <device> {options}
-# Carefully copy the flash file system to the named device.
-disk() {
- local setup_type sleep init device new ffs fst fso
-
- setup_type=disk
- sleep=0
- init=
- while test $# -gt 0
- do
- case "$1" in
- -f) force="$1"
- shift;;
- -m) setup_type=memstick
- shift;;
- -i) init="$1"
- shift;;
- -s*) sleep="${1#-s}"
- sleep="${sleep:-10}"
- shift;;
- *) break;;
- esac
- done
-
- device="$1"
- test -n "$device" -a -b "$device" || {
- echo "turnup disk: $device: block device required" >&2
- return 1
- }
- shift
-
- # make temporary directories for the mount points
- new="/tmp/rootfs.$$"
- ffs="/tmp/flashdisk.$$"
- mkdir "$new" "$ffs" || {
- echo "turnup: disk: failed to create temporary directories" >&2
- return 1
- }
-
- # make sure we can get to the flash file system first
- get_flash "$ffs" || {
- rmdir "$new" "$ffs"
- return 1
- }
-
- # Now mount the device with the given options, note that specifying
- # read only is *not* an option, this is important because the boot/disk
- # script needs a rw file system
- status=1
- fst=
- fso="$(fsoptions "$@")"
- if mount "$@" "$device" "$new"
- then
- fst="$(fstype "$new")"
- umount "$new" ||
- echo "turnup disk: $device($new): umount does not seem to work" >&2
- fi
-
- if test -n "$fst" && mount -t "$fst" -o "$fso" "$device" "$new"
- then
- if check_rootfs $init "$new" && {
- test -z "$init" || {
- copy_rootfs "$ffs" "$new" &&
- setup_rootfs "$setup_type" "$new" "$ffs"/etc/device_table
- }
- }
- then
- setup_fstab "$new" "$device" "$fst" "$fso"
- status=0
- fi
-
- # clean up the disk. It is worrying if this umount fails!
- umount "$new" || test "$force" = "-f" || {
- echo "turnup disk: $device: umount failed" >&2
- echo " you must unmount this device cleanly yourself, then use" >&2
- if test -z "$init"
- then
- echo " turnup with the -f option to boot from the device" >&2
- else
- echo " turnup without the -i option to boot from the device" >&2
- fi
- status=1
- }
-
- # if everything went ok boot from this disk
- if test $status -eq 0
- then
- # memsticks boot like disks, so ignore the -m
- boot_rootfs disk "$ffs" "$sleep" "$device" -t "$fst" -o "$fso"
- fi
- else
- echo "turnup disk: $device($*): unable to mount device on $new" >&2
- # If it worked first time
- if test -n "$fst"
- then
- echo " options used: -t $fst -o $fso [error in this script]" >&2
- fi
- fi
-
- # clean up the flash file system
- umount "$ffs"
- rmdir "$new" "$ffs"
- return $status
-}
-
-#
-# boot_reset <type>
-# Resets the boot type to flash or ram, as appropriate
-boot_reset() {
- local ffs typ status
-
- case "$1" in
- flash|ram)type="$1"
- shift;;
- *) echo "turnup: boot_reset($1): invalid type" >&2
- return 1;;
- esac
-
- ffs="/tmp/flashdisk.$$"
- mkdir "$ffs" || {
- echo "turnup: $1: failed to create temporary directory" >&2
- return 1
- }
-
- get_flash "$ffs" || {
- rmdir "$ffs"
- return 1
- }
-
- # now try to set the /linuxrc appropriately
- boot_rootfs "$type" "$ffs"
- status=$?
-
- # clean up
- umount "$ffs"
- rmdir "$ffs"
- return $status
-}
-
-#
-# nfs [-i] <root partition> {options}
-# Copy the flash file system to the given NFS root partition.
-nfs() {
- local init nfsroot new ffs
-
- init=
- while test $# -gt 0
- do
- case "$1" in
- -i) init="$1"
- shift;;
- -f) force="$1"
- shift;;
- *) break;;
- esac
- done
-
- nfsroot="$1"
- test -n "$nfsroot" || {
- echo "turnup nfs: $nfsroot: NFS root file system required" >&2
- return 1
- }
- shift
-
- # make temporary directories for the mount points
- new="/tmp/rootfs.$$"
- ffs="/tmp/flashdisk.$$"
- mkdir "$new" "$ffs" || {
- echo "turnup nfs: failed to create temporary directories" >&2
- return 1
- }
-
- # make sure we can get to the flash file system first
- get_flash "$ffs" || {
- rmdir "$new" "$ffs"
- return 1
- }
-
- # Now mount the device with the given options, note that specifying
- # read only is *not* an option, this is important because the boot/disk
- # script needs a rw file system
- status=1
- fst=
- # These settings for for NFS, something better will probably have to
- # be done to support other network file systems.
- nfsopt="nolock,noatime,hard,intr,rsize=1024,wsize=1024"
- fso="$(fsoptions -o "$nfsopt" "$@")"
- if mount -o "$nfsopt" "$@" "$nfsroot" "$new"
- then
- fst="$(fstype "$new")"
- umount "$new" ||
- echo "turnup nfs: $nfsroot($new): umount does not seem to work" >&2
- fi
-
- if test -n "$fst" && mount -t "$fst" -o "$fso" "$nfsroot" "$new"
- then
- if :>"$new"/ttt && test -O "$new"/ttt && rm "$new"/ttt
- then
- if check_rootfs $init "$new" && {
- test -z "$init" || {
- copy_rootfs "$ffs" "$new" &&
- setup_rootfs nfs "$new" "$ffs"/etc/device_table
- }
- }
- then
- setup_fstab "$new" "$nfsroot" "$fst" "$fso"
- status=0
- fi
- else
- echo "turnup nfs: $nfsroot: partition must be exported no_root_squash" >&2
- fi
-
- # clean up the disk. It is worrying if this umount fails!
- umount "$new" || test "$force" = "-f" || {
- echo "turnup nfs: $nfsroot: umount failed" >&2
- if test $status -eq 0
- then
- echo " you must unmount this partition cleanly yourself, then use" >&2
- if test -z "$init"
- then
- echo " turnup with the -f option to boot from the NFS root" >&2
- else
- echo " turnup without the -i option to boot from the NFS root" >&2
- fi
- status=1
- fi
- }
-
- # if everything went ok boot from this disk
- if test $status -eq 0
- then
- # the options used are exactly those which worked before.
- boot_rootfs nfs "$ffs" 0 "$nfsroot" -t nfs -o "$fso"
- fi
- else
- echo "turnup nfs: $nfsroot($*): unable to mount device on $new" >&2
- # If it worked first time
- if test -n "$fst"
- then
- echo " options obtained: -t $fst -o $fso" >&2
- fi
- fi
-
- # clean up the flash file system
- umount "$ffs"
- rmdir "$new" "$ffs"
- return $status
-}
-
-#
-# fix_hw_addr
-# Called when the configuration is invalid to reset /etc/default/sysconf
-fix_hw_addr() {
- # first look on the flash disk (ideally this stuff would only
- # be called from flash, but there is no way of guaranteeing that).
- local ffsdev ffs mac name force
-
- case "$1" in
- -f) force="$1";;
- esac
-
- ffsdev="$(mtblockdev Flashdisk)"
- test -n "$ffsdev" -a -b "$ffsdev" || {
- echo "turnup init: the flash file system device is missing" >&2
- echo " The device (typically /dev/mtdblock4) must exist and" >&2
- echo " it must identify a flash partition called 'Flashdisk'" >&2
- echo " It may be that the /dev directory has not been initialised." >&2
- echo " This script cannot correct this problem." >&2
- return 1
- }
-
- test -x /etc/init.d/sysconfsetup || {
- echo "turnup init: /etc/init.d/sysconfsetup: script not executable" >&2
- echo " or script not present. turnup init requires this script to" >&2
- echo " exist to correct the initialisation" >&2
- return 1
- }
-
- # use devio to find out if this *is* the flash disk.
- ffs=
- if test "$(devio "<<$ffsdev" prd)" -ne "$(devio '<</etc/init.d/sysconfsetup' prd)"
- then
- # this isn't the flash device
- ffs="/tmp/flashdisk.$$"
- # make sure we can get to the flash file system first
- get_flash "$ffs" || {
- rmdir "$ffs"
- return 1
- }
-
- # copy if available
- if test -r "$ffs/etc/default/sysconf"
- then
- cp "$ffs/etc/default/sysconf"
- force=
- fi
-
- umount "$ffs"
- rmdir "$ffs"
- fi
-
- # if the config is still not valid generate sysconf from the slug
- # label.
- config valid && test -z "$force" || {
- mac=
- until test -n "$mac"
- do
- echo "turnup init: please find the 'MAC Address' of your NSLU2" >&2
- echo " The required number is on a label on the bottom of the NSLU2" >&2
- echo " It will be something like 'LKG1A2B3C'" >&2
- echo -n "Enter the mac address: " >/dev/tty
- read name </dev/tty
- case "$name" in
- [Ll][Kk][Gg][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])
- mac="$(echo "$name" |
- sed -n 's/^...\(..\)\(..\)\(..\)$/00:0F:66:\1:\2:\3/p')";;
- [0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f])
- mac="$name"
- name=
- ;;
- "") return 1;;
- *) echo "$name: not recognised as a LinkSys mac address" >&2
- echo " Enter the LinkSys value or a full Ethernet MAC addrress" >&2
- mac=;;
- esac
-
- # Now generate the correct sysconf
- { echo '[network]'
- echo "hw_addr=$mac"
- test -n "$name" && echo "default_server_name=$name"
- } >/etc/default/sysconf
- done
- }
-
- # the configuration should be valid now
- /etc/init.d/sysconfsetup reload
-}
-
-#
-# read_one 'prompt' 'group' 'name'
-# read a single value
-read_one() {
- local n o
- o="$(sysval "$2" "$3")"
- echo -n "$1 [$o]: " >/dev/tty
- read n </dev/tty
- test -z "$n" && n="$o"
- eval "$3='$n'"
-}
-#
-# init_network
-# Change the network initialisation
-init_network() {
- # fix the root password
- echo "Please enter a new password for 'root'." >/dev/tty
- echo "The password must be non-empty for ssh login to succeed!" >/dev/tty
- passwd
- # now the network configuration
- read_one "Host name" network disk_server_name
- read_one "Domain name" network w_d_name
- read_one "Boot protocol (dhcp|static)" network bootproto
- case "$bootproto" in
- static) read_one "IP address" network ip_addr
- read_one "IP netmask" network netmask
- read_one "IP gateway" network gateway
- read_one "First DNS server" network dns_server1
- read_one "Second DNS server" network dns_server2
- read_one "Third DNS server" network dns_server3
- echo "$ip_addr $disk_server_name" >> /etc/hosts
- ;;
- dhcp) sed -i -e "s/localhost\$/localhost $disk_server_name/" /etc/hosts
- ;;
- *) bootproto=dhcp;;
- esac
- #
- # The other stuff which cannot be changed
- hw_addr="$(config mac)"
- lan_interface="$(config iface)"
- #
- # Write this out to a new sysconf
- { echo "[network]"
- echo "hw_addr=$hw_addr"
- echo "lan_interface=$lan_interface"
- test -n "$disk_server_name" && echo "disk_server_name=$disk_server_name"
- test -n "$w_d_name" && echo "w_d_name=$w_d_name"
- echo "bootproto=$bootproto"
- case "$bootproto" in
- static) echo "ip_addr=$ip_addr"
- test -n "$netmask" && echo "netmask=$netmask"
- test -n "$gateway" && echo "gateway=$gateway"
- test -n "$dns_server1" && echo "dns_server1=$dns_server1"
- test -n "$dns_server2" && echo "dns_server2=$dns_server2"
- test -n "$dns_server3" && echo "dns_server3=$dns_server3"
- ;;
- esac
- } >/etc/default/sysconf
- #
- # And reload the result
- /etc/init.d/sysconfsetup reload
- #
- # The remove the spurious 'init' motd
- rm /etc/motd
-}
-
-#
-# Basic command switch (this should be the only thing in this
-# script which actually does anything!)
-case "$1" in
-init) shift
- if config valid && test "$1" != -f
- then
- if init_network "$@"
- then
- echo "turnup init: you must reboot the NSLU2 for the changes to take effect" >&2
- else
- exit 1
- fi
- else
- if fix_hw_addr "$@"
- then
- echo "turnup init: you must reboot the NSLU2 for the changes to take effect" >&2
- else
- exit 1
- fi
- fi;;
-disk) shift
- disk "$@";;
-memstick)
- shift
- disk -m "$@" -o noatime;;
-nfs) shift
- nfs "$@";;
-flash) boot_reset flash;;
-ram) boot_reset ram;;
-*) echo "\
-usage: turnup command [options]
- commands:
- help
- output this help
- init
- correct errors in network information
- initialise network information when DHCP is not available
- change network information
- disk [-i] [-s<seconds>] <device> [mount options]
- With -i make <device> a bootable file system then (with or
- without -i) arrange for the next reboot to use that device.
- The device must already be formatted as a file system, with
- -i it must be completely empty, without it must contain an
- apparently bootable file system. -s (for example -s5)
- specifies a delay in seconds to wait at boot time before
- mounting the device.
- memstick [-i] <device> [mount options]
- Behaves as disk however options appropriate to a flash memory
- stick are automatically added
- nfs [-i] <nfs mount path> [mount options]
- <nfs mount path> must be a mountable NFS file system. With
- -i the partition must be empty and is initialised with a
- bootable file system. Without -i the partition must already
- contain a bootable file system. In either case the NFS
- partition must be available to be mounted without root id
- sqashing (i.e. root must be root) and it will be selected
- as the root file system for subsequent reboots.
- A default set of -o options are provided, additional options
- may be given on the command line (multiple -o options will
- be combined into a single -o).
- flash
- Revert to booting from the flash disk on next reboot.
- ram
- Boot (once) into a ramdisk, subsequent boots will be to
- the flash file system.
- disk formatting:
- The argument to 'nfs' or 'disk' must be an empty partition
- of sufficient size to hold the root file system (at least
- 16MByte but more is recommended to allow package installation).
- An appropriate ext3 partition can be made using the command:
-
- mke2fs -j <device> # for example: /dev/sda1
-
- An appropriate NFS partition can be emptied using 'rm', but
- must be set up (exported) on the NFS server." >&2
- exit 0;;
-esac
-# Exit with return code from command.
+++ /dev/null
-#!/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
-
-
+++ /dev/null
-DESCRIPTION = "Openslug initial network config via sysconf"
-SECTION = "console/network"
-LICENSE = "GPL"
-DEPENDS = "base-files devio"
-RDEPENDS = "busybox devio"
-PR = "r45"
-
-SRC_URI = "file://linuxrc \
- file://boot/flash \
- file://boot/disk \
- file://boot/nfs \
- file://boot/ram \
- file://boot/network \
- file://boot/udhcpc.script \
- file://initscripts/syslog.buffer \
- file://initscripts/syslog.file \
- file://initscripts/syslog.network \
- file://initscripts/zleds \
- file://initscripts/leds_startup \
- file://initscripts/rmrecovery \
- file://initscripts/sysconfsetup \
- file://initscripts/umountinitrd.sh \
- file://functions \
- file://conffiles \
- file://turnup \
- file://reflash \
- file://modprobe.conf \
- file://links.conf \
- file://leds.h \
- file://leds.c \
- "
-
-SBINPROGS = "leds"
-USRSBINPROGS = ""
-CPROGS = "${USRSBINPROGS} ${SBINPROGS}"
-SCRIPTS = "turnup reflash"
-BOOTSCRIPTS = "flash disk nfs ram network udhcpc.script"
-INITSCRIPTS = "syslog.buffer syslog.file syslog.network zleds\
- leds_startup rmrecovery sysconfsetup umountinitrd.sh"
-
-# This just makes things easier...
-S="${WORKDIR}"
-
-do_compile() {
- set -ex
- for p in ${CPROGS}
- do
- ${CC} ${CFLAGS} -o $p $p.c
- done
- set +ex
-}
-
-do_install() {
- set -ex
-
- # Directories
- install -d ${D}${sysconfdir} \
- ${D}${sysconfdir}/default \
- ${D}${sysconfdir}/init.d \
- ${D}${sysconfdir}/modutils \
- ${D}${sysconfdir}/udev \
- ${D}${sbindir} \
- ${D}${base_sbindir} \
- ${D}/initrd \
- ${D}/boot
-
- # linuxrc
- rm -f ${D}/linuxrc
- ln -s boot/flash ${D}/linuxrc
-
- # C programs
- for p in ${USRSBINPROGS}
- do
- install -m 0755 $p ${D}${sbindir}/$p
- done
- for p in ${SBINPROGS}
- do
- install -m 0755 $p ${D}${base_sbindir}/$p
- done
-
- # Shell scripts
- for p in ${SCRIPTS}
- do
- install -m 0755 $p ${D}${sbindir}/$p
- done
-
- #
- # Init scripts
- install -m 0644 functions ${D}${sysconfdir}/default
- for s in ${INITSCRIPTS}
- do
- install -m 0755 initscripts/$s ${D}${sysconfdir}/init.d/
- done
-
- #
- # Udev configuration files
- install -m 0644 links.conf ${D}${sysconfdir}/udev
-
- #
- # Boot scripts
- for p in ${BOOTSCRIPTS}
- do
- install -m 0755 boot/$p ${D}/boot
- done
-
- # Configuration files
- install -m 0644 conffiles ${D}${sysconfdir}/default
- # Change MODULE in modprobe.conf to the correct module name
- rm -f ${D}${sysconfdir}/modprobe.conf
- sed 's/MODULE/'"$(echo '${PREFERRED_PROVIDER_virtual/ixp-eth}'|sed 's/-/_/g')"'/g' modprobe.conf >${D}${sysconfdir}/modprobe.conf
-
- set +ex
-}
-
-# If the package is installed on an NSLU2 $D will be empty, in that
-# case it is normal to run 'start' and 'stop', but because the conf
-# files installed don't actually start or stop anything this is
-# unnecessary, so the package postfoo handling is simplified here.
-#NB: do not use '08' (etc) for the first argument after start/stop,
-# the value is interpreted as an octal number if there is a leading
-# zero.
-pkg_postinst_openslug-init() {
- opt=
- test -n "$D" && opt="-r $D"
- update-rc.d $opt hwclock.sh start 8 S . start 45 0 6 .
- update-rc.d $opt umountinitrd.sh start 9 S .
- update-rc.d $opt syslog.buffer start 11 S . start 49 0 6 .
- update-rc.d $opt sysconfsetup start 12 S .
- update-rc.d $opt syslog.file start 39 S . start 47 0 6 .
- update-rc.d $opt syslog.network start 44 S . start 39 0 6 .
- update-rc.d $opt zleds start 99 S 1 2 3 4 5 . stop 5 0 1 2 3 4 5 6 .
- update-rc.d $opt rmrecovery start 99 1 2 3 4 5 .
- # bug fix for startup
- update-rc.d $opt leds_startup start 1 1 2 3 4 5 .
-}
-
-pkg_postrm_openslug-init() {
- opt=
- test -n "$D" && opt="-r $D"
- for s in ${INITSCRIPTS}
- do
- update-rc.d $opt "$s" remove
- done
-}
-
-PACKAGES = "${PN}"
-FILES_${PN} = "/"
-
-# It is bad to overwrite /linuxrc as it puts the system back to
-# a flash boot (and the flash has potentially not been upgraded!)
-CONFFILES_${PN} = "${sysconfdir}/modprobe.conf /linuxrc ${sysconfdir}/default/conffiles"
--- /dev/null
+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
--- /dev/null
+#!/bin/sh
+# boot from the hard disk 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
+#
+# Load the helper functions
+. /etc/default/functions
+#
+if test -n "$1"
+then
+ device="$1"
+ shift
+ echo "boot: rootfs: mount $* $device"
+ #
+ # wait if required
+ test "$sleep" -gt 0 && sleep "$sleep"
+ #
+ # Mount read-write because before exec'ing init
+ # this script creates the '.recovery' link to
+ # detect failed boot. No file type is given to
+ if mount "$@" "$device" /mnt
+ then
+ # checkmount checks for sh, init and no
+ # .recovery plus either mnt or initrd
+ if checkmount /mnt && :>/mnt/.recovery
+ then
+ # sync to ensure .recovery is written
+ sync
+ # pivot to /initrd if available, else /mnt
+ cd /
+ if test -d /mnt/initrd
+ then
+ swivel mnt initrd
+ else
+ swivel mnt mnt
+ fi
+ # swivel failed
+ fi
+ # Failure: unmount the partition
+ umount /mnt
+ fi
+fi
+# fallback - use the flash boot
+exec /boot/flash
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/bin/sh
+# boot from the hard disk 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
+#
+# Load the helper functions
+. /etc/default/functions
+#
+if test -n "$1"
+then
+ device="$1"
+ shift
+ echo "boot: rootfs: mount $* $device"
+ #
+ # prepare the device. This uses tmpfs to avoid dependency
+ # on non-built-in file systems and because tmpfs can expand
+ # to bigger than the 10MByte ram0 partition used before.
+ # The 'device' is currently unused.
+ if mount -t tmpfs "$@" tmpfs /mnt
+ then
+ cd /
+ # filter out boot (with zimage), linuxrc and anything
+ # below /var, keep dev or the boot will fail (note that
+ # nothing is mounted this early in the bootstrap).
+ find . -mount -print |
+ sed '\@^./boot/@d;\@^./boot$@d;\@^./linuxrc@d;\@^./var/@d' |
+ cpio -p -d -m -u /mnt
+ # checkmount checks for sh, init and no .recovery plus
+ # either mnt or initrd, mnt must exist!
+ if checkmount /mnt
+ then
+ # pivot to /mnt
+ cd /
+ swivel mnt mnt
+ # swivel failed
+ fi
+ # Failure: unmount the partition.
+ umount /mnt
+ fi
+fi
+# fallback - use the flash boot
+exec /boot/flash
--- /dev/null
+#!/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
--- /dev/null
+# conffiles
+# Known SlugOS configuration files. These files are preserved on
+# a flash upgrade. Other configuration files, found from:
+#
+# /usr/lib/ipkg/*.conffiles
+# /etc/*.conf
+#
+# are preserved too with an operation of 'diff' if they have been
+# changed since /etc/.configured was created.
+#
+# Lines starting with # are comments, other lines have
+# two fields:
+#
+# operation file
+#
+# The file must *NOT* have a leading /
+#
+# operation may be:
+# ignore Do not preserve this file
+# preserve Preserve this file unconditionally
+# diff Compare file with the new version, ask if different
+#
+preserve linuxrc
+preserve etc/.configured
+preserve etc/TZ
+diff etc/default/conffiles
+diff etc/default/devpts
+diff etc/default/rcS
+preserve etc/default/sysconf
+diff etc/default/usbd
+preserve etc/defaultdomain
+preserve etc/dropbear/dropbear_dss_host_key
+preserve etc/dropbear/dropbear_rsa_host_key
+preserve etc/fstab
+preserve etc/group
+preserve etc/gshadow
+preserve etc/hostname
+preserve etc/hosts
+preserve etc/localtime
+ignore etc/modules
+ignore etc/modules.conf
+preserve etc/motd
+preserve etc/network/interfaces
+preserve etc/ntp.drift
+preserve etc/passwd
+preserve etc/profile
+preserve etc/resolv.conf
+preserve etc/shadow
+preserve etc/syslog.conf
+preserve etc/timezone
--- /dev/null
+# . this file to load the following utility functions
+#
+# mtdev "name"
+# return (output) the character device name for flash parition "name"
+# /proc/mtd has the general form:
+# dev: size erasesize name
+# mtd5: 00020000 00020000 "FIS directory"
+# use this rather than hard-wiring the device because the partition
+# table can change - looking in /proc/mtd is more reliable.
+mtdev(){
+ sed -n 's!^\(mtd[0-9][0-9]*\):[^"]*"'"$1"'"$!/dev/\1!p' /proc/mtd
+}
+#
+# mtblockdev "name"
+# as mtdev but output the name of the block (not character) device
+mtblockdev(){
+ sed -n 's!^mtd\([0-9][0-9]*\):[^"]*"'"$1"'"$!/dev/mtdblock\1!p' /proc/mtd
+}
+#
+# mtsize "name"
+# the size of the partition as a hexadecimal value (with 0x at the front)
+mtsize(){
+ sed -n 's!^mtd[0-9][0-9]*: \([^ ]*\)[^"]*"'"$1"'"$!0x\1!p' /proc/mtd
+}
+#
+# sysvalmatch "section" "name" 'pattern' "configuration file"
+# sysvalof "section" "name" "configuration file"
+# sysval "section" "name"
+# outputs the value of the SysConf variable 'name' from section 'section',
+# this is a bit gross, when it gets a match it copies the value to the
+# hold space, if no match it jumps over the copy, at the end ($) it copies
+# the hold space to the pattern space and prints the result, thus it only
+# ever prints the last match
+# BUG FIX: busybox sed doesn't initialise the hold space and crashes if it
+# is used before initialisation, so temporarily this script does it's own
+# tail by hand.
+# NOTE: these functions should only be used internally, add entries to 'config'
+# below if necessary. This is because 'config' does the defaulting and in the
+# recovering case (zero or absent SysConf) /etc/default/sysconf only contains
+# the hw_addr entry!
+sysvalmatch(){
+ # sed -n '/^\['"$1"'\]$/,/^\[.*\]$/s/^'"$2"'=\('"$3"'\)$/\1/;tH;bE;:H;h;:E;$g;$p' "$4"
+ sed -n '/^\['"$1"'\]$/,/^\[.*\]$/s/^'"$2"'=\('"$3"'\)$/\1/p' "$4" | sed -n '$p'
+}
+sysvalof(){
+ sysvalmatch "$1" "$2" '.*' "$3"
+}
+sysval(){
+ sysvalof "$1" "$2" /etc/default/sysconf
+}
+#
+# config "value"
+# convenience callers for specific values to avoid mis-typing in scripts
+# NOTE: this function does the defaulting, 'sysval' does not! Validity
+# of the sysconf file is determined by the presence of the all important
+# hw_addr.
+config(){
+ local mac
+ mac=
+ test -r /etc/default/sysconf &&
+ mac="$(sysvalmatch network hw_addr '[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]' /etc/default/sysconf)"
+ if test -n "$mac"
+ then
+ case "$1" in
+ mac) echo "$mac";;
+ host) if test -n "$(sysval network disk_server_name)"
+ then
+ sysval network disk_server_name
+ elif test -n "$(sysval network default_server_name)"
+ then
+ sysval network default_server_name
+ else
+ echo "$mac" | sed -n 's/^..:..:..:\(..\):\(..\):\(..\)$/LKG\1\2\3/p'
+ fi;;
+ domain) sysval network w_d_name;;
+ iface) if test -n "$(sysval network lan_interface)"
+ then
+ sysval network lan_interface
+ else
+ echo eth0
+ fi;;
+ ip) if test -n "$(sysval network ip_addr)"
+ then
+ sysval network ip_addr
+ else
+ echo 192.168.1.77
+ fi;;
+ netmask)sysval network netmask;;
+ gateway)sysval network gateway;;
+ dns) sysval network dns_server1;;
+ dns2) sysval network dns_server2;;
+ dns3) sysval network dns_server3;;
+ boot) if test -n "$(sysval network bootproto)"
+ then
+ sysval network bootproto
+ else
+ echo dhcp
+ fi;;
+ valid) return 0;;
+ *) return 1;;
+ esac
+ else
+ # These are the defaults for an invalid mac address, use the compiled
+ # in hardware address.
+ case "$1" in
+ mac) echo "00:02:B3:02:02:01";;
+ host) echo "brokenslug";;
+ iface) echo eth0;;
+ ip) echo 192.168.1.77;;
+ boot) echo dhcp;;
+ *) return 1;;
+ esac
+ fi
+}
+#
+# checkif "iface"
+# Validate an interface name by making sure that it exists
+# in /proc/net/dev (and is not lo). The listing outputs the
+# interface followed by a :, the check function looks for
+# something of the form '$1[a-zA-Z0-9]*:' and outputs the
+# part preceding the ':'
+checkif(){
+ sed -n '/^[ ]*lo:/d;s/^[ ]*\('"$1"'[a-zA-Z0-9]*\):.*$/\1/p;tE;d;:E;q' /proc/net/dev
+}
+#
+# checkmount "mountpoint"
+# tests an already mounted mountpoint to see whether to attempt to
+# boot with this as root. Returns success if it appears ok.
+checkmount(){
+ # basic test for init (the kernel will try to load this)
+ # but require a shell in bin/sh and no .recovery too
+ test \( ! -f "$1/.recovery" \) -a \
+ \( -d "$1/initrd" -o -d "$1/mnt" \) -a \
+ \( -x "$1/bin/sh" -o -h "$1/bin/sh" \) -a \
+ \( -x "$1/sbin/init" -o -h "$1/sbin/init" -o \
+ -x "$1/etc/init" -o -h "$1/etc/init" -o \
+ -x "$1/bin/init" -o -h "$1/bin/init" \)
+}
+#
+# swivel "new root" "old root"
+# NOTE: the arguments must be paths relative to /, bad things
+# will happen if the arguments themselves start with /
+# Pivot to a new root. This does all the fancy pivot_root stuff
+# including closing streams and does a umount /proc - it doesn't
+# matter if this fails (failure codes are ignored), but if /proc
+# was mounted it must be restored by the caller on return.
+# Normally this function never returns!
+# On return 0,1,2 are connected to /dev/console - this may not
+# have been true before!
+swivel() {
+ cd "$1"
+ exec <&- >&- 2>&-
+ # This is just-in-case the called mounted /proc and was
+ # unable to close it because of the streams
+ umount /proc 2>/dev/null
+ if pivot_root . "$2"
+ then
+ # everything must move out of the old root, this process
+ # is $2/bin/sh so it must die, IO is redirected
+ # just in case - typically it will be to a device so it
+ # won't hold the old root open.
+ # the exec here is the first point at which the old root
+ # is unused - before the exec regardless of the close of
+ # 0,1,2 above ash still has *this* shell script open!
+ # (it's on fd 10).
+ # init closes all file descriptors, there's no point
+ # supplying it with fds.
+ # NOTE: this used to use $2/usr/sbin/chroot, however on
+ # linux / is already . when the command is executed
+ # therefore it is essential to use the local (new root)
+ # chroot to ensure it gets the correct shared libraries.
+ exec usr/sbin/chroot . bin/sh -c "\
+ test -x sbin/init && exec sbin/init
+ test -x etc/init && exec etc/init
+ test -x bin/init && exec bin/init
+ leds -A +gr1 '!g1'
+ sleep 10 >/.recovery
+ sync;sync;sync
+ exit 1"
+ fi
+ #
+ # recovery - must restore the old root
+ cd "$2"
+ sbin/pivot_root . "$1"
+ # cd is back to $1 - either pivot_root doesn't change it and the
+ # chroot above was not executed, or pivot_root does change it and
+ # has just changed it back!
+ exec <>/dev/console >&0 2>&0
+}
+#
+# ifup "interface"
+# bring that interface up with the configured ip and other
+# information
+ifup(){
+ local ip hostname router subnet iface HOSTNAME NETMASK BROADCAST
+
+ iface="$1"
+ ip="$(config ip)"
+ hostname="$(config host)"
+ router="$(config gateway)"
+ broadcast=
+
+ if test -n "$ip"
+ then
+ # only if an ip was specified
+ subnet="$(config netmask)"
+ else
+ ip=192.168.1.77
+ fi
+
+ # First try udhcpc - note that the /boot/udhcpc.script
+ # simply records the values returned and the udhcpc
+ # is not left running so this will only work for
+ # the lease length time!
+ ifconfig "$iface" up
+ if test "$(config boot)" != static
+ then
+ test -n "$hostname" && HOSTNAME="-H $hostname"
+ # The script writes the required shell variable assignments
+ # to file descriptor 9
+ eval $(udhcpc -i "$iface" -n -q -r "$ip" $HOSTNAME -s /boot/udhcpc.script 9>&1 >/dev/null)
+ fi
+
+ test -n "$broadcast" && BROADCAST="broadcast $broadcast"
+ test -n "$subnet" && NETMASK="netmask $subnet"
+
+ if ifconfig "$iface" "$ip" $NETMASK $BROADCAST
+ then
+ for route in $router
+ do
+ route add default gw "$route" dev "$iface"
+ done
+ return 0
+ else
+ ifconfig "$iface" down
+ return 1
+ fi
+}
+#
+# ifdown "interface"
+# take the interface down
+ifdown(){
+ ifconfig "$1" down
+}
+#
+# mountflash "flash device" "flash root directory" {mount options}
+# Finds and mounts the flash file system on the given directory
+mountflash() {
+ local ffsdev ffsdir
+
+ ffsdev="$1"
+ test -n "$ffsdev" -a -b "$ffsdev" || {
+ echo "$0: unable to find flash file system to copy ($ffsdev)" >&2
+ return 1
+ }
+ shift
+
+ ffsdir="$1"
+ test -n "$ffsdir" -a -d "$ffsdir" || {
+ echo "$0: mountflash $ffsdir: not a directory (internal error)" >&2
+ return 1
+ }
+ shift
+
+ mount -t jffs2 "$@" "$ffsdev" "$ffsdir" || {
+ echo "$0: $ffsdev: unable to mount flash file system on $ffsdir" >&2
+ return 1
+ }
+ return 0
+}
+#
+# umountflash [-r] "flash device"
+# unmount any instance of the given flash device, if -r is specified a mount on
+# root is an error, otherwise a mount on root is ignored (and remains).
+umountflash() {
+ local rootok ffsno ffsdev
+ rootok=1
+ case "$1" in
+ -r) rootok=
+ shift;;
+ esac
+ #
+ # The argument is ffsdev
+ ffsdev="$1"
+ ffsno="$(devio "<<$ffsdev" prd)"
+ test -n "$ffsno" -a "$ffsno" -ge 0 || {
+ echo "$0: $ffsdev: device number $ffsno is not valid, cannot continue." >&2
+ return 1
+ }
+ #
+ # Make sure that Flashdisk isn't mounted on /
+ if test -z "$rootok" -a "$(devio "<</etc/init.d/sysconfsetup" prd)" -eq "$ffsno"
+ then
+ echo "$0: $ffsdev is mounted on /, use turnup ram" >&2
+ return 1
+ fi
+ #
+ # The function is currently always used interactively, so output
+ echo "$0: umounting any existing mount of $ffsdev" >&2
+ #
+ # check each mount point, do this last first because otherwise nested
+ # mounts of ffsdev cannot be umounted.
+ ffs_umount() {
+ local device mp type options stuff
+
+ read device mp type options stuff
+ test -z "$device" && return 0
+
+ # handle following entries first
+ ffs_umount || return 1
+
+ # handle this entry, since this is currently only used for unmounting
+ # the flash root partition we know a file which must exist...
+ case "$mp/$type" in
+ //jffs2);; # skip /
+ */jffs2)test "$(devio "<<$mp/etc/init.d/sysconfsetup" prd 2>/dev/null)" -ne "$ffsno" ||
+ umount "$mp" || {
+ echo "$0: $mp: unable to umount $ffsdev" >&2
+ return 1
+ };;
+ esac
+
+ return 0
+ }
+ #
+ ffs_umount </proc/mounts || {
+ echo "$0: umount $ffsdev from all mount points then re-run reflash" >&2
+ return 1
+ }
+
+ return 0
+}
--- /dev/null
+#!/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
--- /dev/null
+#!/bin/sh
+# Run to remove /.recovery if the boot seems to have succeeded
+test -e /.recovery && rm -f /.recovery
+exit 0
--- /dev/null
+#!/bin/sh
+# This script is run once when the system first boots. Its sole
+# purpose is to create /etc/default/sysconf (the overall system
+# configuration file) and other files derived from this.
+#
+# The script runs immediately after S10checkroot.sh - this is the
+# point at which the rootfs will be mounted rw even if the kernel
+# booted with it ro.
+#
+# rm or mv the file to run this again. If this is done the
+# following configuration files will be rewritten:
+#
+# /etc/default/sysconf
+# /etc/hostname
+# /etc/defaultdomain
+# /etc/network/interfaces
+# /etc/resolv.conf
+#
+# /etc/default/functions contains useful utility functions - it's
+# in a separate file so that it can be loaded by any script
+. /etc/default/functions
+#
+config valid && test "$1" != reload && exit 0
+#
+# Utility to deal with absence of DNS configuration
+echodns(){
+ local dns
+ if test $# -gt 0
+ then
+ for dns in "$@"
+ do
+ echo "nameserver $dns"
+ done
+ fi
+}
+#
+# The SysConf device must exist in /dev at this point for this script
+# to work.
+#
+# It is important not to hard-wire the name of the device because of
+# the posibility of changing the flash partition layout.
+#
+# The block device is used here because at present udev does not
+# show the character devices
+sysdev=
+config valid || sysdev="$(mtblockdev SysConf)"
+if test -n "$sysdev" -a -b "$sysdev"
+then
+ # Read the defined part of SysConf into /etc/default/sysconf.
+ # SysConf has lines of two forms:
+ #
+ # [section]
+ # name=value
+ #
+ # In practice SysConf also contains other stuff, use the command:
+ #
+ # devio '<</dev/mtd1;cpb'
+ #
+ # to examine the current settings. The badly formatted stuff
+ # is removed (to be exact, the sed script selects only lines
+ # which match one of the two above). The lan interface, which
+ # defaults to ixp0, is changed to the correct value for openslug,
+ # eth0. The bootproto, which LinkSys sets to static in manufacturing,
+ # is reset to dhcp if the IP is still the original (192.168.1.77)
+ devio "<<$sysdev" cpb fb1,10 | sed -n '/^\[[^][]*\]$/p;
+ s/^lan_interface=ixp0$/lan_interface=eth0/;
+ /^ip_addr=192\.168\.1\.77$/,/^bootproto/s/^bootproto=static$/bootproto=dhcp/;
+ /^[-a-zA-Z0-9_][-a-zA-Z0-9_]*=/p' >/etc/default/sysconf
+ #
+ # The SysConf must have a hardware id, if it doesn't it has
+ # probably been erased or never set in the first place and the
+ # hardware id is retrieved from the RedBoot partition. This is
+ # the only thing which cannot be defaulted.
+fi
+#
+# Error recovery: no SysConf or invalid SysConf. Make a new one from the
+# RedBoot hardware ID information.
+# NOTE: this block of code overwrites the shell script arguments.
+config valid || {
+ reddev="$(mtblockdev RedBoot)"
+ initmac=
+ if test -n "$reddev" -a -b "$reddev"
+ then
+ # The hardware id starts 80 bytes before the end of the
+ # block, the block ends (or should end) with the signature
+ # <4 bytes> sErCoMm <bytes> sErCoMm. Note that devio 'pf'
+ # empties the stack.
+ set -- $(devio "<<$reddev" '
+ <= $80-
+ .= @
+ pf %02X
+ A= 5
+ $( 1
+ A= @,A1-
+ pf :%02X
+ $) A
+ pn
+ <=f4+;cp7;pn
+ <=$7-;cp7;pn')
+ if test $# -eq 3 -a "$2" = sErCoMm -a "$3" = sErCoMm
+ then
+ initmac="$1"
+ fi
+ fi
+ #
+ # APEX: may need extra code to set initmac here.
+ #
+ if test -n "$initmac"
+ then
+ #
+ # Generate a complete /etc/default/sysconf based on just
+ # one number ;-)
+ { echo '[network]'
+ echo "hw_addr=$initmac"
+ } >/etc/default/sysconf
+ #
+ # See /etc/default/functions (the config function) for
+ # the derivation of the rest of the information.
+ fi
+}
+#
+# The config function will now return the correct values - even if sysconf
+# is still missing. 'config valid' says if valid configuration information
+# is available.
+#
+# Set up the 'standard' files in the root file system (these couldn't be set
+# up before because they depend on stuff which RedBoot puts into SysConf from
+# the ID info on the specific machine - in particular the hardware address of
+# eth0, which must be the one assigned for *this* box!)
+#
+# HOSTNAME: defaults to LGK<mac> i.e. something derived from
+# the ethernet hardware. LinkSys documentation explains how
+# to determine this. Set by the user in linksys setup software.
+# DOMAINNAME: LinkSys puts this in w_d_name.
+test -n "$(config host)" && config host >/etc/hostname
+domain="$(config domain)"
+test -n "$domain" && echo "$domain" >/etc/defaultdomain
+#
+# Ethernet information. This goes into /etc/network/interfaces,
+# however this is only used for static setup (and this is not
+# the default). With dhcp the openslug udhcp script,
+# /etc/udhcpc.d/50default, loads the values from sysconf. The
+# lan_interface config value must exist for the file to be
+# overwritten here.
+iface="$(config iface)"
+if test -n "$iface"
+then
+ boot="$(config boot)"
+ # Only dhcp and static are supported at present - bootp
+ # support requires installation of appropriate packages
+ # dhcp is the fail-safe
+ case "$boot" in
+ dhcp|static) ;;
+ *) boot=dhcp;;
+ esac
+ #
+ mac="$(config mac)"
+ ip="$(config ip)"
+ netmask="$(config netmask)"
+ gateway="$(config gateway)"
+ {
+ echo "# /etc/network/interfaces"
+ echo "# configuration file for ifup(8), ifdown(8)"
+ echo "#"
+ echo "# The loopback interface"
+ echo "auto lo"
+ echo "iface lo inet loopback"
+ echo "#"
+ echo "# The NSLU2 built-in ethernet"
+ echo "auto $iface"
+ echo "# Automatically generated from /etc/default/sysconf"
+ if config valid
+ then
+ echo "# The pre-up option must always be supplied, regardless"
+ echo "# of configuration, to set the hardware correctly."
+ echo "# Severe network problems may result if this option is"
+ echo "# removed."
+ c=
+ else
+ echo "# WARNING: improperly configured network interface."
+ echo "# WARNING: the pre-up line must be corrected or severe"
+ echo "# WARNING: network problems may result."
+ c='#'
+ mac='<WARNING: unknown hardware address>'
+ fi
+ echo "iface $iface inet $boot"
+ echo "${c} pre-up ifconfig $iface hw ether $mac"
+ # The following are ignored for DHCP but are harmless
+ test -n "$ip" && echo " address $ip"
+ test -n "$netmask" && echo " netmask $netmask"
+ test -n "$gateway" && echo " gateway $gateway"
+ } >/etc/network/interfaces
+fi
+#
+# The DNS server information gives up to three nameservers, but this
+# currently only binds in the first.
+{
+ test -n "$domain" && echo "search $domain"
+ echodns $(config dns) $(config dns1) $(config dns2)
+} >/etc/resolv.conf
+#
+# Invalid config must be handled, do this by hacking /etc/motd.
+if config valid
+then
+ echo "Host name: $(config host)"
+ echo "Host ID: $mac"
+ echo "Network boot method: $boot"
+ case "$boot" in
+ static) echo "Host IP address: $ip";;
+ esac
+ echo "Use 'turnup init' to reset the configuration"
+ echo "Use 'turnup disk|nfs -i <device> options to initialise a non-flash root"
+ echo "Use 'turnup help' for more information"
+else
+ echo "+=====================================================================+"
+ echo "| +-----------------------+ |"
+ echo "| | INITIALISATION FAILED | |"
+ echo "| +-----------------------+ |"
+ echo "| |"
+ echo "| This machine has been booted with a temporary ethernet id |"
+ echo "| The initialisation failed because the machine id was not available |"
+ echo "| within the flash memory of the NSLU2. You must run: |"
+ echo "| |"
+ echo "| turnup init |"
+ echo "| |"
+ echo "| To correct this problem. Severe network problems may occur if this |"
+ echo "| is not done. |"
+ echo "+=====================================================================+"
+fi >/etc/motd
+
+exit 0
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/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
--- /dev/null
+#!/bin/sh
+#
+# umount /mnt, which is where the initrd ends up mounted
+# if the directory /initrd is not present, if this fails
+# then the /initrd is mounted and we want to remount that
+# ro - this works round the shutdown -r hang problem
+umount /mnt 2>/dev/null || {
+ # need the device for a remount
+ . /etc/default/functions
+ ffspart=Flashdisk
+ ffsdev="$(mtblockdev $ffspart)"
+ if test -n "$ffsdev" -a -b "$ffsdev"
+ then
+ mount -o remount,ro "$ffsdev" /initrd
+ else
+ echo "Flashdisk: $ffsdev: flash device not found" >&2
+ fi
+}
--- /dev/null
+#!/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 -gr +"$(colour "$runlevel")";;
+stop) leds -gr +"$(colour "$previous")" /"$(colour "$runlevel")";;
+*) echo "led change: $1: command ignored" >&2;;
+esac
+
+exit 0
--- /dev/null
+
+#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);
+}
+
--- /dev/null
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <math.h>
+ #include <errno.h>
+ #include <string.h>
+ #include <endian.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sys/ioctl.h>
+ #include "leds.h"
+
+ static int leds;
+ static int reset;
+ static int verbose = 0;
+ enum {
+ off=0, on=1, blink, unknown, transition=unknown
+ };
+
+
+ void init_leds(void)
+ {
+ int i;
+ if ((leds = open("/dev/leds", O_RDWR)) < 0) {
+ int e1 = errno;
+ if (e1 != ENOENT) {
+
+ fprintf(stderr,"Error: Could not open LEDS device file '/dev/leds' : %s\n",
+ strerror(e1));
+ if(e1 == EACCES)
+ fprintf(stderr,"Run as root\n");
+ exit(1);
+ }
+ }
+
+ if (verbose)
+ printf("leds: initialized.\n");
+ }
+
+ void led_ioctl( int cmd, int num )
+ {
+ int i, st;
+
+ if (ioctl(leds, cmd, num) < 0) {
+ int e1 = errno;
+ fprintf(stderr, "leds: ioctl(%d,%d): failed to set leds: %s\n",
+ cmd, num, strerror(e1));
+ exit(1);
+ }
+ }
+
+ void led_set( int led, int state )
+ {
+ switch (state) {
+ case off: if (!reset) led_ioctl(N2_LM_OFF, led); break;
+ case on: led_ioctl(N2_LM_ON, led); break;
+ case blink: /* Ensure any previous timer gets deleted first and that
+ * the LED is in a well known state.
+ */
+ if (!reset) led_ioctl(N2_LM_OFF, led);
+ led_ioctl(N2_LM_BLINK, led); break;
+ }
+ }
+
+ int led( int ch ) {
+ switch (ch) {
+ case 'r': return LED_RS_RED;
+ case 'g': return LED_RS_GRN;
+ case '1': return LED_DISK1;
+ case '2': return LED_DISK2;
+ case 'A': reset = 1; return LED_ALL;
+ default: fprintf(stderr, "leds: %c: unknown LED (use r,g,0,1 or A)\n", ch);
+ exit(1);
+ }
+ }
+
+ int main( int argc, char **argv )
+ {
+ /* Default: switch green on, red off (-A +g). */
+ if (argc == 1) {
+ verbose = 1;
+ init_leds();
+ led_ioctl(N2_LM_ALL_OFF, 0);
+ led_ioctl(N2_LM_ON, LED_RS_GRN);
+ } else {
+ int i, alt=0, state[PHYS_LEDS];
+ for(i=0; i<PHYS_LEDS; ++i)
+ state[i] = unknown;
+ reset = 0;
+
+ while (--argc > 0) {
+ char *arg = *++argv;
+ int st;
+ if (strcmp(arg, "-v") == 0) {
+ ++verbose;
+ continue;
+ }
+
+ switch (*arg) {
+ case '+': st = on; break;
+ case '-': st = off; break;
+ case '!': st = blink; break;
+ case '/': st = transition; break;
+ default: fprintf(stderr, "leds: %c: unknown option\n", *arg);
+ exit(1);
+ }
+
+ if (st != transition) {
+ while (*++arg) {
+ i = led(*arg);
+ if (i == LED_ALL)
+ for (i=0; i<PHYS_LEDS; ++i) state[i] = st;
+ else
+ state[i] = st;
+ }
+ } else {
+ int done, newstate[PHYS_LEDS];
+ for(i=0; i<PHYS_LEDS; ++i)
+ newstate[i] = off;
+ while (*++arg) {
+ i = led(*arg);
+ if (i == LED_ALL)
+ for (i=0; i<PHYS_LEDS; ++i) newstate[i] = on;
+ else
+ newstate[i] = on;
+ }
+
+ /* Merge the newstate back in. This sets 'alt' if going
+ * from an old state of just red to a new of just green
+ * or vice versa (and this is the only way of getting
+ * 'alt')
+ */
+ /* Blink anything which changes from off to on or from
+ * on to off (this ignores anything already blinking).
+ */
+ for (done=i=0; i<PHYS_LEDS; ++i) {
+ if (state[i] == !newstate[i]) {
+ done = 1;
+ state[i] = blink;
+ }
+ }
+
+ /* Is anything (new) blinking? If it is then deal
+ * with the red/green case - blinking red,green is
+ * amber, is that what we want? This could be
+ * improved by a better kernel interface - it would
+ * be nice just to specify on/off times and a start
+ * time for each LED.
+ */
+ if (done) {
+ if (state[LED_RS_RED] == blink && state[LED_RS_GRN] == blink &&
+ newstate[LED_RS_RED] == !newstate[LED_RS_GRN]) {
+ /* Kernel bug: must switch off r and g first. */
+ alt = 1;
+ }
+ } else {
+ for (i=0; i<PHYS_LEDS; ++i) {
+ if (newstate[i] == on) {
+ state[i] = blink;
+ }
+ }
+ }
+ }
+ }
+
+ /* Go through the list making the required settings. 'alt' is
+ * special. 'reset' means A was given and all the settings are
+ * known.
+ */
+ init_leds();
+ if (reset)
+ led_ioctl(N2_LM_ALL_OFF, 0);
+ if (alt) {
+ /* Turn the leds off first to get to a known state. */
+ led_set(LED_RS_GRN, off);
+ led_set(LED_RS_RED, off);
+ led_ioctl(N2_LM_ALT, LED_RS_RED);
+ } else {
+ /* KERNEL BUG: setting the green timer zaps the red behaviour
+ * to toggle the green, therefore if red blink is set before
+ * green blink no blink will happen!
+ */
+ led_set(LED_RS_GRN, state[LED_RS_GRN]);
+ led_set(LED_RS_RED, state[LED_RS_RED]);
+ }
+ led_set(LED_DISK1, state[LED_DISK1]);
+ led_set(LED_DISK2, state[LED_DISK2]);
+ }
+
+ return 0;
+ }
--- /dev/null
+ void init_leds(void);
+ void led_on(int);
+ void led_off( int );
+ void led_toggle(int num);
+
+ // ioctls -- 'M" is used for sound cards...we don't got one so it seems safe
+ #define N2_LM_OFF _IOW('M',32,long)
+ #define N2_LM_ON _IOW('M',33,long)
+ #define N2_LM_BLINK _IOW('M',34,long)
+ #define N2_LM_ALT _IOW('M',35,long)
+ #define N2_LM_ALL_ON _IO('M',36)
+ #define N2_LM_ALL_OFF _IO('M',37)
+
+ // The LED names for switches
+ #define LED_RS_RED 0
+ #define LED_RS_GRN 1
+ #define LED_DISK1 2
+ #define LED_DISK2 3
+ #define LED_ALL 4
+
+ #define PHYS_LEDS 4
--- /dev/null
+# This file does not exist. Please do not ask the debian maintainer about it.
+# You may use it to do strange and wonderful things, at your risk.
+
+# The new RTC class does not create the /dev/rtc symlink, and udev rules don't get run for built-in modules.
+# So it looks like we have to do this here for the moment, until someone comes up with a better idea ...
+L rtc rtc0
--- /dev/null
+#!/bin/sh
+
+# **** DO NOT EVEN THINK OF EDITING OR REMOVING THIS FILE ****
+# **** UNLESS YOU REALLY KNOW *EXACTLY* WHAT YOU ARE DOING. ****
+
+
+# Determine the desired rootfs based on user flag files.
+
+if [ -f /.ramdisk ] ; then
+ /bin/echo "Preferred root device is /dev/ram0 (maintenence)"
+ mounted=/mnt
+ prefroot=maintenence
+elif [ -f /.sda1root ] ; then
+ /bin/echo "Preferred root device is /dev/sda1 (disk 1)"
+ mounted=/mnt
+ prefroot=sda1
+elif [ -f /.sda2root ] ; then
+ /bin/echo "Preferred root device is /dev/sda2 (disk 1)"
+ mounted=/mnt
+ prefroot=sda2
+elif [ -f /.sdb1root ] ; then
+ /bin/echo "Preferred root device is /dev/sdb1 (disk 2)"
+ mounted=/mnt
+ prefroot=sdb1
+elif [ -f /.sdb2root ] ; then
+ /bin/echo "Preferred root device is /dev/sdb2 (disk 2)"
+ mounted=/mnt
+ prefroot=sdb2
+elif [ -f /.nfsroot ] ; then
+ /bin/echo "Preferred root device is NFS"
+ mounted=/mnt
+ prefroot=nfsroot
+else
+ /bin/echo "Preferred root device is jffs2"
+ mounted=
+ prefroot=jffs2
+fi
+
+
+# Perform prepatory tasks, and determine whether the desired rootfs is viable.
+
+/bin/mount -t proc proc /proc
+
+if [ $prefroot = "sda1" -o $prefroot = "sda2" -o $prefroot = "sdb1" -o $prefroot = "sdb2" ] ; then
+ /bin/echo "Sleeping 10sec while waiting for disk..."
+ sleep 10
+ /bin/mount -rt ext3 /dev/$prefroot /mnt
+ if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
+ -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
+ /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..."
+ else
+ /bin/umount /mnt
+ /bin/echo "Can't find valid rootfs on /dev/$prefroot, using jffs2 ..."
+ mounted=
+ prefroot=jffs2
+ fi
+fi
+
+if [ $prefroot = "maintenence" ] ; then
+ /bin/dd if=/dev/zero of=/dev/ram0 bs=1k count=12k 2>/dev/null
+ /usr/bin/mke2fs -m 0 /dev/ram0 12288
+ /bin/mount -t ext2 /dev/ram0 /mnt
+ ( /usr/bin/find . -print0 -mount | /usr/bin/cpio -p -0 -d -m -u /mnt )
+ /bin/rm -f /mnt/linuxrc
+ /bin/cp /mnt/home/httpd/html/Management/upgrade.cgi /mnt/home/httpd/html/Management/upgrade-real.cgi
+ /bin/echo "#!/bin/sh" > /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo >> /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo "/bin/mount -t ramfs none /upload -o size=8196 2>/dev/null" \
+ >> /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo "/bin/dd if=/dev/zero of=/upload/free-ram bs=1k count=8k 2>/dev/null" \
+ >> /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo "/bin/umount /upload 2>/dev/null" \
+ >> /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo "exec /home/httpd/html/Management/upgrade-real.cgi" \
+ >> /mnt/home/httpd/html/Management/upgrade.cgi
+ /bin/echo "Root filesystem will be mounted from /dev/ram0 (a copy of /dev/mtdblock4) ..."
+fi
+
+if [ $prefroot = "nfsroot" ] ; then
+
+ sysconflen=`/bin/dd if=/dev/mtd1 bs=4 count=1 2>/dev/null | /usr/bin/hexdump -n 6 -e '"%02d"'`
+ ipaddr=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep ip_addr | sed -e s/ip_addr=//`
+ netmask=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep netmask | sed -e s/netmask=//`
+ gateway=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep gateway | sed -e s/gateway=//`
+
+ /sbin/insmod ixp400
+ /sbin/insmod ixp425_eth
+ /sbin/ifconfig ixp0 up $ipaddr netmask $netmask
+ /sbin/route add default gw $gateway
+
+ /sbin/ifconfig lo up 127.0.0.1
+
+ # The nfsrootloc and nfsrootopts vars can be overridden here.
+ . /.nfsroot
+
+ /bin/mount $nfsrootopts $nfsrootloc /mnt
+
+ if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
+ -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
+ /bin/echo "Root filesystem will be mounted from an NFS root ..."
+ mounted=/mnt
+ else
+ /bin/umount /mnt
+ /bin/echo "Can't find valid NFS rootfs, using jffs2 ..."
+ mounted=
+ prefroot=jffs2
+ fi
+fi
+
+if [ $prefroot = "jffs2" ] ; then
+ /bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..."
+ mounted=
+fi
+
+
+/bin/umount /proc
+
+# Pivot to the desired rootfs and run the initial executable.
+
+if [ -n "$mounted" ] ; then
+
+ cd $mounted
+
+ if [ -x ./sbin/init -o -L ./sbin/init ] ; then
+ runboot=/sbin/init
+ elif [ -x ./bin/init -o -L ./bin/init ] ; then
+ runboot=/bin/init
+ else
+ runboot=/bin/sh
+ fi
+
+ /sbin/pivot_root . initrd
+
+ exec /usr/sbin/chroot . $runboot < /dev/console 1> /dev/console 2> /dev/console
+
+else
+
+ exec /sbin/init
+
+fi
+
+/bin/echo "Can't chroot to $prefroot, using jffs2 ..."
+exec /sbin/init
+
+# Last-resort fall-back - this should never be reached.
+/bin/sh
--- /dev/null
+# Add an alias for eth0 to MODULE to cause the S40networking
+# init script to load the MODULE driver on the first boot
+alias eth0 MODULE
--- /dev/null
+# Adding modules to be automatically loaded via update-modules
--- /dev/null
+#!/bin/sh
+# reflash
+# ensure the flash disk is not mounted
+# save configuration files
+# update the kernel
+# update the flashdisk
+# restore the saved configuration files
+# the set of configuration files is described by
+# /etc/default/conffiles.
+#
+# /etc/default/functions contains useful utility functions
+. /etc/default/functions
+#
+# CHECKING FOR INPUT (ARGUMENTS ETC)
+# ----------------------------------
+#
+# find the kernel and the new flash file system, an image file can
+# be used to specify both images.
+ffsfile=
+kfile=
+imgfile=
+while test $# -gt 0
+do
+ case "$1" in
+ -k) shift
+ test $# -gt 0 || {
+ echo "reflash: -k: give the file containing the kernel image" >&2
+ exit 1
+ }
+ kfile="$1"
+ shift;;
+ -[jr]) shift
+ test $# -gt 0 || {
+ echo "reflash: -j: give the file containing the root jffs2 image" >&2
+ exit 1
+ }
+ ffsfile="$1"
+ shift;;
+ -i) shift
+ test $# -gt 0 || {
+ echo "reflash: -i: give the file containing the complete flash image" >&2
+ exit 1
+ }
+ imgfile="$1"
+ shift;;
+ *) echo "reflash: usage: $0 [-k kernel] [-j rootfs] [-i image]" >&2
+ echo " -k file: the new compressed kernel image ('zImage')" >&2
+ echo " -j file: the new root file system (jffs2)" >&2
+ echo " -i file: a complete flash image (gives both kernel and jffs2)" >&2
+ echo " The current jffs2 will be umounted if mounted." >&2
+ exit 1;;
+ esac
+done
+#
+# Sanity check on the arguments
+if test -n "$imgfile" -a -n "$ffsfile" -a -n "$kfile"
+then
+ echo "reflash: -k,-j,-i: specify at most two files" >&2
+ echo " -i has both a kernel and rootfs, the kernel from -k and" >&2
+ echo " the rootfs from -j override the one in the image (if given)" >&2
+ exit 1
+elif test -z "$imgfile" -a -z "$ffsfile" -a -z "$kfile"
+then
+ echo "reflash: -k,-j,-i: specify at least one file to flash" >&2
+ exit 1
+fi
+#
+# Perform basic checks on the input (must exist, size must be ok).
+if test -n "$imgfile"
+then
+ if test -r "$imgfile"
+ then
+ # read the partition table and from this find the offset
+ # and size of Kernel and Flashdisk partitions. The following
+ # devio command just dumps the partition table in a format
+ # similar to /proc/mtd (but it outputs decimal values!)
+ #NOTE: this uses a here document because this allows the while
+ # loop to set the variables, a pipe would put the while in
+ # a sub-shell and the variable settings would be lost. This
+ # works in ash, no guarantees about other shells!
+ while read size base name
+ do
+ case "$name" in
+ Kernel) imgksize="$size"
+ imgkoffset="$base";;
+ Flashdisk)
+ imgffssize="$size"
+ imgffsoffset="$base";;
+ esac
+ done <<EOI
+$(devio "<<$imgfile" '
+ <= $ 0x20000 -
+ L= 0x1000
+ $( 1
+ # 0xff byte in name[0] ends the partition table
+ $? @ 255 =
+ # output size base name
+ <= f15+
+ .= b 0xfffffff &
+ <= f4+
+ .= b
+ pf "%lu %lu "
+ <= f28-
+ cp 16
+ pn
+ <= f240+
+ L= L256-
+ $) L255>')
+EOI
+ # check the result
+ test "$imgksize" -gt 0 -a "$imgkoffset" -ge 0 || {
+ echo "reflash: $imgfile: failed to find Kernel partition in image" >&2
+ exit 1
+ }
+ # the kernel is after a 16 byte header which holds the
+ # values length,0,0,0 Get the true size.
+ ktmp="$(devio "<<$imgfile" "L=$imgksize" "O=$imgkoffset" '
+ $( OL+$>!
+ <= O
+ A= b
+ $( AL>!
+ pr A
+ $) 0
+ $) 0')"
+ test "$ktmp" -gt 0 || {
+ echo "reflash: $imgfile($imgkoffset,$imgksize): invalid kernel offset/size" >&2
+ exit 1
+ }
+ # update the size and offset to these values (the offset is 16+ because
+ # of the header).
+ imgksize="$ktmp"
+ imgkoffset="$(devio "O=$imgkoffset" 'pr O16+')"
+ # just test the size for the rootfs
+ test "$imgffssize" -gt 0 -a "$imgffsoffset" -ge 0 || {
+ echo "reflash: $imgfile: failed to find Flashdisk" >&2
+ exit 1
+ }
+ else
+ echo "reflash: $imgfile: image file not found" >&2
+ exit 1
+ fi
+fi
+if test -n "$kfile"
+then
+ if test ! -r "$kfile"
+ then
+ echo "reflash: $kfile: kernel file not found" >&2
+ exit 1
+ fi
+ # the file values override anything from the image.
+ imgksize="$(devio "<<$kfile" 'pr$')"
+ imgkoffset=0
+else
+ kfile="$imgfile"
+fi
+if test -n "$ffsfile"
+then
+ if test ! -r "$ffsfile"
+ then
+ echo "reflash: $ffsfile: root file system image file not found" >&2
+ exit 1
+ fi
+ # values override those from the image
+ imgffssize="$(devio "<<$ffsfile" 'pr$')"
+ imgffsoffset=0
+else
+ ffsfile="$imgfile"
+fi
+#
+# INPUTS OK, CHECKING THE ENVIRONMENT
+# -----------------------------------
+# basic setup. This could be parameterised to use different partitions!
+kpart=Kernel
+ffspart=Flashdisk
+#
+kdev=
+ksize=0
+if test -n "$kfile"
+then
+ # we have a new kernel
+ kdev="$(mtblockdev $kpart)"
+ test -n "$kdev" -a -b "$kdev" || {
+ echo "reflash: $kpart($kdev): cannot find $kpart mtd partition." >&2
+ echo " check /proc/mtd, either the partition does not exist or there is no" >&2
+ echo " corresponding block device." >&2
+ exit 1
+ }
+ ksize="$(devio "<<$kdev" 'pr$')"
+ #
+ # check the input file size
+ test -n "$imgksize" -a "$imgksize" -gt 0 -a "$imgksize" -le "$ksize" || {
+ echo "reflash: $kfile: bad Kernel size ($s, max $ksize)" >&2
+ exit 1
+ }
+fi
+#
+ffsdev=
+ffssize=0
+if test -n "$ffsfile"
+then
+ ffsdev="$(mtblockdev $ffspart)"
+ test -n "$ffsdev" -a -b "$ffsdev" || {
+ echo "reflash: $ffspart($ffsdev): cannot find $ffspart mtd partition." >&2
+ echo " check /proc/mtd, either the partition does not exist or there is no" >&2
+ echo " corresponding block device." >&2
+ exit 1
+ }
+ ffssize="$(devio "<<$ffsdev" 'pr$')"
+ #
+ # check the input file size
+ test -n "$imgffssize" -a "$imgffssize" -gt 0 -a "$imgffssize" -le "$ffssize" || {
+ echo "reflash: $ffsfile: bad Flashdisk size ($s, max $ffssize)" >&2
+ exit 1
+ }
+fi
+
+#
+# INPUTS OK, ENVIRONMENT OK, UMOUNT ANY EXISTING MOUNT OF THE FLASHDISK
+# ---------------------------------------------------------------------
+# This is only required if the device is going to be used
+if test -n "$ffsdev"
+then
+ # -r causes this to fail if the flash device is mounted on /
+ umountflash -r "$ffsdev" || exit 1
+ #
+ # Everything is umounted, now remount on a temporary directory.
+ ffsdir="/tmp/flashdisk.$$"
+ mkdir "$ffsdir" || {
+ echo "reflash: $ffsdir: failed to create temporary directory" >&2
+ exit 1
+ }
+ #
+ mountflash "$ffsdev" "$ffsdir" -o ro || {
+ rmdir "$ffsdir"
+ exit 1
+ }
+ #
+ # this is a utility function to make the cleanup easier
+ errorexit() {
+ umount "$ffsdir" && rmdir "$ffsdir" ||
+ echo "reflash: $ffsdir: temporary directory cleanup failed" >&2
+ exit 1
+ }
+ #
+ test -r "$ffsdir/etc/default/conffiles" || {
+ echo "reflash: [/initrd]/etc/default/conffiles: file not found" >&2
+ errorexit
+ }
+else
+ errorexit() {
+ exit 1
+ }
+fi
+#
+# PRESERVE EXISTING CONFIGURATION
+# -------------------------------
+# Only required if the flash partition will be written
+if test -n "$ffsdev"
+then
+ echo "reflash: preserving existing configuration file" >&2
+ #
+ # This step produces /tmp/preserve.$$ and /tmp/cpio.$$, the former is
+ # a list of the preserved configuration files together with the processing
+ # option, the latter is a directory tree of the preserved files (a directory
+ # tree makes the restore step easier.)
+ saved=/tmp/cpio.$$
+ list=/tmp/preserve.$$
+ mkdir "$saved" || {
+ echo "reflash: $saved: could not create save directory" >&2
+ errorexit
+ }
+ #
+ ( cd "$ffsdir"
+ find etc/*.conf $(sed 's!^/!!' usr/lib/ipkg/info/*.conffiles) ! -type d -newer etc/.configured -print |
+ sed 's/^/diff /'
+ exec sed 's/#.*$//;/^[ ]*$/d' etc/default/conffiles
+ ) | sed 's!^/*!!' | awk '{ op=$1; $1=""; file[$0]=op }
+ END{ for (f in file) if (file[f] != "ignore") print file[f] f }' |
+ while read op file
+ do
+ if test -e "$ffsdir/$file"
+ then
+ echo "$op $file" >&3
+ echo "$file"
+ fi
+ done 3>"$list" | (cd "$ffsdir"; exec cpio -p -d -m -u "$saved") || {
+ echo "reflash: $saved: copy of saved configuration files failed" >&2
+ rm -rf "$saved"
+ rm "$list"
+ errorexit
+ }
+ #
+ # If this umount fails do not try to continue...
+ umount "$ffsdir" || {
+ echo "reflash: $ffsdir: temporary mount point umount failed" >&2
+ echo " No changes have been made." >&2
+ rm -rf "$saved"
+ rm "$list"
+ exit 1
+ }
+fi
+#
+# FLASH THE NEW IMAGES
+# --------------------
+echo "reflash: about to flash new image" >&2
+#
+# There are four possibilities here - kernel only, flashdisk only, then
+# kernel&flashdisk in either one or two different files. The code used
+# to attempt to do everything in one step, but this complicates it,
+# so two steps are used (as required). A failure between the two
+# steps is a problem, but then so is a failure in a partial write.
+# Write the flashdisk first because this is larger (most likely to
+# fail).
+# Temporarily check for devio progress indicator capability this way...
+if devio -p '' 2>/dev/null
+then
+ progress=-p
+else
+ progress=
+fi
+do_kernel() {
+ devio $progress "$@" "<<$kfile" ">>$kdev" '
+ # kernel is at imgkoffset[imgksize]
+ ' "<= $imgkoffset" "L=$imgksize" '
+ # kernel write length,0,0,0 header, then fill
+ wb L,4
+ fb 12,0
+ cp L
+ # fill with 255
+ fb #t-,255'
+}
+#
+do_ffs() {
+ devio $progress "$@" "<<$ffsfile" ">>$ffsdev" '
+ # rootfs is at imgffsoffset[imgffssize]
+ ' "<= $imgffsoffset" "cp $imgffssize" '
+ # fill with 255
+ fb #t-,255'
+}
+#
+# check_status $? type file(offset,size) device
+# check the devio status code (given in $1)
+check_status() {
+ case "$1" in
+ 0) echo " done" >&2;;
+ 1) echo " failed" >&2
+ echo "reflash: $3: flash $2 failed, no changes have been made to $4" >&2
+ if test "$2" = rootfs
+ then
+ rm -rf "$saved"
+ rm "$list"
+ exit 1
+ else
+ echo "reflash: $2: continuing with rootfs changes" >&2
+ echo " NOTE: the old kernel is still in $4!" >&2
+ fi;;
+ 3) echo " failed" >&2
+ echo "reflash: $3: WARNING: partial flash of $2 to $4 the system is unbootable" >&2
+ echo " Reflash from RedBoot or correct the problem here." >&2
+ if test "$2" = rootfs
+ then
+ exit 3
+ else
+ echo "reflash: $2: continuing with rootfs changes" >&2
+ echo " NOTE: the kernel in $4 must be reflashed!" >&2
+ fi;;
+ *) echo " failed" >&2
+ echo "reflash($1): $3: internal error flashing $2 to $4" >&2
+ exit $1;;
+ esac
+}
+#
+if test -n "$ffsdev"
+then
+ echo -n "reflash: writing rootfs to $ffsdev " >&2
+ do_ffs
+ check_status $? rootfs "$ffsfile($imgffsoffset,$imgffssize)" "$ffsdev"
+fi
+#
+if test -n "$kdev"
+then
+ echo -n "reflash: writing kernel to $kdev " >&2
+ do_kernel
+ check_status $? kernel "$kfile($imgkoffset,$imgksize)" "$kdev"
+fi
+#
+# verify - this just produces a warning
+if test -n "$ffsdev"
+then
+ echo -n "reflash: verifying new flash image " >&2
+ if do_ffs -v
+ then
+ echo " done" >&2
+ else
+ echo " failed" >&2
+ echo "reflash: WARNING: rootfs flash image verification failed" >&2
+ echo " The system is probably unbootable." >&2
+ echo " System configuration files will be restored but this may fail" >&2
+ echo " Starting a shell for user recovery (exit to continue)" >&2
+ PS1='badflash$ ' sh -i <>/dev/tty >&0 2>&0
+ fi
+fi
+#
+if test -n "$kdev"
+then
+ echo -n "reflash: verifying new kernel image " >&2
+ if do_kernel -v
+ then
+ echo " done" >&2
+ else
+ echo " failed" >&2
+ echo "reflash: WARNING: kernel flash image verification failed" >&2
+ echo " The system is probably unbootable." >&2
+ echo " System configuration files will be restored in the rootfs." >&2
+ fi
+fi
+#
+# RESTORE THE OLD CONFIGURATION
+# -----------------------------
+# If not write the rootfs none of the following is required - exit now.
+test -n "$ffsdev" || exit 0
+#
+echo "reflash: restoring saved configuration files" >&2
+#
+# the file /etc/.configured is the datestamp file used to ensure that
+# changed configuration files can be recognised. It is created by
+# /etc/rcS.d/S99finish on first boot (if it does not exist). We need
+# a timestamp earlier than any files we create so touch it here, this
+# also acts as a test on the mounted file system
+mountflash "$ffsdev" "$ffsdir" && :>"$ffsdir/etc/.configured" || {
+ rmdir "$ffsdir"
+ echo "reflash: mount of new flash root file system failed" >&2
+ if test -d "$ffsdir/etc"
+ then
+ echo " The file system does not seem to be writeable." >&2
+ echo " The mounted file system is in $ffsdir" >&2
+ fi
+ echo " WARNING: the kernel and root file system have been reflashed," >&2
+ echo " HOWEVER the new root file system seems to be unuseable." >&2
+ echo " Saved configuration files are in $saved" >&2
+ echo " The list of saved configuration files is in $list" >&2
+ echo " You should determine the reason for the failed mount, mount the new" >&2
+ echo " file system and restore the configuration from $saved - it's just a" >&2
+ echo " matter of copying the saved files where required." >&2
+ exit 1
+}
+#
+# verify file
+# this is called with the name of a 'diff' file which is, indeed,
+# different and with all the std streams connected to the tty. It
+# returns a status code to say whether (0) or not (1) to copy the
+# file over.
+#
+verify_help() {
+ echo "Please specify how to handle this file or link, the options are as follows,"
+ echo "two character abbreviations may be used:"
+ echo
+ echo " keep: retain the old file, overwrite the new flash image file"
+ echo " upgrade: retain the new file, the old (saved) file is not used"
+ echo " diff: display the differences between the old and the new using diff -u"
+ echo " shell: temporarily start an interactive shell (sh -i), exit to continue"
+ echo " skip: ignore this file for the moment. The file is left in the directory"
+ echo " $saved and many be handled after this script has completed"
+}
+#
+verify() {
+ local command file
+
+ file="$1"
+ echo "reflash: $file: configuration file changed."
+ verify_help "$file"
+ while :
+ do
+ echo -n "option: "
+ read command
+ case "$command" in
+ ke*) return 0;;
+ up*) rm "$saved/$file"
+ return 1;;
+ di*) echo "DIFF OLD($saved) NEW($ffsdir)"
+ diff -u "$saved/$file" "$ffsdir/$file";;
+ sh*) PS1="$file: " sh -i;;
+ sk*) return 1;;
+ *) verify_help "$file";;
+ esac
+ done
+}
+# the same, but for a link
+verify_link() {
+ local command link
+
+ link="$1"
+ echo "reflash: $link: configuration link changed."
+ verify_help "$link"
+ while :
+ do
+ echo -n "option: "
+ read command
+ case "$command" in
+ ke*) return 0;;
+ up*) rm "$saved/$link"
+ return 1;;
+ di*) echo "DIFF:"
+ echo "OLD($saved): $link -> $(readlink "$saved/$link")"
+ echo "NEW($ffsdir): $link -> $(readlink "$ffsdir/$link")";;
+ sh*) PS1="$link: " sh -i;;
+ sk*) return 1;;
+ *) verify_help "$link";;
+ esac
+ done
+}
+#
+while read op file
+do
+ # handle .configured specially (to preserve the original datestamp)
+ if test "$file" = "etc/.configured"
+ then
+ # this should definately not fail because of the test above!
+ if cp -a "$saved/$file" "$ffsdir/$file"
+ then
+ echo "$file" >&3
+ else
+ echo "reflash: $file: timestamp copy failed (ignored)" >&2
+ fi
+ elif test -h "$saved/file" -o -h "$ffsdir/$file"
+ then
+ # new or old symbolic link
+ if test -h "$saved/$file" -a -h "$ffsdir/$file" &&
+ test "$(readlink "$saved/$file")" = "$(readlink "$ffsdir/$file")"
+ then
+ # no change
+ echo "$file" >&3
+ else
+ # assume a change regardless
+ case "$op" in
+ preserve)
+ echo "$file"
+ echo "$file" >&3;;
+ diff) # need user input
+ if verify_link "$file" <>/dev/tty >&0 2>&0
+ then
+ echo "$file"
+ echo "$file" >&3
+ fi;;
+ esac
+ fi
+ else
+ # only overwrite if necessary
+ if test -e "$ffsdir/$file" && cmp -s "$saved/$file" "$ffsdir/$file"
+ then
+ # do not overwrite
+ echo "$file" >&3
+ elif test ! -e "$ffsdir/$file"
+ then
+ # always preserve
+ echo "$file"
+ echo "$file" >&3
+ else
+ case "$op" in
+ preserve)
+ echo "$file"
+ echo "$file" >&3;;
+ diff) # the files are different, get user input
+ if verify "$file" <>/dev/tty >&0 2>&0
+ then
+ echo "$file"
+ echo "$file" >&3
+ fi;;
+ esac
+ fi
+ fi
+done <"$list" 3>/tmp/restore.$$ | (cd "$saved"; exec cpio -p -d -u "$ffsdir") || {
+ echo "reflash: $saved: restore of saved configuration files failed" >&2
+ echo " The new flash file system is mounted on $ffsdir" >&2
+ echo " The saved files are in $saved and the list in $list, the list of" >&2
+ echo " files selected for restore is in /tmp/restore.$$" >&2
+ echo " You should restore any required configuration from $saved," >&2
+ echo " then umount $ffsdir and reboot." >&2
+ exit 1
+}
+#
+# remove the copied files (i.e. the ones which were preserved)
+( cd "$saved"
+ exec rm $(cat /tmp/restore.$$)
+)
+rm /tmp/restore.$$
+#
+# clean up, files left in $saved need to be handled by the user
+files="$(find "$saved" ! -type d -print)"
+if test -n "$files"
+then
+ echo "reflash: the following saved configuration files remain:" >&2
+ echo "$files" >&2
+ echo "The full list of preserved files is in $list. To alter the" >&2
+ echo "new root file system use the command:" >&2
+ echo "" >&2
+ echo " mount -t jffs2 $ffsdev /mnt" >&2
+ echo "" >&2
+ echo "The saved files are in the temporary directory, they will not" >&2
+ echo "be retained across a system boot. Copy them elsewhere if you" >&2
+ echo "are unsure whether they are needed" >&2
+else
+ rm -rf "$saved"
+ rm "$list"
+fi
+#
+# now the final umount
+if umount "$ffsdir"
+then
+ rmdir "$ffsdir"
+ echo "reflash: system upgrade complete. Reboot to continue." >&2
+ exit 0
+else
+ echo "reflash: $ffsdir: temporary mount point umount failed" >&2
+ echo " ALL changes have been made successfully, however the umount of" >&2
+ echo " the new root file system has failed. You should determine the" >&2
+ echo " cause of the failure, umount $ffsdir, then reboot the system (this" >&2
+ echo " will use the upgraded kernel and root file system)" >&2
+ exit 1
+fi
--- /dev/null
+#!/bin/sh
+# turnup
+# See the help block at the end for documentation.
+#
+. /etc/default/functions
+
+#
+# configuration
+# The following variables control which directories in /var end up on the rootfs
+# and which end up in a temporary file system.
+INRAM_MEMSTICK="/var/cache /var/lock /var/log /var/run /var/tmp /var/lib/ipkg"
+INRAM_NFS="/var/cache /var/lock /var/run /var/tmp"
+INRAM_DISK=""
+#
+# force: override certain checks
+force=
+#
+# fstype new
+# The type of the file system mounted on "new" Outputs the last
+# piece of information found, which should be the one for the
+# currently visible mount!
+fstype() {
+ local cwd dev mp type options pass freq result
+ cwd="$(cd "$1"; /bin/pwd)"
+ result=
+ while read dev mp type options pass freq
+ do
+ case "$mp" in
+ "$cwd") result="$type";;
+ esac
+ done </proc/mounts
+ echo "$result"
+}
+#
+# fsoptions arguments
+# Collapses the mount (-o) options into a single list which is
+# printed on stdout. Accepts an arbitrary list of options and
+# just joins them together.
+fsoptions() {
+ local options
+ options=
+ while test $# -gt 1
+ do
+ case "$1" in
+ -t) shift;;
+ -o) if test -n "$2"
+ then
+ if test -n "$options"
+ then
+ options="$options,$2"
+ else
+ options="$2"
+ fi
+ fi
+ shift;;
+ esac
+ shift
+ done
+ if test -n "$options"
+ then
+ echo "$options"
+ else
+ echo defaults
+ fi
+}
+#
+# get_flash <directory> {mount options}
+# mount the flash device, writeable, on the given directory
+get_flash() {
+ local ffsdir ffsdev
+
+ ffsdir="$1"
+ shift
+ test -n "$ffsdir" -a -d "$ffsdir" || {
+ echo "$0: $ffsdir: internal error, flash mount point not a directory" >&2
+ return 1
+ }
+
+ ffsdev="$(mtblockdev Flashdisk)"
+ umountflash "$ffsdev" &&
+ mountflash "$ffsdev" "$ffsdir" "$@"
+}
+#
+# check_rootfs [-i] <root fs directory>
+# Make sure the candidate rootfs is empty
+check_rootfs() {
+ local fcount
+
+ case "$1" in
+ -i) shift
+ case "$force" in
+ -f) return 0;;
+ esac
+
+ fcount="$(find "$1" ! -type d -print | wc -l)"
+ test "$fcount" -eq 0 && return 0
+
+ echo "turnup: $1: partition contains existing files, specify -f to overwrite" >&2
+ return 1;;
+ *) checkmount "$1" && return 0
+
+ echo "turnup: $1: partition does not seem to be a valid root partition" >&2
+ if test -f "$1"/.recovery
+ then
+ echo " $1/.recovery exists: fix the partition then remove it" >&2
+ fi
+ return 1;;
+ esac
+}
+#
+# copy_rootfs old new
+# Make a copy of the given root file system, copying only the
+# directories needed. The root must be the flash file system
+copy_rootfs() {
+ local old new
+ old="$1"
+ new="$2"
+ test -d "$old" -a -d "$new" || {
+ echo "turnup: rootfs: copy $old $new: not a directory" >&2
+ return 1
+ }
+ #
+ # There are no problem file names in the flash file system, so
+ # it is possible to use -print, not -print0. The following
+ # files and directories are not copied:
+ #
+ # /dev/*
+ # /boot, /boot/*
+ # /linuxrc*
+ # /var/*
+ echo "turnup: copying root file system" >&2
+ ( cd "$1"
+ find . -mount -print |
+ sed '\@^./dev/@d;\@^./boot/@d;\@^./boot$@d;\@^./linuxrc@d;\@^./var/@d' |
+ cpio -p -d -m -u "$2"
+ ) || {
+ echo "turnup: rootfs: cpio $old $new failed" >&2
+ return 1
+ }
+ echo "done" >&2
+}
+
+#
+# setup_dev new device_table
+# In flash file systems /dev is in ramfs, in disk systems /dev
+# can be populated permanently. This is done by creating a
+# single entry '.noram' in /dev - the devices init script will
+# then populate the directory without overmounting it. The
+# devices in the passed in device table are also created, but
+# note that this is insufficient, /etc/init.d/devices must
+# also run.
+setup_dev() {
+ test -n "$1" -a -d "$1"/dev -a -r "$2" || {
+ echo "turnup: setup_dev($1,$2): expected a directory and a file" >&2
+ return 1
+ }
+ echo "turnup: initialising dev file system" >&2
+ # init tries to open the following devices:
+ # /dev/console
+ # /dev/tty0
+ # /dev/null
+ # syslog, and maybe other things, only work if fd 1 is valid, therefore
+ # we must create these devices here...
+ makedevs --root="$1" --devtable="$2"
+ :>"$1"/dev/.noram
+ return 0
+}
+
+#
+# setup_bootdev new device_table
+# As above but actually uses the supplied device table - this is possible if
+# the table is just used for boot because the extra setup is not required.
+setup_bootdev() {
+ test -n "$1" -a -d "$1"/dev -a -r "$2" || {
+ echo "turnup: setup_bootdev($1,$2): expected a directory and a file" >&2
+ return 1
+ }
+ # NOTE: this fails silently with 0 return code(!) when a directory
+ # does not exist yet things are created within it.
+ makedevs -r "$1" -D "$2"
+}
+
+#
+# setup_var new type
+# Populates /var.
+# Removes the /var tmpfs entry from /etc/fstab.
+# Creates links from /var into /media/ram for NFS and Memstick.
+
+setup_var() {
+ test -n "$1" -a -d "$1"/var || {
+ echo "turnup: setup_var($1,$2): expected a directory" >&2
+ return 1
+ }
+ case "$2" in
+ disk|nfs|memstick);;
+ *) echo "turnup: setup_var($1,$2): expected 'disk', 'nfs' or 'memstick'" >&2
+ return 1;;
+ esac
+ #
+ # populate /var, there is a shell script to do this, but it uses
+ # absolute path names
+ chroot "$1" /bin/busybox sh /etc/init.d/populate-volatile.sh || {
+ echo "turnup: /var: could not populate directory" >&2
+ return 1
+ }
+
+ case "$2" in
+ disk) RAMTARGETS=${INRAM_DISK};;
+ nfs) RAMTARGETS=${INRAM_NFS};;
+ memstick) RAMTARGETS=${INRAM_MEMSTICK};;
+ esac
+
+ for d in ${RAMTARGETS}; do
+ RAMDIR="/media/ram${d}"
+ REALDIR="${d}"
+ rm -rf "${1}${REALDIR}"
+ ln -s "${RAMDIR}" "${1}${REALDIR}"
+ done
+ # the startup link is left for the moment, this seems safer
+ #rm "$1"/etc/rc?.d/[KS]??populate-var.sh
+ # remove the /var tmpfs entry from the new /etc/fstab
+ sed -i '\@[ ]/var[ ][ ]*tmpfs[ ]@d' "$1"/etc/fstab
+ echo "turnup: tmpfs will no longer be mounted on /var" >&2
+ #
+ # Previous versions of turnup removed populate-var.sh from the
+ # startup links, this one doesn't, so /var can be made back into
+ # a tmpfs just by a change to /etc/fstab.
+ return 0
+}
+
+#
+# setup_syslog new
+# Moves the syslog to a file - appropriate for disk and nfs types, not
+# otherwise.
+setup_syslog() {
+ test -n "$1" -a -d "$1"/etc || {
+ echo "turnup: setup_syslog($1): expected a directory" >&2
+ return 1
+ }
+ #
+ # if the syslog is to the buffer redirect it to a file
+ if egrep -q '^DESTINATION="buffer"' "$1"/etc/syslog.conf
+ then
+ if cp "$1"/etc/syslog.conf "$1"/etc/syslog.conf.sav
+ then
+ # the busybox syslog will fail with ROTATESIZE and ROTATEGENS
+ sed -i 's!DESTINATION="buffer"!DESTINATION="file"!
+ /^ROTATESIZE=/d
+ /^ROTATEGENS=/d' "$1"/etc/syslog.conf
+ echo "turnup: /etc/syslog.conf: changed to file buffering" >&2
+ echo " Old (buffer) version in /etc/syslog.conf.sav" >&2
+ echo " Log messages will be in /var/log/messages" >&2
+ else
+ echo "turnup: /etc/syslog.conf: failed to make a copy" >&2
+ echo " syslog will log to a buffer" >&2
+ fi
+ fi
+ return 0
+}
+
+#
+# setup_rootfs type new device_table
+# Populates the /dev and /var directories, alters the startup to
+# not mount or populate them further. Does the right thing according
+# to the given $type
+setup_rootfs() {
+ local type new table
+ type="$1"
+ new="$2"
+ table="$3"
+
+ test -n "$new" -a -d "$new" -a -f "$table" || {
+ echo "turnup: setup_rootfs($type,$new,$table): expected a directory and a file" >&2
+ return 1
+ }
+
+ case "$type" in
+ flash) return 0;;
+ disk) setup_dev "$new" "$table" &&
+ setup_var "$new" "$type" &&
+ setup_syslog "$new";;
+ memstick)
+ setup_bootdev "$new" "$table" &&
+ setup_var "$new" "$type" ;;
+ nfs) setup_dev "$new" "$table" &&
+ setup_var "$new" "$type" &&
+ setup_syslog "$new";;
+ *) echo "turnup: setup_rootfs: $type: unknown rootfs type" >&2
+ return 1;;
+ esac
+ # return code of last setup function
+}
+
+#
+# setup_fstab new fsdev fstype fsoptions
+# Alters the /etc/fstab entry for / to refer to the correct device and
+# have the correct type and options. Essential for checkroot to remount
+# / with the correct options.
+# bad, since sed won't fail even if it changes nothing.
+setup_fstab() {
+ sed -i '\@^[^ ]*[ ][ ]*/[ ]@s@^.*$@'"$2 / $3 $4 1 1"'@' "$1"/etc/fstab
+ egrep -q "^$2 / $3 $4 1 1\$" "$1"/etc/fstab || {
+ echo "turnup: /etc/fstab: root(/) entry not changed" >&2
+ echo " you probably need to check the options in /etc/fstab" >&2
+ echo " to ensure that the root partition is mounted correctly" >&2
+ return 1
+ }
+}
+
+
+#
+# boot_rootfs <boot type> <flash file system> <sleep time> <device> [options]
+# Change the flash partition (not the current root!) to boot off
+# the new root file system
+boot_rootfs() {
+ local type ffs sleep device opt
+
+ type="$1"
+ ffs="$2"
+ sleep="$3"
+ device="$4"
+
+ # test this first as the test does not depend on the correctness
+ # of the other arguments
+ test -n "$ffs" -a -d "$ffs" || {
+ echo "turnup: boot_rootfs($type, $ffs, $device): expected directory" >&2
+ return 1
+ }
+ test -x "$ffs"/boot/"$type" || {
+ echo "turnup: boot_rootfs($type, $ffs, $device): invalid boot type $type" >&2
+ return 1
+ }
+ shift
+ shift
+
+ case "$type" in
+ disk) test -n "$device" -a -b "$device" || {
+ echo "turnup: boot_rootfs($ffs, $type, $device): expected block device" >&2
+ return 1
+ }
+ shift 2;;
+ nfs) shift 2;;
+ flash) ;;
+ ram) ;;
+ *) echo "turnup: boot_rootfs($type, $ffs, $device): unknown type" >&2
+ return 1;;
+ esac
+
+ #
+ # The /linuxrc records the correct options to mount the device,
+ # since we have already mounted if correctly with these options
+ # we can be sure (maybe) that the boot will work. If not /boot/disk
+ # falls back to flash.
+ #
+ # This modifies the boot process, until this point no harm has been
+ # done to the system, but at this point the boot rootfs will change
+ rm -f "$ffs"/linuxrc.new || {
+ echo "turnup: boot_rootfs: failed to remove $ffs/linuxrc.new" >&2
+ return 1
+ }
+ case "$type" in
+ flash) ln -s "boot/flash" "$ffs"/linuxrc.new || {
+ echo "turnup: boot_rootfs: failed to create $ffs/linuxrc.new" >&2
+ return 1
+ };;
+ ram) { echo '#!/bin/sh'
+ echo 'rm -f /linuxrc.new'
+ echo 'ln -s boot/flash /linuxrc.new'
+ echo 'mv /linuxrc.new /linuxrc'
+ echo 'exec /boot/ram /dev/ram0'
+ echo 'exec /boot/flash'
+ } >"$ffs"/linuxrc.new &&
+ chmod 744 "$ffs"/linuxrc.new || {
+ echo "turnup: boot_rootfs: failed to write $ffs/linuxrc.new" >&2
+ return 1
+ };;
+ *) { echo '#!/bin/sh'
+ test "$sleep" -gt 0 && echo -n "sleep='$sleep' "
+ echo -n "exec '/boot/$type' '$device'"
+ for opt in "$@"
+ do
+ echo -n " '$opt'"
+ done
+ echo
+ echo 'exec /boot/flash'
+ } >"$ffs"/linuxrc.new &&
+ chmod 744 "$ffs"/linuxrc.new || {
+ echo "turnup: boot_rootfs: failed to write $ffs/linuxrc.new" >&2
+ return 1
+ };;
+ esac
+ rm -f "$ffs"/linuxrc.sav || {
+ echo "turnup: boot_rootfs: failed to remove $ffs/linuxrc.sav" >&2
+ return 1
+ }
+ ln "$ffs"/linuxrc "$ffs"/linuxrc.sav || {
+ echo "turnup: boot_rootfs: failed to save /linuxrc.sav" >&2
+ return 1
+ }
+ mv -f "$ffs"/linuxrc.new "$ffs"/linuxrc || {
+ echo "turnup: boot_rootfs: failed to install new /linuxrc" >&2
+ return 1
+ }
+ return 0
+}
+
+#
+# disk [-m] [-i] [-s<time>] <device> {options}
+# Carefully copy the flash file system to the named device.
+disk() {
+ local setup_type sleep init device new ffs fst fso
+
+ setup_type=disk
+ sleep=0
+ init=
+ while test $# -gt 0
+ do
+ case "$1" in
+ -f) force="$1"
+ shift;;
+ -m) setup_type=memstick
+ shift;;
+ -i) init="$1"
+ shift;;
+ -s*) sleep="${1#-s}"
+ sleep="${sleep:-10}"
+ shift;;
+ *) break;;
+ esac
+ done
+
+ device="$1"
+ test -n "$device" -a -b "$device" || {
+ echo "turnup disk: $device: block device required" >&2
+ return 1
+ }
+ shift
+
+ # make temporary directories for the mount points
+ new="/tmp/rootfs.$$"
+ ffs="/tmp/flashdisk.$$"
+ mkdir "$new" "$ffs" || {
+ echo "turnup: disk: failed to create temporary directories" >&2
+ return 1
+ }
+
+ # make sure we can get to the flash file system first
+ get_flash "$ffs" || {
+ rmdir "$new" "$ffs"
+ return 1
+ }
+
+ # Now mount the device with the given options, note that specifying
+ # read only is *not* an option, this is important because the boot/disk
+ # script needs a rw file system
+ status=1
+ fst=
+ fso="$(fsoptions "$@")"
+ if mount "$@" "$device" "$new"
+ then
+ fst="$(fstype "$new")"
+ umount "$new" ||
+ echo "turnup disk: $device($new): umount does not seem to work" >&2
+ fi
+
+ if test -n "$fst" && mount -t "$fst" -o "$fso" "$device" "$new"
+ then
+ if check_rootfs $init "$new" && {
+ test -z "$init" || {
+ copy_rootfs "$ffs" "$new" &&
+ setup_rootfs "$setup_type" "$new" "$ffs"/etc/device_table
+ }
+ }
+ then
+ setup_fstab "$new" "$device" "$fst" "$fso"
+ status=0
+ fi
+
+ # clean up the disk. It is worrying if this umount fails!
+ umount "$new" || test "$force" = "-f" || {
+ echo "turnup disk: $device: umount failed" >&2
+ echo " you must unmount this device cleanly yourself, then use" >&2
+ if test -z "$init"
+ then
+ echo " turnup with the -f option to boot from the device" >&2
+ else
+ echo " turnup without the -i option to boot from the device" >&2
+ fi
+ status=1
+ }
+
+ # if everything went ok boot from this disk
+ if test $status -eq 0
+ then
+ # memsticks boot like disks, so ignore the -m
+ boot_rootfs disk "$ffs" "$sleep" "$device" -t "$fst" -o "$fso"
+ fi
+ else
+ echo "turnup disk: $device($*): unable to mount device on $new" >&2
+ # If it worked first time
+ if test -n "$fst"
+ then
+ echo " options used: -t $fst -o $fso [error in this script]" >&2
+ fi
+ fi
+
+ # clean up the flash file system
+ umount "$ffs"
+ rmdir "$new" "$ffs"
+ return $status
+}
+
+#
+# boot_reset <type>
+# Resets the boot type to flash or ram, as appropriate
+boot_reset() {
+ local ffs typ status
+
+ case "$1" in
+ flash|ram)type="$1"
+ shift;;
+ *) echo "turnup: boot_reset($1): invalid type" >&2
+ return 1;;
+ esac
+
+ ffs="/tmp/flashdisk.$$"
+ mkdir "$ffs" || {
+ echo "turnup: $1: failed to create temporary directory" >&2
+ return 1
+ }
+
+ get_flash "$ffs" || {
+ rmdir "$ffs"
+ return 1
+ }
+
+ # now try to set the /linuxrc appropriately
+ boot_rootfs "$type" "$ffs"
+ status=$?
+
+ # clean up
+ umount "$ffs"
+ rmdir "$ffs"
+ return $status
+}
+
+#
+# nfs [-i] <root partition> {options}
+# Copy the flash file system to the given NFS root partition.
+nfs() {
+ local init nfsroot new ffs
+
+ init=
+ while test $# -gt 0
+ do
+ case "$1" in
+ -i) init="$1"
+ shift;;
+ -f) force="$1"
+ shift;;
+ *) break;;
+ esac
+ done
+
+ nfsroot="$1"
+ test -n "$nfsroot" || {
+ echo "turnup nfs: $nfsroot: NFS root file system required" >&2
+ return 1
+ }
+ shift
+
+ # make temporary directories for the mount points
+ new="/tmp/rootfs.$$"
+ ffs="/tmp/flashdisk.$$"
+ mkdir "$new" "$ffs" || {
+ echo "turnup nfs: failed to create temporary directories" >&2
+ return 1
+ }
+
+ # make sure we can get to the flash file system first
+ get_flash "$ffs" || {
+ rmdir "$new" "$ffs"
+ return 1
+ }
+
+ # Now mount the device with the given options, note that specifying
+ # read only is *not* an option, this is important because the boot/disk
+ # script needs a rw file system
+ status=1
+ fst=
+ # These settings for for NFS, something better will probably have to
+ # be done to support other network file systems.
+ nfsopt="nolock,noatime,hard,intr,rsize=1024,wsize=1024"
+ fso="$(fsoptions -o "$nfsopt" "$@")"
+ if mount -o "$nfsopt" "$@" "$nfsroot" "$new"
+ then
+ fst="$(fstype "$new")"
+ umount "$new" ||
+ echo "turnup nfs: $nfsroot($new): umount does not seem to work" >&2
+ fi
+
+ if test -n "$fst" && mount -t "$fst" -o "$fso" "$nfsroot" "$new"
+ then
+ if :>"$new"/ttt && test -O "$new"/ttt && rm "$new"/ttt
+ then
+ if check_rootfs $init "$new" && {
+ test -z "$init" || {
+ copy_rootfs "$ffs" "$new" &&
+ setup_rootfs nfs "$new" "$ffs"/etc/device_table
+ }
+ }
+ then
+ setup_fstab "$new" "$nfsroot" "$fst" "$fso"
+ status=0
+ fi
+ else
+ echo "turnup nfs: $nfsroot: partition must be exported no_root_squash" >&2
+ fi
+
+ # clean up the disk. It is worrying if this umount fails!
+ umount "$new" || test "$force" = "-f" || {
+ echo "turnup nfs: $nfsroot: umount failed" >&2
+ if test $status -eq 0
+ then
+ echo " you must unmount this partition cleanly yourself, then use" >&2
+ if test -z "$init"
+ then
+ echo " turnup with the -f option to boot from the NFS root" >&2
+ else
+ echo " turnup without the -i option to boot from the NFS root" >&2
+ fi
+ status=1
+ fi
+ }
+
+ # if everything went ok boot from this disk
+ if test $status -eq 0
+ then
+ # the options used are exactly those which worked before.
+ boot_rootfs nfs "$ffs" 0 "$nfsroot" -t nfs -o "$fso"
+ fi
+ else
+ echo "turnup nfs: $nfsroot($*): unable to mount device on $new" >&2
+ # If it worked first time
+ if test -n "$fst"
+ then
+ echo " options obtained: -t $fst -o $fso" >&2
+ fi
+ fi
+
+ # clean up the flash file system
+ umount "$ffs"
+ rmdir "$new" "$ffs"
+ return $status
+}
+
+#
+# fix_hw_addr
+# Called when the configuration is invalid to reset /etc/default/sysconf
+fix_hw_addr() {
+ # first look on the flash disk (ideally this stuff would only
+ # be called from flash, but there is no way of guaranteeing that).
+ local ffsdev ffs mac name force
+
+ case "$1" in
+ -f) force="$1";;
+ esac
+
+ ffsdev="$(mtblockdev Flashdisk)"
+ test -n "$ffsdev" -a -b "$ffsdev" || {
+ echo "turnup init: the flash file system device is missing" >&2
+ echo " The device (typically /dev/mtdblock4) must exist and" >&2
+ echo " it must identify a flash partition called 'Flashdisk'" >&2
+ echo " It may be that the /dev directory has not been initialised." >&2
+ echo " This script cannot correct this problem." >&2
+ return 1
+ }
+
+ test -x /etc/init.d/sysconfsetup || {
+ echo "turnup init: /etc/init.d/sysconfsetup: script not executable" >&2
+ echo " or script not present. turnup init requires this script to" >&2
+ echo " exist to correct the initialisation" >&2
+ return 1
+ }
+
+ # use devio to find out if this *is* the flash disk.
+ ffs=
+ if test "$(devio "<<$ffsdev" prd)" -ne "$(devio '<</etc/init.d/sysconfsetup' prd)"
+ then
+ # this isn't the flash device
+ ffs="/tmp/flashdisk.$$"
+ # make sure we can get to the flash file system first
+ get_flash "$ffs" || {
+ rmdir "$ffs"
+ return 1
+ }
+
+ # copy if available
+ if test -r "$ffs/etc/default/sysconf"
+ then
+ cp "$ffs/etc/default/sysconf"
+ force=
+ fi
+
+ umount "$ffs"
+ rmdir "$ffs"
+ fi
+
+ # if the config is still not valid generate sysconf from the slug
+ # label.
+ config valid && test -z "$force" || {
+ mac=
+ until test -n "$mac"
+ do
+ echo "turnup init: please find the 'MAC Address' of your NSLU2" >&2
+ echo " The required number is on a label on the bottom of the NSLU2" >&2
+ echo " It will be something like 'LKG1A2B3C'" >&2
+ echo -n "Enter the mac address: " >/dev/tty
+ read name </dev/tty
+ case "$name" in
+ [Ll][Kk][Gg][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f])
+ mac="$(echo "$name" |
+ sed -n 's/^...\(..\)\(..\)\(..\)$/00:0F:66:\1:\2:\3/p')";;
+ [0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f])
+ mac="$name"
+ name=
+ ;;
+ "") return 1;;
+ *) echo "$name: not recognised as a LinkSys mac address" >&2
+ echo " Enter the LinkSys value or a full Ethernet MAC addrress" >&2
+ mac=;;
+ esac
+
+ # Now generate the correct sysconf
+ { echo '[network]'
+ echo "hw_addr=$mac"
+ test -n "$name" && echo "default_server_name=$name"
+ } >/etc/default/sysconf
+ done
+ }
+
+ # the configuration should be valid now
+ /etc/init.d/sysconfsetup reload
+}
+
+#
+# read_one 'prompt' 'group' 'name'
+# read a single value
+read_one() {
+ local n o
+ o="$(sysval "$2" "$3")"
+ echo -n "$1 [$o]: " >/dev/tty
+ read n </dev/tty
+ test -z "$n" && n="$o"
+ eval "$3='$n'"
+}
+#
+# init_network
+# Change the network initialisation
+init_network() {
+ # fix the root password
+ echo "Please enter a new password for 'root'." >/dev/tty
+ echo "The password must be non-empty for ssh login to succeed!" >/dev/tty
+ passwd
+ # now the network configuration
+ read_one "Host name" network disk_server_name
+ read_one "Domain name" network w_d_name
+ read_one "Boot protocol (dhcp|static)" network bootproto
+ case "$bootproto" in
+ static) read_one "IP address" network ip_addr
+ read_one "IP netmask" network netmask
+ read_one "IP gateway" network gateway
+ read_one "First DNS server" network dns_server1
+ read_one "Second DNS server" network dns_server2
+ read_one "Third DNS server" network dns_server3
+ echo "$ip_addr $disk_server_name" >> /etc/hosts
+ ;;
+ dhcp) sed -i -e "s/localhost\$/localhost $disk_server_name/" /etc/hosts
+ ;;
+ *) bootproto=dhcp;;
+ esac
+ #
+ # The other stuff which cannot be changed
+ hw_addr="$(config mac)"
+ lan_interface="$(config iface)"
+ #
+ # Write this out to a new sysconf
+ { echo "[network]"
+ echo "hw_addr=$hw_addr"
+ echo "lan_interface=$lan_interface"
+ test -n "$disk_server_name" && echo "disk_server_name=$disk_server_name"
+ test -n "$w_d_name" && echo "w_d_name=$w_d_name"
+ echo "bootproto=$bootproto"
+ case "$bootproto" in
+ static) echo "ip_addr=$ip_addr"
+ test -n "$netmask" && echo "netmask=$netmask"
+ test -n "$gateway" && echo "gateway=$gateway"
+ test -n "$dns_server1" && echo "dns_server1=$dns_server1"
+ test -n "$dns_server2" && echo "dns_server2=$dns_server2"
+ test -n "$dns_server3" && echo "dns_server3=$dns_server3"
+ ;;
+ esac
+ } >/etc/default/sysconf
+ #
+ # And reload the result
+ /etc/init.d/sysconfsetup reload
+ #
+ # The remove the spurious 'init' motd
+ rm /etc/motd
+}
+
+#
+# Basic command switch (this should be the only thing in this
+# script which actually does anything!)
+case "$1" in
+init) shift
+ if config valid && test "$1" != -f
+ then
+ if init_network "$@"
+ then
+ echo "turnup init: you must reboot the NSLU2 for the changes to take effect" >&2
+ else
+ exit 1
+ fi
+ else
+ if fix_hw_addr "$@"
+ then
+ echo "turnup init: you must reboot the NSLU2 for the changes to take effect" >&2
+ else
+ exit 1
+ fi
+ fi;;
+disk) shift
+ disk "$@";;
+memstick)
+ shift
+ disk -m "$@" -o noatime;;
+nfs) shift
+ nfs "$@";;
+flash) boot_reset flash;;
+ram) boot_reset ram;;
+*) echo "\
+usage: turnup command [options]
+ commands:
+ help
+ output this help
+ init
+ correct errors in network information
+ initialise network information when DHCP is not available
+ change network information
+ disk [-i] [-s<seconds>] <device> [mount options]
+ With -i make <device> a bootable file system then (with or
+ without -i) arrange for the next reboot to use that device.
+ The device must already be formatted as a file system, with
+ -i it must be completely empty, without it must contain an
+ apparently bootable file system. -s (for example -s5)
+ specifies a delay in seconds to wait at boot time before
+ mounting the device.
+ memstick [-i] <device> [mount options]
+ Behaves as disk however options appropriate to a flash memory
+ stick are automatically added
+ nfs [-i] <nfs mount path> [mount options]
+ <nfs mount path> must be a mountable NFS file system. With
+ -i the partition must be empty and is initialised with a
+ bootable file system. Without -i the partition must already
+ contain a bootable file system. In either case the NFS
+ partition must be available to be mounted without root id
+ sqashing (i.e. root must be root) and it will be selected
+ as the root file system for subsequent reboots.
+ A default set of -o options are provided, additional options
+ may be given on the command line (multiple -o options will
+ be combined into a single -o).
+ flash
+ Revert to booting from the flash disk on next reboot.
+ ram
+ Boot (once) into a ramdisk, subsequent boots will be to
+ the flash file system.
+ disk formatting:
+ The argument to 'nfs' or 'disk' must be an empty partition
+ of sufficient size to hold the root file system (at least
+ 16MByte but more is recommended to allow package installation).
+ An appropriate ext3 partition can be made using the command:
+
+ mke2fs -j <device> # for example: /dev/sda1
+
+ An appropriate NFS partition can be emptied using 'rm', but
+ must be set up (exported) on the NFS server." >&2
+ exit 0;;
+esac
+# Exit with return code from command.
--- /dev/null
+#!/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
+
+
--- /dev/null
+DESCRIPTION = "SlugOS initial network config via sysconf"
+SECTION = "console/network"
+LICENSE = "GPL"
+DEPENDS = "base-files devio"
+RDEPENDS = "busybox devio"
+PR = "r46"
+
+SRC_URI = "file://linuxrc \
+ file://boot/flash \
+ file://boot/disk \
+ file://boot/nfs \
+ file://boot/ram \
+ file://boot/network \
+ file://boot/udhcpc.script \
+ file://initscripts/syslog.buffer \
+ file://initscripts/syslog.file \
+ file://initscripts/syslog.network \
+ file://initscripts/zleds \
+ file://initscripts/leds_startup \
+ file://initscripts/rmrecovery \
+ file://initscripts/sysconfsetup \
+ file://initscripts/umountinitrd.sh \
+ file://functions \
+ file://conffiles \
+ file://turnup \
+ file://reflash \
+ file://modprobe.conf \
+ file://links.conf \
+ file://leds.h \
+ file://leds.c \
+ "
+
+SBINPROGS = "leds"
+USRSBINPROGS = ""
+CPROGS = "${USRSBINPROGS} ${SBINPROGS}"
+SCRIPTS = "turnup reflash"
+BOOTSCRIPTS = "flash disk nfs ram network udhcpc.script"
+INITSCRIPTS = "syslog.buffer syslog.file syslog.network zleds\
+ leds_startup rmrecovery sysconfsetup umountinitrd.sh"
+
+# This just makes things easier...
+S="${WORKDIR}"
+
+do_compile() {
+ set -ex
+ for p in ${CPROGS}
+ do
+ ${CC} ${CFLAGS} -o $p $p.c
+ done
+ set +ex
+}
+
+do_install() {
+ set -ex
+
+ # Directories
+ install -d ${D}${sysconfdir} \
+ ${D}${sysconfdir}/default \
+ ${D}${sysconfdir}/init.d \
+ ${D}${sysconfdir}/modutils \
+ ${D}${sysconfdir}/udev \
+ ${D}${sbindir} \
+ ${D}${base_sbindir} \
+ ${D}/initrd \
+ ${D}/boot
+
+ # linuxrc
+ rm -f ${D}/linuxrc
+ ln -s boot/flash ${D}/linuxrc
+
+ # C programs
+ for p in ${USRSBINPROGS}
+ do
+ install -m 0755 $p ${D}${sbindir}/$p
+ done
+ for p in ${SBINPROGS}
+ do
+ install -m 0755 $p ${D}${base_sbindir}/$p
+ done
+
+ # Shell scripts
+ for p in ${SCRIPTS}
+ do
+ install -m 0755 $p ${D}${sbindir}/$p
+ done
+
+ #
+ # Init scripts
+ install -m 0644 functions ${D}${sysconfdir}/default
+ for s in ${INITSCRIPTS}
+ do
+ install -m 0755 initscripts/$s ${D}${sysconfdir}/init.d/
+ done
+
+ #
+ # Udev configuration files
+ install -m 0644 links.conf ${D}${sysconfdir}/udev
+
+ #
+ # Boot scripts
+ for p in ${BOOTSCRIPTS}
+ do
+ install -m 0755 boot/$p ${D}/boot
+ done
+
+ # Configuration files
+ install -m 0644 conffiles ${D}${sysconfdir}/default
+ # Change MODULE in modprobe.conf to the correct module name
+ rm -f ${D}${sysconfdir}/modprobe.conf
+ sed 's/MODULE/'"$(echo '${PREFERRED_PROVIDER_virtual/ixp-eth}'|sed 's/-/_/g')"'/g' modprobe.conf >${D}${sysconfdir}/modprobe.conf
+
+ set +ex
+}
+
+# If the package is installed on an NSLU2 $D will be empty, in that
+# case it is normal to run 'start' and 'stop', but because the conf
+# files installed don't actually start or stop anything this is
+# unnecessary, so the package postfoo handling is simplified here.
+#NB: do not use '08' (etc) for the first argument after start/stop,
+# the value is interpreted as an octal number if there is a leading
+# zero.
+pkg_postinst_slugos-init() {
+ opt=
+ test -n "$D" && opt="-r $D"
+ update-rc.d $opt hwclock.sh start 8 S . start 45 0 6 .
+ update-rc.d $opt umountinitrd.sh start 9 S .
+ update-rc.d $opt syslog.buffer start 11 S . start 49 0 6 .
+ update-rc.d $opt sysconfsetup start 12 S .
+ update-rc.d $opt syslog.file start 39 S . start 47 0 6 .
+ update-rc.d $opt syslog.network start 44 S . start 39 0 6 .
+ update-rc.d $opt zleds start 99 S 1 2 3 4 5 . stop 5 0 1 2 3 4 5 6 .
+ update-rc.d $opt rmrecovery start 99 1 2 3 4 5 .
+ # bug fix for startup
+ update-rc.d $opt leds_startup start 1 1 2 3 4 5 .
+}
+
+pkg_postrm_slugos-init() {
+ opt=
+ test -n "$D" && opt="-r $D"
+ for s in ${INITSCRIPTS}
+ do
+ update-rc.d $opt "$s" remove
+ done
+}
+
+PACKAGES = "${PN}"
+FILES_${PN} = "/"
+
+# It is bad to overwrite /linuxrc as it puts the system back to
+# a flash boot (and the flash has potentially not been upgraded!)
+CONFFILES_${PN} = "${sysconfdir}/modprobe.conf /linuxrc ${sysconfdir}/default/conffiles"
+++ /dev/null
-# /etc/inittab: init(8) configuration.
-# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
-
-# The default runlevel.
-id:3:initdefault:
-
-# Boot-time system configuration/initialization script.
-# This is run first except when booting in emergency (-b) mode.
-si::sysinit:/etc/init.d/rcS
-
-# What to do in single-user mode.
-~~:S:wait:/sbin/sulogin
-
-# /etc/init.d executes the S and K scripts upon change
-# of runlevel.
-#
-# Runlevel 0 is halt.
-# Runlevel 1 is single-user.
-# Runlevels 2-5 are multi-user.
-# Runlevel 6 is reboot.
-
-l0:0:wait:/etc/init.d/rc 0
-l1:1:wait:/etc/init.d/rc 1
-l2:2:wait:/etc/init.d/rc 2
-l3:3:wait:/etc/init.d/rc 3
-l4:4:wait:/etc/init.d/rc 4
-l5:5:wait:/etc/init.d/rc 5
-l6:6:wait:/etc/init.d/rc 6
-# Normally not reached, but fallthrough in case of emergency.
-z6:6:respawn:/sbin/sulogin
-
-ca:123456:ctrlaltdel:/sbin/poweroff
--- /dev/null
+# /etc/inittab: init(8) configuration.
+# $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
+
+# The default runlevel.
+id:3:initdefault:
+
+# Boot-time system configuration/initialization script.
+# This is run first except when booting in emergency (-b) mode.
+si::sysinit:/etc/init.d/rcS
+
+# What to do in single-user mode.
+~~:S:wait:/sbin/sulogin
+
+# /etc/init.d executes the S and K scripts upon change
+# of runlevel.
+#
+# Runlevel 0 is halt.
+# Runlevel 1 is single-user.
+# Runlevels 2-5 are multi-user.
+# Runlevel 6 is reboot.
+
+l0:0:wait:/etc/init.d/rc 0
+l1:1:wait:/etc/init.d/rc 1
+l2:2:wait:/etc/init.d/rc 2
+l3:3:wait:/etc/init.d/rc 3
+l4:4:wait:/etc/init.d/rc 4
+l5:5:wait:/etc/init.d/rc 5
+l6:6:wait:/etc/init.d/rc 6
+# Normally not reached, but fallthrough in case of emergency.
+z6:6:respawn:/sbin/sulogin
+
+ca:123456:ctrlaltdel:/sbin/poweroff