mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
80 lines
1.1 KiB
Bash
80 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
mkdir /sys
|
|
mkdir /proc
|
|
mkdir /tmp
|
|
mount -t sysfs sysfs /sys
|
|
mount -t proc proc /proc
|
|
|
|
. /conf/initramfs.conf
|
|
. /scripts/functions
|
|
|
|
# Parse command line options
|
|
export break=
|
|
export init=/sbin/init
|
|
export quiet=n
|
|
export readonly=y
|
|
export root=
|
|
export rootmnt=/root
|
|
for x in $(cat /proc/cmdline); do
|
|
case $x in
|
|
init=*)
|
|
INIT=${x#init=}
|
|
;;
|
|
root=*)
|
|
ROOT=${x#root=}
|
|
;;
|
|
nfsroot=*)
|
|
NFSROOT=${x#nfsroot=}
|
|
;;
|
|
boot=*)
|
|
BOOT=${x#boot=}
|
|
;;
|
|
quiet)
|
|
quiet=y
|
|
;;
|
|
ro)
|
|
readonly=y
|
|
;;
|
|
rw)
|
|
readonly=n
|
|
;;
|
|
break)
|
|
break=yes
|
|
;;
|
|
esac
|
|
done
|
|
|
|
log_begin_msg "Running /script/init-top"
|
|
run_scripts /scripts/init-top
|
|
log_end_msg
|
|
|
|
. /scripts/${BOOT}
|
|
|
|
log_begin_msg "Loading modules"
|
|
load_modules
|
|
log_end_msg
|
|
|
|
# Populate /dev tree
|
|
log_begin_msg "Initializing /dev"
|
|
udevstart
|
|
log_end_msg
|
|
|
|
if [ x${break} = xyes ]; then
|
|
panic "Spawning shell within the initramfs"
|
|
fi
|
|
|
|
log_begin_msg "Mounting root file system"
|
|
mountroot
|
|
log_end_msg
|
|
|
|
log_begin_msg "Running /scripts/init-bottom"
|
|
run_scripts /scripts/init-bottom
|
|
log_end_msg
|
|
|
|
umount /sys
|
|
umount /proc
|
|
|
|
# Chain to real filesystem
|
|
exec run-init ${rootmnt} ${init} "$@"
|