#!/bin/sh msg () { [ "${quiet}" != "y" ] && echo $@; } err () { echo "ERROR: $@"; } /bin/mount -t sysfs none /sys /bin/mount -t proc none /proc read CMDLINE /proc/sys/kernel/modprobe if [ -n "${disablehooks}" ]; then for d in $(replace "${disablehooks}" ','); do eval "hook_${d}=disabled" done fi if [ -n "${disablemodules}" ]; then for d in $(replace "${disablemodules}" ','); do eval "mod_${d}=disabled" done fi if [ -n "${earlymodules}" ]; then for m in $(replace "${earlymodules}" ','); do /sbin/modprobe -q ${m} > /dev/null 2>&1 done fi . /config for m in ${MODULES}; do TST="" eval "TST=\$mod_${m}" if [ "${TST}" != "disabled" ]; then /sbin/modprobe -q ${m} > /dev/null 2>&1 fi done if [ -e "/hooks" ]; then for h in ${HOOKS}; do TST="" eval "TST=\$hook_${h}" if [ "${TST}" != "disabled" ]; then run_hook () { msg "${h}: no run function defined"; } if [ -e "/hooks/${h}" ]; then . /hooks/${h} msg ":: Running Hook [${h}]" run_hook fi fi done fi if [ "${rootdelay}" != "0" ]; then msg -n "Waiting for devices to settle..." /bin/sleep "${rootdelay}" msg "done." 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 [ ! -b "${root}" ]; then # This duplicates code from the filesystem hook # without this, mkinitcpio would fail for users who use # neither the udev hook, nor the filesystem hook msg "\nRoot device '${root}' doesn't exist, attempting to create it" eval $(/bin/parseblock "${root}") if [ "${BLOCKNAME}" = "unknown" ]; then echo "ERROR: Failed to parse block device name for '${root}'" elif [ -z "${BLOCKDEVICE}" ]; then echo "ERROR: Failed to parse block device ids for '${root}'" else root="${BLOCKNAME}" echo "/bin/mknod \"${BLOCKNAME}\" b ${BLOCKDEVICE}" /bin/mknod "${BLOCKNAME}" b ${BLOCKDEVICE} >/dev/null fi if [ ! -b "${root}" ]; then err "Unable to create/detect root device '${root}'" echo "Dropping to a recovery shell... type 'exit' to reboot" 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=8' or higher to the kernel command-line" PS1="ramfs$ " /bin/sh -i msg "Rebooting..." /bin/reboot fi fi if [ -z "${rootfstype}" ]; then eval $(/bin/fstype < ${root}) rootfstype="${FSTYPE}" fi msg ":: Initramfs Completed - control passing to run-init" if [ -f "/message" ]; then msg "$(cat /message)" fi #Special handling if udev is running udevpid=$(/bin/minips -C udevd -o pid=) if [ -n "${udevpid}" ]; then /bin/kill -9 ${udevpid} 2>/dev/null /bin/sleep 0.01 fi /bin/mkdir /real-root /bin/mount -r -t "${rootfstype}" "${root}" /real-root /bin/umount /sys /bin/umount /proc unset HOME OLDPWD PWD #TERM exec /bin/run-init /real-root ${init:-/sbin/init ${runlevel}}