summaryrefslogtreecommitdiffstats
path: root/source/a/mkinitrd/mkinitrd
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2012-09-26 01:10:42 +0000
committer Eric Hameleers <alien@slackware.com>2018-05-31 22:51:55 +0200
commit9664bee729d487bcc0a0bc35859f8e13d5421c75 (patch)
treeb428a16618e36ed864a8d76ea3435e19a452bf90 /source/a/mkinitrd/mkinitrd
parent75a4a592e5ccda30715f93563d741b83e0dcf39e (diff)
downloadcurrent-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.gz
current-9664bee729d487bcc0a0bc35859f8e13d5421c75.tar.xz
Slackware 14.0slackware-14.0
Wed Sep 26 01:10:42 UTC 2012 Slackware 14.0 x86_64 stable is released! We're perfectionists here at Slackware, so this release has been a long time a-brewing. But we think you'll agree that it was worth the wait. Slackware 14.0 combines modern components, ease of use, and flexible configuration... our "KISS" philosophy demands it. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Thanks to everyone who helped make this happen. The Slackware team, the upstream developers, and (of course) the awesome Slackware user community. Have fun! :-)
Diffstat (limited to '')
-rw-r--r--source/a/mkinitrd/mkinitrd74
-rw-r--r--source/a/mkinitrd/mkinitrd.88
-rwxr-xr-xsource/a/mkinitrd/mkinitrd.SlackBuild45
3 files changed, 94 insertions, 33 deletions
diff --git a/source/a/mkinitrd/mkinitrd b/source/a/mkinitrd/mkinitrd
index 1a5b7731f..c5e30218b 100644
--- a/source/a/mkinitrd/mkinitrd
+++ b/source/a/mkinitrd/mkinitrd
@@ -42,13 +42,15 @@
# 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 <volkerdi@slackware.com> 21 August 2012
+# Add Btrfs multi-device filesystem support option (-B).
-MKINITRD_VERSION=1.4.6
+MKINITRD_VERSION=1.4.7
# Don't include these things from /lib/udev/ in the initrd image
LIBUDEV_BLACKLIST="\
ipod-set-info \
- check-mtp-camera \
+ check-mtp-device \
check-ptp-camera \
udev-configure-printer"
@@ -97,6 +99,8 @@ initrd, and the script is easy to modify. Be creative. :-)
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/ to the initrd
-R Add support for RAID partitions
-V Display version number
@@ -234,8 +238,9 @@ copy_libs() {
}
copy_modconf() {
- mkdir -p $SOURCE_TREE/etc
+ 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:
@@ -255,6 +260,8 @@ fi
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
@@ -356,6 +363,10 @@ while [ ! -z "$1" ]; do
LVM=1
shift
;;
+ -B)
+ BTRFS=1
+ shift
+ ;;
-M)
MODCONF=1
shift
@@ -459,12 +470,28 @@ fi
# Include RAID support in initrd
if [ ! -z "$RAID" ]; then
- if [ -r /sbin/mdadm ]; 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
+ 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: mdadm binary is missing, RAID support not installed"
+ echo "ERROR: btrfs binary is missing, Btrfs support not installed"
fi
fi
@@ -474,7 +501,11 @@ if [ ! -z "$UDEV" ]; then
cp -a /lib/udev $SOURCE_TREE/lib/
# But we don't want all of /lib/udev
for file in $(echo $LIBUDEV_BLACKLIST) ; do
- rm -f $SOURCE_TREE/lib/udev/$file ;
+ # 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
@@ -493,6 +524,9 @@ if [ ! -z "$LVM" ]; then
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
else
echo "LVM binary is missing, LVM support isn't installed"
fi
@@ -528,6 +562,16 @@ 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:
@@ -589,8 +633,8 @@ if [ ! -z "$MODULE_LIST" ]; then
/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 -q "$(basename $SRCMOD .ko)" $SOURCE_TREE/load_kernel_modules 2>/dev/null ; then
- LINE="$(echo "modprobe -v $(basename $SRCMOD .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
@@ -611,6 +655,15 @@ if [ ! -z "$MODULE_LIST" ]; then
# 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
@@ -631,6 +684,11 @@ 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/source/a/mkinitrd/mkinitrd.8 b/source/a/mkinitrd/mkinitrd.8
index be4e9d42d..6ee25bdde 100644
--- a/source/a/mkinitrd/mkinitrd.8
+++ b/source/a/mkinitrd/mkinitrd.8
@@ -52,6 +52,9 @@ mkinitrd \- create or rebuilt an initrd (initial ramdisk) using initramfs (simpl
.B \-K luks_keyfile
]
[
+.B \-B
+]
+[
.B \-L
]
[
@@ -171,6 +174,11 @@ you need to set:
-K LABEL=TRAVELSTICK:/keys/alien.luks
.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.
diff --git a/source/a/mkinitrd/mkinitrd.SlackBuild b/source/a/mkinitrd/mkinitrd.SlackBuild
index 953d3cf87..322fa8c5d 100755
--- a/source/a/mkinitrd/mkinitrd.SlackBuild
+++ b/source/a/mkinitrd/mkinitrd.SlackBuild
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright 2007, 2008, 2009, 2010, 2011 Patrick J. Volkerding, Sebeka, MN, USA
+# Copyright 2007, 2008, 2009, 2010, 2011, 2012 Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -21,9 +21,9 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-VERSION=${VERSION:-1.4.6}
-BB=1.18.4
-BUILD=${BUILD:-11}
+VERSION=${VERSION:-1.4.7}
+BB=1.20.1
+BUILD=${BUILD:-6}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
@@ -54,6 +54,12 @@ 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"#' \
@@ -105,29 +111,18 @@ chown root:root $PKG/etc/mkinitrd.conf.sample
chmod 644 $PKG/etc/mkinitrd.conf.sample
mkdir -p $PKG/usr/doc/mkinitrd-$VERSION
-cp -a $CWD/README.initrd $PKG/usr/doc/mkinitrd-$VERSION
-
-( cd $PKG/usr/doc/mkinitrd-$VERSION
- DATE="$(date)"
- KERNEL_VERSION="$(uname -r)"
- PACKAGE_VERSION="$(uname -r | tr - _)"
- LILO_KERNEL_NAME="$(echo $(uname -r) | tr -d . | tr -d - )"
- cat README.initrd | sed -e s/@DATE@/"$DATE"/ > README.initrd1
- cat README.initrd1 | sed -e s/@KERNEL_VERSION@/"$KERNEL_VERSION"/ > README.initrd2
- cat README.initrd2 | sed -e s/@PACKAGE_VERSION@/"$PACKAGE_VERSION"/ > README.initrd3
- cat README.initrd3 | sed -e s/@LILO_KERNEL_NAME@/"$LILO_KERNEL_NAME"/ > README.initrd4
- cat README.initrd4 | sed -e s/@MKINITRD_VERSION@/"$VERSION"/ > README.initrd5
- cat README.initrd5 | sed -e s/@ARCH@/"$ARCH"/ > README.initrd6
- cat README.initrd6 | sed -e s/@BUILD@/"$BUILD"/ > README.initrd
- rm -f README.initrd{1,2,3,4,5,6}
-)
-chmod 644 $PKG/usr/doc/mkinitrd-$VERSION/*
-chown root:root $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
-( cd $PKG/boot
- ln -sf /usr/doc/mkinitrd-$VERSION/README.initrd .
-)
+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