summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:42:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:42:59 +0000
commitc45bd7dca7394d3a25f5bbf416f3b75c50759190 (patch)
treef7dbbfcc2f6b787eea456d1f1e28525ca2ceb9ba /init
parentInitial commit. (diff)
downloadinitramfs-tools-upstream.tar.xz
initramfs-tools-upstream.zip
Adding upstream version 0.143.upstream/0.143upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xinit339
-rw-r--r--initramfs-tools.7671
-rw-r--r--initramfs.conf.5138
3 files changed, 1148 insertions, 0 deletions
diff --git a/init b/init
new file mode 100755
index 0000000..5752dd8
--- /dev/null
+++ b/init
@@ -0,0 +1,339 @@
+#!/bin/sh
+
+# Default PATH differs between shells, and is not automatically exported
+# by klibc dash. Make it consistent.
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+[ -d /dev ] || mkdir -m 0755 /dev
+[ -d /root ] || mkdir -m 0700 /root
+[ -d /sys ] || mkdir /sys
+[ -d /proc ] || mkdir /proc
+[ -d /tmp ] || mkdir /tmp
+mkdir -p /var/lock
+mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
+mount -t proc -o nodev,noexec,nosuid proc /proc
+
+# shellcheck disable=SC2013
+for x in $(cat /proc/cmdline); do
+ case $x in
+ initramfs.clear)
+ clear
+ ;;
+ quiet)
+ quiet=y
+ ;;
+ esac
+done
+
+if [ "$quiet" != "y" ]; then
+ quiet=n
+ echo "Loading, please wait..."
+fi
+export quiet
+
+# Note that this only becomes /dev on the real filesystem if udev's scripts
+# are used; which they will be, but it's worth pointing out
+mount -t devtmpfs -o nosuid,mode=0755 udev /dev
+
+# Prepare the /dev directory
+[ ! -h /dev/fd ] && ln -s /proc/self/fd /dev/fd
+[ ! -h /dev/stdin ] && ln -s /proc/self/fd/0 /dev/stdin
+[ ! -h /dev/stdout ] && ln -s /proc/self/fd/1 /dev/stdout
+[ ! -h /dev/stderr ] && ln -s /proc/self/fd/2 /dev/stderr
+
+mkdir /dev/pts
+mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
+
+# Export the dpkg architecture
+export DPKG_ARCH=
+. /conf/arch.conf
+
+# Set modprobe env
+export MODPROBE_OPTIONS="-qb"
+
+# Export relevant variables
+export ROOT=
+export ROOTDELAY=
+export ROOTFLAGS=
+export ROOTFSTYPE=
+export IP=
+export DEVICE=
+export BOOT=
+export BOOTIF=
+export UBIMTD=
+export break=
+export init=/sbin/init
+export readonly=y
+export rootmnt=/root
+export debug=
+export panic=
+export blacklist=
+export resume=
+export resume_offset=
+export noresume=
+export drop_caps=
+export fastboot=n
+export forcefsck=n
+export fsckfix=
+
+
+# Bring in the main config
+. /conf/initramfs.conf
+for conf in conf/conf.d/*; do
+ [ -f "${conf}" ] && . "${conf}"
+done
+. /scripts/functions
+
+# Parse command line options
+# shellcheck disable=SC2013
+for x in $(cat /proc/cmdline); do
+ case $x in
+ init=*)
+ init=${x#init=}
+ ;;
+ root=*)
+ ROOT=${x#root=}
+ if [ -z "${BOOT}" ] && [ "$ROOT" = "/dev/nfs" ]; then
+ BOOT=nfs
+ fi
+ ;;
+ rootflags=*)
+ ROOTFLAGS="-o ${x#rootflags=}"
+ ;;
+ rootfstype=*)
+ ROOTFSTYPE="${x#rootfstype=}"
+ ;;
+ rootdelay=*)
+ ROOTDELAY="${x#rootdelay=}"
+ case ${ROOTDELAY} in
+ *[![:digit:].]*)
+ ROOTDELAY=
+ ;;
+ esac
+ ;;
+ nfsroot=*)
+ # shellcheck disable=SC2034
+ NFSROOT="${x#nfsroot=}"
+ ;;
+ initramfs.runsize=*)
+ RUNSIZE="${x#initramfs.runsize=}"
+ ;;
+ ip=*)
+ IP="${x#ip=}"
+ ;;
+ boot=*)
+ BOOT=${x#boot=}
+ ;;
+ ubi.mtd=*)
+ UBIMTD=${x#ubi.mtd=}
+ ;;
+ resume=*)
+ RESUME="${x#resume=}"
+ ;;
+ resume_offset=*)
+ resume_offset="${x#resume_offset=}"
+ ;;
+ noresume)
+ noresume=y
+ ;;
+ drop_capabilities=*)
+ drop_caps="-d ${x#drop_capabilities=}"
+ ;;
+ panic=*)
+ panic="${x#panic=}"
+ ;;
+ ro)
+ readonly=y
+ ;;
+ rw)
+ readonly=n
+ ;;
+ debug)
+ debug=y
+ quiet=n
+ if [ -n "${netconsole}" ]; then
+ log_output=/dev/kmsg
+ else
+ log_output=/run/initramfs/initramfs.debug
+ fi
+ set -x
+ ;;
+ debug=*)
+ debug=y
+ quiet=n
+ set -x
+ ;;
+ break=*)
+ break=${x#break=}
+ ;;
+ break)
+ break=premount
+ ;;
+ blacklist=*)
+ blacklist=${x#blacklist=}
+ ;;
+ netconsole=*)
+ netconsole=${x#netconsole=}
+ [ "$debug" = "y" ] && log_output=/dev/kmsg
+ ;;
+ BOOTIF=*)
+ BOOTIF=${x#BOOTIF=}
+ ;;
+ fastboot|fsck.mode=skip)
+ fastboot=y
+ ;;
+ forcefsck|fsck.mode=force)
+ forcefsck=y
+ ;;
+ fsckfix|fsck.repair=yes)
+ fsckfix=y
+ ;;
+ fsck.repair=no)
+ fsckfix=n
+ ;;
+ esac
+done
+
+# Default to BOOT=local if no boot script defined.
+if [ -z "${BOOT}" ]; then
+ BOOT=local
+fi
+
+if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
+ noresume=y
+else
+ resume=${RESUME:-}
+fi
+
+mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
+mkdir -m 0700 /run/initramfs
+
+if [ -n "$log_output" ]; then
+ exec >"$log_output" 2>&1
+ unset log_output
+fi
+
+maybe_break top
+
+# Don't do log messages here to avoid confusing graphical boots
+run_scripts /scripts/init-top
+
+maybe_break modules
+[ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
+[ -n "${netconsole}" ] && /sbin/modprobe netconsole netconsole="${netconsole}"
+load_modules
+[ "$quiet" != "y" ] && log_end_msg
+
+starttime="$(_uptime)"
+starttime=$((starttime + 1)) # round up
+export starttime
+
+if [ "$ROOTDELAY" ]; then
+ sleep "$ROOTDELAY"
+fi
+
+maybe_break premount
+[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
+run_scripts /scripts/init-premount
+[ "$quiet" != "y" ] && log_end_msg
+
+maybe_break mount
+log_begin_msg "Mounting root file system"
+# Always load local and nfs (since these might be needed for /etc or
+# /usr, irrespective of the boot script used to mount the rootfs).
+. /scripts/local
+. /scripts/nfs
+. "/scripts/${BOOT}"
+parse_numeric "${ROOT}"
+maybe_break mountroot
+mount_top
+mount_premount
+mountroot
+log_end_msg
+
+if read_fstab_entry /usr; then
+ log_begin_msg "Mounting /usr file system"
+ mountfs /usr
+ log_end_msg
+fi
+
+# Mount cleanup
+mount_bottom
+nfs_bottom
+local_bottom
+
+case "$IP" in
+""|none|off) ;; # Do nothing
+*)
+ configure_networking
+esac
+
+maybe_break bottom
+[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
+# We expect udev's init-bottom script to move /dev to ${rootmnt}/dev
+run_scripts /scripts/init-bottom
+[ "$quiet" != "y" ] && log_end_msg
+
+# Move /run to the root
+mount -n -o move /run ${rootmnt}/run
+
+validate_init() {
+ run-init -n "${rootmnt}" "${1}"
+}
+
+# Check init is really there
+if ! validate_init "$init"; then
+ echo "Target filesystem doesn't have requested ${init}."
+ init=
+ for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
+ if validate_init "${inittest}"; then
+ init="$inittest"
+ break
+ fi
+ done
+fi
+
+# No init on rootmount
+if ! validate_init "${init}" ; then
+ panic "No init found. Try passing init= bootarg."
+fi
+
+maybe_break init
+
+# don't leak too much of env - some init(8) don't clear it
+# (keep init, rootmnt, drop_caps)
+unset debug
+unset MODPROBE_OPTIONS
+unset DPKG_ARCH
+unset ROOTFLAGS
+unset ROOTFSTYPE
+unset ROOTDELAY
+unset ROOT
+unset IP
+unset BOOT
+unset BOOTIF
+unset DEVICE
+unset UBIMTD
+unset blacklist
+unset break
+unset noresume
+unset panic
+unset quiet
+unset readonly
+unset resume
+unset resume_offset
+unset noresume
+unset fastboot
+unset forcefsck
+unset fsckfix
+unset starttime
+
+# Move virtual filesystems over to the real filesystem
+mount -n -o move /sys ${rootmnt}/sys
+mount -n -o move /proc ${rootmnt}/proc
+
+# Chain to real filesystem
+# shellcheck disable=SC2086,SC2094
+exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <"${rootmnt}/dev/console" >"${rootmnt}/dev/console" 2>&1
+echo "Something went badly wrong in the initramfs."
+panic "Please file a bug on initramfs-tools."
diff --git a/initramfs-tools.7 b/initramfs-tools.7
new file mode 100644
index 0000000..2d5d2d2
--- /dev/null
+++ b/initramfs-tools.7
@@ -0,0 +1,671 @@
+.TH INITRAMFS-TOOLS 7 "2018/07/18" "initramfs\-tools" "Linux Programmer's Manual"
+
+.SH NAME
+initramfs-tools \- an introduction to writing scripts for mkinitramfs
+
+.SH DESCRIPTION
+initramfs-tools has one main script and two different sets of subscripts which
+will be used during different phases of execution. Each of these will be
+discussed separately below with the help of an imaginary tool which performs a
+frobnication of a lvm partition prior to mounting the root partition.
+
+.SH Kernel Command Line
+The root filesystem used by the kernel is specified by the boot loader as
+always. The traditional \fBroot=/dev/sda1\fR style device specification is
+allowed. If a label is used, as in \fBroot=LABEL=rootPart\fR the initrd will
+search all available devices for a filesystem with the appropriate label, and
+mount that device as the root filesystem. \fBroot=UUID=uuidnumber\fR will
+mount the partition with that UUID as the root filesystem.
+
+.SS Standard
+
+.TP
+\fB\fI init= "<path to real init>"
+the binary to hand over execution to on the root fs after the initramfs scripts are done.
+
+.TP
+\fB\fI initramfs.clear
+clear screen at the beginning
+
+.TP
+\fB\fI initramfs.runsize
+The size of the \fI/run\fP tmpfs mount point in bytes (suffixes are supported)
+or as percentage of your physical RAM. This parameter is used as the value of
+the size mount option to tmpfs. See
+\fBhttps://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt\fR for
+details. The default is 10%.
+
+.TP
+\fB\fI root= "<path to blockdevice>"
+the device node to mount as the root file system.
+The recommended usage is to specify the UUID as followed "root=UUID=xxx".
+
+.TP
+\fB\fI rootfstype
+set the root file system type.
+
+.TP
+\fB\fI rootdelay
+set delay in seconds. Determines how long mountroot waits for root to appear.
+The default is 180 seconds.
+
+.TP
+\fB\fI rootflags
+set the file system mount option string.
+
+.TP
+\fB\fI nfsroot
+can be either "auto" to try to get the relevant information from DHCP or a
+string of the form NFSSERVER:NFSPATH or NFSSERVER:NFSPATH:NFSOPTS.
+Use root=/dev/nfs for NFS to kick to in. NFSOPTS can be looked up in
+\fInfs(5)\fP.
+
+.TP
+\fB\fI ip
+tells how to configure the ip address. Allows one to specify an different
+NFS server than the DHCP server. See Documentation/filesystems/nfsroot.txt
+in any recent Linux source for details. Optional parameter for NFS root.
+
+.TP
+\fB\fI BOOTIF
+is a mac address in pxelinux format with leading "01-" and "-" as separations.
+pxelinux passes mac address of network card used to PXE boot on with this
+bootarg.
+
+.TP
+\fB\fI boot
+either local or NFS (affects which initramfs scripts are run, see the "Subdirectories" section under boot scripts).
+
+.TP
+\fB\fI resume
+The resume hook tries to autodetect the resume partition and uses the first
+swap partition as valid guess. It is possible to set the RESUME variable in
+/etc/initramfs-tools/conf.d/resume.
+The boot variable noresume overrides it.
+
+.TP
+\fB\fI resume_offset
+Specify the offset from the partition given by "resume=" at which the swap
+header of the swap file is located.
+
+.TP
+\fB\fI quiet
+reduces the amount of text output to the console during boot.
+
+.TP
+\fB\fI ro
+mounts the rootfs read-only.
+
+.TP
+\fB\fI rw
+mounts the rootfs read-write.
+
+.TP
+\fB\fI blacklist
+disables load of specific modules.
+Use blacklist=module1,module2,module3 bootparameter.
+
+.SS Debug
+.TP
+\fB\fI panic
+sets an timeout on panic.
+panic=<sec> is a documented security feature: it disables the debug shell.
+
+.TP
+\fB\fI debug
+generates lots of output. It writes a log to /run/initramfs/initramfs.debug.
+Instead when invoked with an arbitrary argument output is written to console.
+Use for example "debug=vc".
+
+.TP
+\fB\fI break
+spawns a shell in the initramfs image at the chosen phase
+(top, modules, premount, mount, mountroot, bottom, init)
+before actually executing the corresponding scripts
+(see the "Boot scripts" section) or action. Multiple
+phases may be specified, delimited by commas.
+The default, if no phase is specified, is "premount".
+Beware that if both "panic" and "break" are present,
+initramfs will not spawn any shells but reboot instead.
+
+.TP
+\fB\fI netconsole
+loads netconsole linux modules with the chosen args.
+
+.TP
+\fB\fI all_generic_ide
+loads generic IDE/ATA chipset support on boot.
+
+
+.SH SCRIPTS
+
+Valid boot and hook scripts names consist solely of alphabetics, numerics,
+dashes and underscores. Other scripts are discarded.
+
+.SS Configuration hook scripts
+These are used to override the user configuration where necessary, for
+example to force use of busybox instead of klibc utilities.
+
+.SS Hook scripts
+These are used when an initramfs image is created and not included in the
+image itself. They can however cause files to be included in the image.
+Hook scripts are executed under errexit. Thus a hook script can abort the
+mkinitramfs build on possible errors (exitcode != 0).
+
+.SS Boot scripts
+These are included in the initramfs image and normally executed during
+kernel boot in the early user-space before the root partition has been
+mounted.
+
+
+.SH CONFIGURATION HOOK SCRIPTS
+
+Configuration hook scripts can be found in
+/usr/share/initramfs-tools/conf-hooks.d. They are sourced by
+mkinitramfs after the configuration files in /etc and before running
+any hook scripts. They can override any of the variables documented
+in \fIinitramfs.conf\fR(5), but this should be done only if absolutely
+necessary. For example, if a package's boot script requires commands
+not provided by klibc-utils, it should also install a configuration
+hook that sets \fBBUSYBOX=y\fR.
+
+
+.SH HOOK SCRIPTS
+
+Hooks can be found in two places: /usr/share/initramfs-tools/hooks and
+/etc/initramfs-tools/hooks. They are executed during generation of the
+initramfs-image and are responsible for including all the necessary components
+in the image itself. No guarantees are made as to the order in which the
+different scripts are executed unless the prereqs are setup in the script.
+Please notice that PREREQ is only honored inside a single directory. So first
+the scripts in /usr/share/initramfs-tools are ordered according to their PREREQ
+values and executed. Then all scripts in /etc/initramfs-tools are ordered
+according to \fBtheir\fR PREREQ values and executed. This mean that currently
+there is no possibility to have a local script (/etc/initramfs-tools) get
+executed before one from the package (/usr/share/initramfs-tools).
+
+If a hook script requires configuration beyond the exported variables
+listed below, it should read a private configuration file that is
+separate from the /etc/initramfs-tools directory. It \fImust not\fR
+read initramfs-tools configuration files directly.
+
+.SS Header
+In order to support prereqs, each script should begin with the following lines:
+
+.RS
+.nf
+#!/bin/sh
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+\fR. /usr/share/initramfs-tools/hook-functions
+# Begin real processing below this line
+.fi
+.RE
+
+For example, if you are writing a new hook script which relies on lvm, the line
+starting with PREREQ should be changed to PREREQ="lvm" which will ensure that
+the lvm hook script is run before your custom script.
+
+.SS Help functions
+/usr/share/initramfs-tools/hook-functions contains a number of functions which
+deal with some common tasks in a hook script:
+.TP
+\fB\fI
+manual_add_modules
+adds a module (and any modules which it depends on) to the initramfs image.
+.RS
+.PP
+.B Example:
+manual_add_modules isofs
+.RE
+
+.TP
+\fB\fI
+add_modules_from_file
+reads a file containing a list of modules (one per line) to be added to the
+initramfs image. The file can contain comments (lines starting with #) and
+arguments to the modules by writing the arguments on the same line as the name
+of the module.
+.RS
+.PP
+.B Example:
+add_modules_from_file /tmp/modlist
+.RE
+
+.TP
+\fB\fI
+force_load
+adds a module (and its dependencies) to the initramfs image and also
+unconditionally loads the module during boot. Also supports passing arguments
+to the module by listing them after the module name.
+.RS
+.PP
+.B Example:
+force_load cdrom debug=1
+.RE
+
+.TP
+\fB\fI
+copy_modules_dir
+copies an entire module directory from /lib/modules/KERNELVERSION/ into the
+initramfs image.
+.RS
+.PP
+.B Example:
+copy_modules_dir kernel/drivers/ata
+.RE
+
+.SS Including binaries
+If you need to copy an executable or shared library to the initramfs
+module, use a command like this:
+.PP
+.RS
+copy_exec /sbin/mdadm /sbin
+.RE
+
+mkinitramfs will automatically detect which libraries it depends on
+and copy them to the initramfs. This means that most executables, unless
+compiled with klibc, will automatically include glibc in the image which will
+increase its size by several hundred kilobytes.
+
+.SS Including a system firmware preimage (early initramfs)
+If you need to prepend data to the initramfs image, you need to prepare it
+in a file, and call the \fB\fIprepend_earlyinitramfs\fR function. The file
+can be disposed of as soon as the function returns.
+
+.B Example:
+.nf
+TEMP_FILE=$(mktemp ...)
+ ...
+prepend_earlyinitramfs ${TEMP_FILE}
+rm -f ${TEMP_FILE}
+
+.RE
+
+.SS Exported variables
+mkinitramfs sets several variables for the hook scripts environment.
+
+.TP
+\fB\fI MODULESDIR
+corresponds to the linux modules dir.
+.TP
+\fB\fI version
+is the $(uname \-r) linux version against mkinitramfs is run.
+.TP
+\fB\fI CONFDIR
+is the path of the used initramfs-tools configurations.
+.TP
+\fB\fI DESTDIR
+is the root path of the newly build initramfs.
+.TP
+\fB\fI DPKG_ARCH
+allows arch specific hook additions.
+.TP
+\fB\fI verbose
+corresponds to the verbosity of the update-initramfs run.
+.TP
+\fB\fI BUSYBOX, KEYMAP, MODULES
+are as described in \fIinitramfs.conf\fR(5).
+.TP
+\fB\fI BUSYBOXDIR
+is the directory where busybox utilities should be installed from, or
+empty if busybox is not being used.
+
+
+.SH BOOT SCRIPTS
+
+Similarly to hook scripts, boot scripts can be found in two places
+/usr/share/initramfs-tools/scripts/ and /etc/initramfs-tools/scripts/. There
+are a number of subdirectories to these two directories which control the boot
+stage at which the scripts are executed.
+
+.SS Header
+Like for hook scripts, there are no guarantees as to the order in which the
+different scripts in one subdirectory (see "Subdirectories" below) are
+executed. In order to define a certain order, a similar header as for hook
+scripts should be used:
+
+.RS
+.nf
+#!/bin/sh
+PREREQ=""
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+.fi
+.RE
+
+Where PREREQ is modified to list other scripts in the same subdirectory if necessary.
+
+.SS Help functions
+A number of functions (mostly dealing with output) are provided to boot scripts in
+.I /scripts/functions
+:
+
+.TP
+\fB\fI
+log_success_msg
+Logs a success message
+.RS
+.PP
+.B Example:
+log_success_msg "Frobnication successful"
+.RE
+
+.TP
+\fB\fI
+log_failure_msg
+Logs a failure message
+.RS
+.PP
+.B Example:
+log_failure_msg "Frobnication component froobz missing"
+.RE
+
+.TP
+\fB\fI
+log_warning_msg
+Logs a warning message
+.RS
+.PP
+.B Example:
+log_warning_msg "Only partial frobnication possible"
+.RE
+
+.TP
+\fB\fI
+log_begin_msg
+Logs a message that some processing step has begun
+
+.TP
+\fB\fI
+log_end_msg
+Logs a message that some processing step is finished
+.RS
+.PP
+.B Example:
+.PP
+.RS
+.nf
+log_begin_msg "Frobnication begun"
+# Do something
+log_end_msg
+.fi
+.RE
+.RE
+
+.TP
+\fB\fI
+panic
+Logs an error message and executes a shell in the initramfs image to allow the
+user to investigate the situation.
+.RS
+.PP
+.B Example:
+panic "Frobnication failed"
+.RE
+
+.SS Subdirectories
+Both /usr/share/initramfs-tools/scripts and /etc/initramfs-tools/scripts
+contains the following subdirectories.
+
+.TP
+\fB\fI
+init-top
+the scripts in this directory are the first scripts to be executed after sysfs
+and procfs have been mounted.
+It also runs the udev hook for populating the /dev tree (udev will keep
+running until init-bottom).
+
+.TP
+\fB\fI
+init-premount
+happens after modules specified by hooks and /etc/initramfs-tools/modules
+have been loaded.
+
+.TP
+\fB\fI
+local-top OR nfs-top
+After these scripts have been executed, the root device node is expected to be
+present (local) or the network interface is expected to be usable (NFS).
+
+.TP
+\fB\fI
+local-block
+These scripts are called with the name of a local block device. After
+these scripts have been executed, that device node should be present.
+If the local-top or local-block scripts fail to create the wanted
+device node, the local-block scripts will be called periodically to
+try again.
+
+.TP
+\fB\fI
+local-premount OR nfs-premount
+are run after the sanity of the root device has been verified (local) or the
+network interface has been brought up (NFS), but before the actual root fs has
+been mounted.
+
+.TP
+\fB\fI
+local-bottom OR nfs-bottom
+are run after the rootfs has been mounted (local) or the NFS root share has
+been mounted.
+
+.TP
+\fB\fI
+init-bottom
+are the last scripts to be executed before procfs and sysfs are moved to the
+real rootfs and execution is turned over to the init binary which should now be
+found in the mounted rootfs. udev is stopped.
+
+.SS Boot parameters
+.TP
+\fB\fI
+/conf/param.conf
+allows boot scripts to change exported variables that are listed on top of init. Write the new values to it. It will be sourced after an boot script run if it exists.
+
+
+.SH EXAMPLES
+
+.SS Hook script
+An example hook script would look something like this (and would usually be
+placed in /etc/initramfs-tools/hooks/frobnicate):
+
+.RS
+.nf
+#!/bin/sh
+# Example frobnication hook script
+
+PREREQ="lvm"
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+\fR. /usr/share/initramfs-tools/hook-functions
+# Begin real processing below this line
+
+if [ ! \-x "/sbin/frobnicate" ]; then
+ exit 0
+fi
+
+force_load frobnicator interval=10
+copy_exec /sbin/frobnicate /sbin
+exit 0
+.fi
+.RE
+
+.SS Boot script
+An example boot script would look something like this (and would usually be placed in /etc/initramfs-tools/scripts/local-top/frobnicate):
+
+.RS
+.nf
+#!/bin/sh
+# Example frobnication boot script
+
+PREREQ="lvm"
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+\fR. /scripts/functions
+# Begin real processing below this line
+if [ ! \-x "/sbin/frobnicate" ]; then
+ panic "Frobnication executable not found"
+fi
+
+if [ ! \-e "/dev/mapper/frobb" ]; then
+ panic "Frobnication device not found"
+fi
+
+log_begin_msg "Starting frobnication"
+/sbin/frobnicate "/dev/mapper/frobb" || panic "Frobnication failed"
+log_end_msg
+
+exit 0
+.fi
+.RE
+
+.SS Exported variables
+init sets several variables for the boot scripts environment.
+
+.TP
+\fB\fI ROOT
+corresponds to the root boot option.
+Advanced boot scripts like cryptsetup or live-initramfs need to play tricks.
+Otherwise keep it alone.
+.TP
+\fB\fI ROOTDELAY, ROOTFLAGS, ROOTFSTYPE, IP
+corresponds to the rootdelay, rootflags, rootfstype or ip boot option.
+Use of ROOTDELAY is deprecated; you should implement a \fIlocal-block\fR
+boot script rather than delaying or polling.
+.TP
+\fB\fI DPKG_ARCH
+allows arch specific boot actions.
+.TP
+\fB\fI blacklist, panic, quiet, resume, noresume, resume_offset
+set according relevant boot option.
+.TP
+\fB\fI break
+Useful for manual intervention during setup and coding an boot script.
+.TP
+\fB\fI REASON
+Argument passed to the \fIpanic\fP helper function. Use to find out why
+you landed in the initramfs shell.
+.TP
+\fB\fI init
+passes the path to init(8) usually /sbin/init.
+.TP
+\fB\fI readonly
+is the default for mounting the root corresponds to the ro bootarg.
+Overridden by rw bootarg.
+.TP
+\fB\fI rootmnt
+is the path where root gets mounted usually /root.
+.TP
+\fB\fI debug
+indicates that a debug log is captured for further investigation.
+
+
+.SH UPDATING THE INITRAMFS FROM ANOTHER PACKAGE
+Package maintainer scripts should not run \fBupdate-initramfs\fR
+directly. A package that installs hooks for initramfs-tools should
+include a triggers file containing:
+.RS
+.nf
+activate\-noawait update\-initramfs
+.fi
+.RE
+
+Kernel packages must call the kernel hooks as documented in the
+Debian Kernel Handbook.
+
+A package that requires an initramfs to function, but is not a kernel
+package, should include a triggers file containing:
+.RS
+.nf
+activate\-await update\-initramfs
+.fi
+.RE
+
+
+.SH KERNEL HOOKS
+initramfs-tools includes hook scripts that are called by kernel
+packages on installation and removal, so that an initramfs is
+automatically created, updated or deleted as necessary. The hook
+scripts do nothing if the environment variable \fBINITRD\fR is
+set to \fBNo\fR. This will be the case for kernel packages
+built with \fBmake deb-pkg\fR and with \fBCONFIG_BLK_DEV_INITRD\fR
+not set in the kernel config, or built with \fBmake-kpkg\fR and not
+using the \fB--initrd\fR option.
+
+
+.SH DEBUG
+It is easy to check the generated initramfs for its content. One may need
+to double-check if it contains the relevant binaries, libs or modules:
+.RS
+.nf
+lsinitramfs /boot/initrd.img\-3.16\-3\-amd64
+.fi
+.RE
+
+
+.SH FILES
+.TP
+.I /run/initramfs/fsck.log
+Log of fsck commands run within the initramfs, with their output.
+.TP
+.I /run/initramfs/fsck-root
+Exists only if fsck ran successfully for the root filesystem.
+.TP
+.I /run/initramfs/fsck-usr
+Exists only if fsck ran successfully for the \fI/usr\fR filesystem.
+
+
+.SH AUTHOR
+The initramfs-tools are written by Maximilian Attems <maks@debian.org>,
+Jeff Bailey <jbailey@raspberryginger.com> and numerous others.
+.PP
+This manual was written by David H\[:a]rdeman <david@hardeman.nu>,
+updated by Maximilian Attems <maks@debian.org>.
+
+.SH SEE ALSO
+.BR
+.IR initramfs.conf (5),
+.IR mkinitramfs (8),
+.IR update-initramfs (8),
+.IR lsinitramfs (8).
diff --git a/initramfs.conf.5 b/initramfs.conf.5
new file mode 100644
index 0000000..76e4010
--- /dev/null
+++ b/initramfs.conf.5
@@ -0,0 +1,138 @@
+.TH INITRAMFS.CONF 5 "2018/07/18" "initramfs\-tools" "File Formats Manual"
+
+.SH NAME
+initramfs.conf \- configuration file for mkinitramfs
+
+.SH DESCRIPTION
+The behaviour of
+.B mkinitramfs
+can be modified by its configuration file.
+
+Each line in the file can be a configuration variable, a blank line,
+or a comment. The value of an variable is assigned by an statement
+of the form: \fIname\fP=[\fIvalue\fP]
+
+Configuration options can be broken out into configuration snippets and
+placed in individual files in the /etc/initramfs-tools/conf.d directory. Files
+in this directory are always read \fBafter\fP the main configuration file,
+so you can override the settings in the main config file without editing it
+directly.
+
+.SH GENERAL VARIABLES
+.TP
+\fB MODULES
+Specifies the modules for the initramfs image.
+
+Modules listed in \fI/etc/initramfs-tools/modules\fP and
+\fI/usr/share/initramfs-tools/modules.d/*\fP are always included in the
+initramfs, and are loaded early in the boot process.
+
+
+\fIlist\fP doesn't load any additional modules at boot time, other than those
+listed in the above files.
+
+\fImost\fP adds most file system, all ata, sata, scsi and usb drivers.
+
+\fIdep\fP tries to guess which modules are necessary for the running box and
+only adds those modules.
+
+\fInetboot\fP adds the base and network modules, but skips block devices.
+
+
+The default setting is \fImost\fP.
+
+.TP
+\fB BUSYBOX
+Include busybox utilities for the boot scripts.
+If set to 'n'
+.B mkinitramfs
+will build an initramfs without busybox.
+Beware that many boot scripts need busybox utilities.
+
+.TP
+\fB KEYMAP
+If set to 'y', the console keymap will be loaded during the initramfs stage.
+The keymap will anyway be loaded by the initscripts later, and the packages
+that might need input will normally set this variable automatically, so there
+should normally be no need to set this.
+
+.TP
+\fB COMPRESS
+Specifies the compression method used for the initramfs image.
+.B mkinitramfs
+will default to gzip if the kernel lacks support (CONFIG_RD) or the
+corresponding userspace utility is not present.
+
+.TP
+\fB COMPRESSLEVEL
+Specifies the compression level used for the initramfs image.
+.B mkinitramfs
+will default to 9 for lz4, 9 for zstd, and the builtin defaults for all
+others.
+
+.TP
+\fB UMASK
+Set the umask value of the generated initramfs file.
+Useful to not disclose eventual keys.
+
+.TP
+\fB BOOT
+Allows one to use an nfs drive as the root of the drive.
+The default is to boot from \fIlocal\fP media (hard drive, USB stick).
+Set to \fInfs\fP for an NFS root share.
+
+.TP
+\fB RUNSIZE
+The size of the \fI/run\fP tmpfs mount point in bytes (suffixes are supported)
+or as percentage of your physical RAM. This parameter is used as the value of
+the size mount option to tmpfs. See
+\fBhttps://www.kernel.org/doc/Documentation/filesystems/tmpfs.txt\fR for
+details. Can be overridden by an optional \fBinitramfs.runsize=\fR bootarg.
+The default is 10%.
+
+.SH VARIABLES FOR LOCAL BOOT
+.TP
+\fB RESUME
+Specifies the device used for suspend-to-disk (hibernation), which the
+initramfs code should attempt to resume from. If this is not defined
+or is set to \fIauto\fP,
+.B mkinitramfs
+will automatically select the largest available swap partition.
+Set it to \fInone\fP to disable resume from disk.
+
+.TP
+\fB FSTYPE
+Specifies the filesystem type(s) to support, separated by commas. If
+this is not defined or is set to \fIauto\fP, \fBmkinitramfs\fP will
+automatically detect the current root and \fI/usr\fP filesystem types.
+
+.SH VARIABLES FOR NFS BOOT
+.TP
+\fB DEVICE
+Specifies the default network interface to use, like eth0. The \fIip\fP or
+\fIBOOTIF\fP bootargs may override this.
+
+.TP
+\fB ROOT
+Allows optional root bootarg hardcoding, when no root bootarg can be passed.
+A root bootarg overrides that special setting.
+
+.TP
+\fB NFSROOT
+Defaults to \fIauto\fP in order to pick up value from DHCP server.
+Otherwise you need to specify \fIHOST:MOUNT\fP.
+
+.SH FILES
+.TP
+.I /etc/initramfs-tools/initramfs.conf
+
+.SH AUTHOR
+The initramfs-tools are written by Maximilian Attems <maks@debian.org>,
+Jeff Bailey <jbailey@raspberryginger.com> and numerous others.
+Loosely based on mkinitrd.conf by Herbert Xu.
+
+.SH SEE ALSO
+.BR
+.IR initramfs-tools (7),
+.IR mkinitramfs (8),
+.IR update-initramfs (8).