cat > /etc/inputrc << "EOF" # Begin /etc/inputrc # Modified by Chris Lynn <roryo@roryo.dynup.net>
# Allow the command prompt to wrap to the next line set horizontal-scroll-mode Off
# Enable 8-bit input set meta-flag On set input-meta On
# Turns off 8th bit stripping set convert-meta Off
# Keep the 8th bit for display set output-meta On
# none, visible or audible set bell-style none
# All of the following map the escape sequence of the value # contained in the 1st argument to the readline specific functions "\eOd": backward-word "\eOc": forward-word
# for linux console "\e[1~": beginning-of-line "\e[4~": end-of-line "\e[5~": beginning-of-history "\e[6~": end-of-history "\e[3~": delete-char "\e[2~": quoted-insert
# for xterm "\eOH": beginning-of-line "\eOF": end-of-line
# for Konsole "\e[H": beginning-of-line "\e[F": end-of-line
General setup ---> [ ] Compile the kernel with warnings as errors [WERROR] CPU/Task time and stats accounting ---> [*] Pressure stall information tracking [PSI] [ ] Require boot parameter to enable pressure stall information tracking ... [PSI_DEFAULT_DISABLED] < > Enable kernel headers through /sys/kernel/kheaders.tar.xz [IKHEADERS] [*] Control Group support ---> [CGROUPS] [*] Memory controller [MEMCG] [ ] Configure standard kernel features (expert users) ---> [EXPERT]
Processor type and features ---> [*] Build a relocatable kernel [RELOCATABLE] [*] Randomize the address of the kernel image (KASLR) [RANDOMIZE_BASE] [*] Support x2apic [X86_X2APIC]
Device Drivers ---> Generic Driver Options ---> [ ] Support for uevent helper [UEVENT_HELPER] [*] Maintain a devtmpfs filesystem to mount at /dev [DEVTMPFS] [*] Automount devtmpfs at /dev, after the kernel mounted the rootfs ... [DEVTMPFS_MOUNT] Graphics support ---> < /*/M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) ---> ... [DRM] # If [DRM] is selected as * or M, this must be selected: [ /*] Enable legacy fbdev support for your modesetting driver ... [DRM_FBDEV_EMULATION] Console display driver support ---> # If [DRM] is selected as * or M, this must be selected: [ /*] Framebuffer Console support [FRAMEBUFFER_CONSOLE]
[*] PCI support ---> [PCI] [*] Message Signaled Interrupts (MSI and MSI-X) [PCI_MSI] [*] IOMMU Hardware Support ---> [IOMMU_SUPPORT] [*] Support for Interrupt Remapping [IRQ_REMAP]
cat > /usr/sbin/mkinitramfs << "EOF" #!/bin/bash # This file based in part on the mkinitramfs script for the LFS LiveCD # written by Alexander E. Patrakov and Jeremy Huntwork.
copy() { local file
if [ "$2" = "lib" ]; then file=$(PATH=/usr/lib type -p $1) else file=$(type -p $1) fi
if [ -n "$file" ] ; then cp$file$WDIR/usr/$2 else echo"Missing required file: $1 for directory $2" rm -rf $WDIR exit 1 fi }
if [ -z $1 ] ; then INITRAMFS_FILE=initrd.img-no-kmods else KERNEL_VERSION=$1 INITRAMFS_FILE=initrd.img-$KERNEL_VERSION fi
if [ -n "$KERNEL_VERSION" ] && [ ! -d "/usr/lib/modules/$1" ] ; then echo"No modules directory named $1" exit 1 fi
printf"Creating $INITRAMFS_FILE... "
binfiles="sh cat cp dd killall ls mkdir mknod mount " binfiles="$binfiles umount sed sleep ln rm uname" binfiles="$binfiles readlink basename"
# Systemd installs udevadm in /bin. Other udev implementations have it in /sbin if [ -x /usr/bin/udevadm ] ; then binfiles="$binfiles udevadm"; fi
sbinfiles="modprobe blkid switch_root"
# Optional files and locations for f in mdadm mdmon udevd udevadm; do if [ -x /usr/sbin/$f ] ; then sbinfiles="$sbinfiles$f"; fi done
# Add lvm if present (cannot be done with the others because it # also needs dmsetup if [ -x /usr/sbin/lvm ] ; then sbinfiles="$sbinfiles lvm dmsetup"; fi
unsorted=$(mktemp /tmp/unsorted.XXXXXXXXXX)
DATADIR=/usr/share/mkinitramfs INITIN=init.in
# Create a temporary working directory WDIR=$(mktemp -d /tmp/initrd-work.XXXXXXXXXX)
# Create necessary device nodes mknod -m 640 $WDIR/dev/console c 5 1 mknod -m 664 $WDIR/dev/null c 1 3
# Install the udev configuration files if [ -f /etc/udev/udev.conf ]; then cp /etc/udev/udev.conf $WDIR/etc/udev/udev.conf fi
for file in $(find /etc/udev/rules.d/ -type f) ; do cp$file$WDIR/etc/udev/rules.d done
# Install any firmware present cp -a /usr/lib/firmware $WDIR/usr/lib
# Copy the RAID configuration file if present if [ -f /etc/mdadm.conf ] ; then cp /etc/mdadm.conf $WDIR/etc fi
# Install the init file install -m0755 $DATADIR/$INITIN$WDIR/init
if [ -n "$KERNEL_VERSION" ] ; then if [ -x /usr/bin/kmod ] ; then binfiles="$binfiles kmod" else binfiles="$binfiles lsmod" sbinfiles="$sbinfiles insmod" fi fi
# Install basic binaries for f in$binfiles ; do ldd /usr/bin/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted copy /usr/bin/$f bin done
for f in$sbinfiles ; do ldd /usr/sbin/$f | sed "s/\t//" | cut -d " " -f1 >> $unsorted copy $f sbin done
# Add udevd libraries if not in /usr/sbin if [ -x /usr/lib/udev/udevd ] ; then ldd /usr/lib/udev/udevd | sed "s/\t//" | cut -d " " -f1 >> $unsorted elif [ -x /usr/lib/systemd/systemd-udevd ] ; then ldd /usr/lib/systemd/systemd-udevd | sed "s/\t//" | cut -d " " -f1 >> $unsorted fi
# Add module symlinks if appropriate if [ -n "$KERNEL_VERSION" ] && [ -x /usr/bin/kmod ] ; then ln -s kmod $WDIR/usr/bin/lsmod ln -s kmod $WDIR/usr/bin/insmod fi
# Add lvm symlinks if appropriate # Also copy the lvm.conf file if [ -x /usr/sbin/lvm ] ; then ln -s lvm $WDIR/usr/sbin/lvchange ln -s lvm $WDIR/usr/sbin/lvrename ln -s lvm $WDIR/usr/sbin/lvextend ln -s lvm $WDIR/usr/sbin/lvcreate ln -s lvm $WDIR/usr/sbin/lvdisplay ln -s lvm $WDIR/usr/sbin/lvscan
# Install libraries sort$unsorted | uniq | whileread library ; do # linux-vdso and linux-gate are pseudo libraries and do not correspond to a file # libsystemd-shared is in /lib/systemd, so it is not found by copy, and # it is copied below anyway if [[ "$library" == linux-vdso.so.1 ]] || [[ "$library" == linux-gate.so.1 ]] || [[ "$library" == libsystemd-shared* ]]; then continue fi
copy $library lib done
if [ -d /usr/lib/udev ]; then cp -a /usr/lib/udev $WDIR/usr/lib fi if [ -d /usr/lib/systemd ]; then cp -a /usr/lib/systemd $WDIR/usr/lib fi if [ -d /usr/lib/elogind ]; then cp -a /usr/lib/elogind $WDIR/usr/lib fi
# Install the kernel modules if requested if [ -n "$KERNEL_VERSION" ]; then find \ /usr/lib/modules/$KERNEL_VERSION/kernel/{crypto,fs,lib} \ /usr/lib/modules/$KERNEL_VERSION/kernel/drivers/{block,ata,nvme,md,firewire} \ /usr/lib/modules/$KERNEL_VERSION/kernel/drivers/{scsi,message,pcmcia,virtio} \ /usr/lib/modules/$KERNEL_VERSION/kernel/drivers/usb/{host,storage} \ -type f 2> /dev/null | cpio --make-directories -p --quiet $WDIR
cp /usr/lib/modules/$KERNEL_VERSION/modules.{builtin,order} \ $WDIR/usr/lib/modules/$KERNEL_VERSION if [ -f /usr/lib/modules/$KERNEL_VERSION/modules.builtin.modinfo ]; then cp /usr/lib/modules/$KERNEL_VERSION/modules.builtin.modinfo \ $WDIR/usr/lib/modules/$KERNEL_VERSION fi
# Prepare early loading of microcode if available ifls /usr/lib/firmware/intel-ucode/* >/dev/null 2>&1 || ls /usr/lib/firmware/amd-ucode/* >/dev/null 2>&1; then
problem() { printf"Encountered a problem!\n\nDropping you to a shell.\n\n" sh }
no_device() { printf"The device %s, which is supposed to contain the\n"$1 printf"root file system, does not exist.\n" printf"Please fix this problem and exit this shell.\n\n" }
no_mount() { printf"Could not mount device %s\n"$1 printf"Sleeping forever. Please reboot and fix the kernel command line.\n\n" printf"Maybe the device is formatted with an unsupported file system?\n\n" printf"Or maybe filesystem type autodetection went wrong, in which case\n" printf"you should add the rootfstype=... parameter to the kernel command line.\n\n" printf"Available partitions:\n" }
# udevd location depends on version if [ -x /sbin/udevd ]; then UDEVD=/sbin/udevd elif [ -x /lib/udev/udevd ]; then UDEVD=/lib/udev/udevd elif [ -x /lib/systemd/systemd-udevd ]; then UDEVD=/lib/systemd/systemd-udevd else echo"Cannot find udevd nor systemd-udevd" problem fi
if [ -f /etc/mdadm.conf ] ; then mdadm -As ; fi if [ -x /sbin/vgchange ] ; then /sbin/vgchange -a y > /dev/null ; fi if [ -n "$rootdelay" ] ; thensleep"$rootdelay" ; fi
do_try_resume # This function will not return if resuming from disk do_mount_root