summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bächler <thomas@archlinux.org>2010-02-11 19:31:31 +0100
committerThomas Bächler <thomas@archlinux.org>2010-02-11 19:31:31 +0100
commit0d755f3b5f96e9cf229c523cebcfb8c2379c1fd2 (patch)
tree31768b40897ce1d9ac3c2b22c1d8fcc89b6ecd23
parent1a91e4fa8e2d9823082843e98021c3345f82f072 (diff)
parentd67250f427937cb4b6f75b27d47d35302bd9890b (diff)
downloadmkinitcpio-0d755f3b5f96e9cf229c523cebcfb8c2379c1fd2.tar.gz
mkinitcpio-0d755f3b5f96e9cf229c523cebcfb8c2379c1fd2.tar.xz
Merge branch 'kill-klibc'
Conflicts: Makefile
-rw-r--r--Makefile4
-rw-r--r--hooks/consolefont10
-rw-r--r--hooks/keymap17
-rw-r--r--hooks/net72
-rw-r--r--hooks/raid9
-rw-r--r--hooks/resume32
-rw-r--r--hooks/udev8
-rw-r--r--init149
-rw-r--r--init_functions4
-rw-r--r--install/autodetect11
-rw-r--r--install/base26
-rw-r--r--install/consolefont31
-rw-r--r--install/firmware22
-rw-r--r--install/keymap31
-rw-r--r--install/net11
-rw-r--r--install/pcmcia6
-rw-r--r--install/raid39
-rw-r--r--install/udev28
-rwxr-xr-xload-modules.sh56
-rwxr-xr-xmkinitcpio11
-rw-r--r--mkinitcpio.5.txt4
-rw-r--r--mkinitcpio.conf1
22 files changed, 410 insertions, 172 deletions
diff --git a/Makefile b/Makefile
index d7b1e10..0acb2e8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# Makefile for mkinitcpio
-VERSION = 0.5.30
+VERSION = 0.5.99.5
all: doc
@@ -22,6 +22,7 @@ install: all
install -D -m755 init ${DESTDIR}/lib/initcpio/init
install -D -m755 init_functions ${DESTDIR}/lib/initcpio/init_functions
install -D -m644 functions ${DESTDIR}/lib/initcpio/functions
+ install -D -m755 load-modules.sh ${DESTDIR}/lib/initcpio/udev/load-modules.sh
install -d ${DESTDIR}/lib/initcpio/hooks
install -d ${DESTDIR}/lib/initcpio/install
@@ -55,6 +56,7 @@ TARBALL_FILES = \
init \
init_functions \
install \
+ load-modules.sh \
mkinitcpio \
mkinitcpio.conf \
mkinitcpio.d \
diff --git a/hooks/consolefont b/hooks/consolefont
new file mode 100644
index 0000000..f35869e
--- /dev/null
+++ b/hooks/consolefont
@@ -0,0 +1,10 @@
+# vim: set ft=sh:
+
+run_hook ()
+{
+ if [ -e /consolefont.psfu ]; then
+ msg -n ":: Loading console font..."
+ /usr/sbin/setfont -C /dev/console /consolefont.psfu
+ msg "done."
+ fi
+}
diff --git a/hooks/keymap b/hooks/keymap
new file mode 100644
index 0000000..9557c26
--- /dev/null
+++ b/hooks/keymap
@@ -0,0 +1,17 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ if [ -e /keymap.bin ]; then
+ msg -n ":: Loading keymap..."
+ . /keymap.utf8
+ if [ "${UTF8}" = "yes" ]; then
+ /usr/bin/kbd_mode -u -C /dev/console
+ printf "\033%%G" >> /dev/console
+ else
+ /usr/bin/kbd_mode -a -C /dev/console
+ printf "\033%%@" >> /dev/console
+ fi
+ /sbin/loadkmap < /keymap.bin
+ msg "done."
+ fi
+}
diff --git a/hooks/net b/hooks/net
new file mode 100644
index 0000000..9b97e39
--- /dev/null
+++ b/hooks/net
@@ -0,0 +1,72 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ local line i address rootserver rootpath
+
+ : > /ip_opts
+
+ if [ -n "${ip}" ]; then
+ # setup network and save some values
+ ipconfig "${ip}" | while read line; do
+ # echo ":: ${line}"
+ if [ "${line#"IP-Config:"}" != "${line}" ]; then
+ continue
+ fi
+ line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')"
+ for i in ${line}; do
+ case "${i}" in
+ address=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ netmask=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ gateway=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ dns0=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ dns1=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ rootserver=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ rootpath=*)
+ echo "${i}" >> /ip_opts
+ ;;
+ esac
+ done
+ done
+
+ . /ip_opts
+
+ echo "IP-Config: ${address}/${netmask}"
+ echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}"
+
+ # calculate nfs_server, nfs_path and nfs_option for later nfs mount
+ if [ "${root}" = "/dev/nfs" -o "${nfsroot}" != "" ]; then
+ # default rootpath
+ if [ "${rootpath}" = "" ]; then
+ rootpath="/tftpboot/${address}"
+ fi
+
+ # parse nfsroot
+ line="${nfsroot}"
+ nfs_server="${line%%:*}"
+ [ "${nfs_server}" = "${line}" ] && nfs_server="${rootserver}"
+ line="${line#*:}"
+ nfs_path="${line%%,*}"
+ line="${line#"${nfs_path}"}"
+ [ "${nfs_path}" = "" ] && nfs_path="${rootpath}"
+ nfs_option="${line#","}"
+
+ # ensure root and filesystem type are set proper for nfs boot
+ root="/dev/nfs"
+ rootfstype="nfs"
+
+ echo "NFS-root: ${nfs_server}:${nfs_path}"
+ fi
+ fi
+}
diff --git a/hooks/raid b/hooks/raid
deleted file mode 100644
index cd1a920..0000000
--- a/hooks/raid
+++ /dev/null
@@ -1,9 +0,0 @@
-# vim: set ft=sh:
-run_hook ()
-{
- #TODO scan for these somehow...
- /sbin/modprobe -aq linear multipath raid0 raid1 raid456 raid10 >/dev/null 2>&1
- # md= can be specified multiple times. The simplistic commandline
- # parsing does not handle this, so we will let mdassemble parse it
- /bin/mdassemble ${CMDLINE}
-}
diff --git a/hooks/resume b/hooks/resume
index 0632fed..f514eb6 100644
--- a/hooks/resume
+++ b/hooks/resume
@@ -3,18 +3,28 @@ run_hook ()
{
fmtdevice () { echo "${1}:${2}"; }
- if [ -n "${resume}" ] && poll_device "${resume}" ${rootdelay}; then
- # Try resuming with tuxonice
- tuxoniceroot="/sys/power/tuxonice"
- if [ -d "${tuxoniceroot}" ]; then
- echo ${resume} > ${tuxoniceroot}/resume
- echo > ${tuxoniceroot}/do_resume
+ if [ -n "${resume}" ]; then
+ if echo ${resume} | grep -q ':'; then
+ # Tux-on-ice syntax: swap:/dev/sda2 or file:/dev/sda2:0xdeadbeef
+ resumedev="$(echo ${resume} | cut -d: -f2)"
+ else
+ # Classical syntax: just a device
+ resumedev="${resume}"
fi
-
- # Try resuming with vanilla hibernation
- if [ -e "/sys/power/resume" ]; then
- eval $(/bin/parseblock "${resume}")
- fmtdevice ${BLOCKDEVICE} > /sys/power/resume
+ if poll_device "${resumedev}" ${rootdelay}; then
+ if echo ${resume} | grep -q ':'; then
+ # Try resuming with tuxonice
+ tuxoniceroot="/sys/power/tuxonice"
+ if [ -d "${tuxoniceroot}" ]; then
+ echo ${resume} > ${tuxoniceroot}/resume
+ echo > ${tuxoniceroot}/do_resume
+ fi
+ else
+ # Try resuming with vanilla hibernation
+ if [ -e "/sys/power/resume" ]; then
+ printf "%d:%d" $(stat -Lc "0x%t 0x%T" ${resume}) > /sys/power/resume
+ fi
+ fi
fi
fi
}
diff --git a/hooks/udev b/hooks/udev
new file mode 100644
index 0000000..57a90f7
--- /dev/null
+++ b/hooks/udev
@@ -0,0 +1,8 @@
+# vim: set ft=sh:
+run_hook ()
+{
+ msg -n ":: Triggering uevents..."
+ /sbin/udevadm trigger
+ /sbin/udevadm settle
+ msg "done."
+}
diff --git a/init b/init
index 8885b39..7d4b226 100644
--- a/init
+++ b/init
@@ -1,25 +1,25 @@
-#!/bin/sh
+#!/bin/busybox ash
+# Install busybox's applets as symlinks
+/bin/busybox --install -s
. /init_functions
msg ":: Loading Initramfs"
-
-/bin/mount -t sysfs none /sys
-/bin/mount -t proc none /proc
+/bin/mount -t proc proc /proc
+/bin/mount -t sysfs sys /sys
read CMDLINE </proc/cmdline
export CMDLINE
-# Used so hooks can override params to kinit
-export kinit_params=""
export root=""
+export init=""
echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
# if available, start udevd at this stage
if [ -x /sbin/udevd ]; then
msg ":: Starting udevd..."
echo > /proc/sys/kernel/hotplug
- /sbin/udevd --daemon
+ /sbin/udevd --daemon --resolve-names=never
msg "done."
fi
@@ -30,34 +30,35 @@ for cmd in ${CMDLINE}; do
[0123456Ss]) ;;
[0-9]*) ;;
single) ;;
- #Allow "init=X" to pass-through
- init=*) kinit_params="${kinit_params} ${cmd}" ;;
- # only export stuff that does work with dash :)
- *=*) cmd="$(replace -s= "${cmd}" '.' '_')"
- cmd="$(replace -s= "${cmd}" '-' '_')"
- export "${cmd}"
+ rw) readwrite="yes" ;;
+ ro) readwrite="no" ;;
+ # only export stuff that does work with ash :)
+ *=*) rhs="$(echo "${cmd}" | cut -d= -f2-)"
+ cmd="$(echo "${cmd}" | cut -d= -f1 | sed 's|\.|_|g')"
+ cmd="$(echo "${cmd}" | sed 's|-|_|g')=${rhs}"
+ (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}"
+ ;;
+ *) cmd="$(echo "${cmd}" | sed 's|\.|_|g')"
+ cmd="$(echo "${cmd}" | sed 's|-|_|g')"
+ (echo "${cmd}" | grep -qe '^[0-9]') || export "${cmd}=y"
;;
- *) cmd="$(replace "${cmd}" '.' '_')"
- cmd="$(replace "${cmd}" '-' '_')"
- export "${cmd}=y"
- ;;
esac
done
if [ -n "${disablehooks}" ]; then
- for d in $(replace "${disablehooks}" ','); do
+ for d in $(echo "${disablehooks}" | sed 's|,| |g'); do
export "hook_${d}=disabled"
done
fi
if [ -n "${disablemodules}" ]; then
- for d in $(replace "${disablemodules}" ','); do
+ for d in $(echo "${disablemodules}" | sed 's|,| |g'); do
export "mod_${d}=disabled"
done
fi
if [ -n "${earlymodules}" ]; then
- for m in $(replace "${earlymodules}" ','); do
+ for m in $(echo "${earlymodules}" | sed 's|,| |g'); do
/sbin/modprobe -q ${m} > /dev/null 2>&1
done
fi
@@ -76,8 +77,6 @@ done
if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then
export rootdelay=10
fi
-# We'll wait for the root device, so make sure klibc doesn't
-export kinit_params="${kinit_params} rootdelay=0"
if [ -e "/hooks" ]; then
for h in ${HOOKS}; do
@@ -96,49 +95,87 @@ fi
if [ "${break}" = "y" ]; then
echo ":: Break requested, type 'exit' to resume operation"
- echo " NOTE: klibc contains no 'ls' binary, use 'echo *' instead"
- PS1="ramfs$ " /bin/sh -i
-fi
-
-# If we boot from NFS, don't check for a block device in /dev
-# Let kinit do it all
-if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then
- if ! poll_device "${root}" ${rootdelay}; then
- msg "\nRoot device '${root}' doesn't exist, attempting to create it"
-
- eval $(/bin/parseblock "${root}")
- if [ -z "${BLOCKDEVICE}" ]; then
- echo "ERROR: Failed to parse block device ids for '${root}'"
- else
- echo "/bin/mknod /dev/root b ${BLOCKDEVICE}"
- /bin/mknod /dev/root b ${BLOCKDEVICE} >/dev/null
- export root="/dev/root"
- fi
- if [ ! -b "${root}" -a ! -h "${root}" ]; then
- err "Unable to detect or create root device '${root}'"
- echo "You are being dropped to a recovery shell"
- echo " Type 'reboot' to reboot"
- echo " Type 'exit' to try and continue booting"
- echo "NOTE: klibc contains no 'ls' binary, use 'echo *' instead"
- echo ""
- echo "If the device '${root}' gets created while you are here,"
- echo "try adding 'rootdelay=10' or higher to the kernel command-line"
- PS1="ramfs$ " /bin/sh -i
- msg "Trying to continue (this will most likely fail)..."
- fi
- fi
+ launch_interactive_shell
fi
if [ -f "/message" ]; then
msg "$(cat /message)"
fi
-msg ":: Initramfs Completed - control passing to kinit"
#Special handling if udev is running
-udevpid=$(/bin/minips -C udevd -o pid=)
+udevpid=$(/bin/pidof udevd)
if [ -n "${udevpid}" ]; then
+ # Settle pending uevents, then kill udev
+ /sbin/udevadm settle
/bin/kill -9 ${udevpid} > /dev/null 2>&1
/bin/sleep 0.01
fi
-exec /bin/kinit "$@" -- "root=${root}" ${kinit_params} > /dev/null 2>&1
+mkdir -p /new_root
+if [ -z "${nfsroot}" -a "${root}" != "/dev/nfs" ]; then
+ if [ ${root:0:5} != "/dev/" ] || ! poll_device "${root}" ${rootdelay}; then
+ msg "\nRoot device '${root}' doesn't exist. Attempting to create it."
+ rootdev=""
+ if [ ${root:0:5} = "/dev/" ]; then
+ # It might be a block device (/dev/sda)
+ if [ -f /sys/block/${root:5}/dev ]; then
+ rootdev="$(cat /sys/block/${root:5}/dev | sed 's|:| |')"
+ # It might be a partition on any block device (/dev/sda1)
+ else
+ for dir in /sys/block/*; do
+ if [ -f ${dir}/${root:5}/dev ]; then
+ rootdev="$(cat ${dir}/${root:5}/dev | sed 's|:| |')"
+ break
+ fi
+ done
+ fi
+ # It might be a major/minor pair (8:1)
+ elif echo ${root} | grep -q :; then
+ rootdev="$(echo ${root} | sed 's|:| |')"
+ root="/dev/root"
+ # It might be major/minor encoded as a single hex-number (lilo-style) (801)
+ elif [ ${#root} -le 4 -a ${#root} -gt 2 ] && echo "${root}" | grep -qe '^[A-Fa-f0-9]*$'; then
+ str_offset=$((${#root}-2))
+ major=$(printf "%d" 0x${root:0:${str_offset}})
+ minor=$(printf "%d" 0x${root:${str_offset}})
+ rootdev="${major} ${minor}"
+ root="/dev/root"
+ fi
+ if [ -n "${rootdev}" ]; then
+ msg "Creating root device ${root} with major $(echo "${rootdev}" | cut -d\ -f1) and minor $(echo "${rootdev}" | cut -d\ -f2)."
+ mknod ${root} b ${rootdev}
+ else
+ err "Unable to determine major/minor number of root device '${root}'."
+ echo "You are being dropped to a recovery shell"
+ echo " Type 'exit' to try and continue booting"
+ launch_interactive_shell
+ msg "Trying to continue (this will most likely fail) ..."
+ fi
+ fi
+ # We didn't build filesystem support into busybox,
+ # instead we use util-linux-ng's blkid for best compatibility
+ if [ -n "${rootfstype}" ]; then
+ fstype="${rootfstype}"
+ else
+ fstype=$(eval $(/sbin/blkid -o udev -p "${root}"); echo $ID_FS_TYPE)
+ fi
+ if [ "${readwrite}" = "yes" ]; then
+ rwopt="rw"
+ else
+ rwopt="ro"
+ fi
+ mount ${fstype:+-t ${fstype}} -o ${rwopt}${rootflags:+,${rootflags}} "${root}" /new_root
+else
+ if [ -z "$nfs_server" -o -z "$nfs_path" ]; then
+ err "Unable to mount root filesystem over NFS: wrong parameters."
+ echo "You are being dropped to a recovery shell"
+ echo " Type 'exit' to try and continue booting"
+ launch_interactive_shell
+ msg "Trying to continue (this will most likely fail) ..."
+ fi
+ nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" /new_root
+fi
+umount /proc
+umount /sys
+[ -z "${init}" ] && init="/sbin/init"
+exec /sbin/switch_root -c /dev/console /new_root ${init} "$@"
diff --git a/init_functions b/init_functions
index 968258a..c0f10e9 100644
--- a/init_functions
+++ b/init_functions
@@ -21,3 +21,7 @@ poll_device() {
done
[ -b "${device}" -o -h "${device}" ]
}
+
+launch_interactive_shell() {
+ PS1='[ramfs \W]\$ ' /bin/sh -i
+}
diff --git a/install/autodetect b/install/autodetect
index 0010da3..6c9193c 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -20,10 +20,13 @@ install ()
if [ ${UID} -eq 0 -o "$(groups | grep disk)" != "" ]; then
for fs in $(findfs | sort | uniq); do
- for mod in $(find "${MODULEDIR}" -type f -name "${fs}.ko"); do
- if [ -n "${mod}" ]; then
- AUTODETECT="${AUTODETECT} ${mod}"
- fi
+ allfs="${fs} $(modprobe --set-version ${KERNELVERSION} --resolve-alias ${fs})"
+ for mod in ${allfs}; do
+ for modfile in $(find "${MODULEDIR}" -type f -name "${mod}.ko"); do
+ if [ -n "${modfile}" ]; then
+ AUTODETECT="${AUTODETECT} ${modfile}"
+ fi
+ done
done
done
diff --git a/install/base b/install/base
index 0fdc120..ff1be88 100644
--- a/install/base
+++ b/install/base
@@ -5,24 +5,22 @@ install ()
add_dir "/proc"
add_dir "/sys"
add_dir "/dev"
+ add_dir "/bin"
+ add_dir "/sbin"
+ add_dir "/lib"
+ add_dir "/usr"
+ add_dir "/usr/bin"
+ add_dir "/usr/lib"
+ add_dir "/usr/sbin"
add_device "/dev/null" c 1 3
add_device "/dev/zero" c 1 5
add_device "/dev/console" c 5 1
add_device "/dev/mem" c 1 1
- for f in $(find /lib -name klibc-*.so); do
- add_file ${f}
- done
-
- for f in /usr/lib/klibc/bin/*; do
- add_file ${f} /bin/$(basename ${f})
- done
- for f in /usr/lib/klibc/sbin/*; do
- add_file ${f} /sbin/$(basename ${f})
- done
- # add symlink for compatibility
- add_symlink2 /bin/modprobe /sbin/modprobe
+ add_binary /lib/initcpio/busybox /bin/busybox
+ add_binary /sbin/modprobe
+ add_binary /sbin/blkid
add_file "/lib/initcpio/init_functions" "/init_functions"
add_file "/lib/initcpio/init" "/init"
@@ -39,7 +37,7 @@ help ()
{
cat <<HELPEOF
This hook sets up all initial directories and installs base
- klibc utilities and libraries. DO NOT remove this one unless
- you know what you're doing.
+ utilities. DO NOT remove this one unless you know what you're
+ doing.
HELPEOF
}
diff --git a/install/consolefont b/install/consolefont
new file mode 100644
index 0000000..67777b8
--- /dev/null
+++ b/install/consolefont
@@ -0,0 +1,31 @@
+# vim: set ft=sh:
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ FILES=""
+ SCRIPT="consolefont"
+ if [ -n "$CONSOLEFONT" ]; then
+ CONSOLEFONT_FILE_GZ="/usr/share/kbd/consolefonts/$CONSOLEFONT.psfu.gz"
+ if [ -e ${CONSOLEFONT_FILE_GZ} ]; then
+ CONSOLEFONT_FILE="$(mktemp ${TMPDIR}/consolefont.psfu.XXXXXX)"
+ zcat ${CONSOLEFONT_FILE_GZ} > ${CONSOLEFONT_FILE}
+ add_file ${CONSOLEFONT_FILE} /consolefont.psfu
+ else
+ echo "consolefont: Font file does not exist or does not end with .psfu.gz"
+ echo "consolefont: Only unicode fonts are supported at the moment."
+ fi
+ fi
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook loads consolefont specified in mkinitcpio.conf
+ during early userspace.
+ You should add CONSOLEFONT="font" (same syntax as in rc.conf) to your
+ mkinitcpio.conf. You may also remove the CONSOLEFONT from rc.conf
+ to prevent the font from being set twice and speed up your boot proccess.
+HELPEOF
+}
diff --git a/install/firmware b/install/firmware
deleted file mode 100644
index d03e274..0000000
--- a/install/firmware
+++ /dev/null
@@ -1,22 +0,0 @@
-# vim: set ft=sh:
-
-install ()
-{
- MODULES=""
- BINARIES=""
- FILES=""
- SCRIPT=""
- if [ -d /lib/firmware ]; then
- add_full_dir /lib/firmware
- else
- err "No firmware files found!"
- fi
-}
-
-help ()
-{
-cat<<HELPEOF
- This hook adds the firmware files that are placed at /lib/firmware/
- to the image.
-HELPEOF
-}
diff --git a/install/keymap b/install/keymap
new file mode 100644
index 0000000..65990dd
--- /dev/null
+++ b/install/keymap
@@ -0,0 +1,31 @@
+# vim: set ft=sh:
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ FILES=""
+ SCRIPT="keymap"
+ eval "$(grep -e "^LOCALE=" -e "^KEYMAP=" /etc/rc.conf)"
+ if [ -n "$KEYMAP" ]; then
+ KEYMAP_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)"
+ UTF8_FILE="$(mktemp ${TMPDIR}/keymap.XXXXXX)"
+ if [ -n "$(echo ${LOCALE} | grep -i utf)" ]; then
+ echo "UTF8='yes'" > ${UTF8_FILE}
+ /bin/loadkeys -q -u $KEYMAP -b > ${KEYMAP_FILE}
+ else
+ echo "UTF8='no'" > ${UTF8_FILE}
+ /bin/loadkeys -q $KEYMAP -b > ${KEYMAP_FILE}
+ fi
+ add_file ${KEYMAP_FILE} /keymap.bin
+ add_file ${UTF8_FILE} /keymap.utf8
+ fi
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook loads keymap(s) specified in rc.conf
+ during early userspace.
+HELPEOF
+}
diff --git a/install/net b/install/net
index 69359e9..7b31c09 100644
--- a/install/net
+++ b/install/net
@@ -6,7 +6,10 @@ install ()
BINARIES=""
FILES=""
- SCRIPT=""
+ SCRIPT="net"
+
+ add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig"
+ add_binary "/lib/initcpio/nfsmount" "/bin/nfsmount"
}
help ()
@@ -97,10 +100,10 @@ cat<<HELPEOF
acdirmin = 30
acdirmax = 60
flags = hard, nointr, noposix, cto, ac
-
+
root=/dev/nfs
-
- If you don't use nfsroot= parameter you need to set root=/dev/nfs
+
+ If you don't use nfsroot= parameter you need to set root=/dev/nfs
to boot from a nfs root by autoconfiguration.
HELPEOF
}
diff --git a/install/pcmcia b/install/pcmcia
index b17ad27..8b685c5 100644
--- a/install/pcmcia
+++ b/install/pcmcia
@@ -5,13 +5,13 @@ install ()
MODULES=" $(checked_modules '/pcmcia/' | grep -ve 'sound' -e 'net') $(checked_modules '/ide/legacy')"
MODULES=$(echo ${MODULES}) #trim whitespace
if [ -n "${MODULES}" ]; then
- MODULES="${MODULES} sd_mod sr_mod ide-gd_mod ide-cd_mod"
+ MODULES="${MODULES} sd_mod"
fi
BINARIES=""
FILES="/etc/pcmcia/config.opts"
SCRIPT=""
- add_file "/lib/udev/pcmcia-socket-startup.static" "/lib/udev/pcmcia-socket-startup"
- add_file "/lib/udev/pcmcia-check-broken-cis.static" "/lib/udev/pcmcia-check-broken-cis"
+ add_binary "/lib/udev/pcmcia-socket-startup"
+ add_binary "/lib/udev/pcmcia-check-broken-cis"
add_file "/lib/udev/rules.d/60-pcmcia.rules"
}
diff --git a/install/raid b/install/raid
deleted file mode 100644
index 0b227d2..0000000
--- a/install/raid
+++ /dev/null
@@ -1,39 +0,0 @@
-# vim: set ft=sh:
-
-install ()
-{
- MODULES=" $(checked_modules "drivers/md/*" | grep -v "dm-") "
- BINARIES=""
- FILES=""
- SCRIPT="raid"
- add_file "/usr/lib/klibc/bin/mdassemble" "/bin/mdassemble"
-}
-
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for an raid root device,
- and assemble the raid device when run.
-
- Kernel Parameters:
- Specify all your md arrays with md= parameter:
- ::: Example ::: md=0,/dev/sda3,/dev/sda4 md=1,/dev/hda1,/dev/hdb1
- This will setup 2 md arrays with persistent superblocks
-
- Setup:
- - for old raid arrays without persistent superblocks:
- md=<md device no.>,<raid level>,<chunk size factor>,<fault level>,dev0,dev1
- - for raid arrays with persistent superblocks:
- md=<md device no.>,dev0,dev1,...,devn
-
- Parameters:
- - <md device no.> = the number of the md device:
- 0 means md0, 1 means md1, ...
- - <raid level> = -1 linear mode, 0 striped mode
- other modes are only supported with persistent super block
- - <chunk size factor> = (raid-0 and raid-1 only):
- Set the chunk size as 4k << n.
- - <fault level> = totally ignored
- - <dev0-devn>: e.g. /dev/hda1,/dev/hdc1,/dev/sda1,/dev/sdb1
-HELPEOF
-}
diff --git a/install/udev b/install/udev
new file mode 100644
index 0000000..17a82c9
--- /dev/null
+++ b/install/udev
@@ -0,0 +1,28 @@
+# vim:set ft=sh:
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ FILES=" /etc/udev/udev.conf"
+ SCRIPT="udev"
+ add_binary /sbin/udevd
+ add_binary /sbin/udevadm
+ for rules in 50-firmware.rules 50-udev-default.rules 60-persistent-storage.rules 80-drivers.rules; do
+ add_file /lib/udev/rules.d/${rules}
+ done
+ for tool in firmware; do
+ add_file /lib/udev/${tool}
+ done
+ add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh
+}
+
+help ()
+{
+cat <<HELPEOF
+ This hook will use udev to create your root device node
+ and detect the needed modules for your root device. It
+ is also required for firmware loading in initramfs.
+ It is recommended to use this hook.
+HELPEOF
+}
diff --git a/load-modules.sh b/load-modules.sh
new file mode 100755
index 0000000..4631dac
--- /dev/null
+++ b/load-modules.sh
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Implement blacklisting for udev-loaded modules
+# Includes module checking
+# - Aaron Griffin, Tobias Powalowski & Thomas Bächler for Arch Linux
+[ $# -ne 1 ] && exit 1
+
+MODPROBE="/sbin/modprobe"
+RESOLVEALIAS="${MODPROBE} --resolve-alias"
+USEBLACKLIST="--use-blacklist"
+SED="/bin/sed"
+
+if [ -f /proc/cmdline ]; then
+ for cmd in $(cat /proc/cmdline); do
+ case $cmd in
+ disablemodules=*) eval $cmd ;;
+ load_modules=off) exit ;;
+ esac
+ done
+ #parse cmdline entries of the form "disablemodules=x,y,z"
+ if [ -n "${disablemodules}" ]; then
+ BLACKLIST="$(echo "${disablemodules}" | ${SED} 's|,| |g')"
+ fi
+fi
+
+# sanitize the module names
+BLACKLIST="$(echo "${BLACKLIST}" | ${SED} 's|-|_|g')"
+
+if [ -n "${BLACKLIST}" ] ; then
+ # Try to find all modules for the alias
+ mods="$($RESOLVEALIAS $1)"
+ # If no modules could be found, try if the alias name is a module name
+ # In that case, omit the --use-blacklist parameter to imitate normal modprobe behaviour
+ [ -z "${mods}" ] && $MODPROBE -qni $1 && mods="$1" && USEBLACKLIST=""
+ [ -z "${mods}" ] && exit
+ for mod in ${mods}; do
+ # Find the module and all its dependencies
+ deps="$($MODPROBE -i --show-depends ${mod})"
+ [ $? -ne 0 ] && continue
+
+ #sanitize the module names
+ deps="$(echo "$deps" | ${SED} \
+ -e "s#^insmod /lib.*/\(.*\)\.ko.*#\1#g" \
+ -e 's|-|_|g')"
+ # If the module or any of its dependencies is blacklisted, don't load it
+ for dep in $deps; do
+ for blackmod in ${BLACKLIST}; do
+ [ "${blackmod}" = "${dep}" ] && continue 3
+ done
+ done
+ $MODPROBE $USEBLACKLIST ${mod}
+ done
+else
+ $MODPROBE $1
+fi
+
+# vim: set et ts=4:
diff --git a/mkinitcpio b/mkinitcpio
index 91dac25..0865482 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -1,14 +1,13 @@
#!/bin/bash
# mkinitcpio - modular tool for building an init ramfs cpio image
#
-# IMPORTANT: We need to keep a common base syntax here
-# because some of these hooks/scripts need to run under
-# the klibc shell or even busybox's ash - therefore, the
-# following constraints should be enforced:
+# IMPORTANT: We need to keep a common base syntax here because
+# some of these hooks/scripts need to run under busybox's ash -
+# therefore, the following constraints should be enforced:
# variables should be quoted and bracketed "${SOMEVAR}"
# inline execution should be done with $() instead of backticks
# use -z "${var}" to test for nulls/empty strings
-# incase of embedded spaces, quote all path names and string comarpisons
+# in case of embedded spaces, quote all path names and string comparisons
#
@@ -54,7 +53,7 @@ usage ()
echo " -g IMAGE Generate a cpio image as IMAGE. default: no"
echo " -a NAME Append to an existing filelist. default: no"
echo " -p PRESET Build specified preset."
- echo " -m MESSAGE Print MESSAGE before passing control to kinit."
+ echo " -m MESSAGE Print MESSAGE before passing control to init."
echo " -S SKIPHOOKS Skip SKIPHOOKS (comma-separated) when building the image."
echo " -v Verbose output. Default: no"
echo " -M Display modules found via autodetection."
diff --git a/mkinitcpio.5.txt b/mkinitcpio.5.txt
index 56e5eae..1c095dc 100644
--- a/mkinitcpio.5.txt
+++ b/mkinitcpio.5.txt
@@ -37,7 +37,7 @@ Options
Build initial ramdisk according to specified 'preset'. Presets are found in /etc/mkinitcpio.d
*-m* 'message'::
- Print 'message' before passing control to kinit.
+ Print 'message' before passing control to init.
*-S* 'hooks'::
Skip 'hooks' when generating the image. Several hooks should be comma-separated.
@@ -66,7 +66,7 @@ set up the udev device filesystem, load IDE modules, etc.
About Presets
-------------
-A preset is a pre-defined definition on how to create an initial ramdisk. Instead of specifying the configuration file and which output file, every time you generate a new intial ramdisk, you define a preset and use the -p switch to generate an initial ramdisk according to your preset. Presets are located in /etc/mkinitcpio.d
+A preset is a pre-defined definition on how to create an initial ramdisk. Instead of specifying the configuration file and which output file, every time you generate a new initial ramdisk, you define a preset and use the -p switch to generate an initial ramdisk according to your preset. Presets are located in /etc/mkinitcpio.d
Files
-----
diff --git a/mkinitcpio.conf b/mkinitcpio.conf
index 7b2c98c..781d64a 100644
--- a/mkinitcpio.conf
+++ b/mkinitcpio.conf
@@ -30,7 +30,6 @@ FILES=""
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
# 'udev' is _required_ in order to automatically load modules
-# 'modload' may be used in place of 'udev', but is not recommended
# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
# This setup specifies all modules in the MODULES setting above.