summaryrefslogtreecommitdiff
path: root/packages/slugos-init/files
diff options
context:
space:
mode:
Diffstat (limited to 'packages/slugos-init/files')
-rw-r--r--packages/slugos-init/files/boot/kexec4
-rw-r--r--packages/slugos-init/files/boot/network24
-rw-r--r--packages/slugos-init/files/boot/nfs5
-rw-r--r--packages/slugos-init/files/leds62
-rw-r--r--packages/slugos-init/files/modulefunctions5
5 files changed, 69 insertions, 31 deletions
diff --git a/packages/slugos-init/files/boot/kexec b/packages/slugos-init/files/boot/kexec
index 7c02a14f04..8973d20bfe 100644
--- a/packages/slugos-init/files/boot/kexec
+++ b/packages/slugos-init/files/boot/kexec
@@ -91,6 +91,7 @@ if [ -n "$1" -a -n "$2" ] ; then
t=`basename "$kpath"`
kexec_image="/mnt/$t"
fi
+ umount /sys
fi
;;
@@ -98,11 +99,13 @@ if [ -n "$1" -a -n "$2" ] ; then
if /boot/network ; then
echo "Loading kexec kernel using nfs \"$kpath\"..."
echo "mounting nfs partition..."
+ loadnfsmods
if mount -o ro,nolock -t nfs `dirname "$kpath"` /mnt ; then
need_umount=1
t=`basename "$kpath"`
kexec_image="/mnt/$t"
fi
+ umount /sys
fi
;;
@@ -140,6 +143,7 @@ if [ -n "$1" -a -n "$2" ] ; then
echo "Loading kexec kernel using tftp \"$kpath\"..."
tftp -g -l "$kexec_image" -r "${kpath#*:}" "${kpath%%:*}"
fi
+ umount /sys
fi
;;
diff --git a/packages/slugos-init/files/boot/network b/packages/slugos-init/files/boot/network
index 9aa295e43d..8124f19ab2 100644
--- a/packages/slugos-init/files/boot/network
+++ b/packages/slugos-init/files/boot/network
@@ -8,6 +8,11 @@
# function!
. /etc/default/functions
#
+# /proc is needed for the module loading, and /sys is
+# necessary to load firmware (if required).
+mount -t proc proc /proc
+mount -t sysfs sysfs /sys
+#
# We may need to load the network driver modules here
. /etc/default/modulefunctions
loadnetmods
@@ -17,5 +22,22 @@ loadnetmods
# file. Config the loopback and network interfaces.
ifconfig lo 127.0.0.1 up
iface="$(config iface)"
-test -n "$iface" && ifup "$iface"
+test -z "$iface" && exit 1
+#
+# Fire up a process in the background to load the firmware if necessary
+sysf="/sys/class/firmware/firmware-$iface"
+(
+ # Wait for the firware to be requested, if required
+ [ -f $sysf/loading ] || sleep 1
+ [ -f $sysf/loading ] || sleep 1
+ if [ -f $sysf/loading ] ; then
+ echo "1" >$sysf/loading
+ cat /lib/firmware/NPE-B >$sysf/data
+ echo "0" >$sysf/loading
+ fi
+) &
+# Trigger the firmware load proactively
+ifconfig "$iface" up
+#
+ifup "$iface"
# exit code is true only if the interface config has succeeded
diff --git a/packages/slugos-init/files/boot/nfs b/packages/slugos-init/files/boot/nfs
index 856f4e56b9..e0f05754c5 100644
--- a/packages/slugos-init/files/boot/nfs
+++ b/packages/slugos-init/files/boot/nfs
@@ -7,10 +7,15 @@
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
#
. /etc/default/functions
+. /etc/default/modulefunctions
+#
leds boot system
#
if /boot/network
then
+ # load the nfs kernel module
+ loadnfsmods
+
# network is up and running, the NFS mount will
# now succeed (possibly), use /boot/disk
exec /boot/disk "$@"
diff --git a/packages/slugos-init/files/leds b/packages/slugos-init/files/leds
index 8043dae682..1beb013c5f 100644
--- a/packages/slugos-init/files/leds
+++ b/packages/slugos-init/files/leds
@@ -12,17 +12,9 @@ leds) ;;
esac
#
-# led_set led-dir off|on|slow|fast|panic|blink|flash|user|*
+# led_set led-dir off|on|slow|fast|panic|blink|flash|*
# set the given LED (expressed as a directory) to the
-# given status. USER_LED may be set to indicate how to
-# handle the 'user' setting.
-led_user_default(){
- case "$(machine)" in
- nslu2) echo -n "cpu-idle";;
- nas100d) echo -n "on";;
- *) echo -n "cpu";;
- esac
-}
+# given status.
#
led_set(){
local setting
@@ -31,15 +23,6 @@ led_set(){
then
setting="$2"
case "$setting" in
- user) if test -n "$USER_LED"
- then
- setting="$USER_LED"
- else
- setting="$(led_user_default)"
- fi;;
- esac
-
- case "$setting" in
off|on) echo -n none
case "$setting" in
@@ -66,11 +49,6 @@ led_set(){
panic) echo -n 3000;;
esac >"$1/delay_off";;
- cpu-idle) echo -n cpu
- # these settings work well on NSLU2
- echo -n on >"$1/idle"
- echo -n flash >"$1/active";;
-
*) echo -n "$setting";;
esac >"$1/trigger"
else
@@ -129,6 +107,28 @@ sysled_ready(){
led_set "$1/ready" "$ready"
}
#
+# the cases for one blue flashing LED (just power)
+sysled_power(){
+ local power
+ # expect dir [boot](system|user) [error|panic]
+ case "$3" in
+ error) power=off;;
+ panic) power=off;;
+ *) case "$2" in
+ bootsystem) power=off;; # blinking
+ system) power=off;; # blinking
+ bootuser) power=on;;
+ user) power=on;;
+ bootsingleuser) power=off;; # blinking
+ singleuser) power=off;; # blinking
+ bootshutdown) power=off;; # blinking
+ shutdown) power=off;; # blinking
+ esac;;
+ esac
+
+ led_set "$1/power" "$power"
+}
+#
sysled(){
local mp st boot isst
mp=/sys
@@ -153,7 +153,7 @@ sysled(){
mp=/mnt
fi
#
- # check for the 'ready' LED - otherwise do nothing
+ # check for the 'ready' LED - otherwise check for a 'power' LED
if test -d "$mp/class/leds/ready"
then
if test -d "$mp/class/leds/status"
@@ -162,6 +162,11 @@ sysled(){
else
sysled_ready "$mp/class/leds" $boot"$@"
fi
+ else
+ if test -d "$mp/class/leds/power"
+ then
+ sysled_power "$mp/class/leds" $boot"$@"
+ fi
fi
#
# clean up
@@ -200,11 +205,8 @@ leds_help(){
echo " the new state. 'error' or 'panic' means a (potentially)" >&2
echo " recoverable error or an unrecoverable error ('panic') has" >&2
echo " occured." >&2
- echo " <led> off|on|slow|fast|panic|blink|flash|user|cpu|cpu-idle" >&2
- echo " set the named led to the given display, an arbitrary led" >&2
- echo " trigger may be given. 'user' will use the default specified" >&2
- echo " in USER_LED from /etc/default/rcS, if not specified a cpu" >&2
- echo " activity setting appropriate to the machine is selected" >&2
+ echo " <led> off|on|slow|fast|panic|blink|flash" >&2
+ echo " set the named led to the given display." >&2
echo " beep {args}" >&2
echo " if possible cause the machine to emit a beep" >&2
}
diff --git a/packages/slugos-init/files/modulefunctions b/packages/slugos-init/files/modulefunctions
index a497f71f6c..82fd7681af 100644
--- a/packages/slugos-init/files/modulefunctions
+++ b/packages/slugos-init/files/modulefunctions
@@ -1,5 +1,6 @@
#!/bin/sh
# . this file to load the functions for automatically loading modules
+# NB: /proc must be mounted for correct evaluation of "$(machine)".
. /etc/default/functions
@@ -34,6 +35,10 @@ loadnetmods(){
esac
}
+loadnfsmods(){
+ modprobe nfs
+}
+
loadmiscmods(){
true
}