summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/init-premount/blacklist25
-rwxr-xr-xscripts/init-premount/thermal37
-rwxr-xr-xscripts/init-top/framebuffer102
-rwxr-xr-xscripts/local-top/lvm74
4 files changed, 238 insertions, 0 deletions
diff --git a/scripts/init-premount/blacklist b/scripts/init-premount/blacklist
new file mode 100755
index 0000000..1dd9dbc
--- /dev/null
+++ b/scripts/init-premount/blacklist
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+# sanity check
+[ -z "${blacklist}" ] && exit 0
+
+# write blacklist to modprobe.d
+IFS=','
+for b in ${blacklist}; do
+ echo "blacklist $b" >> /etc/modprobe.d/initramfs
+done
diff --git a/scripts/init-premount/thermal b/scripts/init-premount/thermal
new file mode 100755
index 0000000..aa146ec
--- /dev/null
+++ b/scripts/init-premount/thermal
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+case "$DPKG_ARCH" in
+# load the right modules
+powerpc|ppc64)
+ modprobe i2c-powermac
+ modprobe therm_pm72
+ modprobe windfarm_cpufreq_clamp
+ modprobe windfarm_lm75_sensor
+ modprobe windfarm_max6690_sensor
+ modprobe windfarm_pm112
+ modprobe windfarm_pm81
+ modprobe windfarm_pm91
+ modprobe windfarm_smu_controls
+ modprobe windfarm_smu_sat
+ modprobe windfarm_smu_sensors
+ ;;
+i386|amd64|ia64)
+ modprobe fan
+ modprobe thermal
+ ;;
+esac
diff --git a/scripts/init-top/framebuffer b/scripts/init-top/framebuffer
new file mode 100755
index 0000000..0ed798e
--- /dev/null
+++ b/scripts/init-top/framebuffer
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+
+# The options part of the kernel "video=" argument (i.e. everyting
+# after "video=<fbdriver>:") has very inconsistent rules.
+#
+# Generally the following applies:
+# 1) options are comma-separated
+# 2) options can be in either of these three forms:
+# <arg>=<value>, <arg>:<value>, <boolean-arg>.
+# 3) the "mode" option has the form <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m]
+# and may or may not start with "mode="
+#
+# When the options are used with modules, they need to be space-separated
+# and the following conversions are needed:
+# <arg>:<value> -> <arg>=<value>
+# <boolean-arg> -> <boolean-arg>=1
+# <modevalue> -> mode=<modevalue>
+parse_video_opts()
+{
+ local OPTS="$1"
+ local IFS=","
+
+ # Must be a line like video=<fbdriver>:<opt1>,[opt2]...
+ if [ "${OPTS}" = "${OPTS%%:*}" ]; then
+ return
+ fi
+ OPTS="${OPTS#*:}"
+ for opt in ${OPTS}; do
+ # Already in the "<arg>=<value>" form
+ if [ "${opt}" != "${opt#*=}" ]; then
+ echo -n "$opt "
+ # In the "<arg>:<value>" form
+ elif [ "${opt}" != "${opt#*:}" ]; then
+ echo -n "${opt%:*}=${opt#*:} "
+ # Presumably a modevalue without the "mode=" prefix
+ elif [ "${opt}" != "${opt#[0-9]*x[0-9]}" ]; then
+ echo -n "mode=$opt "
+ # Presumably a boolean
+ else
+ echo -n "${opt}=1 "
+ fi
+ done
+}
+
+FB=""
+OPTS=""
+
+for x in $(cat /proc/cmdline); do
+ case ${x} in
+ vga=*)
+ FB="vesafb";
+ OPTS="";
+ ;;
+ video=*)
+ FB=${x#*=}
+ FB="${FB%%:*}"
+ OPTS="$(parse_video_opts "${x}")"
+ esac
+done
+
+# Map command line name to module name and other tweaks
+case ${FB} in
+matroxfb)
+ FB=matroxfb_base
+ ;;
+uvesafb)
+ # v86d requires /dev/zero and dev/mem, but udev haven't been started yet
+ [ -e /dev/zero ] || mknod -m 0666 /dev/zero c 1 5
+ [ -e /dev/mem ] || mknod -m 0640 /dev/mem c 1 1
+ ;;
+*)
+ ;;
+esac
+
+if [ -n "${FB}" ]; then
+ modprobe fbcon
+ modprobe ${FB} ${OPTS}
+fi
+
+if [ -e /proc/fb ]; then
+ while read fbno desc; do
+ if [ $(($fbno < 32)) ]; then
+ mknod -m 0640 /dev/fb${fbno} c 29 ${fbno}
+ fi
+ done < /proc/fb
+else
+ mknod -m 0640 /dev/fb0 c 29 0
+fi
diff --git a/scripts/local-top/lvm b/scripts/local-top/lvm
new file mode 100755
index 0000000..4cf48ad
--- /dev/null
+++ b/scripts/local-top/lvm
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+PREREQ="mdadm mdrun lvm2"
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+activate_vg()
+{
+ local vg="$1"
+
+ # Make sure that we have a non-empty argument
+ if [ -z "${vg}" ]; then
+ return 1
+ fi
+
+ # Take care of lilo boot arg, risky activating of all vg
+ case $vg in
+ fe[0-9]*)
+ vgchange -ay
+ exit 0
+ ;;
+ # FIXME: check major
+ /dev/root)
+ vgchange -ay
+ exit 0
+ ;;
+ esac
+
+ # Make sure that we have a d-m path
+ vg=${vg#/dev/mapper/}
+ if [ "$vg" = "$1" ]; then
+ return 1
+ fi
+
+ # Make sure that the device includes at least one dash
+ if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then
+ return 1
+ fi
+
+ # Split volume group from logical volume.
+ vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#')
+ # Reduce padded --'s to -'s
+ vg=$(echo ${vg} | sed -e 's#--#-#g')
+
+ vgchange -ay ${vg}
+}
+
+if [ -e /scripts/local-top/lvm2 ]; then
+ exit 0
+fi
+
+if [ ! -e /sbin/vgchange ]; then
+ exit 0
+fi
+
+modprobe dm-mod
+modprobe dm-snapshot
+modprobe dm-mirror
+
+activate_vg "$ROOT"
+activate_vg "$resume"
+
+exit 0