diff options
Diffstat (limited to 'source/a')
-rw-r--r-- | source/a/mkinitrd/busybox-dot-config | 48 | ||||
-rw-r--r-- | source/a/mkinitrd/mkinitrd | 143 | ||||
-rw-r--r-- | source/a/mkinitrd/mkinitrd.8 | 7 | ||||
-rw-r--r-- | source/a/mkinitrd/mkinitrd.8.orig | 287 | ||||
-rwxr-xr-x | source/a/mkinitrd/mkinitrd.SlackBuild | 8 | ||||
-rw-r--r-- | source/a/mkinitrd/mkinitrd_command_generator.8 | 2 | ||||
-rw-r--r-- | source/a/mkinitrd/mkinitrd_command_generator.sh | 21 | ||||
-rw-r--r-- | source/a/mkinitrd/setup.01.mkinitrd | 76 |
8 files changed, 454 insertions, 138 deletions
diff --git a/source/a/mkinitrd/busybox-dot-config b/source/a/mkinitrd/busybox-dot-config index 995a2355..69e0c9ab 100644 --- a/source/a/mkinitrd/busybox-dot-config +++ b/source/a/mkinitrd/busybox-dot-config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Busybox version: 1.28.3 -# Tue Apr 17 23:06:01 2018 +# Busybox version: 1.30.1 +# Sun Mar 3 13:10:00 2019 # CONFIG_HAVE_DOT_CONFIG=y @@ -24,6 +24,7 @@ CONFIG_FEATURE_WTMP=y CONFIG_FEATURE_PIDFILE=y CONFIG_PID_FILE_PATH="/var/run" CONFIG_BUSYBOX=y +CONFIG_FEATURE_SHOW_SCRIPT=y CONFIG_FEATURE_INSTALLER=y CONFIG_INSTALL_NO_USR=y CONFIG_FEATURE_SUID=y @@ -52,6 +53,7 @@ CONFIG_EXTRA_CFLAGS="" CONFIG_EXTRA_LDFLAGS="" CONFIG_EXTRA_LDLIBS="" # CONFIG_USE_PORTABLE_CODE is not set +CONFIG_STACK_OPTIMIZATION_386=y # # Installation Options ("make install" behavior) @@ -81,7 +83,9 @@ CONFIG_NO_DEBUG_LIB=y # Library Tuning # # CONFIG_FEATURE_USE_BSS_TAIL is not set +CONFIG_FLOAT_DURATION=y CONFIG_FEATURE_RTMINMAX=y +CONFIG_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS=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 @@ -90,6 +94,7 @@ CONFIG_MD5_SMALL=1 CONFIG_SHA3_SMALL=1 # CONFIG_FEATURE_FAST_TOP is not set # CONFIG_FEATURE_ETC_NETWORKS is not set +# CONFIG_FEATURE_ETC_SERVICES is not set CONFIG_FEATURE_EDITING=y CONFIG_FEATURE_EDITING_MAX_LEN=1024 CONFIG_FEATURE_EDITING_VI=y @@ -100,6 +105,7 @@ CONFIG_FEATURE_EDITING_HISTORY=64 CONFIG_FEATURE_TAB_COMPLETION=y # CONFIG_FEATURE_USERNAME_COMPLETION is not set CONFIG_FEATURE_EDITING_FANCY_PROMPT=y +CONFIG_FEATURE_EDITING_WINCH=y # CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set CONFIG_LOCALE_SUPPORT=y CONFIG_UNICODE_SUPPORT=y @@ -149,6 +155,7 @@ CONFIG_UNXZ=y CONFIG_XZCAT=y CONFIG_XZ=y CONFIG_BZIP2=y +CONFIG_BZIP2_SMALL=8 CONFIG_FEATURE_BZIP2_DECOMPRESS=y CONFIG_CPIO=y CONFIG_FEATURE_CPIO_O=y @@ -201,6 +208,7 @@ CONFIG_CKSUM=y CONFIG_COMM=y CONFIG_CP=y CONFIG_FEATURE_CP_LONG_OPTIONS=y +CONFIG_FEATURE_CP_REFLINK=y CONFIG_CUT=y CONFIG_DATE=y CONFIG_FEATURE_DATE_ISOFMT=y @@ -283,9 +291,9 @@ CONFIG_SHRED=y CONFIG_SHUF=y CONFIG_SLEEP=y CONFIG_FEATURE_FANCY_SLEEP=y -CONFIG_FEATURE_FLOAT_SLEEP=y CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y +# CONFIG_FEATURE_SORT_OPTIMIZE_MEMORY is not set CONFIG_SPLIT=y CONFIG_FEATURE_SPLIT_FANCY=y CONFIG_STAT=y @@ -437,6 +445,7 @@ CONFIG_FEATURE_FIND_MTIME=y CONFIG_FEATURE_FIND_MMIN=y CONFIG_FEATURE_FIND_PERM=y CONFIG_FEATURE_FIND_TYPE=y +CONFIG_FEATURE_FIND_EXECUTABLE=y CONFIG_FEATURE_FIND_XDEV=y CONFIG_FEATURE_FIND_MAXDEPTH=y CONFIG_FEATURE_FIND_NEWER=y @@ -450,6 +459,7 @@ CONFIG_FEATURE_FIND_DEPTH=y CONFIG_FEATURE_FIND_PAREN=y CONFIG_FEATURE_FIND_SIZE=y CONFIG_FEATURE_FIND_PRUNE=y +CONFIG_FEATURE_FIND_QUIT=y CONFIG_FEATURE_FIND_DELETE=y CONFIG_FEATURE_FIND_PATH=y CONFIG_FEATURE_FIND_REGEX=y @@ -477,6 +487,7 @@ CONFIG_FEATURE_XARGS_SUPPORT_ARGS_FILE=y CONFIG_HALT=y CONFIG_POWEROFF=y CONFIG_REBOOT=y +CONFIG_FEATURE_WAIT_FOR_INIT=y # CONFIG_FEATURE_CALL_TELINIT is not set CONFIG_TELINIT_PATH="" CONFIG_INIT=y @@ -651,6 +662,8 @@ CONFIG_FEATURE_MOUNT_FLAGS=y CONFIG_FEATURE_MOUNT_FSTAB=y CONFIG_FEATURE_MOUNT_OTHERTAB=y CONFIG_MOUNTPOINT=y +CONFIG_NOLOGIN=y +CONFIG_NOLOGIN_DEPENDENCIES=y CONFIG_NSENTER=y CONFIG_PIVOT_ROOT=y CONFIG_RDATE=y @@ -704,6 +717,7 @@ CONFIG_FEATURE_VOLUMEID_FAT=y CONFIG_FEATURE_VOLUMEID_HFS=y CONFIG_FEATURE_VOLUMEID_ISO9660=y CONFIG_FEATURE_VOLUMEID_JFS=y +CONFIG_FEATURE_VOLUMEID_LFS=y CONFIG_FEATURE_VOLUMEID_LINUXRAID=y CONFIG_FEATURE_VOLUMEID_LINUXSWAP=y CONFIG_FEATURE_VOLUMEID_LUKS=y @@ -725,6 +739,12 @@ CONFIG_FEATURE_VOLUMEID_XFS=y # CONFIG_ADJTIMEX is not set CONFIG_BBCONFIG=y CONFIG_FEATURE_COMPRESS_BBCONFIG=y +CONFIG_BC=y +CONFIG_DC=y +CONFIG_FEATURE_DC_BIG=y +# CONFIG_FEATURE_DC_LIBM is not set +CONFIG_FEATURE_BC_INTERACTIVE=y +CONFIG_FEATURE_BC_LONG_OPTIONS=y CONFIG_BEEP=y CONFIG_FEATURE_BEEP_FREQ=4000 CONFIG_FEATURE_BEEP_LENGTH_MS=30 @@ -743,8 +763,6 @@ CONFIG_FEATURE_CROND_CALL_SENDMAIL=y CONFIG_FEATURE_CROND_SPECIAL_TIMES=y 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 @@ -780,6 +798,8 @@ CONFIG_FEATURE_LESS_REGEXP=y # CONFIG_FEATURE_LESS_ASK_TERMINAL is not set # CONFIG_FEATURE_LESS_DASHCMD is not set # CONFIG_FEATURE_LESS_LINENUMS is not set +# CONFIG_FEATURE_LESS_RAW is not set +# CONFIG_FEATURE_LESS_ENV is not set CONFIG_LSSCSI=y CONFIG_MAKEDEVS=y # CONFIG_FEATURE_MAKEDEVS_LEAF is not set @@ -817,6 +837,7 @@ CONFIG_FEATURE_IPV6=y # CONFIG_FEATURE_UNIX_LOCAL is not set CONFIG_FEATURE_PREFER_IPV4_ADDRESS=y # CONFIG_VERBOSE_RESOLUTION_ERRORS is not set +# CONFIG_FEATURE_TLS_SHA1 is not set CONFIG_ARP=y CONFIG_ARPING=y CONFIG_BRCTL=y @@ -899,9 +920,12 @@ CONFIG_NETSTAT=y CONFIG_FEATURE_NETSTAT_WIDE=y CONFIG_FEATURE_NETSTAT_PRG=y CONFIG_NSLOOKUP=y +CONFIG_FEATURE_NSLOOKUP_BIG=y +CONFIG_FEATURE_NSLOOKUP_LONG_OPTIONS=y CONFIG_NTPD=y CONFIG_FEATURE_NTPD_SERVER=y CONFIG_FEATURE_NTPD_CONF=y +CONFIG_FEATURE_NTP_AUTH=y CONFIG_PING=y CONFIG_PING6=y CONFIG_FEATURE_FANCY_PING=y @@ -909,6 +933,8 @@ CONFIG_PSCAN=y CONFIG_ROUTE=y CONFIG_SLATTACH=y CONFIG_SSL_CLIENT=y +CONFIG_TC=y +CONFIG_FEATURE_TC_INGRESS=y CONFIG_TCPSVD=y CONFIG_UDPSVD=y CONFIG_TELNET=y @@ -921,10 +947,6 @@ CONFIG_FEATURE_TELNETD_INETD_WAIT=y CONFIG_TFTP=y CONFIG_FEATURE_TFTP_PROGRESS_BAR=y CONFIG_TFTPD=y - -# -# Common options for tftp/tftpd -# CONFIG_FEATURE_TFTP_GET=y CONFIG_FEATURE_TFTP_PUT=y CONFIG_FEATURE_TFTP_BLOCKSIZE=y @@ -960,6 +982,7 @@ CONFIG_UDHCPC6=y CONFIG_FEATURE_UDHCPC6_RFC3646=y CONFIG_FEATURE_UDHCPC6_RFC4704=y CONFIG_FEATURE_UDHCPC6_RFC4833=y +CONFIG_FEATURE_UDHCPC6_RFC5970=y # # Common options for DHCP applets @@ -1046,6 +1069,7 @@ CONFIG_FEATURE_SHOW_THREADS=y # CONFIG_SV is not set CONFIG_SV_DEFAULT_SERVICE_DIR="" # CONFIG_SVC is not set +# CONFIG_SVOK is not set # CONFIG_SVLOGD is not set # CONFIG_CHCON is not set # CONFIG_GETENFORCE is not set @@ -1074,6 +1098,8 @@ CONFIG_ASH=y CONFIG_ASH_OPTIMIZE_FOR_SIZE=y CONFIG_ASH_INTERNAL_GLOB=y CONFIG_ASH_BASH_COMPAT=y +# CONFIG_ASH_BASH_SOURCE_CURDIR is not set +CONFIG_ASH_BASH_NOT_FOUND_HOOK=y CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_ALIAS=y CONFIG_ASH_RANDOM_SUPPORT=y @@ -1090,6 +1116,8 @@ CONFIG_CTTYHACK=y # CONFIG_HUSH is not set # CONFIG_HUSH_BASH_COMPAT is not set # CONFIG_HUSH_BRACE_EXPANSION is not set +# CONFIG_HUSH_LINENO_VAR is not set +# CONFIG_HUSH_BASH_SOURCE_CURDIR is not set # CONFIG_HUSH_INTERACTIVE is not set # CONFIG_HUSH_SAVEHISTORY is not set # CONFIG_HUSH_JOB is not set @@ -1110,6 +1138,7 @@ CONFIG_CTTYHACK=y # CONFIG_HUSH_READONLY is not set # CONFIG_HUSH_KILL is not set # CONFIG_HUSH_WAIT is not set +# CONFIG_HUSH_COMMAND is not set # CONFIG_HUSH_TRAP is not set # CONFIG_HUSH_TYPE is not set # CONFIG_HUSH_TIMES is not set @@ -1131,6 +1160,7 @@ CONFIG_FEATURE_SH_EXTRA_QUIET=y # CONFIG_FEATURE_SH_NOFORK is not set # CONFIG_FEATURE_SH_READ_FRAC is not set CONFIG_FEATURE_SH_HISTFILESIZE=y +CONFIG_FEATURE_SH_EMBEDDED_SCRIPTS=y # # System Logging Utilities diff --git a/source/a/mkinitrd/mkinitrd b/source/a/mkinitrd/mkinitrd index 7c2f7629..6f4ff3c1 100644 --- a/source/a/mkinitrd/mkinitrd +++ b/source/a/mkinitrd/mkinitrd @@ -51,6 +51,8 @@ # Modified by Patrick Volkerding <volkerdi@slackware.com> 12 July 2017 # Add support for including Slackware and kernel versions in the # output filename. Thanks to SeB. +# Modified by Patrick Volkerding <volkerdi@slackware.com> 04 Feb 2019 +# Allow specifying more than one kernel version. MKINITRD_VERSION=1.4.11 @@ -148,8 +150,10 @@ EOF create_new_source_tree() { mkdir -p $SOURCE_TREE - # Make sure a kernel module directory exists: - mkdir -p $SOURCE_TREE/lib/modules/${KERNEL_VERSION} + # Make sure the kernel module directories exist: + for kver in $(echo ${KERNEL_VERSION} | tr ':' '\n') ; do + mkdir -p $SOURCE_TREE/lib/modules/${kver} + done # 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: @@ -445,10 +449,12 @@ if echo "$OUTPUT_IMAGE" | grep -qE "%KVER%|%SLACKVER%" ; then fi # 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 +for kver in $(echo ${KERNEL_VERSION} | tr ':' '\n') ; do + if [ ! -d /lib/modules/$kver ]; then + echo "ERROR: No /lib/modules/$kver kernel modules tree found for kernel \"$kver\"" + exit 1 + fi +done # If clearing source tree was requested, do that first if [ "$CLEAR_TREE" = "1" ]; then @@ -644,10 +650,12 @@ if [ ! -z "$CRYPT" -o ! -z "$LVM" ]; then $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 +# Make module directories: +for kver in $(echo ${KERNEL_VERSION} | tr ':' '\n') ; do + if [ ! -d $SOURCE_TREE/lib/modules/$kver ]; then + mkdir -p $SOURCE_TREE/lib/modules/$kver + fi +done # Copy kmod/modprobe stuff to initrd: for i in kmod depmod insmod lsmod modinfo modprobe rmmod ; do @@ -656,8 +664,10 @@ for i in kmod depmod insmod lsmod modinfo modprobe rmmod ; do 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 +for kver in $(echo ${KERNEL_VERSION} | tr ':' '\n') ; do + cp /lib/modules/$kver/modules.{builtin,order} \ + $SOURCE_TREE/lib/modules/$kver +done # If an executable $SOURCE_TREE/load_kernel_modules already exists, then # we assume you will want to load the kernel modules mentioned in there. @@ -699,67 +709,72 @@ if [ ! -z "$MODULE_LIST" ]; then 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 + # Repeat these tasks for all kernel versions support has been requested for: + for kver in $(echo ${KERNEL_VERSION} | tr ':' '\n') ; do + + # 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 + # Get MODULE deps and prepare modprobe lines + /sbin/modprobe --set-version $kver --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)" )" + 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 + # 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 + fi - if ! grep -qx "$LINE" $SOURCE_TREE/load_kernel_modules ; then - echo "$LINE" >> $SOURCE_TREE/load_kernel_modules - 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 + # 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 - done - # Pregenerate the module dependency information - /sbin/depmod -a -b $SOURCE_TREE ${KERNEL_VERSION} + # Pregenerate the module dependency information + /sbin/depmod -a -b $SOURCE_TREE $kver + + done # repeat for all kernel versions # Copy /{etc,lib}/modprobe.d/* if desired if [ ! -z $MODCONF ]; then diff --git a/source/a/mkinitrd/mkinitrd.8 b/source/a/mkinitrd/mkinitrd.8 index 7e0247a0..1874d814 100644 --- a/source/a/mkinitrd/mkinitrd.8 +++ b/source/a/mkinitrd/mkinitrd.8 @@ -25,7 +25,7 @@ mkinitrd \- create or rebuilt an initrd (initial ramdisk) using initramfs (simpl .B \-h hibernate_partition ] [ -.B \-k kernel_version +.B \-k kernel_version1:kernel_version2:kernel_version3... ] [ .B \-m module1:module2:module3... @@ -105,9 +105,10 @@ Display a help summary. .B \-h hibernate_partition Specify the swap partition holding the hibernation image. .TP -.B \-k kernel version +.B \-k kernel version list Use kernel modules from the specified kernel version. mkinitrd will look -for them in /lib/modules/(kernel version). +for them in /lib/modules/(kernel version). This may be a single kernel version, +or it may be a colon-delimited list of kernel versions. .TP .B \-l keymap Load an alternative keyboard mapping. All supported keyboard mappings diff --git a/source/a/mkinitrd/mkinitrd.8.orig b/source/a/mkinitrd/mkinitrd.8.orig new file mode 100644 index 00000000..7e0247a0 --- /dev/null +++ b/source/a/mkinitrd/mkinitrd.8.orig @@ -0,0 +1,287 @@ +.\" -*- 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 to load kernel +kernel modules in order to access the root partition. An initrd might also +be required to unlock an encrypted device. Usually these modules are +required to support the filesystem used by the root partition (e.g., ext4, +jfs, 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 +.BI \-r \ root_device +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. +.I root_device +can be a device node path, UUID, or LABEL. See examples for \fB\-C\fR below. +.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 +.BI \-C \ device_list +A colon (:) delimited list of luks encrypted block devices to be unlocked by +the initrd using cryptsetup. +.I device_list +may include any of: device node path, UUID, or LABEL. All devices that must be +unlocked in order to access the root filesystem must be specified. For example: + + -C /dev/sda2:/dev/sda3 +.br + -C UUID=ec6dea40-c8d8-4590-850a-a757be60e45a +.br + -C LABEL=darkstar + +Each unlocked device will be assigned an automatically generated luks device +name of the form luks<device> where '<device>' will be the basename of the +encrypted device node path. For example: + + /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 <volkerdi@slackware.com> diff --git a/source/a/mkinitrd/mkinitrd.SlackBuild b/source/a/mkinitrd/mkinitrd.SlackBuild index 4e298bae..8aaa9b27 100755 --- a/source/a/mkinitrd/mkinitrd.SlackBuild +++ b/source/a/mkinitrd/mkinitrd.SlackBuild @@ -24,8 +24,8 @@ cd $(dirname $0) ; CWD=$(pwd) PKGNAM=mkinitrd VERSION=${VERSION:-1.4.11} -BB=1.28.3 -BUILD=${BUILD:-11} +BB=1.30.1 +BUILD=${BUILD:-12} # Automatically determine the architecture we're building on: if [ -z "$ARCH" ]; then @@ -60,7 +60,7 @@ rm -rf $PKG mkdir -p $TMP $PKG cd $TMP rm -rf busybox-$BB -tar xvf $CWD/busybox-$BB.tar.bz2 || exit 1 +tar xvf $CWD/busybox-$BB.tar.bz2 || tar xvf $CWD/busybox-$BB.tar.?z || exit 1 cd busybox-$BB || exit 1 if [ -d $CWD/fixes-$BB ]; then @@ -103,7 +103,7 @@ 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* \ +cp -a AUTHORS COPYING* INSTALL LICENSE README* TODO* \ $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 diff --git a/source/a/mkinitrd/mkinitrd_command_generator.8 b/source/a/mkinitrd/mkinitrd_command_generator.8 index 954fab48..d64b6d54 100644 --- a/source/a/mkinitrd/mkinitrd_command_generator.8 +++ b/source/a/mkinitrd/mkinitrd_command_generator.8 @@ -63,7 +63,7 @@ Show more detailed information/examples\&. .PP \fB\-k \fR\fB\fIkernelversion\fR\fR .RS 4 -Use specific kernel version\&. +Use specific kernel version\&. This may also be a colon-delimited list of kernel versions to use\&. .RE .PP \fB\-m \fR\fB\fIadditional mods\fR\fR diff --git a/source/a/mkinitrd/mkinitrd_command_generator.sh b/source/a/mkinitrd/mkinitrd_command_generator.sh index df6f24c9..489225be 100644 --- a/source/a/mkinitrd/mkinitrd_command_generator.sh +++ b/source/a/mkinitrd/mkinitrd_command_generator.sh @@ -72,7 +72,9 @@ basic_usage() { -i | --interactive Navigate through menus instead of using commandline arguments. --longhelp Show more detailed information/examples. - -k <kernelversion> Use specific kernel version. + -k <kernelversion> Use specific kernel version. Or, support + more than one kernel version by passing a + list of versions separated by colons (:). -m <"additional mods"> Additional modules to pass to mkinitrd, separated by colons (:). -l | --lilo Only show lilo.conf section @@ -345,7 +347,7 @@ while [ ! -z "$1" ]; do echo "Error: -k requires a kernel version." exit 1 fi - KVER=$2 + KVERLIST=$2 shift 2 ;; -m) @@ -411,6 +413,15 @@ fi # Determine kernel version to use, # and check if modules for this kernel are actually present: +if [ ! -z $KVERLIST ]; then + for kernel_version in $(echo $KVERLIST | tr ":" "\n") ; do + KVER=$kernel_version + if [ ! -d /lib/modules/$KVER ]; then + echo "Modules for kernel $KVER aren't installed." + exit 1 + fi + done +fi if [ -z "$KVER" ]; then if [ -n "$KFILE" ]; then KVER="$(strings $KFILE | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')" @@ -775,7 +786,11 @@ if [ -n "$MKINIT_MODS" ]; then fi # Constructing the mkinitrd command: -MKINIT="mkinitrd -c -k $KVER -f $ROOTFS -r $ROOTDEV" +if [ -z $KVERLIST ]; then + MKINIT="mkinitrd -c -k $KVER -f $ROOTFS -r $ROOTDEV" +else + MKINIT="mkinitrd -c -k $KVERLIST -f $ROOTFS -r $ROOTDEV" +fi # If we have a module list, add them: if ! [ -z "$MLIST" -o "$MLIST" = ":" ]; then diff --git a/source/a/mkinitrd/setup.01.mkinitrd b/source/a/mkinitrd/setup.01.mkinitrd index 8bddb5c5..31e87144 100644 --- a/source/a/mkinitrd/setup.01.mkinitrd +++ b/source/a/mkinitrd/setup.01.mkinitrd @@ -1,69 +1,37 @@ #!/bin/sh #BLURB="Generate /boot/initrd.gz for the generic kernel" -# First, clear the existing initrd-tree: -if [ -f $(readlink -f boot/vmlinuz-generic) -o -f $(readlink -f boot/vmlinuz-generic-smp) ]; then - rm -rf boot/initrd-tree +# Start with the version for vmlinuz-generic-smp: +KERNEL_SYMLINK="boot/vmlinuz-generic-smp" +if [ -L $KERNEL_SYMLINK ]; then + KERNEL_VERSION_LIST=$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ') fi -# Next, if boot/vmlinuz-generic is a symlink to a kernel, generate a ramdisk -# using the modules for that kernel: +# Next add the version for vmlinuz-generic: KERNEL_SYMLINK="boot/vmlinuz-generic" if [ -L $KERNEL_SYMLINK ]; then - KERNEL_VERSION="$(readlink -f $KERNEL_SYMLINK | sed "s/-smp/_smp/g" | rev | cut -f 1 -d - | rev | sed "s/_smp/-smp/g")" - # Sanity check. Not sure how/why, but there are reports we can arrive here - # without a $KERNEL_VERSION. The only way I see how is if the symlink were - # pointing to file with a malformed name - # (i.e. not ${KERNEL_SYMLINK}-${KERNEL_VERSION}). - # If ${KERNEL_VERSION} is blank, we'll bail out here. - # Any information on known cases that might cause this would be appreciated. - if [ ! "$KERNEL_VERSION" = "" ]; then - dialog --title "GENERATING INITIAL RAMDISK" --infobox \ - "Generating an initial ramdisk for use with the $KERNEL_VERSION generic \ -kernel. The initial ramdisk contains kernel modules needed to mount the \ -root partition, and must be regenerated whenever the kernel is updated. To \ -regenerate the initrd, select this setup script from within pkgtool, or run \ -'geninitrd' which will produce an initial ramdisk (/boot/initrd.gz) for the \ -kernel pointed to by the /$KERNEL_SYMLINK symlink." 9 68 - chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION | sed "s/-c -k/-k/g" | chroot . bash 1> /dev/null 2> /dev/null + if [ -z $KERNEL_VERSION_LIST ]; then + KERNEL_VERSION_LIST=$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ') else - dialog --title "INTERNAL ERROR" --msgbox \ - "An internal error was detected. Please report the following information: \n\ -KERNEL_SYMLINK = $KERNEL_SYMLINK \n\ -KERNEL_SYMLINK (points to) = $(readlink -f $KERNEL_SYMLINK) \n\ -KERNEL_VERSION (is blank) \n\ -ls -l \$KERNEL_SYMLINK: \n\ -$(ls -l $KERNEL_SYMLINK)" 0 0 + KERNEL_VERSION_LIST="$KERNEL_VERSION_LIST:$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')" fi fi -# If boot/vmlinuz-generic-smp is a symlink to a kernel, also include the -# modules for that kernel: -KERNEL_SYMLINK="boot/vmlinuz-generic-smp" -if [ -L $KERNEL_SYMLINK ]; then - KERNEL_VERSION="$(readlink -f $KERNEL_SYMLINK | sed "s/-smp/_smp/g" | rev | cut -f 1 -d - | rev | sed "s/_smp/-smp/g")" - # Sanity check. Not sure how/why, but there are reports we can arrive here - # without a $KERNEL_VERSION. The only way I see how is if the symlink were - # pointing to file with a malformed name - # (i.e. not ${KERNEL_SYMLINK}-${KERNEL_VERSION}). - # If ${KERNEL_VERSION} is blank, we'll bail out here. - # Any information on known cases that might cause this would be appreciated. - if [ ! "$KERNEL_VERSION" = "" ]; then - dialog --title "GENERATING INITIAL RAMDISK" --infobox \ - "Generating an initial ramdisk for use with the $KERNEL_VERSION generic \ -kernel. The initial ramdisk contains kernel modules needed to mount the \ +# Proper plural(s): +if echo $KERNEL_VERSION_LIST | grep -q : ; then + KERNEL=kernels +else + KERNEL=kernel +fi + +# Generate the initrd: +if [ ! -z $KERNEL_VERSION_LIST ]; then + dialog --title "GENERATING INITIAL RAMDISK" --infobox \ + "Generating an initial ramdisk for use with the $KERNEL_VERSION_LIST generic \ +${KERNEL}. The initial ramdisk contains kernel modules needed to mount the \ root partition, and must be regenerated whenever the kernel is updated. To \ regenerate the initrd, select this setup script from within pkgtool, or run \ 'geninitrd' which will produce an initial ramdisk (/boot/initrd.gz) for the \ -kernel pointed to by the /$KERNEL_SYMLINK symlink." 9 68 - chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION | sed "s/-c -k/-k/g" | chroot . bash 1> /dev/null 2> /dev/null - else - dialog --title "INTERNAL ERROR" --msgbox \ - "An internal error was detected. Please report the following information: \n\ -KERNEL_SYMLINK = $KERNEL_SYMLINK \n\ -KERNEL_SYMLINK (points to) = $(readlink -f $KERNEL_SYMLINK) \n\ -KERNEL_VERSION (is blank) \n\ -ls -l \$KERNEL_SYMLINK: \n\ -$(ls -l $KERNEL_SYMLINK)" 0 0 - fi +installed generic ${KERNEL}." 9 68 + chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION_LIST | chroot . bash 1> /dev/null 2> /dev/null fi |