From 39366733c3fe943363566756e2e152c45a1b3cb2 Mon Sep 17 00:00:00 2001 From: Patrick J Volkerding Date: Fri, 25 May 2018 23:29:36 +0000 Subject: Fri May 25 23:29:36 UTC 2018 patches/packages/glibc-zoneinfo-2018e-noarch-2_slack14.2.txz: Rebuilt. Handle removal of US/Pacific-New timezone. If we see that the machine is using this, it will be automatically switched to US/Pacific. --- patches/source/mkinitrd/README.initrd | 99 ++ patches/source/mkinitrd/busybox-dot-config | 1 + patches/source/mkinitrd/busybox-dot-config.1.20.x | 1024 ++++++++++++++++++++ .../fixes-1.20.2/busybox-1.20.2-kernel_ver.patch | 25 + .../fixes-1.20.2/busybox-1.20.2-ntpd.patch | 11 + .../busybox-1.20.2-pkg-config-selinux.patch | 67 ++ .../fixes-1.20.2/busybox-1.20.2-sys-resource.patch | 123 +++ patches/source/mkinitrd/init | 350 +++++++ patches/source/mkinitrd/mkinitrd | 740 ++++++++++++++ patches/source/mkinitrd/mkinitrd.8 | 279 ++++++ patches/source/mkinitrd/mkinitrd.SlackBuild | 146 +++ patches/source/mkinitrd/mkinitrd.conf.5 | 244 +++++ patches/source/mkinitrd/mkinitrd.conf.sample | 21 + .../source/mkinitrd/mkinitrd_command_generator.8 | 187 ++++ .../source/mkinitrd/mkinitrd_command_generator.sh | 872 +++++++++++++++++ patches/source/mkinitrd/slack-desc | 19 + 16 files changed, 4208 insertions(+) create mode 100644 patches/source/mkinitrd/README.initrd create mode 120000 patches/source/mkinitrd/busybox-dot-config create mode 100644 patches/source/mkinitrd/busybox-dot-config.1.20.x create mode 100644 patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-kernel_ver.patch create mode 100644 patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-ntpd.patch create mode 100644 patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-pkg-config-selinux.patch create mode 100644 patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-sys-resource.patch create mode 100755 patches/source/mkinitrd/init create mode 100644 patches/source/mkinitrd/mkinitrd create mode 100644 patches/source/mkinitrd/mkinitrd.8 create mode 100755 patches/source/mkinitrd/mkinitrd.SlackBuild create mode 100644 patches/source/mkinitrd/mkinitrd.conf.5 create mode 100644 patches/source/mkinitrd/mkinitrd.conf.sample create mode 100644 patches/source/mkinitrd/mkinitrd_command_generator.8 create mode 100644 patches/source/mkinitrd/mkinitrd_command_generator.sh create mode 100644 patches/source/mkinitrd/slack-desc (limited to 'patches/source/mkinitrd') diff --git a/patches/source/mkinitrd/README.initrd b/patches/source/mkinitrd/README.initrd new file mode 100644 index 000000000..c10bb6306 --- /dev/null +++ b/patches/source/mkinitrd/README.initrd @@ -0,0 +1,99 @@ + +Slackware initrd mini HOWTO +by Patrick Volkerding, volkerdi@slackware.com +@DATE@ + +This document describes how to create and install an initrd, which may be +required to use some features of the kernel. Also see "man mkinitrd". + +1. What is an initrd? +2. Why to I need an initrd? +3. How do I build the initrd? +4. Now that I've built an initrd, how do I use it? + + +1. What is an initrd? + +Initrd stands for "initial ramdisk". An initial ramdisk is a very small +Linux filesystem that is loaded into RAM and mounted as the kernel boots, +and before the main root filesystem is mounted. + +2. Why do I need an initrd? + +The usual reason to use an initrd is because you need to load kernel +modules before mounting the root partition. Usually these modules are +required to support the filesystem used by the root partition (ext3, +reiserfs, xfs), or perhaps the controller that the hard drive is attached +to (SCSI, RAID, etc). Essentially, there are so many different options +available in modern Linux kernels that it isn't practical to try to ship +many different kernels to try to cover everyone's needs. It's a lot more +flexible to ship a generic kernel and a set of kernel modules for it. + +3. How do I build the initrd? + +The easiest way to make the initrd is to use the mkinitrd script included +in Slackware's mkinitrd package. We'll walk through the process of +upgrading to the generic @KERNEL_VERSION@ Linux kernel using the packages +found in Slackware's slackware/a/ directory. + +First, make sure the kernel, kernel modules, and mkinitrd package are +installed (the current version numbers might be a little different, so +this is just an example): + + installpkg kernel-generic-@KERNEL_VERSION@-@ARCH@-@BUILD@.tgz + installpkg kernel-modules-@KERNEL_VERSION@-@ARCH@-@BUILD@.tgz + installpkg mkinitrd-@MKINITRD_VERSION@-@ARCH@-@BUILD@.tgz + +Change into the /boot directory: + + cd /boot + +Now you'll want to run "mkinitrd". I'm using ext4 for my root +filesystem, and since mkinitrd should figure out any other modules +it requires, I shouldn't need to specify any others: + + mkinitrd -c -k @KERNEL_VERSION@ -m ext4 + +This should do two things. First, it will create a directory +/boot/initrd-tree containing the initrd's filesystem. Then it will +create an initrd (/boot/initrd.gz) from this tree. If you wanted to, +you could make some additional changes in /boot/initrd-tree/ and +then run mkinitrd again without options to rebuild the image. That's +optional, though, and only advanced users will need to think about that. + +Here's another example: Build an initrd image using Linux @KERNEL_VERSION@ +kernel modules for a system with an ext3 root partition on /dev/sdb3: + + mkinitrd -c -k @KERNEL_VERSION@ -m ext3 -f ext3 -r /dev/sdb3 + + +4. Now that I've built an initrd, how do I use it? + +Now that you've got an initrd (/boot/initrd.gz), you'll want to load +it along with the kernel at boot time. If you use LILO for your boot +loader you'll need to edit /etc/lilo.conf and add a line to load the +initrd. Here's an example section of lilo.conf showing how this is +done: + +# Linux bootable partition config begins +image = /boot/vmlinuz-generic-@KERNEL_VERSION@ + initrd = /boot/initrd.gz + root = /dev/sda6 + label = @LILO_KERNEL_NAME@ + read-only +# Linux bootable partition config ends + +The initrd is loaded by the "initrd = /boot/initrd.gz" line. +Just add the line right below the line for the kernel image you use. +Save the file, and then run LILO again ('lilo' at the command line). +You'll need to run lilo every time you edit lilo.conf or rebuild the +initrd. + +Other bootloaders such as syslinux also support the use of an initrd. +See the documentation for those programs for details on using an +initrd with them. + + +--------- + +Have fun! diff --git a/patches/source/mkinitrd/busybox-dot-config b/patches/source/mkinitrd/busybox-dot-config new file mode 120000 index 000000000..09ac6817e --- /dev/null +++ b/patches/source/mkinitrd/busybox-dot-config @@ -0,0 +1 @@ +busybox-dot-config.1.20.x \ No newline at end of file diff --git a/patches/source/mkinitrd/busybox-dot-config.1.20.x b/patches/source/mkinitrd/busybox-dot-config.1.20.x new file mode 100644 index 000000000..93a4ea8d9 --- /dev/null +++ b/patches/source/mkinitrd/busybox-dot-config.1.20.x @@ -0,0 +1,1024 @@ +# +# Automatically generated make config: don't edit +# Busybox version: 1.20.2 +# Wed Jun 8 14:48:15 2016 +# +CONFIG_HAVE_DOT_CONFIG=y + +# +# Busybox Settings +# + +# +# General Configuration +# +CONFIG_DESKTOP=y +# CONFIG_EXTRA_COMPAT is not set +CONFIG_INCLUDE_SUSv2=y +# CONFIG_USE_PORTABLE_CODE is not set +CONFIG_PLATFORM_LINUX=y +CONFIG_FEATURE_BUFFERS_USE_MALLOC=y +# CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +CONFIG_SHOW_USAGE=y +CONFIG_FEATURE_VERBOSE_USAGE=y +CONFIG_FEATURE_COMPRESS_USAGE=y +CONFIG_FEATURE_INSTALLER=y +CONFIG_INSTALL_NO_USR=y +CONFIG_LOCALE_SUPPORT=y +CONFIG_UNICODE_SUPPORT=y +# CONFIG_UNICODE_USING_LOCALE is not set +# CONFIG_FEATURE_CHECK_UNICODE_IN_ENV is not set +CONFIG_SUBST_WCHAR=63 +CONFIG_LAST_SUPPORTED_WCHAR=767 +# CONFIG_UNICODE_COMBINING_WCHARS is not set +# CONFIG_UNICODE_WIDE_WCHARS is not set +# CONFIG_UNICODE_BIDI_SUPPORT is not set +# CONFIG_UNICODE_NEUTRAL_TABLE is not set +# CONFIG_UNICODE_PRESERVE_BROKEN is not set +CONFIG_LONG_OPTS=y +CONFIG_FEATURE_DEVPTS=y +# CONFIG_FEATURE_CLEAN_UP is not set +CONFIG_FEATURE_UTMP=y +CONFIG_FEATURE_WTMP=y +CONFIG_FEATURE_PIDFILE=y +CONFIG_FEATURE_SUID=y +CONFIG_FEATURE_SUID_CONFIG=y +CONFIG_FEATURE_SUID_CONFIG_QUIET=y +# CONFIG_SELINUX is not set +# CONFIG_FEATURE_PREFER_APPLETS is not set +CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" +CONFIG_FEATURE_SYSLOG=y +CONFIG_FEATURE_HAVE_RPC=y + +# +# Build Options +# +# CONFIG_STATIC is not set +# CONFIG_PIE is not set +# CONFIG_NOMMU is not set +# CONFIG_BUILD_LIBBUSYBOX is not set +# CONFIG_FEATURE_INDIVIDUAL is not set +# CONFIG_FEATURE_SHARED_BUSYBOX is not set +CONFIG_LFS=y +CONFIG_CROSS_COMPILER_PREFIX="" +CONFIG_SYSROOT="" +CONFIG_EXTRA_CFLAGS="" +CONFIG_EXTRA_LDFLAGS="" +CONFIG_EXTRA_LDLIBS="" + +# +# Debugging Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_PESSIMIZE is not set +# CONFIG_WERROR is not set +CONFIG_NO_DEBUG_LIB=y +# CONFIG_DMALLOC is not set +# CONFIG_EFENCE is not set + +# +# Installation Options ("make install" behavior) +# +CONFIG_INSTALL_APPLET_SYMLINKS=y +# CONFIG_INSTALL_APPLET_HARDLINKS is not set +# CONFIG_INSTALL_APPLET_SCRIPT_WRAPPERS is not set +# CONFIG_INSTALL_APPLET_DONT is not set +# CONFIG_INSTALL_SH_APPLET_SYMLINK is not set +# CONFIG_INSTALL_SH_APPLET_HARDLINK is not set +# CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set +CONFIG_PREFIX="/tmp/package-mkinitrd/usr/share/mkinitrd/initrd-tree" + +# +# Busybox Library Tuning +# +# CONFIG_FEATURE_SYSTEMD is not set +CONFIG_FEATURE_RTMINMAX=y +CONFIG_PASSWORD_MINLEN=6 +CONFIG_MD5_SMALL=1 +# CONFIG_FEATURE_FAST_TOP is not set +# CONFIG_FEATURE_ETC_NETWORKS is not set +CONFIG_FEATURE_USE_TERMIOS=y +CONFIG_FEATURE_EDITING=y +CONFIG_FEATURE_EDITING_MAX_LEN=1024 +CONFIG_FEATURE_EDITING_VI=y +CONFIG_FEATURE_EDITING_HISTORY=64 +# CONFIG_FEATURE_EDITING_SAVEHISTORY is not set +# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set +# CONFIG_FEATURE_REVERSE_SEARCH is not set +CONFIG_FEATURE_TAB_COMPLETION=y +# CONFIG_FEATURE_USERNAME_COMPLETION is not set +CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +CONFIG_FEATURE_EDITING_ASK_TERMINAL=y +# CONFIG_FEATURE_NON_POSIX_CP is not set +CONFIG_FEATURE_VERBOSE_CP_MESSAGE=y +CONFIG_FEATURE_COPYBUF_KB=4 +# CONFIG_FEATURE_SKIP_ROOTFS is not set +CONFIG_MONOTONIC_SYSCALL=y +CONFIG_IOCTL_HEX2STR_ERROR=y +# CONFIG_FEATURE_HWIB is not set + +# +# Applets +# + +# +# Archival Utilities +# +CONFIG_FEATURE_SEAMLESS_XZ=y +# CONFIG_FEATURE_SEAMLESS_LZMA is not set +CONFIG_FEATURE_SEAMLESS_BZ2=y +CONFIG_FEATURE_SEAMLESS_GZ=y +CONFIG_FEATURE_SEAMLESS_Z=y +CONFIG_AR=y +CONFIG_FEATURE_AR_LONG_FILENAMES=y +# CONFIG_FEATURE_AR_CREATE is not set +CONFIG_BUNZIP2=y +CONFIG_BZIP2=y +CONFIG_CPIO=y +CONFIG_FEATURE_CPIO_O=y +CONFIG_FEATURE_CPIO_P=y +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set +CONFIG_GUNZIP=y +CONFIG_GZIP=y +CONFIG_FEATURE_GZIP_LONG_OPTIONS=y +CONFIG_GZIP_FAST=0 +CONFIG_LZOP=y +CONFIG_LZOP_COMPR_HIGH=y +CONFIG_RPM2CPIO=y +# CONFIG_RPM is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_CREATE=y +CONFIG_FEATURE_TAR_AUTODETECT=y +CONFIG_FEATURE_TAR_FROM=y +CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y +# CONFIG_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +CONFIG_FEATURE_TAR_LONG_OPTIONS=y +# CONFIG_FEATURE_TAR_TO_COMMAND is not set +CONFIG_FEATURE_TAR_UNAME_GNAME=y +CONFIG_FEATURE_TAR_NOPRESERVE_TIME=y +# CONFIG_FEATURE_TAR_SELINUX is not set +CONFIG_UNCOMPRESS=y +CONFIG_UNLZMA=y +CONFIG_FEATURE_LZMA_FAST=y +CONFIG_LZMA=y +CONFIG_UNXZ=y +CONFIG_XZ=y +CONFIG_UNZIP=y + +# +# Coreutils +# +CONFIG_BASENAME=y +CONFIG_CAT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +# CONFIG_FEATURE_DATE_NANO is not set +# CONFIG_FEATURE_DATE_COMPAT is not set +CONFIG_HOSTID=y +CONFIG_ID=y +# CONFIG_GROUPS is not set +CONFIG_TEST=y +CONFIG_FEATURE_TEST_64=y +CONFIG_TOUCH=y +CONFIG_FEATURE_TOUCH_SUSV3=y +CONFIG_TR=y +CONFIG_FEATURE_TR_CLASSES=y +CONFIG_FEATURE_TR_EQUIV=y +CONFIG_BASE64=y +CONFIG_WHO=y +CONFIG_USERS=y +CONFIG_CAL=y +CONFIG_CATV=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +# CONFIG_FEATURE_CHOWN_LONG_OPTIONS is not set +CONFIG_CHROOT=y +CONFIG_CKSUM=y +CONFIG_COMM=y +CONFIG_CP=y +CONFIG_FEATURE_CP_LONG_OPTIONS=y +CONFIG_CUT=y +CONFIG_DD=y +CONFIG_FEATURE_DD_SIGNAL_HANDLING=y +# CONFIG_FEATURE_DD_THIRD_STATUS_LINE is not set +CONFIG_FEATURE_DD_IBS_OBS=y +CONFIG_DF=y +CONFIG_FEATURE_DF_FANCY=y +CONFIG_DIRNAME=y +CONFIG_DOS2UNIX=y +CONFIG_UNIX2DOS=y +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +CONFIG_FEATURE_ENV_LONG_OPTIONS=y +CONFIG_EXPAND=y +CONFIG_FEATURE_EXPAND_LONG_OPTIONS=y +CONFIG_EXPR=y +CONFIG_EXPR_MATH_SUPPORT_64=y +CONFIG_FALSE=y +CONFIG_FOLD=y +CONFIG_FSYNC=y +CONFIG_HEAD=y +CONFIG_FEATURE_FANCY_HEAD=y +CONFIG_INSTALL=y +CONFIG_FEATURE_INSTALL_LONG_OPTIONS=y +CONFIG_LN=y +CONFIG_LOGNAME=y +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +CONFIG_FEATURE_LS_RECURSIVE=y +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y +CONFIG_MD5SUM=y +CONFIG_MKDIR=y +CONFIG_FEATURE_MKDIR_LONG_OPTIONS=y +CONFIG_MKFIFO=y +CONFIG_MKNOD=y +CONFIG_MV=y +CONFIG_FEATURE_MV_LONG_OPTIONS=y +CONFIG_NICE=y +CONFIG_NOHUP=y +CONFIG_OD=y +CONFIG_PRINTENV=y +CONFIG_PRINTF=y +CONFIG_PWD=y +CONFIG_READLINK=y +CONFIG_FEATURE_READLINK_FOLLOW=y +CONFIG_REALPATH=y +CONFIG_RM=y +CONFIG_RMDIR=y +# CONFIG_FEATURE_RMDIR_LONG_OPTIONS is not set +CONFIG_SEQ=y +CONFIG_SHA1SUM=y +CONFIG_SHA256SUM=y +CONFIG_SHA512SUM=y +CONFIG_SLEEP=y +CONFIG_FEATURE_FANCY_SLEEP=y +# CONFIG_FEATURE_FLOAT_SLEEP is not set +CONFIG_SORT=y +CONFIG_FEATURE_SORT_BIG=y +CONFIG_SPLIT=y +CONFIG_FEATURE_SPLIT_FANCY=y +CONFIG_STAT=y +CONFIG_FEATURE_STAT_FORMAT=y +CONFIG_STTY=y +CONFIG_SUM=y +CONFIG_SYNC=y +CONFIG_TAC=y +CONFIG_TAIL=y +CONFIG_FEATURE_FANCY_TAIL=y +CONFIG_TEE=y +CONFIG_FEATURE_TEE_USE_BLOCK_IO=y +CONFIG_TRUE=y +CONFIG_TTY=y +CONFIG_UNAME=y +CONFIG_UNEXPAND=y +CONFIG_FEATURE_UNEXPAND_LONG_OPTIONS=y +CONFIG_UNIQ=y +CONFIG_USLEEP=y +CONFIG_UUDECODE=y +CONFIG_UUENCODE=y +CONFIG_WC=y +CONFIG_FEATURE_WC_LARGE=y +CONFIG_WHOAMI=y +CONFIG_YES=y + +# +# Common options for cp and mv +# +CONFIG_FEATURE_PRESERVE_HARDLINKS=y + +# +# Common options for ls, more and telnet +# +CONFIG_FEATURE_AUTOWIDTH=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y + +# +# Common options for md5sum, sha1sum, sha256sum, sha512sum +# +CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y + +# +# Console Utilities +# +CONFIG_CHVT=y +CONFIG_FGCONSOLE=y +CONFIG_CLEAR=y +CONFIG_DEALLOCVT=y +CONFIG_DUMPKMAP=y +CONFIG_KBD_MODE=y +CONFIG_LOADFONT=y +CONFIG_LOADKMAP=y +CONFIG_OPENVT=y +CONFIG_RESET=y +CONFIG_RESIZE=y +CONFIG_FEATURE_RESIZE_PRINT=y +CONFIG_SETCONSOLE=y +CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS=y +CONFIG_SETFONT=y +CONFIG_FEATURE_SETFONT_TEXTUAL_MAP=y +CONFIG_DEFAULT_SETFONT_DIR="/usr/share/kbd/consolefonts" +CONFIG_SETKEYCODES=y +CONFIG_SETLOGCONS=y +CONFIG_SHOWKEY=y + +# +# Common options for loadfont and setfont +# +# CONFIG_FEATURE_LOADFONT_PSF2 is not set +CONFIG_FEATURE_LOADFONT_RAW=y + +# +# Debian Utilities +# +CONFIG_MKTEMP=y +CONFIG_PIPE_PROGRESS=y +CONFIG_RUN_PARTS=y +CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y +CONFIG_FEATURE_RUN_PARTS_FANCY=y +CONFIG_START_STOP_DAEMON=y +CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y +CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y +CONFIG_WHICH=y + +# +# Editors +# +CONFIG_PATCH=y +CONFIG_VI=y +CONFIG_FEATURE_VI_MAX_LEN=1024 +CONFIG_FEATURE_VI_8BIT=y +CONFIG_FEATURE_VI_COLON=y +CONFIG_FEATURE_VI_YANKMARK=y +CONFIG_FEATURE_VI_SEARCH=y +# CONFIG_FEATURE_VI_REGEX_SEARCH is not set +CONFIG_FEATURE_VI_USE_SIGNALS=y +CONFIG_FEATURE_VI_DOT_CMD=y +CONFIG_FEATURE_VI_READONLY=y +CONFIG_FEATURE_VI_SETOPTS=y +CONFIG_FEATURE_VI_SET=y +CONFIG_FEATURE_VI_WIN_RESIZE=y +CONFIG_FEATURE_VI_ASK_TERMINAL=y +CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y +CONFIG_AWK=y +CONFIG_FEATURE_AWK_LIBM=y +CONFIG_CMP=y +CONFIG_DIFF=y +# CONFIG_FEATURE_DIFF_LONG_OPTIONS is not set +CONFIG_FEATURE_DIFF_DIR=y +CONFIG_ED=y +CONFIG_SED=y +CONFIG_FEATURE_ALLOW_EXEC=y + +# +# Finding Utilities +# +CONFIG_FIND=y +CONFIG_FEATURE_FIND_PRINT0=y +CONFIG_FEATURE_FIND_MTIME=y +CONFIG_FEATURE_FIND_MMIN=y +CONFIG_FEATURE_FIND_PERM=y +CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_XDEV=y +CONFIG_FEATURE_FIND_MAXDEPTH=y +CONFIG_FEATURE_FIND_NEWER=y +CONFIG_FEATURE_FIND_INUM=y +CONFIG_FEATURE_FIND_EXEC=y +CONFIG_FEATURE_FIND_USER=y +CONFIG_FEATURE_FIND_GROUP=y +CONFIG_FEATURE_FIND_NOT=y +CONFIG_FEATURE_FIND_DEPTH=y +CONFIG_FEATURE_FIND_PAREN=y +CONFIG_FEATURE_FIND_SIZE=y +CONFIG_FEATURE_FIND_PRUNE=y +# CONFIG_FEATURE_FIND_DELETE is not set +CONFIG_FEATURE_FIND_PATH=y +CONFIG_FEATURE_FIND_REGEX=y +# CONFIG_FEATURE_FIND_CONTEXT is not set +CONFIG_FEATURE_FIND_LINKS=y +CONFIG_GREP=y +CONFIG_FEATURE_GREP_EGREP_ALIAS=y +CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y +CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y +CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y +CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y + +# +# Init Utilities +# +# CONFIG_BOOTCHARTD is not set +# CONFIG_FEATURE_BOOTCHARTD_BLOATED_HEADER is not set +# CONFIG_FEATURE_BOOTCHARTD_CONFIG_FILE is not set +CONFIG_HALT=y +# CONFIG_FEATURE_CALL_TELINIT is not set +CONFIG_TELINIT_PATH="" +CONFIG_INIT=y +CONFIG_FEATURE_USE_INITTAB=y +CONFIG_FEATURE_KILL_REMOVED=y +CONFIG_FEATURE_KILL_DELAY=10 +CONFIG_FEATURE_INIT_SCTTY=y +CONFIG_FEATURE_INIT_SYSLOG=y +CONFIG_FEATURE_EXTRA_QUIET=y +# CONFIG_FEATURE_INIT_COREDUMPS is not set +# CONFIG_FEATURE_INITRD is not set +CONFIG_INIT_TERMINAL_TYPE="linux" +CONFIG_MESG=y +CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y + +# +# Login/Password Management Utilities +# +CONFIG_ADD_SHELL=y +CONFIG_REMOVE_SHELL=y +CONFIG_FEATURE_SHADOWPASSWDS=y +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_USE_BB_SHADOW is not set +CONFIG_USE_BB_CRYPT=y +CONFIG_USE_BB_CRYPT_SHA=y +CONFIG_ADDUSER=y +# CONFIG_FEATURE_ADDUSER_LONG_OPTIONS is not set +CONFIG_FEATURE_CHECK_NAMES=y +CONFIG_FIRST_SYSTEM_ID=1000 +CONFIG_LAST_SYSTEM_ID=12000 +CONFIG_ADDGROUP=y +CONFIG_FEATURE_ADDGROUP_LONG_OPTIONS=y +CONFIG_FEATURE_ADDUSER_TO_GROUP=y +CONFIG_DELUSER=y +CONFIG_DELGROUP=y +CONFIG_FEATURE_DEL_USER_FROM_GROUP=y +CONFIG_GETTY=y +CONFIG_LOGIN=y +# CONFIG_LOGIN_SESSION_AS_CHILD is not set +# CONFIG_PAM is not set +CONFIG_LOGIN_SCRIPTS=y +CONFIG_FEATURE_NOLOGIN=y +# CONFIG_FEATURE_SECURETTY is not set +CONFIG_PASSWD=y +CONFIG_FEATURE_PASSWD_WEAK_CHECK=y +CONFIG_CRYPTPW=y +CONFIG_CHPASSWD=y +CONFIG_FEATURE_DEFAULT_PASSWD_ALGO="s" +CONFIG_SU=y +CONFIG_FEATURE_SU_SYSLOG=y +CONFIG_FEATURE_SU_CHECKS_SHELLS=y +CONFIG_SULOGIN=y +CONFIG_VLOCK=y + +# +# Linux Ext2 FS Progs +# +CONFIG_CHATTR=y +CONFIG_FSCK=y +CONFIG_LSATTR=y +CONFIG_TUNE2FS=y + +# +# Linux Module Utilities +# +CONFIG_MODINFO=y +# CONFIG_MODPROBE_SMALL is not set +# CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set +# CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED is not set +CONFIG_INSMOD=y +CONFIG_RMMOD=y +CONFIG_LSMOD=y +CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y +CONFIG_MODPROBE=y +CONFIG_FEATURE_MODPROBE_BLACKLIST=y +CONFIG_DEPMOD=y + +# +# Options common to multiple modutils +# +# CONFIG_FEATURE_2_4_MODULES is not set +# CONFIG_FEATURE_INSMOD_TRY_MMAP is not set +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set +CONFIG_FEATURE_CHECK_TAINTED_MODULE=y +CONFIG_FEATURE_MODUTILS_ALIAS=y +CONFIG_FEATURE_MODUTILS_SYMBOLS=y +CONFIG_DEFAULT_MODULES_DIR="/lib/modules" +CONFIG_DEFAULT_DEPMOD_FILE="modules.dep" + +# +# Linux System Utilities +# +CONFIG_BLOCKDEV=y +CONFIG_MDEV=y +CONFIG_FEATURE_MDEV_CONF=y +CONFIG_FEATURE_MDEV_RENAME=y +CONFIG_FEATURE_MDEV_RENAME_REGEXP=y +CONFIG_FEATURE_MDEV_EXEC=y +CONFIG_FEATURE_MDEV_LOAD_FIRMWARE=y +CONFIG_REV=y +CONFIG_ACPID=y +CONFIG_FEATURE_ACPID_COMPAT=y +CONFIG_BLKID=y +CONFIG_FEATURE_BLKID_TYPE=y +CONFIG_DMESG=y +CONFIG_FEATURE_DMESG_PRETTY=y +CONFIG_FBSET=y +CONFIG_FEATURE_FBSET_FANCY=y +CONFIG_FEATURE_FBSET_READMODE=y +CONFIG_FDFLUSH=y +CONFIG_FDFORMAT=y +CONFIG_FDISK=y +# CONFIG_FDISK_SUPPORT_LARGE_DISKS is not set +CONFIG_FEATURE_FDISK_WRITABLE=y +# CONFIG_FEATURE_AIX_LABEL is not set +# CONFIG_FEATURE_SGI_LABEL is not set +# CONFIG_FEATURE_SUN_LABEL is not set +CONFIG_FEATURE_OSF_LABEL=y +CONFIG_FEATURE_GPT_LABEL=y +CONFIG_FEATURE_FDISK_ADVANCED=y +CONFIG_FINDFS=y +# CONFIG_FLOCK is not set +CONFIG_FREERAMDISK=y +CONFIG_FSCK_MINIX=y +# CONFIG_MKFS_EXT2 is not set +CONFIG_MKFS_MINIX=y +CONFIG_FEATURE_MINIX2=y +# CONFIG_MKFS_REISER is not set +CONFIG_MKFS_VFAT=y +CONFIG_GETOPT=y +CONFIG_FEATURE_GETOPT_LONG=y +CONFIG_HEXDUMP=y +CONFIG_FEATURE_HEXDUMP_REVERSE=y +CONFIG_HD=y +CONFIG_HWCLOCK=y +CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS=y +CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y +CONFIG_IPCRM=y +CONFIG_IPCS=y +CONFIG_LOSETUP=y +CONFIG_LSPCI=y +CONFIG_LSUSB=y +CONFIG_MKSWAP=y +CONFIG_FEATURE_MKSWAP_UUID=y +CONFIG_MORE=y +CONFIG_MOUNT=y +CONFIG_FEATURE_MOUNT_FAKE=y +# CONFIG_FEATURE_MOUNT_VERBOSE is not set +CONFIG_FEATURE_MOUNT_HELPERS=y +CONFIG_FEATURE_MOUNT_LABEL=y +CONFIG_FEATURE_MOUNT_NFS=y +CONFIG_FEATURE_MOUNT_CIFS=y +CONFIG_FEATURE_MOUNT_FLAGS=y +CONFIG_FEATURE_MOUNT_FSTAB=y +CONFIG_PIVOT_ROOT=y +CONFIG_RDATE=y +CONFIG_RDEV=y +CONFIG_READPROFILE=y +CONFIG_RTCWAKE=y +CONFIG_SCRIPT=y +CONFIG_SCRIPTREPLAY=y +CONFIG_SETARCH=y +CONFIG_SWAPONOFF=y +CONFIG_FEATURE_SWAPON_PRI=y +CONFIG_SWITCH_ROOT=y +CONFIG_UMOUNT=y +CONFIG_FEATURE_UMOUNT_ALL=y + +# +# Common options for mount/umount +# +CONFIG_FEATURE_MOUNT_LOOP=y +CONFIG_FEATURE_MOUNT_LOOP_CREATE=y +CONFIG_FEATURE_MTAB_SUPPORT=y +CONFIG_VOLUMEID=y + +# +# Filesystem/Volume identification +# +CONFIG_FEATURE_VOLUMEID_EXT=y +# CONFIG_FEATURE_VOLUMEID_BTRFS is not set +CONFIG_FEATURE_VOLUMEID_REISERFS=y +CONFIG_FEATURE_VOLUMEID_FAT=y +CONFIG_FEATURE_VOLUMEID_HFS=y +CONFIG_FEATURE_VOLUMEID_JFS=y +CONFIG_FEATURE_VOLUMEID_XFS=y +CONFIG_FEATURE_VOLUMEID_NTFS=y +CONFIG_FEATURE_VOLUMEID_ISO9660=y +CONFIG_FEATURE_VOLUMEID_UDF=y +CONFIG_FEATURE_VOLUMEID_LUKS=y +CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y +CONFIG_FEATURE_VOLUMEID_CRAMFS=y +CONFIG_FEATURE_VOLUMEID_ROMFS=y +CONFIG_FEATURE_VOLUMEID_SYSV=y +# CONFIG_FEATURE_VOLUMEID_OCFS2 is not set +CONFIG_FEATURE_VOLUMEID_LINUXRAID=y + +# +# Miscellaneous Utilities +# +# CONFIG_CONSPY is not set +CONFIG_LESS=y +CONFIG_FEATURE_LESS_MAXLINES=9999999 +CONFIG_FEATURE_LESS_BRACKETS=y +CONFIG_FEATURE_LESS_FLAGS=y +CONFIG_FEATURE_LESS_MARKS=y +CONFIG_FEATURE_LESS_REGEXP=y +CONFIG_FEATURE_LESS_WINCH=y +CONFIG_FEATURE_LESS_ASK_TERMINAL=y +CONFIG_FEATURE_LESS_DASHCMD=y +CONFIG_FEATURE_LESS_LINENUMS=y +# CONFIG_NANDWRITE is not set +# CONFIG_NANDDUMP is not set +CONFIG_SETSERIAL=y +# CONFIG_UBIATTACH is not set +# CONFIG_UBIDETACH is not set +# CONFIG_UBIMKVOL is not set +# CONFIG_UBIRMVOL is not set +# CONFIG_UBIRSVOL is not set +# CONFIG_UBIUPDATEVOL is not set +CONFIG_ADJTIMEX=y +CONFIG_BBCONFIG=y +CONFIG_FEATURE_COMPRESS_BBCONFIG=y +CONFIG_BEEP=y +CONFIG_FEATURE_BEEP_FREQ=4000 +CONFIG_FEATURE_BEEP_LENGTH_MS=30 +CONFIG_CHAT=y +CONFIG_FEATURE_CHAT_NOFAIL=y +# CONFIG_FEATURE_CHAT_TTY_HIFI is not set +CONFIG_FEATURE_CHAT_IMPLICIT_CR=y +# CONFIG_FEATURE_CHAT_SWALLOW_OPTS is not set +# CONFIG_FEATURE_CHAT_SEND_ESCAPES is not set +# CONFIG_FEATURE_CHAT_VAR_ABORT_LEN is not set +# CONFIG_FEATURE_CHAT_CLR_ABORT is not set +CONFIG_CHRT=y +CONFIG_CROND=y +CONFIG_FEATURE_CROND_D=y +# CONFIG_FEATURE_CROND_CALL_SENDMAIL is not set +CONFIG_FEATURE_CROND_DIR="/var/spool/cron" +CONFIG_CRONTAB=y +CONFIG_DC=y +CONFIG_FEATURE_DC_LIBM=y +# CONFIG_DEVFSD is not set +# CONFIG_DEVFSD_MODLOAD is not set +# CONFIG_DEVFSD_FG_NP is not set +# CONFIG_DEVFSD_VERBOSE is not set +# CONFIG_FEATURE_DEVFS is not set +CONFIG_DEVMEM=y +CONFIG_EJECT=y +CONFIG_FEATURE_EJECT_SCSI=y +CONFIG_FBSPLASH=y +# CONFIG_FLASHCP is not set +CONFIG_FLASH_LOCK=y +CONFIG_FLASH_UNLOCK=y +CONFIG_FLASH_ERASEALL=y +CONFIG_IONICE=y +CONFIG_INOTIFYD=y +CONFIG_LAST=y +CONFIG_FEATURE_LAST_SMALL=y +# CONFIG_FEATURE_LAST_FANCY is not set +CONFIG_HDPARM=y +CONFIG_FEATURE_HDPARM_GET_IDENTITY=y +CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET=y +CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF=y +CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA=y +CONFIG_MAKEDEVS=y +# CONFIG_FEATURE_MAKEDEVS_LEAF is not set +CONFIG_FEATURE_MAKEDEVS_TABLE=y +# CONFIG_MAN is not set +# CONFIG_MICROCOM is not set +CONFIG_MOUNTPOINT=y +CONFIG_MT=y +CONFIG_RAIDAUTORUN=y +CONFIG_READAHEAD=y +# CONFIG_RFKILL is not set +CONFIG_RUNLEVEL=y +CONFIG_RX=y +CONFIG_SETSID=y +CONFIG_STRINGS=y +CONFIG_TASKSET=y +CONFIG_FEATURE_TASKSET_FANCY=y +CONFIG_TIME=y +CONFIG_TIMEOUT=y +CONFIG_TTYSIZE=y +CONFIG_VOLNAME=y +# CONFIG_WALL is not set +CONFIG_WATCHDOG=y + +# +# Networking Utilities +# +CONFIG_NAMEIF=y +# CONFIG_FEATURE_NAMEIF_EXTENDED is not set +CONFIG_NBDCLIENT=y +CONFIG_NC=y +CONFIG_NC_SERVER=y +CONFIG_NC_EXTRA=y +# CONFIG_NC_110_COMPAT is not set +CONFIG_PING=y +CONFIG_PING6=y +CONFIG_FEATURE_FANCY_PING=y +# CONFIG_WHOIS is not set +CONFIG_FEATURE_IPV6=y +CONFIG_FEATURE_UNIX_LOCAL=y +CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y +# CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +CONFIG_ARP=y +CONFIG_ARPING=y +CONFIG_BRCTL=y +# CONFIG_FEATURE_BRCTL_FANCY is not set +# CONFIG_FEATURE_BRCTL_SHOW is not set +CONFIG_DNSD=y +CONFIG_ETHER_WAKE=y +CONFIG_FAKEIDENTD=y +CONFIG_FTPD=y +CONFIG_FEATURE_FTP_WRITE=y +CONFIG_FEATURE_FTPD_ACCEPT_BROKEN_LIST=y +CONFIG_FTPGET=y +CONFIG_FTPPUT=y +CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS=y +CONFIG_HOSTNAME=y +# CONFIG_HTTPD is not set +# CONFIG_FEATURE_HTTPD_RANGES is not set +# CONFIG_FEATURE_HTTPD_USE_SENDFILE is not set +# CONFIG_FEATURE_HTTPD_SETUID is not set +# CONFIG_FEATURE_HTTPD_BASIC_AUTH is not set +# CONFIG_FEATURE_HTTPD_AUTH_MD5 is not set +# CONFIG_FEATURE_HTTPD_CGI is not set +# CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR is not set +# CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV is not set +# CONFIG_FEATURE_HTTPD_ENCODE_URL_STR is not set +# CONFIG_FEATURE_HTTPD_ERROR_PAGES is not set +# CONFIG_FEATURE_HTTPD_PROXY is not set +# CONFIG_FEATURE_HTTPD_GZIP is not set +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +CONFIG_FEATURE_IFCONFIG_SLIP=y +CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y +CONFIG_FEATURE_IFCONFIG_HW=y +CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y +CONFIG_IFENSLAVE=y +CONFIG_IFPLUGD=y +CONFIG_IFUPDOWN=y +CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" +CONFIG_FEATURE_IFUPDOWN_IP=y +CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y +# CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set +CONFIG_FEATURE_IFUPDOWN_IPV4=y +CONFIG_FEATURE_IFUPDOWN_IPV6=y +CONFIG_FEATURE_IFUPDOWN_MAPPING=y +CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y +# CONFIG_INETD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set +# CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set +# CONFIG_FEATURE_INETD_RPC is not set +CONFIG_IP=y +CONFIG_FEATURE_IP_ADDRESS=y +CONFIG_FEATURE_IP_LINK=y +CONFIG_FEATURE_IP_ROUTE=y +CONFIG_FEATURE_IP_TUNNEL=y +CONFIG_FEATURE_IP_RULE=y +CONFIG_FEATURE_IP_SHORT_FORMS=y +# CONFIG_FEATURE_IP_RARE_PROTOCOLS is not set +CONFIG_IPADDR=y +CONFIG_IPLINK=y +CONFIG_IPROUTE=y +CONFIG_IPTUNNEL=y +CONFIG_IPRULE=y +CONFIG_IPCALC=y +CONFIG_FEATURE_IPCALC_FANCY=y +CONFIG_FEATURE_IPCALC_LONG_OPTIONS=y +CONFIG_NETSTAT=y +# CONFIG_FEATURE_NETSTAT_WIDE is not set +CONFIG_FEATURE_NETSTAT_PRG=y +CONFIG_NSLOOKUP=y +# CONFIG_NTPD is not set +# CONFIG_FEATURE_NTPD_SERVER is not set +CONFIG_PSCAN=y +CONFIG_ROUTE=y +CONFIG_SLATTACH=y +CONFIG_TCPSVD=y +CONFIG_TELNET=y +CONFIG_FEATURE_TELNET_TTYPE=y +CONFIG_FEATURE_TELNET_AUTOLOGIN=y +CONFIG_TELNETD=y +CONFIG_FEATURE_TELNETD_STANDALONE=y +# CONFIG_FEATURE_TELNETD_INETD_WAIT is not set +CONFIG_TFTP=y +# CONFIG_TFTPD is not set + +# +# Common options for tftp/tftpd +# +CONFIG_FEATURE_TFTP_GET=y +CONFIG_FEATURE_TFTP_PUT=y +CONFIG_FEATURE_TFTP_BLOCKSIZE=y +CONFIG_FEATURE_TFTP_PROGRESS_BAR=y +CONFIG_TFTP_DEBUG=y +CONFIG_TRACEROUTE=y +CONFIG_TRACEROUTE6=y +# CONFIG_FEATURE_TRACEROUTE_VERBOSE is not set +# CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE is not set +# CONFIG_FEATURE_TRACEROUTE_USE_ICMP is not set +CONFIG_TUNCTL=y +CONFIG_FEATURE_TUNCTL_UG=y +CONFIG_UDHCPC6=y +# CONFIG_UDHCPD is not set +# CONFIG_DHCPRELAY is not set +# CONFIG_DUMPLEASES is not set +# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set +# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set +CONFIG_DHCPD_LEASES_FILE="" +# CONFIG_UDHCPC is not set +# CONFIG_FEATURE_UDHCPC_ARPING is not set +# CONFIG_FEATURE_UDHCP_PORT is not set +CONFIG_UDHCP_DEBUG=0 +# CONFIG_FEATURE_UDHCP_RFC3397 is not set +# CONFIG_FEATURE_UDHCP_8021Q is not set +CONFIG_UDHCPC_DEFAULT_SCRIPT="" +CONFIG_UDHCPC_SLACK_FOR_BUGGY_SERVERS=0 +CONFIG_IFUPDOWN_UDHCPC_CMD_OPTIONS="" +CONFIG_UDPSVD=y +CONFIG_VCONFIG=y +CONFIG_WGET=y +CONFIG_FEATURE_WGET_STATUSBAR=y +CONFIG_FEATURE_WGET_AUTHENTICATION=y +CONFIG_FEATURE_WGET_LONG_OPTIONS=y +CONFIG_FEATURE_WGET_TIMEOUT=y +CONFIG_ZCIP=y + +# +# Print Utilities +# +# CONFIG_LPD is not set +CONFIG_LPR=y +# CONFIG_LPQ is not set + +# +# Mail Utilities +# +CONFIG_MAKEMIME=y +CONFIG_FEATURE_MIME_CHARSET="us-ascii" +CONFIG_POPMAILDIR=y +CONFIG_FEATURE_POPMAILDIR_DELIVERY=y +CONFIG_REFORMIME=y +CONFIG_FEATURE_REFORMIME_COMPAT=y +# CONFIG_SENDMAIL is not set + +# +# Process Utilities +# +CONFIG_IOSTAT=y +CONFIG_LSOF=y +CONFIG_MPSTAT=y +CONFIG_NMETER=y +CONFIG_PMAP=y +CONFIG_POWERTOP=y +# CONFIG_PSTREE is not set +# CONFIG_PWDX is not set +# CONFIG_SMEMCAP is not set +CONFIG_UPTIME=y +# CONFIG_FEATURE_UPTIME_UTMP_SUPPORT is not set +CONFIG_FREE=y +CONFIG_FUSER=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_KILLALL5=y +CONFIG_PGREP=y +CONFIG_PIDOF=y +CONFIG_FEATURE_PIDOF_SINGLE=y +CONFIG_FEATURE_PIDOF_OMIT=y +CONFIG_PKILL=y +CONFIG_PS=y +# CONFIG_FEATURE_PS_WIDE is not set +# CONFIG_FEATURE_PS_LONG is not set +CONFIG_FEATURE_PS_TIME=y +CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y +# CONFIG_FEATURE_PS_UNUSUAL_SYSTEMS is not set +CONFIG_RENICE=y +CONFIG_BB_SYSCTL=y +CONFIG_TOP=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y +CONFIG_FEATURE_TOP_CPU_GLOBAL_PERCENTS=y +CONFIG_FEATURE_TOP_SMP_CPU=y +CONFIG_FEATURE_TOP_DECIMALS=y +CONFIG_FEATURE_TOP_SMP_PROCESS=y +CONFIG_FEATURE_TOPMEM=y +CONFIG_FEATURE_SHOW_THREADS=y +CONFIG_WATCH=y + +# +# Runit Utilities +# +CONFIG_RUNSV=y +CONFIG_RUNSVDIR=y +CONFIG_FEATURE_RUNSVDIR_LOG=y +CONFIG_SV=y +CONFIG_SV_DEFAULT_SERVICE_DIR="/var/service" +CONFIG_SVLOGD=y +CONFIG_CHPST=y +CONFIG_SETUIDGID=y +CONFIG_ENVUIDGID=y +CONFIG_ENVDIR=y +CONFIG_SOFTLIMIT=y +# CONFIG_CHCON is not set +# CONFIG_FEATURE_CHCON_LONG_OPTIONS is not set +# CONFIG_GETENFORCE is not set +# CONFIG_GETSEBOOL is not set +# CONFIG_LOAD_POLICY is not set +# CONFIG_MATCHPATHCON is not set +# CONFIG_RESTORECON is not set +# CONFIG_RUNCON is not set +# CONFIG_FEATURE_RUNCON_LONG_OPTIONS is not set +# CONFIG_SELINUXENABLED is not set +# CONFIG_SETENFORCE is not set +# CONFIG_SETFILES is not set +# CONFIG_FEATURE_SETFILES_CHECK_OPTION is not set +# CONFIG_SETSEBOOL is not set +# CONFIG_SESTATUS is not set + +# +# Shells +# +CONFIG_ASH=y +CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_IDLE_TIMEOUT is not set +CONFIG_ASH_JOB_CONTROL=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_GETOPTS=y +CONFIG_ASH_BUILTIN_ECHO=y +CONFIG_ASH_BUILTIN_PRINTF=y +CONFIG_ASH_BUILTIN_TEST=y +CONFIG_ASH_CMDCMD=y +CONFIG_ASH_MAIL=y +CONFIG_ASH_OPTIMIZE_FOR_SIZE=y +CONFIG_ASH_RANDOM_SUPPORT=y +CONFIG_ASH_EXPAND_PRMT=y +CONFIG_CTTYHACK=y +# CONFIG_HUSH is not set +# CONFIG_HUSH_BASH_COMPAT is not set +# CONFIG_HUSH_BRACE_EXPANSION is not set +# CONFIG_HUSH_HELP is not set +# CONFIG_HUSH_INTERACTIVE is not set +# CONFIG_HUSH_SAVEHISTORY is not set +# CONFIG_HUSH_JOB is not set +# CONFIG_HUSH_TICK is not set +# CONFIG_HUSH_IF is not set +# CONFIG_HUSH_LOOPS is not set +# CONFIG_HUSH_CASE is not set +# CONFIG_HUSH_FUNCTIONS is not set +# CONFIG_HUSH_LOCAL is not set +# CONFIG_HUSH_RANDOM_SUPPORT is not set +# CONFIG_HUSH_EXPORT_N is not set +# CONFIG_HUSH_MODE_X is not set +# CONFIG_MSH is not set +CONFIG_FEATURE_SH_IS_ASH=y +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +# CONFIG_FEATURE_BASH_IS_ASH is not set +# CONFIG_FEATURE_BASH_IS_HUSH is not set +CONFIG_FEATURE_BASH_IS_NONE=y +CONFIG_SH_MATH_SUPPORT=y +CONFIG_SH_MATH_SUPPORT_64=y +CONFIG_FEATURE_SH_EXTRA_QUIET=y +# CONFIG_FEATURE_SH_STANDALONE is not set +# CONFIG_FEATURE_SH_NOFORK is not set +CONFIG_FEATURE_SH_HISTFILESIZE=y + +# +# System Logging Utilities +# +CONFIG_SYSLOGD=y +CONFIG_FEATURE_ROTATE_LOGFILE=y +CONFIG_FEATURE_REMOTE_LOG=y +# CONFIG_FEATURE_SYSLOGD_DUP is not set +# CONFIG_FEATURE_SYSLOGD_CFG is not set +CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 +CONFIG_FEATURE_IPC_SYSLOG=y +CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 +CONFIG_LOGREAD=y +CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y +CONFIG_KLOGD=y +CONFIG_FEATURE_KLOGD_KLOGCTL=y +CONFIG_LOGGER=y diff --git a/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-kernel_ver.patch b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-kernel_ver.patch new file mode 100644 index 000000000..456fb08e1 --- /dev/null +++ b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-kernel_ver.patch @@ -0,0 +1,25 @@ +--- busybox-1.20.2/libbb/kernel_version.c ++++ busybox-1.20.2-kernel_ver/libbb/kernel_version.c +@@ -20,18 +20,15 @@ + int FAST_FUNC get_linux_version_code(void) + { + struct utsname name; +- char *s; ++ char *s, *t; + int i, r; + +- if (uname(&name) == -1) { +- bb_perror_msg("can't get system information"); +- return 0; +- } +- ++ uname(&name); /* never fails */ + s = name.release; + r = 0; + for (i = 0; i < 3; i++) { +- r = r * 256 + atoi(strtok(s, ".")); ++ t = strtok(s, "."); ++ r = r * 256 + (t ? atoi(t) : 0); + s = NULL; + } + return r; diff --git a/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-ntpd.patch b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-ntpd.patch new file mode 100644 index 000000000..17fc0b1c4 --- /dev/null +++ b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-ntpd.patch @@ -0,0 +1,11 @@ +--- busybox-1.20.2/networking/ntpd.c ++++ busybox-1.20.2-ntpd/networking/ntpd.c +@@ -1840,7 +1840,7 @@ recv_and_process_client_pkt(void /*int f + + /* Build a reply packet */ + memset(&msg, 0, sizeof(msg)); +- msg.m_status = G.stratum < MAXSTRAT ? G.ntp_status : LI_ALARM; ++ msg.m_status = G.stratum < MAXSTRAT ? (G.ntp_status & LI_MASK) : LI_ALARM; + msg.m_status |= (query_status & VERSION_MASK); + msg.m_status |= ((query_status & MODE_MASK) == MODE_CLIENT) ? + MODE_SERVER : MODE_SYM_PAS; diff --git a/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-pkg-config-selinux.patch b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-pkg-config-selinux.patch new file mode 100644 index 000000000..f39250c85 --- /dev/null +++ b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-pkg-config-selinux.patch @@ -0,0 +1,67 @@ +From b1cec5003b73080a8aa7ea277621bf1c71c3e8d6 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Sat, 20 Oct 2012 15:01:26 -0400 +Subject: [PATCH] build system: use pkg-config to look up selinux libs + +Newer versions of libselinux has started linking against more libs. +Rather than continuing hardcoding things, switch to using pkg-config +to query for its dependencies. + +Signed-off-by: Mike Frysinger +--- + Makefile | 1 + + Makefile.flags | 12 +++++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index fccde4a..3a0a5e1 100644 +--- a/Makefile ++++ b/Makefile +@@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm + STRIP = $(CROSS_COMPILE)strip + OBJCOPY = $(CROSS_COMPILE)objcopy + OBJDUMP = $(CROSS_COMPILE)objdump ++PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config + AWK = awk + GENKSYMS = scripts/genksyms/genksyms + DEPMOD = /sbin/depmod +diff --git a/Makefile.flags b/Makefile.flags +index c43c8dc..15dcc1f 100644 +--- a/Makefile.flags ++++ b/Makefile.flags +@@ -74,6 +74,12 @@ ARCH_FPIC ?= -fpic + ARCH_FPIE ?= -fpie + ARCH_PIE ?= -pie + ++# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES)) ++define pkg_check_modules ++$(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2)) ++$(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2)) ++endef ++ + ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) + # on i386: 14% smaller libbusybox.so + # (code itself is 9% bigger, we save on relocs/PLT/GOT) +@@ -85,6 +91,7 @@ endif + + ifeq ($(CONFIG_STATIC),y) + CFLAGS_busybox += -static ++PKG_CONFIG_FLAGS += --static + endif + + ifeq ($(CONFIG_PIE),y) +@@ -127,7 +134,10 @@ LDLIBS += pam pam_misc pthread + endif + + ifeq ($(CONFIG_SELINUX),y) +-LDLIBS += selinux sepol ++SELINUX_PC_MODULES = libselinux libsepol ++$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES))) ++CPPFLAGS += $(SELINUX_CFLAGS) ++LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%)) + endif + + ifeq ($(CONFIG_EFENCE),y) +-- +1.7.12 + diff --git a/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-sys-resource.patch b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-sys-resource.patch new file mode 100644 index 000000000..7b1850084 --- /dev/null +++ b/patches/source/mkinitrd/fixes-1.20.2/busybox-1.20.2-sys-resource.patch @@ -0,0 +1,123 @@ +From 5a5dfcad6ba96d12d68bd7b39279215a8fee70d3 Mon Sep 17 00:00:00 2001 +From: Tias Guns +Date: Sun, 10 Jun 2012 14:19:01 +0200 +Subject: [PATCH] inetd: fix build failure in Android + +Signed-off-by: Tias Guns +Signed-off-by: Denys Vlasenko +(cherry picked from commit 64f763b42a43cbf36e401690ff6767c25575e520) +--- + networking/inetd.c | 1 + + 1 file changed, 1 insertion(+) +-- +1.7.12 + +From 246ea72843d5b7e9d4cd902dc5e9d71359196303 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Thu, 5 Jul 2012 23:19:09 -0400 +Subject: [PATCH] include sys/resource.h where needed + +We use functions from sys/resource.h in misc applets, but don't include +the header. This breaks building with newer glibc versions, so add the +include where needed. + +Signed-off-by: Mike Frysinger +(cherry picked from commit c5fe9f7b723f949457263ef8e22ab807d5b549ce) +--- + loginutils/passwd.c | 1 + + miscutils/time.c | 1 + + networking/inetd.c | 1 + + networking/ntpd.c | 1 + + networking/ntpd_simple.c | 1 + + runit/chpst.c | 1 + + shell/shell_common.c | 1 + + 7 files changed, 7 insertions(+) + +diff --git a/loginutils/passwd.c b/loginutils/passwd.c +index b83db00..a7006f0 100644 +--- a/loginutils/passwd.c ++++ b/loginutils/passwd.c +@@ -15,6 +15,7 @@ + + #include "libbb.h" + #include ++#include /* setrlimit */ + + static void nuke_str(char *str) + { +diff --git a/miscutils/time.c b/miscutils/time.c +index 945f15f..ffed386 100644 +--- a/miscutils/time.c ++++ b/miscutils/time.c +@@ -16,6 +16,7 @@ + //usage: "\n -v Verbose" + + #include "libbb.h" ++#include /* getrusage */ + + /* Information on the resources used by a child process. */ + typedef struct { +diff --git a/networking/inetd.c b/networking/inetd.c +index 1308d74..00baf69 100644 +--- a/networking/inetd.c ++++ b/networking/inetd.c +@@ -165,6 +165,8 @@ + //usage: "\n (default: 0 - disabled)" + + #include ++#include /* setrlimit */ ++#include /* un.h may need this */ + #include + + #include "libbb.h" +diff --git a/networking/ntpd.c b/networking/ntpd.c +index 603801e..b885215 100644 +--- a/networking/ntpd.c ++++ b/networking/ntpd.c +@@ -46,6 +46,7 @@ + #include "libbb.h" + #include + #include /* For IPTOS_LOWDELAY definition */ ++#include /* setpriority */ + #include + #ifndef IPTOS_LOWDELAY + # define IPTOS_LOWDELAY 0x10 +diff --git a/networking/ntpd_simple.c b/networking/ntpd_simple.c +index 4ad44e4..1b7c66b 100644 +--- a/networking/ntpd_simple.c ++++ b/networking/ntpd_simple.c +@@ -7,6 +7,7 @@ + */ + #include "libbb.h" + #include /* For IPTOS_LOWDELAY definition */ ++#include /* setpriority */ + #ifndef IPTOS_LOWDELAY + # define IPTOS_LOWDELAY 0x10 + #endif +diff --git a/runit/chpst.c b/runit/chpst.c +index ac296ba..ed72c8b 100644 +--- a/runit/chpst.c ++++ b/runit/chpst.c +@@ -91,6 +91,7 @@ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + //usage: "\n a SIGXCPU after N seconds" + + #include "libbb.h" ++#include /* getrlimit */ + + /* + Five applets here: chpst, envdir, envuidgid, setuidgid, softlimit. +diff --git a/shell/shell_common.c b/shell/shell_common.c +index 51c92d6..780e27e 100644 +--- a/shell/shell_common.c ++++ b/shell/shell_common.c +@@ -18,6 +18,7 @@ + */ + #include "libbb.h" + #include "shell_common.h" ++#include /* getrlimit */ + + const char defifsvar[] ALIGN1 = "IFS= \t\n"; + +-- +1.7.12 + diff --git a/patches/source/mkinitrd/init b/patches/source/mkinitrd/init new file mode 100755 index 000000000..7122dbc3d --- /dev/null +++ b/patches/source/mkinitrd/init @@ -0,0 +1,350 @@ +#!/bin/ash +# +# /init: init script to load kernel modules from an initramfs +# This requires that your kernel supports initramfs!!! +# +# Copyright 2004 Slackware Linux, Inc., Concord, CA, USA +# Copyright 2007, 2008, 2009, 2010, 2012 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +################################################################################## +# With a generic kernel, you need to load the modules needed to mount the +# root partition. This might mean a SCSI, RAID, or other drive controller +# module, as well as the module to support the root filesystem. Once the +# root partition is mounted all the other modules will be available so you +# don't need to load them here. +# +# Config files used by this script: +# +# /rootdev Contains the name of the root device, such as: /dev/hda1 +# +# /rootfs Contains the root filesystem type, such as: xfs +# +# /initrd-name Contains the name of the initrd file. +# +# /resumedev Contains the name of the device to resume from hibernation. +# +# /luksdev Contains colon separated list of luks encrypted devices to +# be unlocked. +# +# /lukstrim Contains colon separated list of luks encrypted devices to +# pass '--allow-discards' when unlocking +# +# /lukskey Contains the path to a LUKS key-file for automatic unlock +# Format: LABEL=:/path/to/file +# UUID=:/path/to/file +# +# /wait-for-root Contains a number - the init script will wait this amount +# of seconds before creating device nodes. +# +# /keymap Contains the name for a custom keyboard map +# +# Optional: +# +# /load_kernel_modules +# A script that uses modprobe to load the desired modules. +# +# There's an example in here. To actually use it, you'll +# need to make it executable: +# +# chmod 755 load_kernel_modules +################################################################################## +# Changelog +# 10-Dec-2012 +# * Added support for the official Kernel parameters to select root filesystem +# type ('rootfstype') and pause before attempting to mount the root filesystem +# ('rootdelay'). The original parameters may continue to be used. +################################################################################## + +INITRD=$(cat /initrd-name) +ROOTDEV=$(cat /rootdev) +ROOTFS=$(cat /rootfs) +LUKSDEV=$(cat /luksdev) +LUKSTRIM=$(cat /lukstrim 2>/dev/null) +LUKSKEY=$(cat /lukskey) +RESUMEDEV=$(cat /resumedev) +WAIT=$(cat /wait-for-root) +KEYMAP=$(cat /keymap) +INIT=/sbin/init + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +# Mount /proc and /sys: +mount -n proc /proc -t proc +mount -n sysfs /sys -t sysfs +mount -n tmpfs /run -t tmpfs -o mode=0755,size=32M,nodev,nosuid,noexec + +if grep devtmpfs /proc/filesystems 1>/dev/null 2>/dev/null ; then + DEVTMPFS=1 + mount -n devtmpfs /dev -t devtmpfs -o size=8M +fi + +# Parse command line +for ARG in $(cat /proc/cmdline); do + case $ARG in + 0|1|2|3|4|5|6|S|s|single) + RUNLEVEL=$ARG + ;; + init=*) + INIT=$(echo $ARG | cut -f2 -d=) + ;; + luksdev=/dev/*) + LUKSDEV=$(echo $ARG | cut -f2 -d=) + ;; + lukskey=*) + LUKSKEY=$(echo $ARG | cut -f2- -d=) + ;; + rescue) + RESCUE=1 + ;; + resume=*) + RESUMEDEV=$(echo $ARG | cut -f2- -d=) + ;; + root=/dev/*) + ROOTDEV=$(echo $ARG | cut -f2 -d=) + ;; + root=LABEL=*) + ROOTDEV=$(echo $ARG | cut -f2- -d=) + ;; + root=UUID=*) + ROOTDEV=$(echo $ARG | cut -f2- -d=) + ;; + rootfs=*|rootfstype=*) + ROOTFS=$(echo $ARG | cut -f2 -d=) + ;; + waitforroot=*|rootdelay=*) + WAIT=$(echo $ARG | cut -f2 -d=) + ;; + esac +done + +# If udevd is available, use it to generate block devices +# else use mdev to read sysfs and generate the needed devices +if [ -x /sbin/udevd -a -x /sbin/udevadm ]; then + /sbin/udevd --daemon --resolve-names=never + /sbin/udevadm trigger --subsystem-match=block --action=add + /sbin/udevadm settle --timeout=10 +else + [ "$DEVTMPFS" != "1" ] && mdev -s +fi + +# Load kernel modules (ideally this was already done by udev): +if [ ! -d /lib/modules/$(uname -r) ]; then + echo "No kernel modules found for Linux $(uname -r)." +elif [ -x ./load_kernel_modules ]; then # use load_kernel_modules script: + echo "${INITRD}: Loading kernel modules from initrd image:" + . ./load_kernel_modules +else # load modules (if any) in order: + if ls /lib/modules/$(uname -r)/*.*o 1> /dev/null 2> /dev/null ; then + echo "${INITRD}: Loading kernel modules from initrd image:" + for module in /lib/modules/$(uname -r)/*.*o ; do + /sbin/modprobe $module + done + unset module + fi +fi + +# Sometimes the devices need extra time to be available. +# A root filesystem on USB is a good example of that. +sleep $WAIT + +# Load a custom keyboard mapping: +if [ -n "$KEYMAP" ]; then + echo "${INITRD}: Loading '$KEYMAP' keyboard mapping:" + tar xzOf /etc/keymaps.tar.gz ${KEYMAP}.bmap | loadkmap +fi + +if [ "$RESCUE" = "" ]; then + # Initialize RAID: + if [ -x /sbin/mdadm ]; then + # If /etc/mdadm.conf is present, udev should DTRT on its own; + # If not, we'll make one and go from there: + if [ ! -r /etc/mdadm.conf ]; then + /sbin/mdadm -E -s >/etc/mdadm.conf + /sbin/mdadm -S -s + /sbin/mdadm -A -s + # This seems to make the kernel see partitions more reliably: + fdisk -l /dev/md* 1> /dev/null 2> /dev/null + fi + fi + + # Unlock any encrypted partitions necessary to access the + # root filesystem, such as encrypted LVM Physical volumes, disk + # partitions or mdadm arrays. + # Unavailable devices such as LVM Logical Volumes will need to be + # deferred until they become available after the vgscan. + + if [ -x /sbin/cryptsetup ]; then + + # Determine if we have to use a LUKS keyfile: + if [ ! -z "$LUKSKEY" ]; then + mkdir /mountkey + KEYPART=$(echo $LUKSKEY |cut -f1 -d:) + KEYNAME=$(echo $KEYPART |cut -f2 -d=) + LUKSPATH="/mountkey$(echo $LUKSKEY |cut -f2 -d:)" + # Catch possible mount failure: + if blkid |grep "TYPE=\"vfat\"" |grep $KEYNAME 1>/dev/null 2>&1 ; then + MOUNTOPTS="-t vfat -o shortname=mixed" + else + MOUNTOPTS="-t auto" + fi + mount $MOUNTOPTS $(findfs $KEYPART) /mountkey 2>/dev/null + # Check if we can actually use this file: + if [ ! -f $LUKSPATH ]; then + LUKSKEY="" + else + echo ">>> Using LUKS key file: '$LUKSKEY'" + LUKSKEY="-d $LUKSPATH" + fi + fi + + LUKSLIST_DEFERRED="" + LUKSLIST=$(echo $LUKSDEV | tr -s ':' ' ') + for LUKSDEV in $LUKSLIST ; do + if /sbin/cryptsetup isLuks ${LUKSDEV} 1>/dev/null 2>/dev/null ; then + if echo $ROOTDEV | grep -q "LABEL=" || echo $ROOTDEV | grep -q "UUID=" ; then + CRYPTDEV="luks$(basename $LUKSDEV)" + elif [ "x$ROOTDEV" = "x$(basename $ROOTDEV)" ]; then + CRYPTDEV="$ROOTDEV" + else + CRYPTDEV="luks$(basename $LUKSDEV)" + fi + if echo $LUKSTRIM | grep -wq $LUKSDEV 2>/dev/null ; then + LUKSOPTS="--allow-discards" + else + LUKSOPTS="" + fi + if [ -z "${LUKSOPTS}" ]; then + echo "Unlocking LUKS encrypted device '${LUKSDEV}' as luks mapped device '$CRYPTDEV':" + else + echo "Unlocking LUKS encrypted device '${LUKSDEV}' as luks mapped device '$CRYPTDEV' with '$LUKSOPTS':" + fi + /sbin/cryptsetup ${LUKSOPTS} ${LUKSKEY} luksOpen ${LUKSDEV} ${CRYPTDEV} /dev/tty0 2>&1 + if [ "$ROOTDEV" = "$LUKSDEV" -o "$ROOTDEV" = "$CRYPTDEV" ] ; then + ROOTDEV="/dev/mapper/$CRYPTDEV" + fi + else + LUKSLIST_DEFERRED="${LUKSLIST_DEFERRED} ${LUKSDEV}" + fi + done + fi + + # Initialize LVM: + if [ -x /sbin/vgchange ]; then + mkdir -p /var/lock/lvm # this avoids useless warnings + /sbin/vgchange -ay --ignorelockingfailure 2>/dev/null + /sbin/udevadm settle --timeout=10 + fi + + # Unlock any LUKS encrypted devices that were deferred above but have now + # become available due to the vgscan (i.e. filesystems on LVM Logical Volumes) + + if [ -x /sbin/cryptsetup -a -n "${LUKSLIST_DEFERRED}" ]; then + for LUKSDEV in ${LUKSLIST_DEFERRED} ; do + if /sbin/cryptsetup isLuks ${LUKSDEV} 1>/dev/null 2>/dev/null ; then + if echo $ROOTDEV | grep -q "LABEL=" || echo $ROOTDEV | grep -q "UUID=" ; then + CRYPTDEV="luks$(basename $LUKSDEV)" + elif [ "x$ROOTDEV" = "x$(basename $ROOTDEV)" ]; then + CRYPTDEV="$ROOTDEV" + else + CRYPTDEV="luks$(basename $LUKSDEV)" + fi + echo "Unlocking LUKS encrypted device '${LUKSDEV}' as luks mapped device '$CRYPTDEV':" + /sbin/cryptsetup ${LUKSKEY} luksOpen ${LUKSDEV} ${CRYPTDEV} /dev/tty0 2>&1 + if [ "$ROOTDEV" = "$LUKSDEV" -o "$ROOTDEV" = "$CRYPTDEV" ] ; then + ROOTDEV="/dev/mapper/$CRYPTDEV" + fi + else + echo "LUKS device '${LUKSDEV}' unavailable for unlocking!" + fi + done + /sbin/udevadm settle --timeout=10 + fi + + # Scan for btrfs multi-device filesystems: + if [ -x /sbin/btrfs ]; then + /sbin/btrfs device scan + fi + + # Find root device if a label or UUID was given: + if echo $ROOTDEV | grep -q "LABEL=" || \ + echo $ROOTDEV | grep -q "UUID=" ; then + ROOTDEV=$(findfs $ROOTDEV) + fi + + # Clean up after LUKS unlock using a keyfile: + if grep -q mountkey /proc/mounts 2>/dev/null ; then + umount -l /mountkey + rmdir /mountkey 2>/dev/null + fi + + # Resume state from swap + if [ "$RESUMEDEV" != "" ]; then + # Find resume device if a label or UUID was given: + if echo $RESUMEDEV | grep -q "LABEL=" || \ + echo $RESUMEDEV | grep -q "UUID=" ; then + RESUMEDEV=$(findfs $RESUMEDEV) + elif ls -l $RESUMEDEV | grep -q "^l" ; then + RESUMEDEV=$(readlink -f $RESUMEDEV) + fi + echo "Trying to resume from $RESUMEDEV" + RESMAJMIN=$(ls -l $RESUMEDEV | tr , : | awk '{ print $5$6 }') + echo $RESMAJMIN > /sys/power/resume + fi + + # Switch to real root partition: + /sbin/udevadm settle --timeout=10 + echo 0x0100 > /proc/sys/kernel/real-root-dev + mount -o ro -t $ROOTFS $ROOTDEV /mnt + + if [ ! -r /mnt/sbin/init ]; then + echo "ERROR: No /sbin/init found on rootdev (or not mounted). Trouble ahead." + echo " You can try to fix it. Type 'exit' when things are done." + echo + /bin/sh + fi +else + echo + echo "RESCUE mode" + echo + echo " You can try to fix or rescue your system now. If you want" + echo " to boot into your fixed system, mount your root filesystem" + echo " read-only under /mnt:" + echo + echo " # mount -o ro -t filesystem root_device /mnt" + echo + echo " Type 'exit' when things are done." + echo + /bin/sh +fi + +# Need to make sure OPTIONS+="db_persist" exists for all dm devices +# That should be handled in /sbin/mkinitrd now +/sbin/udevadm info --cleanup-db +/sbin/udevadm control --exit + +unset ERR +mount -o move /proc /mnt/proc +mount -o move /sys /mnt/sys +mount -o move /run /mnt/run + +[ "$DEVTMPFS" = "1" ] && mount -o move /dev /mnt/dev +echo "${INITRD}: exiting" +exec switch_root /mnt $INIT $RUNLEVEL diff --git a/patches/source/mkinitrd/mkinitrd b/patches/source/mkinitrd/mkinitrd new file mode 100644 index 000000000..ed8f3247b --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd @@ -0,0 +1,740 @@ +#!/bin/sh +# Copyright 2004 Slackware Linux, Inc., Concord, CA, USA +# Copyright 2004 Patrick J. Volkerding, Concord, CA, USA +# Copyright 2007, 2008, 2009, 2010, 2011, 2015, 2016, 2017 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Modified by Robby Workman 26 November 2007 +# to add support for mkinitrd.conf - No additional license terms added +# Modified by Alan Hicks 27 November 2007 to enable +# passing arguments to kernel modules - No additional license terms added +# volkerdi - feel free to remove these :) +# Modified by Eric Hameleers 3 April 2008 +# to add support custom keymaps - No additional license terms added +# Modified by Patrick Volkerding 17 Dec 2008 +# Added support to bail out if kernel modules are requested for a kernel +# version that is not installed (thanks to Eric Hameleers), be more +# verbose about showing modules added to the initrd (thanks to +# Ellington Santos), and if "mount" returns /dev/root as the root device, +# use readlink to resolve the device pointed to by the /dev/root +# symlink, changed modprobe to use --ignore-install to avoid catching +# custom "install" lines and causing /sbin/modprobe to be copied to the +# initrd (thanks to Ken Milmore). +# Of course, license terms remain unchanged. +# Modified by Eric Hameleers 3 March 2010 +# Add lukskey option (-K). Automatically add kernel modules listed in +# load-kernel-modules if that file is executable. +# Yada yada yada. +# Modified by Patrick Volkerding 21 August 2012 +# Add Btrfs multi-device filesystem support option (-B). +# Modified by Robby Workman 08 March 2017 +# to add support for TRIM on LUKS root devs +# Modified by Patrick Volkerding 29 June 2017 +# Add support for prepending a microcode update archive (-P). + +MKINITRD_VERSION=1.4.10 + +# Don't include these things from /lib/udev/ in the initrd image +LIBUDEV_BLACKLIST="\ + ipod-set-info \ + iphone-set-info \ + check-mtp-device \ + check-ptp-camera \ + udev-configure-printer \ + rules.d/60-openobex.rules \ + rules.d/85-regulatory.rules \ + " + +print_usage() { + cat << EOF +Usage: mkinitrd [OPTION] + +mkinitrd creates an initial ramdisk (actually an initramfs cpio+gzip +archive) used to load kernel modules that are needed to mount the +root filesystem, or other modules that might be needed before the +root filesystem is available. Other binaries may be added to the +initrd, and the script is easy to modify. Be creative. :-) + + -F Use the contents of /etc/mkinitrd.conf (optional) + If this is used in conjunction with any other options passed + on the command line, the command-line options will override + the config file options. See mkinitrd.conf(5) for details. + -c Clear the existing initrd tree first + -f Filesystem to use for root partition (must be used with -r) + --help Display this message + -h Device to resume from hibernation. Needs to be the name of + the swap partition holding the hibernation image. + -k Kernel version to use + -l Custom keymap to load. Like, 'nl' or 'de-latin1-nodeadkeys' + -m A colon (:) delimited list of kernel modules to load. + Additional options may be added to use when loading the + kernel modules (but in this case the entire list must be + wrapped with double quotes). Any dependencies of requested + modules will also be added to the initrd. + -o Output image (default /boot/initrd.gz) + -r Root partition device (must be used with -f) + -s Initrd source tree (default /boot/initrd-tree/) + -u Include udev in the initrd + -w Time to wait until all disks are detected + -C A colon (:) delimited list of luks encrypted block devices to be + unlocked by the initrd using cryptsetup. All devices that must + be unlocked in order to access the root filesystem must be + specified. (Use with '-r' parameter). + -T A colon (:) delimited list of luks encrypted block devices to be + passed the "--allow-discards" option when unlocked by the initrd + using cryptsetup. This has the effect of allowing TRIM on SSD drives. + Be sure your SSD supports this feature (correctly) before enabling + it. See fstrim(8) for more information. + -L Add support for LVM partitions + -K Use a USB key (fat-formatted) to unlock the root LUKS volume + The parameter value is filename of a keyfile, as well as the label + (or uuid) of the partition this file is on. This way, you can unlock + your computer automatically if you have a USB stick with your LUKS + key inserted at boot. A passphrase will still be asked if the LUKS + key can not be found. + For example, if your USB thumb drive has a FAT partition with label + "TRAVELSTICK" and the actual keyfile is called "/keys/alien.luks", + then you need to pass: -K LABEL=TRAVELSTICK:/keys/alien.luks + -B Add /sbin/btrfs to enable scanning for a root filesystem that is + part of a Btrfs multi-device filesystem. + -M Add the files in /etc/modprobe.d/ and /lib/modprobe.d/ to the initrd + -P Prepend the output image with the microcode CPIO archive given in arguments. + -R Add support for RAID partitions + -V Display version number + +A simple example: Build an initrd for a reiserfs root partition: + + mkinitrd -c -m reiserfs + +Another example: Build an initrd image using Linux 2.6.35.4-smp kernel +modules for a system with an ext4 root partition on /dev/sdb3: + + mkinitrd -c -k 2.6.35.4-smp -m mbcache:jbd:ext4 -f ext4 -r /dev/sdb3 + +Note that if you are already logged in with /dev/sdb3 as your / +partition, and it is running ext4, this command works just the same: + + mkinitrd -c -m ext4 + +If run without options, mkinitrd will rebuild an initrd image using +the contents of the $SOURCE_TREE directory, or, if that directory +does not exist it will be created and populated, and then mkinitrd +will exit. + +EOF +} + +create_new_source_tree() { + mkdir -p $SOURCE_TREE + # Make sure a kernel module directory exists: + mkdir -p $SOURCE_TREE/lib/modules/${KERNEL_VERSION} + # Add the initrd-tree skeleton: + ( cd $SOURCE_TREE ; tar xzf /usr/share/mkinitrd/initrd-tree.tar.gz ) + # Make sure we have any block devices that might be needed: + + SLOPPY_DEV_LIST=$(cat /proc/partitions) + for device in $SLOPPY_DEV_LIST ; do + if [ ! -r $SOURCE_TREE/dev/$device ]; then + if [ -b /dev/$device ]; then + if [ -L /dev/$device ]; then + cp -a --parents $(readlink -e /dev/$device) $SOURCE_TREE + fi + cp -a --parents /dev/$device $SOURCE_TREE + fi + fi + done +} + +clear_source_tree() { + if [ -d "$SOURCE_TREE" ]; then + rm -rf $SOURCE_TREE + fi +} + +build_initrd_image() { + # Make sure we have any block devices that might be needed: + SLOPPY_DEV_LIST=$(cat /proc/partitions) + for device in $SLOPPY_DEV_LIST ; do + if [ ! -r $SOURCE_TREE/dev/$device ]; then + if [ -b /dev/$device ]; then + if [ -L /dev/$device ]; then + cp -a --parents $(readlink -e /dev/$device) $SOURCE_TREE + fi + cp -a --parents /dev/$device $SOURCE_TREE + fi + fi + done + # Use the output image name written in the initrd-tree if present: + if [ ! -z "$(cat $SOURCE_TREE/initrd-name)" ]; then + OUTPUT_IMAGE=$(cat $SOURCE_TREE/initrd-name) + if [ "$OUTPUT_IMAGE" = "$(basename $OUTPUT_IMAGE)" ]; then + OUTPUT_IMAGE=/boot/$OUTPUT_IMAGE + fi + mkdir -p $(dirname $OUTPUT_IMAGE) + fi + # Wrap the initrd as an initramfs image and move it into place: + ( cd $SOURCE_TREE + rm -f $OUTPUT_IMAGE + find . | cpio -o -H newc | gzip -9c > $OUTPUT_IMAGE + ) + + if [ ! -z "${MICROCODE_ARCH}" ] ; then + cat ${MICROCODE_ARCH} ${OUTPUT_IMAGE} > ${OUTPUT_IMAGE}.2 + mv ${OUTPUT_IMAGE}.2 ${OUTPUT_IMAGE} + fi + echo "$OUTPUT_IMAGE created." + echo "Be sure to run lilo again if you use it." +} + +badconf_file() { + # This won't really help with what's *wrong* with the file, + # but it will at least give them a clue that there's a problem + echo "/etc/mkinitrd.conf is bad or does not exist." + echo "If the file does not exist, do not pass -F to mkinitrd." + exit 1 +} + + +unify_libs() { + awk '/=. \// { print $3 }' | sort -u +} + +copy_libs() { + # First copy the essential glibc files: + find /lib /lib64 -name "ld-*so*" -o -name "libnss_files*so*" -o -name "libnss_compat*so*" 2> /dev/null | xargs -I'{}' cp -P --parents '{}' $SOURCE_TREE/ + + # Then copy all remaining libs our initrd files link against: + COUNT=1 + PRFX=$(tempfile --prefix ldd-) + TMPFILE=${PRFX}${COUNT} + + find $SOURCE_TREE -type f -exec ldd {} 2>/dev/null \; | unify_libs > $TMPFILE + while [ "$COUNT" != "0" ]; do + COUNT=$((COUNT+1)) + for i in $(cat ${TMPFILE}) ; do + ldd $i 2>/dev/null + done | unify_libs > ${PRFX}${COUNT} + if [ $(cat $TMPFILE ${PRFX}${COUNT} | sort |uniq -u | wc -l) -eq 0 ]; then + COUNT=0 + else + TMPFILE=${PRFX}${COUNT} + fi + # emergency eject lever: + if [ "$COUNT" = "42" ]; then + COUNT=0 + fi + done + + for i in $(cat ${PRFX}* | sort -u) ; do + cp -P --parents ${i}* $SOURCE_TREE + done + + ( + cd $SOURCE_TREE + for i in $(find -L . -type l -exec readlink -m /{} \; 2>/dev/null ) ; do + cp -P --parents ${i} $SOURCE_TREE + done + ) + + rm ${PRFX}* +} + +copy_modconf() { + mkdir -p $SOURCE_TREE/etc $SOURCE_TREE/lib + cp -a /etc/modprobe.d $SOURCE_TREE/etc + cp -a /lib/modprobe.d $SOURCE_TREE/lib/ +} + +# If --help is given, print_usage and exit: +if echo $* | grep -wq '\--help' ; then + print_usage + exit 0 +fi + +# If -V given, print version and exit: +if echo $* | grep -wq '\-V' ; then + echo "mkinitrd version $MKINITRD_VERSION" + exit 0 +fi + +# Default values if these aren't previously set. +# Might be set from config file or by -s and -o options too. +SOURCE_TREE=${SOURCE_TREE:-/boot/initrd-tree} +OUTPUT_IMAGE=${OUTPUT_IMAGE:-""} +KERNEL_VERSION=${KERNEL_VERSION:-"$(uname -r)"} +# The initrd requires udev to function correctly: +UDEV=1 + +# Default actions without options: +if [ -z "$1" ]; then + # We need a sensible default for this special case: + OUTPUT_IMAGE=${OUTPUT_IMAGE:-/boot/initrd.gz} + # If the output tree doesn't exist, create it and then exit: + if [ ! -d $SOURCE_TREE ]; then + echo "Nothing found at location $SOURCE_TREE, so we will create an" + echo -n "initrd directory structure there... " + create_new_source_tree + echo "done." + echo + echo "Now cd to $SOURCE_TREE and install some modules in your" + echo "module directory (lib/modules/${KERNEL_VERSION}). Then see init" + echo "for more information (there are a few other files to edit)." + echo "Finally, run mkinitrd again once the initrd-tree is ready," + echo "and $OUTPUT_IMAGE will be created from it." + echo + exit 0 + else + # If the source tree does exist, the default is to build the initrd + # image from it and then exit: + build_initrd_image + exit 0 + fi +fi # default no-option actions + +# Parse for the use config file option first or else the other command +# line options can not override /etc/mkinitrd.conf. +for opt in "$@"; do + if [ "$opt" = "-F" ]; then + if [ -e /etc/mkinitrd.conf ]; then + . /etc/mkinitrd.conf || badconf_file + else + badconf_file + fi + fi +done + +# Parse options: +while [ ! -z "$1" ]; do + case $1 in + -c) + CLEAR_TREE=1 + shift + ;; + -f) + ROOTFS="$2" + shift 2 + ;; + -h) + RESUMEDEV="$2" + shift 2 + ;; + -k) + KERNEL_VERSION="$2" + shift 2 + ;; + -l) + KEYMAP="$2" + shift 2 + ;; + -m) + MODULE_LIST="$2" + shift 2 + ;; + -o) + # canonicalize filename: + OUTPUT_IMAGE="$(readlink -m $2)" + shift 2 + ;; + -r) + ROOTDEV="$2" + shift 2 + ;; + -s) + # canonicalize filename: + SOURCE_TREE="$(readlink -m $2)" + shift 2 + ;; + -u) + UDEV=1 + shift + ;; + -w) + WAIT="$2" + shift 2 + ;; + -C) + CRYPT=1 + LUKSDEV="$2" + shift 2 + ;; + -K) + LUKSKEY="$2" + shift 2 + ;; + -T) + LUKSTRIM="$2" + shift 2 + ;; + -L) + LVM=1 + shift + ;; + -B) + BTRFS=1 + shift + ;; + -M) + MODCONF=1 + shift + ;; + -P) + # canonicalize filename: + MICROCODE_ARCH="$(readlink -m $2)" + if [ ! -e "${MICROCODE_ARCH}" ] ; then + echo "Error, the microcode cpio archive ${MICROCODE_ARCH} does not exist." + exit 1 + fi + shift 2 + ;; + + -R) + RAID=1 + shift + ;; + *) # unknown, prevent infinite loop + shift + ;; + esac +done + +# If kernel modules are needed but the kernel version is absent, exit now: +if [ ! -d /lib/modules/$KERNEL_VERSION ]; then + echo "ERROR: No /lib/modules/$KERNEL_VERSION kernel modules tree found for kernel \"$KERNEL_VERSION\"" + exit 1 +fi + +# If clearing source tree was requested, do that first +if [ "$CLEAR_TREE" = "1" ]; then + clear_source_tree +fi + +# If there's no $SOURCE_TREE, make one now: +if [ ! -d "$SOURCE_TREE" ]; then + create_new_source_tree +fi + +# If $ROOTDEV and $ROOTFS are not set, assume we want the +# values for the currently mounted / +# (unless we find that values are already set in the initrd-tree): +if [ -z "$ROOTDEV" -a -z "$(cat $SOURCE_TREE/rootdev 2>/dev/null)" ]; then + ROOTDEV=$(mount | grep ' on / ' | cut -f 1 -d ' ') + if [ "$ROOTDEV" = "/dev/root" ]; then # find real root device + ROOTDEV="/dev/$(readlink /dev/root)" + fi +fi +if [ -z "$ROOTFS" -a -z "$(cat $SOURCE_TREE/rootfs 2>/dev/null)" ]; then + ROOTFS=$(mount | grep ' on / ' | cut -f 5 -d ' ') +fi +# If needed, write them in the initrd-tree: +if [ ! -z "$ROOTDEV" ]; then + echo $ROOTDEV > $SOURCE_TREE/rootdev +fi +if [ ! -z "$ROOTFS" ]; then + echo $ROOTFS > $SOURCE_TREE/rootfs +fi + +# If $WAIT is not set, assume we need only one second +# to have all devices done +# (unless we find that value is already set in the initrd-tree): +if [ -z "$WAIT" -a -z "$(cat $SOURCE_TREE/wait-for-root)" ]; then + WAIT=1 + # ARM devices need even more time: + case "$( uname -m )" in + arm*) WAIT=4;; + esac +fi +if [ ! -z "$WAIT" ]; then + echo $WAIT > $SOURCE_TREE/wait-for-root +fi + +# If no OUTPUT_IMAGE was specified, read it from the SOURCE_TREE if possible: +OUTPUT_IMAGE=${OUTPUT_IMAGE:-"$(cat $SOURCE_TREE/initrd-name)"} +# If we still have no value, apply the default: +OUTPUT_IMAGE=${OUTPUT_IMAGE:-"/boot/initrd.gz"} +# Finally, write the image name into the SOURCE_TREE: +echo "$OUTPUT_IMAGE" > $SOURCE_TREE/initrd-name + +# Fill /resumedev with the swap partition holding the hibernation image +if [ ! -z "$RESUMEDEV" ]; then + echo $RESUMEDEV > $SOURCE_TREE/resumedev +fi + +# Add custom keymap support if one was given +if [ ! -z "$KEYMAP" ]; then + echo $KEYMAP > $SOURCE_TREE/keymap + cp /usr/share/mkinitrd/keymaps.tar.gz $SOURCE_TREE/etc/ +fi + +# If LUKSDEV was set in the config file, then we need to set CRYPT=1 +if [ ! -z "$LUKSDEV" ]; then + CRYPT=1 +fi + +# Check for LUKSTRIM +if [ ! -z "$LUKSTRIM" ]; then + echo $LUKSTRIM > $SOURCE_TREE/lukstrim +fi + +# If LUKSKEY was set in the config file, then give it a warm welcome: +if [ ! -z "$LUKSKEY" ]; then + # $SOURCE_TREE/wait-for-root may have been configured earlier in the script, + # but we require at least 5 seconds for the USB stick to settle + # after insertion : + if [ ! -s $SOURCE_TREE/wait-for-root ] || [ $(cat $SOURCE_TREE/wait-for-root) -lt 5 ]; then + echo 5 > $SOURCE_TREE/wait-for-root + fi + + # Several extra modules are needed to support a vfat formatted USB stick... + # assuming here we are using a western codepage. + # This possibly adds doublures, but we clean up the MODULE_LIST further down! + MODULE_LIST="${MODULE_LIST}:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:ohci-hcd:ehci-hcd:uhci-hcd:usb-storage:hid:usbhid:fat:nls_cp437:nls_iso8859-1:msdos:vfat" + + # Finally, write the lukskey to the initrd-tree: + echo $LUKSKEY > $SOURCE_TREE/lukskey +fi + +# Include RAID support in initrd +if [ ! -z "$RAID" ]; then + if [ -r /sbin/mdadm -a -r /sbin/mdmon ]; then + mkdir -p $SOURCE_TREE/sbin + cp /sbin/mdadm $SOURCE_TREE/sbin/mdadm + cp /sbin/mdmon $SOURCE_TREE/sbin/mdmon + chmod 0755 $SOURCE_TREE/sbin/mdadm + chmod 0755 $SOURCE_TREE/sbin/mdmon + mkdir -p $SOURCE_TREE/lib/udev/rules.d + echo 'KERNEL=="dm-[0-9]*", OPTIONS+="db_persist"' > \ + $SOURCE_TREE/lib/udev/rules.d/95-dm-initrd.rules + if [ -r /etc/mdadm.conf ] ; then + cp /etc/mdadm.conf $SOURCE_TREE/etc + fi + else + echo "ERROR: mdadm and/or mdmon binary is missing, RAID support not installed" + fi +fi + +# Include Btrfs support in initrd +if [ ! -z "$BTRFS" ]; then + if [ -r /sbin/btrfs ]; then + mkdir -p $SOURCE_TREE/sbin + cp /sbin/btrfs $SOURCE_TREE/sbin/btrfs + chmod 0755 $SOURCE_TREE/sbin/btrfs + else + echo "ERROR: btrfs binary is missing, Btrfs support not installed" + fi +fi + +# Include udev in initrd +if [ ! -z "$UDEV" ]; then + cp /sbin/udev* $SOURCE_TREE/sbin/ + cp -a /lib/udev $SOURCE_TREE/lib/ + # But we don't want all of /lib/udev + for file in $(echo $LIBUDEV_BLACKLIST) ; do + # Replace with a null script (avoids error spew): + cat << EOF > $SOURCE_TREE/lib/udev/$file +#!/bin/ash +# This space is intentionally left blank +EOF + done +fi + +# Include LVM support in initrd +if [ ! -z "$LVM" ]; then + if [ -f /sbin/lvm ]; then + mkdir -p $SOURCE_TREE/sbin + cp /sbin/lvm $SOURCE_TREE/sbin/lvm + ( cd $SOURCE_TREE/sbin + ln -s lvm vgchange 2>/dev/null + ln -s lvm vgscan 2>/dev/null ) + else + echo "LVM binary is missing, LVM support isn't installed" + LVM="" + fi +fi + +# Include cryptsetup (LUKS) support in initrd +if [ ! -z "$CRYPT" ]; then + if [ -e /usr/sbin/cryptsetup ]; then + mkdir -p $SOURCE_TREE/sbin + cp /usr/sbin/cryptsetup $SOURCE_TREE/sbin/cryptsetup + if [ ! -e $SOURCE_TREE/sbin/udevadm ]; then + cat << EOF > $SOURCE_TREE/sbin/udevadm +#!/bin/sh +sleep 3 +EOF + chmod 0755 $SOURCE_TREE/sbin/udevadm + fi + + # Write the underlying luks device to the initrd-tree: + echo $LUKSDEV > $SOURCE_TREE/luksdev + else + echo "Cryptsetup binary is missing, CRYPT support isn't installed" + CRYPT="" + fi +fi + +# Include device mapper in initrd (needed for LUKS and LVM) +if [ ! -z "$CRYPT" -o ! -z "$LVM" ]; then + cp /sbin/dmsetup $SOURCE_TREE/sbin/dmsetup + find /lib /lib64 -name "libdevmapper*so*" 2> /dev/null | xargs -I'{}' cp -P --parents '{}' $SOURCE_TREE/ + if [ -z "${MODULE_LIST}" ] ; then + MODULE_LIST="dm-mod" + elif ! echo ${MODULE_LIST} | grep -q dm-mod ; then + MODULE_LIST="$MODULE_LIST:dm-mod" + fi + mkdir -p $SOURCE_TREE/lib/udev/rules.d + echo 'KERNEL=="dm-[0-9]*", OPTIONS+="db_persist"' > \ + $SOURCE_TREE/lib/udev/rules.d/95-dm-initrd.rules +fi + +# Make module directory: +if [ ! -d $SOURCE_TREE/lib/modules/$KERNEL_VERSION ]; then + mkdir -p $SOURCE_TREE/lib/modules/$KERNEL_VERSION +fi + +# Copy kmod/modprobe stuff to initrd: +for i in kmod depmod insmod lsmod modinfo modprobe rmmod ; do + rm -f $SOURCE_TREE/sbin/$i ; + cp -a /sbin/$i $SOURCE_TREE/sbin ; +done + +# Make sure modules.builtin and modules.order are there (for kmod): +cp /lib/modules/$KERNEL_VERSION/modules.{builtin,order} \ + $SOURCE_TREE/lib/modules/$KERNEL_VERSION + +# If an executable $SOURCE_TREE/load_kernel_modules already exists, then +# we assume you will want to load the kernel modules mentioned in there. +# This means, you do not have to explicitly add those on the commandline: +if [ -x $SOURCE_TREE/load_kernel_modules ]; then + MODULE_LIST="${MODULE_LIST}:$(cat $SOURCE_TREE/load_kernel_modules |grep "^modprobe" |rev |cut -d/ -f1 |rev |cut -d. -f1)" +fi + +# If the module list is not empty, copy the modules into place: +if [ ! -z "$MODULE_LIST" ]; then + if grep -q "#modprobe reiserfs" $SOURCE_TREE/load_kernel_modules ; then + rm -f $SOURCE_TREE/load_kernel_modules + touch $SOURCE_TREE/load_kernel_modules + chmod 755 $SOURCE_TREE/load_kernel_modules + echo "# This is a script used to load the kernel modules." >> $SOURCE_TREE/load_kernel_modules + echo "# To use it, chmod it 755, and then add the insmod" >> $SOURCE_TREE/load_kernel_modules + echo "# lines needed to load your modules, like this:" >> $SOURCE_TREE/load_kernel_modules + echo >> $SOURCE_TREE/load_kernel_modules + fi + + # Sanitize the modules list first, before any further processing. + # The awk command eliminates doubles without changing the order: + MODULE_LIST=$(echo $MODULE_LIST |tr -s ':' '\n' |awk '!x[$0]++' |tr '\n' ':') + MODULE_LIST=$(echo ${MODULE_LIST%:}) # Weed out a trailing ':' + + # Count number of modules + # This INDEX number gives us an easy way to find individual + # modules and their arguments, as well as tells us how many + # times to run through the list + if ! echo $MODULE_LIST | grep ':' > /dev/null ; then # only 1 module specified + INDEX=1 + else + # Trim excess ':' which will screw this routine: + MODULE_LIST=$(echo $MODULE_LIST | tr -s ':') + INDEX=1 + while [ ! "$(echo "$MODULE_LIST" | cut -f $INDEX -d ':' )" = "" ]; do + INDEX=$(expr $INDEX + 1) + done + INDEX=$(expr $INDEX - 1) # Don't include the null value + fi + + # Wrap everything in a while loop + i=0 + while [ $i -ne $INDEX ]; do + i=$(( $i + 1 )) + + # FULL_MOD is the module plus any arguments (if any) + # MODULE is the module name + # ARGS is any optional arguments to be passed to the kernel + FULL_MOD="$(echo "$MODULE_LIST" | cut -d ':' -f $i)" + MODULE="$(echo "$FULL_MOD" | cut -d ' ' -f 1 )" + # Test for arguments + if echo "$FULL_MOD" | grep ' ' > /dev/null; then + ARGS=" $(echo "$FULL_MOD" | cut -d ' ' -f 2- )" + else + unset ARGS + fi + + # Get MODULE deps and prepare modprobe lines + /sbin/modprobe --set-version $KERNEL_VERSION --show-depends --ignore-install $MODULE 2>/dev/null \ + | grep "^insmod " | cut -f 2 -d ' ' | while read SRCMOD; do + + if ! grep -Eq " $(basename $SRCMOD .ko)(\.| |$)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then + LINE="$(echo "modprobe -v $(basename ${SRCMOD%%.gz} .ko)" )" + + # Test to see if arguments should be passed + # Over-ride the previously defined LINE variable if so + if [ "$(basename $SRCMOD .ko)" = "$MODULE" ]; then + # SRCMOD and MODULE are same, ARGS can be passed + LINE="$LINE$ARGS" + fi + + fi + + if ! grep -qx "$LINE" $SOURCE_TREE/load_kernel_modules ; then + echo "$LINE" >> $SOURCE_TREE/load_kernel_modules + fi + + # Try to add the module to the initrd-tree. This should be done + # even if it exists there already as we may have changed compilers + # or otherwise caused the modules in the initrd-tree to need + # replacement. + if cp -a --parents $SRCMOD $SOURCE_TREE 2>/dev/null; then + echo "OK: $SRCMOD added." + # If a module needs firmware, copy that too + /sbin/modinfo -F firmware "$SRCMOD" | sed 's/^/\/lib\/firmware\//' | + while read SRCFW; do + if cp -a --parents "$SRCFW" $SOURCE_TREE 2>/dev/null; then + echo "OK: $SRCFW added." + else + echo "WARNING: Could not find firmware \"$SRCFW\"" + fi + done + else + echo "WARNING: Could not find module \"$SRCMOD\"" + fi + + done + done + + # Pregenerate the module dependency information + depmod -a -b $SOURCE_TREE ${KERNEL_VERSION} + + # Copy /{etc,lib}/modprobe.d/* if desired + if [ ! -z $MODCONF ]; then + copy_modconf + fi + +fi + +# Copy needed libraries +copy_libs + +# Make sure all libraries have symlinks: +/sbin/ldconfig $(readlink -f $SOURCE_TREE)/lib/ 2> /dev/null +/sbin/ldconfig $(readlink -f $SOURCE_TREE)/lib64/ 2> /dev/null +/sbin/ldconfig + +# And finally, build the initrd: +build_initrd_image + diff --git a/patches/source/mkinitrd/mkinitrd.8 b/patches/source/mkinitrd/mkinitrd.8 new file mode 100644 index 000000000..64dad3f43 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd.8 @@ -0,0 +1,279 @@ +.\" -*- nroff -*- +.ds g \" empty +.ds G \" empty +.\" Like TP, but if specified indent is more than half +.\" the current line-length - indent, use the default indent. +.de Tp +.ie \\n(.$=0:((0\\$1)*2u>(\\n(.lu-\\n(.iu)) .TP +.el .TP "\\$1" +.. +.TH MKINITRD 8 "27 March 2010" "Slackware Version 13.1" +.SH NAME +mkinitrd \- create or rebuilt an initrd (initial ramdisk) using initramfs (simple cpio+gzip). +.SH SYNOPSIS +.B mkinitrd +[ +.B \-F +] +[ +.B \-c +] +[ +.B \-f filesystem +] +[ +.B \-h hibernate_partition +] +[ +.B \-k kernel_version +] +[ +.B \-m module1:module2:module3... +] +[ +.B \-o output_file +] +[ +.B \-r root_device +] +[ +.B \-s source_tree +] +[ +.B \-u +] +[ +.B \-w wait_time +] +[ +.B \-C device1:device2:device3... +] +[ +.B \-K luks_keyfile +] +[ +.B \-P microcode_archive +] +[ +.B \-B +] +[ +.B \-L +] +[ +.B \-R +] +[ +.B \-V +] +.SH DESCRIPTION +.B mkinitrd +is used to build an initial ramdisk. An initial ramdisk is a very small +set of files that are loaded into RAM and "mounted" (as initramfs doesn't +actually use a filesystem) as the kernel boots (before the main root +filesystem is mounted). The usual reason to use an initrd is because +you need to load kernel modules before mounting the root partition. +Usually these modules are required to support the filesystem used by the +root partition (ext3, reiserfs, xfs), or perhaps the controller that the +hard drive is attached to (SCSI, RAID, etc). Essentially, there are so many +different options available in modern Linux kernels that it isn't practical +to try to ship many different kernels to try to cover everyone's needs. +It's a lot more flexible to ship a generic kernel and a set of kernel +modules for it. +.SH OPTIONS +.TP +.B \-F +Use the contents of /etc/mkinitrd.conf as options to mkinitrd (optional). +If this is used in conjunction with any other options passed on the command +line, the command-line options will override the config file options. +.br +See mkinitrd.conf(5) for details. +.TP +.B \-c +Clear the existing initrd tree (by default in /boot/initrd-tree/) first. +If this is not done, running mkinitrd will add additional modules to the +existing initrd. +.TP +.B \-f filesystem +Specify the filesystem to use for the root partition. If this isn't given, +mount will usually figure it out. This option must be used together with the +\-r option in order to be beneficial. +.TP +.B \--help +Display a help summary. +.TP +.B \-h hibernate_partition +Specify the swap partition holding the hibernation image. +.TP +.B \-k kernel version +Use kernel modules from the specified kernel version. mkinitrd will look +for them in /lib/modules/(kernel version). +.TP +.B \-l keymap +Load an alternative keyboard mapping. All supported keyboard mappings +can be found in /usr/share/mkinitrd/keymaps.tar.gz +Leave the '.bmap' out when you supply this parameter. E.g. '-l nl' will +add support for dutch keyboard mapping to the initrd. +.TP +.B \-m module list +This is a list of colon-delimited modules to build into the initrd. +Any dependencies of requested modules will also be added to the initrd. +Additional options may be added to use when loading the kernel modules +(but in this case the entire list must be wrapped with double quotes). +.TP +.B \-o output image +The file to write the initrd to. (default: /boot/initrd.gz) +.TP +.B \-r root partition +Specify the device to be used as the root partition. If this isn't given, the +kernel default will be used (which is usually fine). This option must be used +together with the \-f option in order to be beneficial. +.TP +.B \-s source tree +The directory to use as the source for the initrd. (default: /boot/initrd-tree/) +.TP +.B \-u +Include udev in the initrd. +.TP +.B \-w +The -w option specifies how long to wait in seconds before assuming that all the +drives are spun up and ready to go. +.TP +.B \-C device list +A colon (:) delimited list of luks encrypted block devices to be unlocked by +the initrd using cryptsetup. All devices that must be unlocked in order to +access the root filesystem must be specified. e.g. + + -C /dev/sda2:/dev/sda3 + +Each unlocked device will be assigned an automatically generated luks device +name of the form luks where '' will be the basename of the +encrypted device. e.g. + + /dev/mapper/lukssda2 + +As a convenience to users, where -r specifies one of the device names listed +on the -C option it will be automatically adjusted to use the correct luks +device name. i.e. + + "-C /dev/sda2 -r /dev/sda2" and + "-C /dev/sda2 -r /dev/mapper/lukssda2" + +are equivalent. +.br +(Use with '-r' option). +.TP +.B \-K luks_keyfile +When using cryptsetup to encrypt your partition, you can use a keyfile instead +of a passphrase to unlock the LUKS volume. The LUKSKEY variable holds the +filename of a keyfile, as well as the label (or uuid) of the partition this +file is on. This way, you can unlock your computer automatically if you have a +USB stick with your LUKS key inserted at boot. A passphrase will still be asked +if the LUKS key can not be found. +.br +For example, if your USB thumb drive has a FAT partition with label +"TRAVELSTICK" and the actual keyfile is called "/keys/alien.luks", then +you need to set: + + -K LABEL=TRAVELSTICK:/keys/alien.luks +.TP +.B \-T device list +A colon (:) delimited list of luks encrypted block devices to be passed the +"--allow-discards" option when unlocked by the initrd using cryptsetup, e.g. + + -T /dev/sda2:/dev/sda4 + +This has the effect of allowing TRIM on SSD drives. Be sure your SSD supports +this feature (correctly) before enabling it. See fstrim(8) for more information. +.TP +.B \-P microcode_archive +This option specifies a cpio archive containing updated microcode for your CPU. +CPU manufacturers occasionally release such updates to fix bugs in the microcode +currently embedded in the CPU. The microcode archive will be prepended to the +output initrd, where the kernel will find it for early patching: + + -P /boot/intel-ucode.cpio + +.TP +.B \-B +This option adds the btrfs utility to the initrd so that multi-device filesystems +will be picked up by a scan (/sbin/btrfs device scan). This is needed if the +root filesystem is a Btrfs multi-device filesystem. +.TP +.B \-L +This option adds LVM support to the initrd, if the tools are +available on the system. +.TP +.B \-R +This option adds RAID support to the initrd, if a static mdadm binary is +available on the system. +.TP +.B \-V +Display version information and exit. +.SH EXAMPLES +A simple example: Build an initrd for a reiserfs root partition: + + mkinitrd -c -m reiserfs + +Another example: Build an initrd image using Linux 2.6.33.1 kernel +modules for a system with an ext3 root partition on /dev/sdb3: + + mkinitrd -c -k 2.6.33.1 -m ext3 -f ext3 -r /dev/sdb3 + +An example of a single encrypted partition setup: +.br +As a user convenience, the value for the "-r" option may also be specified as +"/dev/sda2" in this example: + + mkinitrd -c -k 2.6.33.1 \\ + -m ext4:ehci-hcd:uhci-hcd:usbhid \\ + -f ext4 -r /dev/mapper/lukssda2 \\ + -C /dev/sda2 \\ + -l uk + +Finally, A more complex example: +.br +This one is for a LVM Volume Group (rootvg) comprising of two LVM Physical +Volumes, each of which is on a LUKS encrypted partition that will need to be +unlocked before the root filesystem (/dev/rootvg/lvroot) can be accessed. + + mkinitrd -c -k 2.6.29.6 \\ + -m ext4:ehci-hcd:uhci-hcd:usbhid \\ + -f ext4 -r /dev/rootvg/lvroot \\ + -L -C /dev/sda2:/dev/sdb2 \\ + -l uk + +If run without options, mkinitrd will rebuild an initrd image using +the contents of the $SOURCE_TREE directory, or, if that directory +does not exist it will be created and populated, and then mkinitrd +will exit. These options are handy for building an initrd mostly +by hand. After creating /boot/initrd-tree/, you can add modules and +edit files by hand, and then rerun mkinitrd to create the initrd. + +Once the initrd is created, you'll need to tell your boot loader +to load it. If you boot with LILO, you will need to add an initrd +line to /etc/lilo.conf. Here's a section of lilo.conf that shows +how to set this up: + + # Linux bootable partition config begins + image = /boot/vmlinuz-generic-2.6.33.1 + initrd = /boot/initrd.gz + root = /dev/sda3 + label = Linux26331 + read-only + # Linux bootable partition config ends + +Note that the line "root = /dev/sda3" is not needed if the root device +has been configured in the initrd image. + +Once you've created the initrd and editing /etc/lilo.conf, you will +need to run 'lilo' to write out the changed boot block. The next +time you reboot the initrd should be loaded along with the kernel. + +Have fun! + +.SH SEE ALSO +mkinitrd.conf (5) + +.SH AUTHOR +Patrick J. Volkerding diff --git a/patches/source/mkinitrd/mkinitrd.SlackBuild b/patches/source/mkinitrd/mkinitrd.SlackBuild new file mode 100755 index 000000000..c7529be11 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd.SlackBuild @@ -0,0 +1,146 @@ +#!/bin/sh + +# Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2015, 2016, 2017 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +VERSION=${VERSION:-1.4.10} +BB=1.20.2 +BUILD=${BUILD:-1_slack14.2} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i586 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +NUMJOBS=${NUMJOBS:--j7} +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-mkinitrd + +# Write a warning to stdout if the mkinitrd script has a different version: +eval $( grep "^MKINITRD_VERSION=" $CWD/mkinitrd ) +if [ "$VERSION" != "$MKINITRD_VERSION" ]; then + echo "The version of this package ($VERSION) is not equal to the version of the mkinitrd script ($MKINITRD_VERSION)." + sleep 5 +fi + +rm -rf $PKG +mkdir -p $TMP $PKG +cd $TMP +rm -rf busybox-$BB +tar xvf $CWD/busybox-$BB.tar.?z* || exit 1 +cd busybox-$BB + +if [ -d $CWD/fixes-$BB ]; then + for pfile in $CWD/fixes-$BB/*.patch ; do + patch -p1 < $pfile || exit 1 + done +fi + +chown -R root:root . +sed -e \ + 's#^CONFIG_PREFIX=.*#CONFIG_PREFIX="'$PKG'/usr/share/mkinitrd/initrd-tree"#' \ + $CWD/busybox-dot-config > .config +make oldconfig +make $NUMJOBS || make || exit 1 + +mkdir -p $PKG/usr/share/mkinitrd/initrd-tree/{bin,sbin} +make install || exit 1 +rm -f $PKG/usr/share/mkinitrd/initrd-tree/linuxrc + +# Copying additional files: +cp -a $CWD/mkinitrd_command_generator.sh $PKG/usr/share/mkinitrd +chown root:root $PKG/usr/share/mkinitrd/mkinitrd_command_generator.sh +chmod 755 $PKG/usr/share/mkinitrd/mkinitrd_command_generator.sh +cp -a $CWD/keymaps.tar.gz $PKG/usr/share/mkinitrd +chown root:root $PKG/usr/share/mkinitrd/keymaps.tar.gz +chmod 644 $PKG/usr/share/mkinitrd/keymaps.tar.gz + +# Zip up the initrd-tree: +( cd $PKG/usr/share/mkinitrd/initrd-tree + tar xf $CWD/_initrd-tree.tar.gz + cat $CWD/init > init + + # These are useful for ARM: + mknod -m 644 dev/random c 1 8 + mknod -m 644 dev/urandom c 1 9 + + tar czf ../initrd-tree.tar.gz . +) +rm -rf $PKG/usr/share/mkinitrd/initrd-tree + +# Add busybox docs: +mkdir -p $PKG/usr/doc/busybox-$BB +cp -a AUTHORS COPYING* INSTALL LICENSE README* \ + $PKG/usr/doc/busybox-$BB +cp -a e2fsprogs/README $PKG/usr/doc/busybox-$BB/README.e2fsprogs +cp -a libbb/README $PKG/usr/doc/busybox-$BB/README.libbb +cp -a shell/README $PKG/usr/doc/busybox-$BB/README.shell +cp -a testsuite/README $PKG/usr/doc/busybox-$BB/README.testsuite + +mkdir -p $PKG/sbin +cp -a $CWD/mkinitrd $PKG/sbin/mkinitrd +chown root:root $PKG/sbin/mkinitrd +chmod 755 $PKG/sbin/mkinitrd + +mkdir -p $PKG/usr/man/man{5,8} +cat $CWD/mkinitrd.conf.5 | gzip -9c > $PKG/usr/man/man5/mkinitrd.conf.5.gz +cat $CWD/mkinitrd.8 | gzip -9c > $PKG/usr/man/man8/mkinitrd.8.gz +cat $CWD/mkinitrd_command_generator.8 | gzip -9c > $PKG/usr/man/man8/mkinitrd_command_generator.8.gz + +mkdir -p $PKG/etc +cp -a $CWD/mkinitrd.conf.sample $PKG/etc/mkinitrd.conf.sample +# ARM systems often need more time to find devices: +case "$( uname -m )" in + arm*) sed -e 's@#WAIT="1"@#WAIT="4"@g' \ + -i $PKG/etc/mkinitrd.conf.sample;; +esac +chown root:root $PKG/etc/mkinitrd.conf.sample +chmod 644 $PKG/etc/mkinitrd.conf.sample + +mkdir -p $PKG/usr/doc/mkinitrd-$VERSION +sed $CWD/README.initrd \ + -e "s,@DATE@,$(date),g" \ + -e "s,@KERNEL_VERSION@,$(uname -r),g" \ + -e "s,@PACKAGE_VERSION@,$(uname -r | tr - _),g" \ + -e "s,@LILO_KERNEL_NAME@,$(echo $(uname -r) | tr -d . | tr -d - ),g" \ + -e "s,@MKINITRD_VERSION@,$VERSION,g" \ + -e "s,@ARCH@,$ARCH,g" \ + -e "s,@BUILD@,$BUILD,g" \ + > $PKG/usr/doc/mkinitrd-$VERSION/README.initrd + +mkdir $PKG/boot +ln -sf /usr/doc/mkinitrd-$VERSION/README.initrd $PKG/boot/README.initrd + +find $PKG | xargs file | grep -e "executable" -e "shared object" \ + | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/mkinitrd-$VERSION-$ARCH-$BUILD.txz + diff --git a/patches/source/mkinitrd/mkinitrd.conf.5 b/patches/source/mkinitrd/mkinitrd.conf.5 new file mode 100644 index 000000000..65c180185 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd.conf.5 @@ -0,0 +1,244 @@ +.\" mkinitrd.5 Robby Workman +.\" 28 August 2010 " + +.TH MKINITRD.CONF 5 "27 March 2010" "Slackware 13.1" +.SH NAME +.B mkinitrd.conf(5) +.SH SYNOPSIS +.B mkinitrd.conf - optional configuration file for +.I mkinitrd(8) + +.SH DESCRIPTION +The +.I mkinitrd.conf +file contains options to be passed to +.I mkinitrd(8) +on every run if mkinitrd is executed with the -F flag. +.br +It is intended as a fast and easy way for the system administrator to +pass options to mkinitrd without having to type them on each execution. + +Options passed to +.I mkinitrd(8) +on the command line will override any +values set in the config file. + +.SH OPTIONS AND SYNTAX + +All options are in the format of OPTION="value" +.br +Unset variables have no effect. + +.TP 5 +.I SOURCE_TREE +This is the location for the initrd's source tree. +.br +Defaults to "/boot/initrd-tree" + +.TP 5 +.I CLEAR_TREE +This option specifies whether to clear the initrd source tree prior to +creating the initrd. +.br +This requires a value of either "0" or "1" where 0=no and 1=yes +.br +Examples: +.br +CLEAR_TREE="0" # Do not clear initrd tree first +.br +CLEAR_TREE="1" # Clear initrd tree first + +It is recommended to leave this unset and pass "-c" on the command line +when clearing the tree is desired. Clearing the tree is not desirable +if you wish to build support for more than one kernel into the initrd +image. + +.TP 5 +.I OUTPUT_IMAGE +This is the location for the initrd image that is created. +.br +Defaults to "/boot/initrd.gz" + +.TP 5 +.I KERNEL_VERSION +This is the kernel version for which the initrd should be created. +.br +Defaults to "$(uname -r)" + +.TP 5 +.I KEYMAP +This is the custom keyboard map that should be loaded instead of the +default 'us' keymap. +.br +The file /usr/share/mkinitrd/keymaps.tar.gz contains all possible keymaps +to choose from (omit the '.bmap' extension in the mkinitrd command) +.br +Example: KEYMAP="nl" + +.TP 5 +.I MODULE_LIST +This should be a colon-separated list of modules you wish to be included +in the initrd image. +.br +Example: MODULE_LIST="ext3:mbcache:jbd" + +If you have loadtime options that you need to specify when loading kernel +modules, those can be added here as well. +.br +Example: MODULE_LIST="module1:module2 option=1:module3" + +.TP 5 +.I LUKSDEV +Contains a colon (:) delimited list of luks encrypted block devices to be +unlocked by the initrd using cryptsetup. All devices that must be unlocked +in order to access the root filesystem must be specified. +.br +Example: LUKSDEV="/dev/sda2:/dev/sda3" + +Each unlocked device will be assigned an automatically generated luks device +name of the form luks where '' will be the basename of the +encrypted device. e.g. + + /dev/mapper/lukssda2 + +As a convenience to users, if +.I ROOTDEV +(see below) specifies one of the device names listed in the +.I LUKSDEV +option, then it will be automatically adjusted to use the correct luks +device name. i.e. when specifying +.I "LUKSDEV=/dev/sda2" +then +.I "ROOTDEV=/dev/sda2" +and +.I "ROOTDEV=/dev/mapper/lukssda2" +are equivalent. + +.TP 5 +.I LUKSKEY +When using cryptsetup to encrypt your partition, you can use a keyfile instead +of a passphrase to unlock the LUKS volume. The LUKSKEY variable holds the +filename of a keyfile, as well as the label (or uuid) of the partition this +file is on. This way, you can unlock your computer automatically if you have a +USB stick with your LUKS key inserted at boot. A passphrase will still be asked +if the LUKS key can not be found. +.br +For example, if your USB thumb drive has a FAT partition with label +"TRAVELSTICK" and the actual keyfile is called "/keys/alien.luks", then +you need to set: +.br +LUKSKEY="LABEL=TRAVELSTICK:/keys/alien.luks" + +.TP 5 +.I LUKSTRIM +Contains a colon (:) delimited list of luks encrypted block devices to be +passed the "--allow-discards" option when unlocked by the initrd using +cryptsetup. This has the effect of allowing TRIM on SSD drives. Be sure +your SSD supports this feature (correctly) before enabling it. +.br +See fstrim(8) for more information. +.br +Example: LUKSTRIM="/dev/sda2:/dev/sda4" + +.TP 5 +.I ROOTDEV +The device on which your root filesystem is located. +.br +Example: ROOTDEV="/dev/sda2" + +If you are using cryptsetup and an encrypted root filesystem, be sure to +read the option above for LUKSDEV or Bad Things will happen. + +.TP 5 +.I ROOTFS +The filesystem type of your root filesystem +.br +Example: ROOTFS="ext3" + +.TP 5 +.I RAID +This option adds the mdadm binary to the initrd to support RAID. +Additional modules may be required, depending on your kernel +configuration. If you wish to add LVM support to the initrd, then +set this to 1; otherwise, leave it unset or set it to 0. +.br +Examples: +.br +RAID="0" # Do not add RAID support to initrd +.br +RAID="1" # Add RAID support to initrd + +.TP 5 +.I LVM +This option adds support for LVM partitions into the initrd. +If you wish to add LVM support to the initrd, then set this to 1; +otherwise, leave it unset or set it to 0. +.br +Examples: +.br +LVM="0" # Do not add LVM support to initrd +.br +LVM="1" # Add LVM support to initrd + +.TP 5 +.I UDEV +Use UDEV in the initrd. +.br +Examples: +.br +UDEV="0" # Do not use udev in the initrd +.br +UDEV="1" # Use udev in the initrd (this is the default) + +.TP 5 +.I WAIT +This defines the time to wait, in seconds, until all disks are detected. +.br +This is useful for allowing extra time that might be needed for slow usb disks or systems with large amounts of storage to become ready. +.br +If not defined, the default is 1 second. + +.TP 5 +.I RESUMEDEV +The swap partition holding your hibernation image. +.br +Example: RESUMEDEV="/dev/sda2" + +.TP 5 +.I MODCONF +This option defines whether to copy the module-init-tools config files +from /etc/modprobe.d/ into the initrd. This will not usually be necessary, +but if you need certain modules to be loaded with special options, and you +have this configured in a file in /etc/modprobe.d/, this is one way to +accomplish the desired goal. +.br +Examples: +.br +MODCONF="0" # Do not add /etc/modprobe.d/* to the initrd +.br +MODCONF="1" # Add /etc/modprobe.d/* to the initrd + +.TP 5 +.I MICROCODE_ARCH +This option specifies a cpio archive containing updated microcode for your CPU. +CPU manufacturers occasionally release such updates to fix bugs in the microcode +currently embedded in the CPU. The microcode archive will be prepended to the +output initrd, where the kernel will find it for early patching. +.br +Examples: +.br +MICROCODE_ARCH="/boot/intel-ucode.cpio" + +.SH FILES +.I /etc/mkinitrd.conf +.br +See /etc/mkinitrd.conf.sample + +.SH "SEE ALSO" +.BR mkinitrd "(8)" + +.SH BUGS +None known :-) + +.SH MISCELLANEOUS +Support for mkinitrd.conf was added in mkinitrd-1.3.0 diff --git a/patches/source/mkinitrd/mkinitrd.conf.sample b/patches/source/mkinitrd/mkinitrd.conf.sample new file mode 100644 index 000000000..70256ef38 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd.conf.sample @@ -0,0 +1,21 @@ +# mkinitrd.conf.sample +# See "man mkinitrd.conf" for details on the syntax of this file +# +#SOURCE_TREE="/boot/initrd-tree" +#CLEAR_TREE="0" +#OUTPUT_IMAGE="/boot/initrd.gz" +#KERNEL_VERSION="$(uname -r)" +#KEYMAP="us" +#MODULE_LIST="ext4" +#LUKSDEV="/dev/sda2" +#LUKSTRIM="/dev/sda2" # verify support with 'hdparm -I $dev | grep TRIM' +#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks" +#ROOTDEV="/dev/sda1" +#ROOTFS="ext4" +#RESUMEDEV="/dev/sda2" +#RAID="0" +#LVM="0" +#UDEV="1" +#MODCONF="0" +#MICROCODE_ARCH="/boot/intel-ucode.cpio" +#WAIT="1" diff --git a/patches/source/mkinitrd/mkinitrd_command_generator.8 b/patches/source/mkinitrd/mkinitrd_command_generator.8 new file mode 100644 index 000000000..954fab484 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd_command_generator.8 @@ -0,0 +1,187 @@ +'\" t +.\" Title: mkinitrd_command_generator +.\" Author: Eric Hameleers +.\" Generator: DocBook XSL Stylesheets v1.78.1 +.\" Date: 2016-02-07 +.\" Manual: Slackware Tools +.\" Source: http://www.slackware.com 1.40 +.\" Language: English +.\" +.TH "MKINITRD_COMMAND_GEN" "8" "2016-02-07" "http://www\&.slackware\&.com" "Slackware Tools" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +mkinitrd_command_generator \- mkinitrd the easy way +.SH "SYNOPSIS" +.sp +.nf +mkinitrd_command_generator\&.sh [ \fIoptions\fR ] [ \fIkernel_filename\fR ] +.fi +.SH "OPTIONS" +.PP +\fB\-a \fR\fB\fIadditional params\fR\fR +.RS 4 +Additional parameters to pass to mkinitrd\&. +.RE +.PP +\fB\-c | \-\-conf\fR +.RS 4 +Show a suitable mkinitrd configuration file\&. +.RE +.PP +\fB\-h | \-\-help\fR +.RS 4 +Show this help\&. +.RE +.PP +\fB\-i | \-\-interactive\fR +.RS 4 +Navigate through menus instead of using commandline arguments\&. +.RE +.PP +\fB\-\-longhelp\fR +.RS 4 +Show more detailed information/examples\&. +.RE +.PP +\fB\-k \fR\fB\fIkernelversion\fR\fR +.RS 4 +Use specific kernel version\&. +.RE +.PP +\fB\-m \fR\fB\fIadditional mods\fR\fR +.RS 4 +Additional modules to pass to mkinitrd, separated by colons (:)\&. +.RE +.PP +\fB\-l | \-\-lilo\fR +.RS 4 +Only show lilo\&.conf section (requires a kernel_filename)\&. +.RE +.PP +\fB\-r | \-\-run\fR +.RS 4 +Only show +\fImkinitrd\fR +command\&. +.RE +.SH "DESCRIPTION" +.sp +This script is useful in situations where you require an initrd image to boot your computer\&. +.sp +For instance, when booting a kernel that does not have support for your storage or root filesystem built in (such as the Slackware \fIgeneric\fR kernels)\&. +.sp +When you run the script without parameters, it will examine your running system, your current kernel version and will output an example of a \fImkinitrd\fR commandline that you can use to generate an initrd image containing enough driver support to boot the computer\&. +.sp +You can make it more specific: when you add the filename of a kernel as parameter to the script, it will determine the kernel version from that kernel, and also give an example of the lines that you should add to your \fI/etc/lilo\&.conf\fR file\&. +.sp +If you want your initrd image to have a custom name instead of the default \fI/boot/initrd\&.gz\fR you can add it as another parameter to the script, as follows: +.sp +mkinitrd_command_generator\&.sh \-a "\-o \fI/boot/custom\&.gz\fR" +.sp +The arguments to the \fI\-a\fR parameter will be used as additional arguments to the \fImkinitrd\fR command\&. +.sp +If you need additional modules in the initrd image, apart from what the script determines, you can pass then to the script using the \fI\-m\fR parameter as follows: +.sp +mkinitrd_command_generator\&.sh \-m "uhci\-hcd:usbhid:hid:hid\-generic" +.sp +The above example adds support for USB keyboards to the initrd \- you may need that if you have encrypted your root partition and need to enter a passphrase using a USB keyboard\&. +.sp +Instead of copying and pasting the script\(cqs output, you can create an initrd by directly executing the output, like in this example: +.sp +.if n \{\ +.RS 4 +.\} +.nf +$(mkinitrd_command_generator\&.sh \-\-run /boot/vmlinuz\-generic\-4\&.4\&.1) +.fi +.if n \{\ +.RE +.\} +.sp +That used the \fI\-r\fR or \fI\-\-run\fR switch to make the script only write the \fImkinitrd\fR commandline to the terminal\&. +.sp +When you want to add a section for a specific kernel to \fI/etc/lilo\&.conf\fR directly, use the \fI\-l\fR or \fI\-\-lilo\fR switch and use a command like in this example: +.sp +mkinitrd_command_generator\&.sh \-\-lilo /boot/vmlinuz\-generic\-smp\-4\&.4\&.1 >>/etc/lilo\&.conf +.sp +That command will result in the following lines being added to your \fI/etc/lilo\&.conf\fR file (example for my hardware): +.sp +.if n \{\ +.RS 4 +.\} +.nf +\fI# Linux bootable partition config begins\fR +\fI# initrd created with \*(Aqmkinitrd \-c \-k 4\&.4\&.1 \-m mbcache:jbd2:ext4 \-f ext4 \-r /dev/sda7 \-u \-o /boot/initrd\&.gz\fR\*(Aq +image = /boot/vmlinuz\-generic\-4\&.4\&.1 +initrd = /boot/initrd\&.gz +root = /dev/sda7 +label = 4\&.4\&.1 +read\-only +\fI# Linux bootable partition config ends\fR +.fi +.if n \{\ +.RE +.\} +.sp +The last two examples show how easy it is to configure your computer for the use of an initrd if you need one\&. The only thing left to do afterwards is running \fIlilo\fR\&. +.SH "EXIT STATUS" +.sp +.if n \{\ +.RS 4 +.\} +.nf +\fB0\fR Success +\fB1\fR Failure +.fi +.if n \{\ +.RE +.\} +.SH "FILES" +.sp +.if n \{\ +.RS 4 +.\} +.nf +/usr/share/mkinitrd/mkinitrd_command_generator\&.sh +.fi +.if n \{\ +.RE +.\} +.SH "BUGS" +.sp +Report bugs to Eric Hameleers +.SH "SEE ALSO" +.sp +.if n \{\ +.RS 4 +.\} +.nf +mkinitrd(1), lilo\&.conf(1) +.fi +.if n \{\ +.RE +.\} +.SH "AUTHOR" +.PP +\fBEric Hameleers\fR +.RS 4 +Author. +.RE diff --git a/patches/source/mkinitrd/mkinitrd_command_generator.sh b/patches/source/mkinitrd/mkinitrd_command_generator.sh new file mode 100644 index 000000000..33d9c9de3 --- /dev/null +++ b/patches/source/mkinitrd/mkinitrd_command_generator.sh @@ -0,0 +1,872 @@ +#!/bin/sh +# $Id: mkinitrd_command_generator.sh,v 1.45 2011/02/17 09:27:05 eha Exp eha $ +# Copyright 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA +# Copyright 2008, 2009, 2010, 2011 Eric Hameleers, Eindhoven, Netherlands +# Contact: +# Copyright 2008, 2009 PiterPUNK, Sao Paulo, SP, Brazil +# Contact: +# All rights reserved. +# +# Permission to use, copy, modify, and distribute this software for +# any purpose with or without fee is hereby granted, provided that +# the above copyright notice and this permission notice appear in all +# copies. +# +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# ----------------------------------------------------------------------------- +# +# Create an initrd which fits the system. +# Take into account the use of LVM/LUKS/RAID. +# Find out about any hardware drivers the system may need in an initrd when +# booting from a generic lightweight kernel. +# +# ----------------------------------------------------------------------------- + +# The script's revision number will be displayed in the help text: +REV=$( echo "$Revision: 1.45 $" | cut -d' ' -f2 ) + +# Define some essential parameter values: +USING_LVM="" +USING_LUKS="" +USING_RAID="" +MLIST="" +REALDEV="" # The device that contains the LUKS volume +BASEDEV="" # Lowest level device (raw block device or RAID volume) + +FSTAB=${FSTAB:-"/etc/fstab"} # so we can test with alternate fstab files + +# These are needed by -c and -i options: +SOURCE_TREE=${SOURCE_TREE:-"/boot/initrd-tree"} +CLEAR_TREE=${CLEAR_TREE:-1} +KEYMAP=${KEYMAP:-"us"} +UDEV=${UDEV:-1} +# ARM devices need more time: +case "$( uname -m )" in + arm*) WAIT_DEFAULT=4;; + *) WAIT_DEFAULT=1;; +esac +WAIT=${WAIT:-$WAIT_DEFAULT} + +# A basic explanation of the commandline parameters: +basic_usage() { + cat <<-EOT + + *** $(basename $0) revision $REV *** + Usage: + $(basename $0) [ options ] [ kernel_filename ] + Options: + -a <"additional params"> Additional parameters to pass to mkinitrd. + -c | --conf Show a suitable mkinitrd configuration file. + -h | --help Show this help. + -i | --interactive Navigate through menus instead of using + commandline arguments. + --longhelp Show more detailed information/examples. + -k Use specific kernel version. + -m <"additional mods"> Additional modules to pass to mkinitrd, + separated by colons (:). + -l | --lilo Only show lilo.conf section + (requires a kernel_filename). + -r | --run Only show 'mkinitrd' command. + EOT +} + +# More of a tutorial here: +extended_usage() { + cat <<-EOT + + This script is useful in situations where you require an initrd image + to boot your computer. + For instance, when booting a kernel that does not have support for your + storage or root filesystem built in (such as the Slackware 'generic' + kernels'). + + * When you run the script without parameters, it will examine your + running system, your current kernel version and will output an example + of a 'mkinitrd' commandline that you can use to generate an initrd + image containing enough driver support to boot the computer. + + * You can make it more specific: when you add the filename of a kernel + as parameter to the script, it will determine the kernel version from + that kernel, and also give an example of the lines that you should add + to your '/etc/lilo.conf' file. + + * If you want your initrd image to have a custom name instead of the + default '/boot/initrd.gz' you can add it as another parameter to the + script, as follows: + + $(basename $0) -a "-o /boot/custom.gz" + + The arguments to the '-a' parameter will be used as additional arguments + to the 'mkinitrd' command. + + * If you need additional modules in the initrd image, apart from what + the script determines, you can pass then to the script using the '-m' + parameter as follows: + + $(basename $0) -m "uhci-hcd:usbhid:hid_generic" + + The above example adds support for USB keyboards to the initrd - you + may need that if you have encrypted your root partition and need to + enter a passphrase using a USB keyboard. + + * Instead of copying and pasting the script's output, you can create + an initrd by directly executing the output, like in this example: + + EOT + + echo " \$($(basename $0) --run /boot/vmlinuz-generic-smp-2.6.35.11-smp)" + + cat <<-EOT + + That used the '-r' or '--run' switch to make the script only write + the 'mkinitrd' commandline to the terminal. + + * When you want to add a section for a specific kernel to + '/etc/lilo.conf' directly, use the '-l' or '--lilo' switch and use a + command like in this example: + + EOT + + echo " $(basename $0) --lilo /boot/vmlinuz-generic-smp-2.6.35.11-smp >>/etc/lilo.conf" + + cat <<-EOT + + That command will result in the following lines being added to your + '/etc/lilo.conf' file (example for my hardware): + + # Linux bootable partition config begins + # initrd created with 'mkinitrd -c -k 2.6.35.11-smp -m ata_generic:pata_amd:mbcache:jbd:ext3 -f ext3 -r /dev/hda7' + image = /boot/vmlinuz-generic-smp-2.6.35.11-smp + initrd = /boot/initrd.gz + root = /dev/hda7 + label = 2.6.35.11-smp + read-only + # Linux bootable partition config ends + + The last two examples show how easy it is to configure your computer + for the use of an initrd if you need one. The only thing left to do + afterwards is running 'lilo'. + + EOT +} + +# Find the device that holds the root partition: +get_root_device() { + if [ -e $FSTAB ]; then + RD=$(cat $FSTAB |tr '\t' ' ' |grep -v '^ *#' |tr -s ' ' |grep ' / ' |cut -f1 -d' ') + if [ "$(echo $RD | cut -f1 -d=)" = "LABEL" -o "$(echo $RD | cut -f1 -d=)" = "UUID" ]; then + DKEY=$(echo $RD | cut -f1 -d=) + # The value can be LABEL=foo or LABEL='foo' or LABEL="foo" + DVAL=$(echo $RD | cut -f2 -d= | tr -d "'\042") + RD=$(/sbin/blkid | grep -w $DKEY | grep -w $DVAL | cut -f1 -d:) + fi + else + RD=$(grep -m1 "^/dev/.*[[:blank:]]/[[:blank:]]" /proc/mounts | cut -f1 -d' ') + fi + echo $RD +} + +# Get the root fs information: +get_rootfs_type() { + if $(type blkid 1>/dev/null 2>&1) ; then + blkid -s TYPE -o value $ROOTDEV + elif $(type vol_id 1>/dev/null 2>&1) ; then + vol_id $ROOTDEV | grep ID_FS_TYPE | cut -f2 -d= + else + # As a fallback, use: + cat $FSTAB |tr '\t' ' ' |grep -v '^ *#' |tr -s ' ' |grep ' / ' |cut -f3 -d' ' + fi +} + +# Add the module(s) needed for the root filesystem: +add_rootfs_module() { + local FSMOD + FSMOD=$(/sbin/modprobe --set-version $KVER --show-depends ${ROOTFS} 2>/dev/null | while read LINE; do + echo $(basename $(echo $LINE | cut -d' ' -f2) .ko ) + done) + if [ -n "$FSMOD" ]; then + [ -n "$MLIST" ] && echo "$MLIST:$(echo $FSMOD | tr ' ' ':')" \ + || echo $FSMOD | tr ' ' ':' + fi +} + +# Determine the list of kernel modules needed to support the root device: +determine_blockdev_drivers() { + # Walk the /sys tree to find kernel modules that are + # required for our storage devices. + # Thanks to PiterPUNK for help with this code. + local MLIST + MLIST=$(for i in $(find /sys/block/*/ -name "device" -print0 | xargs -0 -i'{}' readlink -f '{}' | sort -u); do + /sbin/udevadm info --query=all --path=$i --attribute-walk | \ + sed -ne 's/^[[:blank:]]\+DRIVER[S]*=="\([^"]\+\)"$/\1/p' | \ + xargs -I@ /sbin/modprobe --set-version $KVER --show-depends @ \ + 2>/dev/null | grep -v "builtin " | \ + while read LINE ; do + echo $(basename $(echo $LINE | cut -d' ' -f2) .ko ) + done + done) + MLIST=$( echo $MLIST | tr ' ' ':' ) + echo $MLIST +} + +# Search for USB keyboards: +function add_usb_keyboard() { + local USBMOD + if cat /proc/bus/input/devices | sed -e 's/^$/\$/g' | \ + tr "\n$" " \n" | grep -q " Phys=.*usb.* .*Handlers=.*kbd.*B:"; then + USBMOD="xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:hid:usbhid:i2c-hid:hid_generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch" + [ -n "$MLIST" ] && MLIST="$MLIST:$USBMOD" \ + || MLIST="$USBMOD" + fi + echo $MLIST +} + +# Determine what USB Host Controller is in use +function add_usb_hcd() { + local USBMOD + for i in $(ls -Ld /sys/module/*_hcd/drivers/* 2> /dev/null); do + if ls -L $i | grep -q "[0-9a-f]*:" ; then + USBMOD=$( echo $i | cut -f4 -d/ | tr "_" "-") + [ -n "$MLIST" ] && MLIST="$MLIST:$USBMOD" \ + || MLIST="$USBMOD" + fi + done + echo $MLIST +} + +# Is the root partition on a (combination of) LVM/LUKS volume? +check_luks_lvm_raid() { + if $( lvdisplay -c $ROOTDEV 1>/dev/null 2>/dev/null ); then + # Our root partition is on a LV: + USING_LVM=1 + # Search the Physical Volume of our Logical Volume: + MYVG=$( echo $(lvdisplay -c $ROOTDEV 2>/dev/null) | cut -d: -f2 ) + for LINE in $(pvdisplay -c) ; do + VG=$(echo $LINE | cut -d: -f2) + [ "$VG" = "$MYVG" ] && break + done + PV=$(echo $LINE | cut -d: -f1) + # Check if there is a LUKS device underneath: + if $( cryptsetup status $PV 1>/dev/null 2>/dev/null ) ; then + # Our root partition's LV is on a LUKS volume: + USING_LUKS=1 + REALDEV=$( cryptsetup status $PV | grep 'device: ' | tr -d ' ' | cut -d: -f2 ) + BASEDEV=$REALDEV + else + BASEDEV=$PV + fi + elif $( cryptsetup status $ROOTDEV 1>/dev/null 2>/dev/null ) ; then + # Our root device is on a LUKS volume: + USING_LUKS=1 + REALDEV=$( cryptsetup status $ROOTDEV | grep 'device: ' | tr -d ' ' | cut -d: -f2 ) + ROOTDEV=$(basename $ROOTDEV) + # Check for LVM: + for LV in $(lvdisplay -c 2>/dev/null | tr -d ' ' | cut -f1 -d:) ; do + # Note: cryptsetup shows the real device, whereas + # lvdisplay requires the /dev//... symlink to the real device. + if [ "$(readlink $LV)" = "$REALDEV" ]; then + REALDEV=$LV + break + fi + done + if $( lvdisplay -c $REALDEV 1>/dev/null 2>/dev/null ); then + # Our root partition's LUKS device is on a LV: + USING_LVM=1 + # Search the Physical Volume of our Logical Volume: + MYVG=$( echo $(lvdisplay -c $REALDEV 2>/dev/null) | cut -d: -f2 ) + for LINE in $(pvdisplay -c) ; do + VG=$(echo $LINE | cut -d: -f2) + [ "$VG" = "$MYVG" ] && break + done + PV=$(echo $LINE | cut -d: -f1) + BASEDEV=$PV + else + BASEDEV=$REALDEV + fi + else + BASEDEV=$ROOTDEV + fi + + # Finally, we should check if base device is + # a real block device or a RAID volume: + for MD in $(cat /proc/mdstat | grep -w active | cut -d' ' -f1) ; do + if [ "$BASEDEV" = "/dev/$MD" ]; then + USING_RAID=1 + break + fi + done +} + +# Before we start +[ -x /bin/id ] && CMD_ID="/bin/id" || CMD_ID="/usr/bin/id" +if [ "$($CMD_ID -u)" != "0" ]; then + echo "You need to be root to run $(basename $0)." + exit 1 +fi + +# Parse the commandline parameters: +while [ ! -z "$1" ]; do + case $1 in + --longhelp) + basic_usage + extended_usage + exit 0 + ;; + -a) + MKINIT_PARAMS="$2" + shift 2 + ;; + -c|--conf) + [ -n "$EMIT" ] && { echo "Do not mix incompatible parameters!"; exit 1; } + EMIT="conf" + shift + ;; + -h|--help) + basic_usage + exit 0 + ;; + -i|--interactive) + INTERACTIVE=1 + shift + ;; + -k) + KVER=$2 + shift 2 + ;; + -m) + MKINIT_MODS=$2 + shift 2 + ;; + -l|--lilo) + [ -n "$EMIT" ] && { echo "Do not mix incompatible parameters!"; exit 1; } + EMIT="lilo" + shift + ;; + -L|--fromlilo) + FROMLILO=1 + shift + ;; + -r|--run) + [ -n "$EMIT" ] && { echo "Do not mix incompatible parameters!"; exit 1; } + EMIT="run" + shift + ;; + -R|--rootdev) + ROOTDEV=$2 + shift 2 + ;; + -*) + echo "Unsupported parameter '$1'!" + exit 1 + ;; + *) # Everything else but switches (which start with '-') follows: + if [ -f $1 ]; then + KFILE=$1 + # Construction of KFILE's full filename: + KFILEPATH=$(cd $(dirname $KFILE) && pwd) + if [ -L $KFILE ]; then + KFILE=$(readlink $KFILE) + else + KFILE=$(basename $KFILE) + fi + KFILE=${KFILEPATH}/$KFILE + if [ -z "$(file $KFILE | grep -E 'Linux kernel x86 boot|x86 boot sector')" ]; then + echo "File '$KFILE' does not look like it is a kernel file!" + exit 1 + fi + else + echo "File $1 not found!" + exit 1 + fi + shift + ;; + esac +done + +# Determine what to show as output (other options may have set EMIT already) +EMIT=${EMIT:-"all"} + +# An EMIT value of 'lilo' requires a kernel filename as script parameter: +if [ "$EMIT" = "lilo" ]; then + if [ -z "$KFILE" ]; then + echo "A kernel_filename is required with the '-l|--lilo' option!" + exit 1 + fi +fi + +# Determine kernel version to use, +# and check if modules for this kernel are actually present: +if [ -z "$KVER" ]; then + if [ -n "$KFILE" ]; then + KVER="$(strings $KFILE | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')" + else + KVER="$(uname -r)" + fi +fi +if [ ! -d /lib/modules/$KVER ]; then + echo "Modules for kernel $KVER aren't installed." + exit 1 +fi + +# Determine whether the user passed an alternate filename for the initrd: +if [ -n "$MKINIT_PARAMS" ]; then + SRCHLIST="$MKINIT_PARAMS" + for ELEM in $MKINIT_PARAMS ; do + SRCHLIST=$(echo $SRCHLIST | cut -d' ' -f2-) # cut ELEM from the list + if [ "$ELEM" = "-o" ]; then + IMGFILE=$(echo $SRCHLIST | cut -d' ' -f1) + break + fi + done +fi +IMGFILE=${IMGFILE:-"/boot/initrd.gz"} + +# Get information about the root device / root filesystem: +ROOTDEV=${ROOTDEV:-$(get_root_device)} +ROOTFS=$(get_rootfs_type) + +# Determine the list of kernel modules needed to support the root device: +MLIST=$(determine_blockdev_drivers) + +# Check if we are running in a kvm guest with virtio block device driver +# (add all virtio modules, we sort out the doubles later): +if echo $MLIST | grep -q "virtio"; then + MLIST="$MLIST:virtio:virtio_balloon:virtio_blk:virtio_ring:virtio_pci:virtio_net" +fi + +# Determine if a USB keyboard is in use and include usbhid and hid_generic +# to module list +MLIST=$(add_usb_keyboard) + +# If we use any USB module, try to determine the Host Controller +if echo $MLIST | grep -q "usb"; then + MLIST=$(add_usb_hcd) +fi + +# Check what combination of LUKS/LVM/RAID we have to support: +# This sets values for USING_LUKS, USING_LVM, USING_RAID, REALDEV and BASEDEV. +check_luks_lvm_raid + +# This is the interactive part: +if [ "$INTERACTIVE" = "1" ]; then + if [ "$FROMLILO" != "1" ]; then + dialog --stdout --title "WELCOME TO MKINITRD COMMAND GENERATOR" --msgbox "\ +The main goal of this utility is to create a good initrd to \ +fit your needs. It can detect what kernel you are running, \ +what is your root device, root filesystem, if you use encryption, \ +LVM, RAID, etc. \ +\n\n\ +Usually the probed values are OK and they will be the \ +defaults in all subsequent dialogs, but maybe you want \ +to change something. \n\ +If in doubt, leave the defaults." 0 0 + + KVER=$( ls -d1 --indicator-style=none /lib/modules/* | \ + awk -F/ -vVER=$KVER '{ + if ( VER == $NF ) { + ONOFF="on" + } else { + ONOFF="off" + } ; printf("%s \"\" %s\n",$NF,ONOFF) }' | \ + xargs dialog --stdout --title "CHOOSE KERNEL VERSION" \ + --default-item $KVER --radiolist "\ +Please, select the kernel version you want to create this initrd for." 0 0 4 ) + [ -z "$KVER" ] && exit 1 + + OLDROOTDEV=$ROOTDEV + ROOTDEV=$( dialog --stdout --title "SELECT ROOT DEVICE" --inputbox "\ +Enter your root device. Root device is the one where your '/' filesystem \ +is mounted." 0 0 "$ROOTDEV" ) + [ -z "$ROOTDEV" ] && exit 1 + + # We need to re-check our defaults in case the user changed the default + # value for ROOTDEV: + [ "$OLDROOTDEV" != "$ROOTDEV" ] && check_luks_lvm_raid + ROOTFS=$(get_rootfs_type) + + ROOTFS=$( dialog --stdout --title "SELECT ROOT FILESYSTEM" --inputbox "\ +Enter the type of your root filesystem." 0 0 "$ROOTFS" ) + [ -z "$ROOTFS" ] && exit 1 + fi + + MLIST=$(add_rootfs_module) + + LLR=$( dialog --stdout --title "LVM/LUKS/RAID" --checklist "\ +Do you use some of those in your root filesystem? \ +If this is the case, please select one or more options." 12 45 3 \ +"LVM" "Logical Volume Manager" $([ "$USING_LVM" = "1" ] && echo on || echo off) \ +"LUKS" "Linux Unified Key Setup" $([ "$USING_LUKS" = "1" ] && echo on || echo off) \ +"RAID" "Linux Software RAID" $([ "$USING_RAID" = "1" ] && echo on || echo off)) + + if [ "$?" != "0" ]; then + exit 1 + fi + + echo $LLR | grep -q LUKS && USING_LUKS="1" + echo $LLR | grep -q LVM && USING_LVM="1" + echo $LLR | grep -q RAID && USING_RAID="1" + + if [ "$USING_LUKS" = "1" ]; then + REALDEV=$( dialog --stdout --title "LUKS ROOT DEVICE" --inputbox "\ +Please, enter your LUKS root device:" 0 0 "$REALDEV" ) + [ -z "$REALDEV" ] && exit 1 + fi +fi + +# Step out of the interactive loop for a moment. The next block needs to be +# executed in all cases. + +# We need to 'undouble' the MLIST array. Some people report that walking the +# /sys tree produces duplicate modules in the list. +# The awk command elimitates doubles without changing the order: +MLIST=$( echo $MLIST | tr ':' '\n' | awk '!x[$0]++' | tr '\n' ' ' ) +MLIST=$( echo $MLIST | tr ' ' ':' ) +MLIST=$(echo ${MLIST%:}) # To weed out a trailing ':' which was reported once. + +# Back to the interactive part: + +if [ "$INTERACTIVE" = "1" ]; then + MLIST=$( dialog --stdout --title "INITRD'S MODULE LIST" --inputbox "\ +The list here shows all modules needed to support your root filesystem \ +and boot from it. But you can change the list to use some alternative \ +or additional modules. If you don't know what to do, the default is safe." \ +0 0 "$MLIST" ) + if [ "$?" != "0" ]; then + exit 1 + fi + + EXTRA=$( dialog --stdout --title "EXTRA CONFIGURATION" --checklist "\ +Now is your chance for some additional configuration. All of these \ +configurations are optional and you can stick to the defaults." 11 72 3 \ +"KEYMAP" "Select keyboard layout (default: US)" \ + $([ $USING_LUKS = 1 ] && echo on || echo off) \ +"RESUMEDEV" "Select device for 'suspend-to-disk' feature" off \ +"UDEV" "Use UDEV in the initrd for device configuration" $(test $UDEV -eq 1 && echo on || echo off) \ +"WAIT" "Add delay to allow detection of slow disks at boot" $(test $WAIT -gt $WAIT_DEFAULT && echo on || echo off) ) + if [ "$?" != "0" ]; then + exit 1 + fi + + if echo $EXTRA | grep -q KEYMAP ; then + KEYMAP=$( dialog --stdout --title "KEYBOARD LAYOUT SELECTION" \ + --cancel-label "Skip" \ + --menu "You may select one of the following keyboard layouts. \ +If you do not select a keyboard map, 'us.map' \ +(the US keyboard layout) is the default. Use the UP/DOWN \ +arrow keys and PageUp/PageDown to scroll \ +through the whole list of choices." \ +22 55 11 \ +"qwerty/us.map" "" \ +"azerty/azerty.map" "" \ +"azerty/be-latin1.map" "" \ +"azerty/fr-latin0.map" "" \ +"azerty/fr-latin1.map" "" \ +"azerty/fr-latin9.map" "" \ +"azerty/fr-old.map" "" \ +"azerty/fr-pc.map" "" \ +"azerty/fr.map" "" \ +"azerty/wangbe.map" "" \ +"azerty/wangbe2.map" "" \ +"dvorak/ANSI-dvorak.map" "" \ +"dvorak/dvorak-l.map" "" \ +"dvorak/dvorak-r.map" "" \ +"dvorak/dvorak.map" "" \ +"dvorak/no-dvorak.map" "" \ +"fgGIod/tr_f-latin5.map" "" \ +"fgGIod/trf-fgGIod.map" "" \ +"olpc/es-olpc.map" "" \ +"olpc/pt-olpc.map" "" \ +"qwerty/bg-cp1251.map" "" \ +"qwerty/bg-cp855.map" "" \ +"qwerty/bg_bds-cp1251.map" "" \ +"qwerty/bg_bds-utf8.map" "" \ +"qwerty/bg_pho-cp1251.map" "" \ +"qwerty/bg_pho-utf8.map" "" \ +"qwerty/br-abnt.map" "" \ +"qwerty/br-abnt2.map" "" \ +"qwerty/br-latin1-abnt2.map" "" \ +"qwerty/br-latin1-us.map" "" \ +"qwerty/by-cp1251.map" "" \ +"qwerty/by.map" "" \ +"qwerty/bywin-cp1251.map" "" \ +"qwerty/cf.map" "" \ +"qwerty/cz-cp1250.map" "" \ +"qwerty/cz-lat2-prog.map" "" \ +"qwerty/cz-lat2.map" "" \ +"qwerty/cz-qwerty.map" "" \ +"qwerty/defkeymap.map" "" \ +"qwerty/defkeymap_V1.0.map" "" \ +"qwerty/dk-latin1.map" "" \ +"qwerty/dk.map" "" \ +"qwerty/emacs.map" "" \ +"qwerty/emacs2.map" "" \ +"qwerty/es-cp850.map" "" \ +"qwerty/es.map" "" \ +"qwerty/et-nodeadkeys.map" "" \ +"qwerty/et.map" "" \ +"qwerty/fi-latin1.map" "" \ +"qwerty/fi-latin9.map" "" \ +"qwerty/fi-old.map" "" \ +"qwerty/fi.map" "" \ +"qwerty/gr-pc.map" "" \ +"qwerty/gr.map" "" \ +"qwerty/hu101.map" "" \ +"qwerty/il-heb.map" "" \ +"qwerty/il-phonetic.map" "" \ +"qwerty/il.map" "" \ +"qwerty/is-latin1-us.map" "" \ +"qwerty/is-latin1.map" "" \ +"qwerty/it-ibm.map" "" \ +"qwerty/it.map" "" \ +"qwerty/it2.map" "" \ +"qwerty/jp106.map" "" \ +"qwerty/kazakh.map" "" \ +"qwerty/kyrgyz.map" "" \ +"qwerty/la-latin1.map" "" \ +"qwerty/lt.baltic.map" "" \ +"qwerty/lt.l4.map" "" \ +"qwerty/lt.map" "" \ +"qwerty/mk-cp1251.map" "" \ +"qwerty/mk-utf.map" "" \ +"qwerty/mk.map" "" \ +"qwerty/mk0.map" "" \ +"qwerty/nl.map" "" \ +"qwerty/nl2.map" "" \ +"qwerty/no-latin1.map" "" \ +"qwerty/no.map" "" \ +"qwerty/pc110.map" "" \ +"qwerty/pl.map" "" \ +"qwerty/pl1.map" "" \ +"qwerty/pl2.map" "" \ +"qwerty/pl3.map" "" \ +"qwerty/pl4.map" "" \ +"qwerty/pt-latin1.map" "" \ +"qwerty/pt-latin9.map" "" \ +"qwerty/pt.map" "" \ +"qwerty/ro.map" "" \ +"qwerty/ro_std.map" "" \ +"qwerty/ru-cp1251.map" "" \ +"qwerty/ru-ms.map" "" \ +"qwerty/ru-yawerty.map" "" \ +"qwerty/ru.map" "" \ +"qwerty/ru1.map" "" \ +"qwerty/ru2.map" "" \ +"qwerty/ru3.map" "" \ +"qwerty/ru4.map" "" \ +"qwerty/ru_win.map" "" \ +"qwerty/ruwin_alt-CP1251.map" "" \ +"qwerty/ruwin_alt-KOI8-R.map" "" \ +"qwerty/ruwin_alt-UTF-8.map" "" \ +"qwerty/ruwin_cplk-CP1251.map" "" \ +"qwerty/ruwin_cplk-KOI8-R.map" "" \ +"qwerty/ruwin_cplk-UTF-8.map" "" \ +"qwerty/ruwin_ct_sh-CP1251.map" "" \ +"qwerty/ruwin_ct_sh-KOI8-R.map" "" \ +"qwerty/ruwin_ct_sh-UTF-8.map" "" \ +"qwerty/ruwin_ctrl-CP1251.map" "" \ +"qwerty/ruwin_ctrl-KOI8-R.map" "" \ +"qwerty/ruwin_ctrl-UTF-8.map" "" \ +"qwerty/se-fi-ir209.map" "" \ +"qwerty/se-fi-lat6.map" "" \ +"qwerty/se-ir209.map" "" \ +"qwerty/se-lat6.map" "" \ +"qwerty/se-latin1.map" "" \ +"qwerty/sk-prog-qwerty.map" "" \ +"qwerty/sk-qwerty.map" "" \ +"qwerty/speakup-jfw.map" "" \ +"qwerty/speakupmap.map" "" \ +"qwerty/sr-cy.map" "" \ +"qwerty/sv-latin1.map" "" \ +"qwerty/tr_q-latin5.map" "" \ +"qwerty/tralt.map" "" \ +"qwerty/trf.map" "" \ +"qwerty/trq.map" "" \ +"qwerty/ttwin_alt-UTF-8.map.gz" "" \ +"qwerty/ttwin_cplk-UTF-8.map.gz" "" \ +"qwerty/ttwin_ct_sh-UTF-8.map.gz" "" \ +"qwerty/ttwin_ctrl-UTF-8.map.gz" "" \ +"qwerty/ua-cp1251.map.gz" "" \ +"qwerty/ua-utf-ws.map" "" \ +"qwerty/ua-utf.map" "" \ +"qwerty/ua-ws.map" "" \ +"qwerty/ua.map" "" \ +"qwerty/uk.map" "" \ +"qwerty/us-acentos.map" "" \ +"qwerty/us.map" "" \ +"qwertz/croat.map" "" \ +"qwertz/cz-us-qwertz.map" "" \ +"qwertz/cz.map" "" \ +"qwertz/de-latin1-nodeadkeys.map" "" \ +"qwertz/de-latin1.map" "" \ +"qwertz/de.map" "" \ +"qwertz/de_CH-latin1.map" "" \ +"qwertz/fr_CH-latin1.map" "" \ +"qwertz/fr_CH.map" "" \ +"qwertz/hu.map" "" \ +"qwertz/sg-latin1-lk450.map" "" \ +"qwertz/sg-latin1.map" "" \ +"qwertz/sg.map" "" \ +"qwertz/sk-prog-qwertz.map" "" \ +"qwertz/sk-qwertz.map" "" \ +"qwertz/slovene.map" "" ) + [ -n "$KEYMAP" ] && KEYMAP=$(basename $KEYMAP .map) + fi + + if echo $EXTRA | grep -q UDEV ; then + UDEV=1 + fi + + if echo $EXTRA | grep -q RESUMEDEV ; then + # Print information about swap partitions: + FREERAM=$(free -k | grep "^Mem:" | tr -s ' ' | cut -d' ' -f2) + SWPINFO="" + for SWPDEV in $(grep -w swap $FSTAB | cut -d' ' -f1) ; do + SWPINFO="$SWPINFO $SWPDEV Linux swap partition $(fdisk -s $SWPDEV) KB \\n" + [ $(fdisk -s $SWPDEV) -gt $FREERAM ] && RESUMEDEV=$SWPDEV + done + FREERAM=$(free -m | grep "^Mem:" | tr -s ' ' | cut -d' ' -f2) + RESUMEDEV=$( dialog --stdout --no-collapse --title "HIBERNATE RESUME DEVICE" --inputbox "\ +When using suspend-to-disk feature (hibernate), your computer's RAM is copied \ +to a swap device when it shuts down. The kernel will resume from that RAM \ +image at boot. This means that the swap partition must not be smaller than \ +the amount of RAM you have ($FREERAM MB). \n\ +$SWPINFO \n\ +Please specify a swap partition to be used for hibernation:" \ +0 0 "$RESUMEDEV") + [ -z "$RESUMEDEV" ] && exit 1 + fi + + if echo $EXTRA | grep -q WAIT ; then + WAIT=$( dialog --stdout --title "WAIT FOR ROOT DEVICE" --inputbox "\ +Some block devices are too slow to be detected properly at boot. USB storage \ +devices and some disk arrays have this 'feature'. To make your machine \ +boot properly, you can add some delay here, to wait until all your disks are \ +probed and detected. The time is in seconds:" 0 0 "$WAIT") + [ -z "$WAIT" ] && exit 1 + fi + + IMGFILE=$( dialog --stdout --title "INITRD IMAGE NAME" --inputbox "\ +Enter your initrd image filename." 0 0 "$IMGFILE" ) + [ -z "$IMGFILE" ] && exit 1 + +else + MLIST=$(add_rootfs_module) +fi + +# Add any modules passed along on the commandline: +if [ -n "$MKINIT_MODS" ]; then + [ -n "$MLIST" ] && MLIST="$MLIST:$(echo $MKINIT_MODS | tr ' ' ':')" \ + || MLIST="$(echo $MKINIT_MODS | tr ' ' ':')" +fi + +# Constructing the mkinitrd command: +MKINIT="mkinitrd -c -k $KVER -f $ROOTFS -r $ROOTDEV" + +# If we have a module list, add them: +if ! [ -z "$MLIST" -o "$MLIST" = ":" ]; then + MKINIT="$MKINIT -m $MLIST" +fi + +# Deal with LUKS/LVM/RAID: +if [ "$USING_LUKS" = "1" ]; then + MKINIT="$MKINIT -C $REALDEV" +fi +if [ "$USING_LVM" = "1" ]; then + MKINIT="$MKINIT -L" +fi +if [ "$USING_RAID" = "1" ]; then + MKINIT="$MKINIT -R" +fi + +if [ -n "$RESUMEDEV" ]; then + # Add hibernation partition: + MKINIT="$MKINIT -h $RESUMEDEV" +fi +if [ -n "$KEYMAP" -a "$KEYMAP" != "us" ]; then + # Add non-us keyboard mapping: + MKINIT="$MKINIT -l $KEYMAP" +fi +if [ $UDEV -eq 1 ]; then + # Add UDEV support: + MKINIT="$MKINIT -u" +fi +if [ -n "$WAIT" -a $WAIT -ne $WAIT_DEFAULT ]; then + # Add non-default wait time: + MKINIT="$MKINIT -w $WAIT" +fi +if ! echo "$MKINIT_PARAMS" | grep -q -- '-o ' ; then + # Add default output filename: + MKINIT="$MKINIT -o $IMGFILE" +fi +if [ -n "$MKINIT_PARAMS" ]; then + # Add user-supplied additional parameters: + MKINIT="$MKINIT $MKINIT_PARAMS" +fi + +# Notify the user: +if [ "$EMIT" = "all" ]; then + cat <<-EOT + # + # $(basename $0) revision $REV + # + # This script will now make a recommendation about the command to use + # in case you require an initrd image to boot a kernel that does not + # have support for your storage or root filesystem built in + # (such as the Slackware 'generic' kernels'). + # A suitable 'mkinitrd' command will be: + + $MKINIT + EOT +elif [ "$EMIT" = "run" ]; then + echo "$MKINIT" +elif [ "$EMIT" = "conf" ]; then + cat <<-EOT + SOURCE_TREE="$SOURCE_TREE" + CLEAR_TREE="$CLEAR_TREE" + OUTPUT_IMAGE="$IMGFILE" + KERNEL_VERSION="$KVER" + KEYMAP="$KEYMAP" + MODULE_LIST="$(echo $MLIST | cut -f2 -d\ )" + LUKSDEV="$REALDEV" + ROOTDEV="$ROOTDEV" + ROOTFS="$ROOTFS" + RESUMEDEV="$RESUMEDEV" + RAID="$USING_RAID" + LVM="$USING_LVM" + UDEV="$UDEV" + WAIT="$WAIT" + EOT +fi + +if [ -n "$KFILE" ]; then + if [ "$EMIT" = "all" ]; then + cat <<-EOT + # An entry in 'etc/lilo.conf' for kernel '$KFILE' would look like this: + EOT + fi + if [ "$EMIT" = "all" -o "$EMIT" = "lilo" ]; then + # Compensate for the syntax used for the LUKS-on-LVM case: + [ "$(basename $ROOTDEV)" = "$ROOTDEV" ] && BASE="/dev/mapper/" || BASE="" + cat <<-EOT + # Linux bootable partition config begins + # initrd created with '$MKINIT' + image = $KFILE + initrd = $IMGFILE + root = $BASE$ROOTDEV + label = $KVER + read-only + # Linux bootable partition config ends + EOT + fi +fi diff --git a/patches/source/mkinitrd/slack-desc b/patches/source/mkinitrd/slack-desc new file mode 100644 index 000000000..49d1a764f --- /dev/null +++ b/patches/source/mkinitrd/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +mkinitrd: mkinitrd (make an initial ramdisk) +mkinitrd: +mkinitrd: mkinitrd is a script to create an initial ramdisk that is loaded at +mkinitrd: the same time as the kernel. The initial ramdisk may be responsible +mkinitrd: for loading kernel modules (such a filesystem or SCSI controller +mkinitrd: module) that are needed to mount the root filesystem. +mkinitrd: +mkinitrd: The "initrd" is implemented as an initramfs. See the kernel +mkinitrd: documentation for more information on this, if you are interested. +mkinitrd: +mkinitrd: -- cgit v1.2.3