dracut-040-78.git20141219

- git snapshot
This commit is contained in:
Harald Hoyer 2014-12-19 15:01:39 +01:00
parent 3e293267a2
commit b94732d29a
49 changed files with 2670 additions and 1 deletions

View File

@ -0,0 +1,51 @@
From 1f8abe81a9fca0f44c63bf3bd30a7f7fbec28642 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 16 Dec 2014 12:53:18 +0100
Subject: [PATCH] dmsquash-live: setup the images in /run/initramfs
We want to cleanup / after switch_root. Placing the loop files in /
works, but it is more sane to put them in /run/initramfs
---
modules.d/90dmsquash-live/dmsquash-live-root.sh | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
index d921f0c..6e504a6 100755
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
@@ -162,9 +162,9 @@ fi
if [ -n "$OSMINSQFS" ]; then
# decompress the delta data
- dd if=$OSMINSQFS of=/osmin.img 2> /dev/null
+ dd if=$OSMINSQFS of=/run/initramfs/osmin.img 2> /dev/null
OSMIN_SQUASHED_LOOPDEV=$( losetup -f )
- losetup -r $OSMIN_SQUASHED_LOOPDEV /osmin.img
+ losetup -r $OSMIN_SQUASHED_LOOPDEV /run/initramfs/osmin.img
mkdir -m 0755 -p /run/initramfs/squashfs.osmin
mount -n -t squashfs -o ro $OSMIN_SQUASHED_LOOPDEV /run/initramfs/squashfs.osmin
OSMIN_LOOPDEV=$( losetup -f )
@@ -185,8 +185,8 @@ if [ -n "$FSIMG" ] ; then
if [ -n "$writable_fsimg" ] ; then
# mount the provided fileysstem read/write
echo "Unpacking live filesystem (may take some time)"
- unpack_archive $FSIMG /tmp/fsimg/
- losetup $BASE_LOOPDEV /tmp/fsimg/rootfs.img
+ unpack_archive $FSIMG /run/initramfs/fsimg/
+ losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
else
# mount the filesystem read-only and add a dm snapshot for writes
@@ -204,10 +204,10 @@ if [ -e "$SQUASHED" ] ; then
if [ -n "$live_ram" ] ; then
echo "Copying live image to RAM..."
echo "(this may take a few minutes)"
- dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
+ dd if=$SQUASHED of=/run/initramfs/squashed.img bs=512 2> /dev/null
umount -n /run/initramfs/live
echo "Done copying live image to RAM."
- SQUASHED="/squashed.img"
+ SQUASHED="/run/initramfs/squashed.img"
fi
SQUASHED_LOOPDEV=$( losetup -f )

View File

@ -0,0 +1,195 @@
From 552c37e1563eccbc25968064b087232b9eaea987 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:45:52 +0100
Subject: [PATCH] mkinitrd-suse: Update to sles12 SUSE state
Incorporates these patches:
- 0013 mkinitrd-suse: do not update bootloader if no kernel was found
bnc#858268
- 0018 mkinitrd-suse: Fix whitespaces when adding drivers
- 0032 mkinitrd-suse.sh: Use '--hostonly' and '--hostonly-cmdline' correctly
bnc#874000,bnc#874905,bnc#874363
- 0039 Remove --force parameter from mkinitrd
- 0041 mkinitd-suse: remove --hostonly and --hostonly-cmdline
Should be set via configuration files, not in the script itself.
- 0051 mkinitrd-suse: add 'update bootloader' message
- 0120 mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be generated
bnc#886630
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
mkinitrd-suse.8.asc | 7 +++---
mkinitrd-suse.sh | 66 +++++++++++++++++++++++++----------------------------
2 files changed, 34 insertions(+), 39 deletions(-)
diff --git a/mkinitrd-suse.8.asc b/mkinitrd-suse.8.asc
index 9eb8fc9..cdb8e3a 100644
--- a/mkinitrd-suse.8.asc
+++ b/mkinitrd-suse.8.asc
@@ -76,7 +76,9 @@ OPTIONS
**-A**::
Create a so called "monster initrd" which includes all available
- features and modules.
+ features and modules. This calls dracut with --no-hostonly and
+ --no-hostonly-cmdline parameters internally, instead of the default
+ --hostonly and --hostonly-cmdline.
**-v, --verbose**::
increase verbosity level
@@ -85,9 +87,6 @@ OPTIONS
Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
testing if you dont want to clutter the system log.
-**--force**::
- overwrite existing initramfs file.
-
**--help**::
print a help message and exit.
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
index 23dc262..af42cbe 100755
--- a/mkinitrd-suse.sh
+++ b/mkinitrd-suse.sh
@@ -20,8 +20,6 @@
boot_dir="/boot"
quiet=0
-host_only=1
-force=0
logfile=/var/log/YaST2/mkinitrd.log
dracut_cmd=dracut
@@ -68,10 +66,7 @@ usage () {
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
- $cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated"
- $cmd " System Description Table) to initrd. This"
- $cmd " replaces the DSDT of the BIOS. Defaults to"
- $cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel."
+ $cmd " -a acpi_dsdt Obsolete, do not use."
$cmd " -s size Add splash animation and bootscreen to initrd."
[[ $1 = '-n' ]] && exit 0
@@ -204,8 +199,6 @@ default_kernel_images() {
for initrd_image in $initrd_images;do
targets="$targets $initrd_image"
done
- host_only=1
- force=1
}
while (($# > 0)); do
@@ -218,8 +211,6 @@ while (($# > 0)); do
for kernel_image in $kernel_images;do
kernels="$kernels ${kernel_image#*-}"
done
- host_only=1
- force=1
;;
-i) read_arg initrd_images "$@" || shift $?
for initrd_image in $initrd_images;do
@@ -261,7 +252,7 @@ while (($# > 0)); do
dracut_cmdline="${dracut_cmdline} ip=$(ipconfig $static_if)":
;;
-a) read_arg acpi_dsdt "$@" || shift $?
- echo "mkinitrd: custom DSDT not yet supported"
+ echo "Obsolete -a param, use acpi_table_dir= and acpi_override= variables in /etc/dracut.conf.d/"
exit 1
;;
-s) read_arg boot_splash "$@" || shift $?
@@ -275,7 +266,6 @@ while (($# > 0)); do
--version|-R)
echo "mkinitrd: dracut compatibility wrapper"
exit 0;;
- --force) force=1;;
--quiet|-q) quiet=1;;
*) if [[ ! $targets ]]; then
targets=$1
@@ -289,15 +279,17 @@ while (($# > 0)); do
done
[[ $targets && $kernels ]] || default_kernel_images
-[[ $targets && $kernels ]] || (error "No kernel found in $boot_dir" && usage)
+if [[ ! $targets || ! $kernels ]];then
+ error "No kernel found in $boot_dir"
+fi
# We can have several targets/kernels, transform the list to an array
targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
-[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly"
-[[ $force == 1 ]] && dracut_args="${dracut_args} --force"
+dracut_args="${dracut_args} --force"
+
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
@@ -306,11 +298,9 @@ if [ -f /etc/sysconfig/kernel ] ; then
. /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list="${INITRD_MODULES}"
-basicmodules="$basicmodules ${module_list}"
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
-[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}"
+shopt -s extglob
-echo "Creating: target|kernel|dracut args|basicmodules "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
@@ -320,28 +310,34 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); do
fi
kernel="${kernels[$i]}"
+ if is_xen_kernel $kernel $rootfs ; then
+ modules_all="${module_list} ${domu_module_list}"
+ else
+ modules_all="${module_list}"
+ fi
+
+ # Remove leading and trailing spaces needs (set above): shopt -s extglob
+ modules_all=${modules_all%%+([[:space:]])}
+ modules_all=${modules_all##+([[:space:]])}
+
+ echo "Creating initrd: $target"
+
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
- echo "$target|$kernel|$dracut_args|$basicmodules"
- if is_xen_kernel $kernel $rootfs ; then
- basicmodules="$basicmodules ${domu_module_list}"
- fi
- if [[ $basicmodules ]]; then
- $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
- "$kernel" &>/dev/null
- else
+ # Duplicate code: --force-drivers must not be called with empty string
+ # -> dracut bug workarounded ugly, because of complex whitespace
+ # expansion magics
+ if [ -n "${modules_all}" ];then
+ $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel" &>/dev/null
+ else
$dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
- fi
+ fi
else
- if is_xen_kernel $kernel $rootfs ; then
- basicmodules="$basicmodules ${domu_module_list}"
- fi
- if [[ $basicmodules ]]; then
- $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
- "$kernel"
- else
+ if [ -n "${modules_all}" ];then
+ $dracut_cmd $dracut_args --force-drivers "${modules_all}" "$target" "$kernel"
+ else
$dracut_cmd $dracut_args "$target" "$kernel"
- fi
+ fi
fi
done

View File

@ -0,0 +1,29 @@
From ae8e6ed5afc1a58c40a2f6b4ec668545dc4841fe Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:45:53 +0100
Subject: [PATCH] systemd always tries to load autofs4
During boot systemd tries to load autofs4, but dracut will only
add it if it's loaded by the time dracut is run.
Modify dracut to always load autofs4.
References: bnc#869411
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/98systemd/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 8052984..53e07a2 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -18,7 +18,7 @@ depends() {
}
installkernel() {
- instmods autofs4 ipv6
+ hostonly='' instmods autofs4 ipv6
instmods -s efivarfs
}

View File

@ -0,0 +1,29 @@
From 36894743e3105e4831a2d04fc5671c16fc5900c2 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 11 Dec 2014 15:45:54 +0100
Subject: [PATCH] Fixup mdraid setup
This sed script to edit 64-md-raid-assemble.rules needs to
be adjusted for latest mdadm
References: bnc#866660
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/90mdraid/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index bc4c514..ce3394a 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -86,7 +86,7 @@ install() {
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
rule_path="${initdir}${udevdir}/rules.d/${rule}"
[ -f "${rule_path}" ] && sed -i -r \
- -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
+ -e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
"${rule_path}"
done

View File

@ -0,0 +1,29 @@
From 15eed1e4f1d3b72a6112cce686f00d0c97ec616d Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:45:55 +0100
Subject: [PATCH] 95udev-rules: Include correct sg3_utils rules
sg3_utils now provides two rules 55-scsi-sg3_id.rules and
58-scsi-sg3_symlink.rules, which need to be included instead
of the older 59-scsi-sg3_utils.rules.
References: bnc#873151
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95udev-rules/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
index 9d6f960..e50709d 100755
--- a/modules.d/95udev-rules/module-setup.sh
+++ b/modules.d/95udev-rules/module-setup.sh
@@ -31,6 +31,7 @@ install() {
50-udev.rules 95-late.rules \
50-firmware.rules \
59-scsi-sg3_utils.rules \
+ 55-scsi-sg3_id.rules 58-scsi-sg3_symlink.rules \
70-uaccess.rules 71-seat.rules 73-seat-late.rules \
75-net-description.rules \
80-net-name-slot.rules 80-net-setup-link.rules \

View File

@ -0,0 +1,33 @@
From 8f4ee8c71b05948c1b65f7cde49c0a4236d91f03 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:45:56 +0100
Subject: [PATCH] 90multipath: install correct multipath rules
The multipath and kpartx rules have different numbers in SUSE.
The 11-dm-mpath.rules file had been missing, causing
blacklisting to not work properly.
References: bnc#873151, bnc#872662, bnc#883149
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/90multipath/module-setup.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index a8700f4..0f88f82 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -114,6 +114,9 @@ install() {
inst_hook cleanup 80 "$moddir/multipathd-needshutdown.sh"
- inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
+ inst_rules 40-multipath.rules 56-multipath.rules \
+ 62-multipath.rules 65-multipath.rules \
+ 66-kpartx.rules 67-kpartx-compat.rules \
+ 11-dm-mpath.rules
}

View File

@ -0,0 +1,85 @@
From 442abd16d2cfc6e006738a7373dc14445d22448f Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:45:57 +0100
Subject: [PATCH] 95iscsi: Autodetect iSCSI firmware
Some iSCSI initiator present firmware information in
/sys/firmware/ibft or /sys/firmware/iscsi_bootX
Whenever we detect one of those directories we should assume
that the iSCSI devices should be activated.
Also incorporates SUSE patches:
0049:
95iscsi: Use 'ip=ibft' for ibft autoconfiguration
For iBFT autoconfiguration we should be setting 'ip=ibft'
instead of rd.neednet. This should instruct dracut to only
enable the iBFT interfaces and leave the rest alone.
References: bnc#879038
0054:
95iscsi: update commandline printing
dracut has a separate callout 'cmdline' which should be used
for printing out the generated commandline.
Signed-off-by: Pavel Wieczorkiewicz <pwieczorkiewicz@suse.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 8b42d3e..5d2a39b 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -28,6 +28,21 @@ check() {
return 0
}
+install_ibft() {
+ # When iBFT / iscsi_boot is detected:
+ # - Use 'ip=ibft' to set up iBFT network interface
+ # - specify firmware booting cmdline parameter
+
+ for d in /sys/firmware/* ; do
+ if [ -d ${d}/initiator ] ; then
+ if [ ${d##*/} = "ibft" ] ; then
+ echo -n "ip=ibft "
+ fi
+ echo -n "rd.iscsi.firmware=1"
+ fi
+ done
+}
+
# called by dracut
depends() {
echo network rootfs-block
@@ -37,6 +52,12 @@ depends() {
installkernel() {
local _arch=$(uname -m)
+ # Detect iBFT and perform mandatory steps
+ if [[ $hostonly_cmdline == "yes" ]] ; then
+ install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
+ echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+ fi
+
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
iscsi_module_filter() {
@@ -77,6 +98,11 @@ installkernel() {
}
# called by dracut
+cmdline() {
+ install_ibft
+}
+
+# called by dracut
install() {
inst_multiple umount iscsistart hostname iscsi-iname
inst_multiple -o iscsiuio

View File

@ -0,0 +1,29 @@
From 4aad3438f7e9fcd58f6c65d2d0d52c0a0db1f00a Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:45:58 +0100
Subject: [PATCH] 95iscsi: Install libgcc_s library
iscsiuio is using pthread, which requires libgcc_s for
pthread_cancel to work.
Without this library iscsiuio will crash with SIGABRT.
References: bnc#881692
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 5d2a39b..3641fb8 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -106,6 +106,7 @@ cmdline() {
install() {
inst_multiple umount iscsistart hostname iscsi-iname
inst_multiple -o iscsiuio
+ inst_libdir_file 'libgcc_s.so*'
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"

View File

@ -0,0 +1,35 @@
From a3a2266046299ef4cfed48ce3a2e6bb573ee0dc7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:45:59 +0100
Subject: [PATCH] 95iscsi: Set correct iscsi_started value for iSCSI firmware
When iSCSI firmware booting is selected we should not rely on
'netroot' or 'iscsiroot' variables to be set.
References: bnc#873448
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/parse-iscsiroot.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index ca57668..85c3027 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -90,8 +90,12 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the
fi
fi
-netroot_enc=$(str_replace "$netroot" '/' '\2f')
-echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+if [ -n "$iscsi_firmware" ] ; then
+ echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+else
+ netroot_enc=$(str_replace "$netroot" '/' '\2f')
+ echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+fi
# Done, all good!
rootok=1

View File

@ -0,0 +1,52 @@
From 9ebf4a5d3c1b47d7e681b2331cf062920613bf2e Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:00 +0100
Subject: [PATCH] 95iscsi: strip one set of quotes when calling initqueue
The bad initqueue parameter passing is already addressed by git commit:
commit bb8c16d12178373f17553294603ff5187e318b51
and
commit 486a8f33e2edaf249e3a09c98a910094e201cf9e
However this appraoch is slightly different:
"$netroot" instead of "'$netroot'", etc.
initqueue will process the arguments, assuming the first non-option
argument to be the program to be executed. Putting the entire
commandline into this argument confuses both, initqueue and the
program in question.
References: bnc#879038
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/parse-iscsiroot.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh
index 85c3027..37e46ad 100755
--- a/modules.d/95iscsi/parse-iscsiroot.sh
+++ b/modules.d/95iscsi/parse-iscsiroot.sh
@@ -59,10 +59,10 @@ fi
# iscsi_firmware does not need argument checking
if [ -n "$iscsi_firmware" ] ; then
- netroot=${netroot:-iscsi:}
+ [ -z "$netroot" ] && netroot=iscsi:
modprobe -q iscsi_boot_sysfs 2>/dev/null
modprobe -q iscsi_ibft
- initqueue --onetime --timeout /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
+ initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
fi
# If it's not iscsi we don't continue
@@ -86,7 +86,7 @@ fi
if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
- initqueue --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
+ initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
fi
fi

View File

@ -0,0 +1,67 @@
From 2e34f3809524d5a69e06a51e13bb3f41b300b4ed Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:01 +0100
Subject: [PATCH] 95iscsi: Fixup bnx2i offload booting
bnx2i is using a separate iSCSI offload engine with a separate
MAC address. As a result, the iBFT information is displaying
a MAC address which does not relate to any MAC address from
the network interfaces.
In addition, the iSCSI offload engine works independently on
the NIC, so we do not need to enable the NIC for iSCSI offload
to work.
This patch modifies the automatic iBFT detection to not set
the 'ip=ibft' flag when bnx2i offload is detected.
References: bnc#855747
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 3641fb8..d30e64f 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -28,14 +28,38 @@ check() {
return 0
}
+get_ibft_mod() {
+ local ibft_mac=$1
+ # Return the iSCSI offload module for a given MAC address
+ iscsiadm -m iface | while read iface_name iface_desc ; do
+ IFS=$','
+ set -- $iface_desc
+ if [ "$ibft_mac" = "$2" ] ; then
+ echo $1
+ return 0
+ fi
+ unset IFS
+ done
+}
+
install_ibft() {
# When iBFT / iscsi_boot is detected:
# - Use 'ip=ibft' to set up iBFT network interface
+ # Note: bnx2i is using a different MAC address of iSCSI offloading
+ # so the 'ip=ibft' parameter must not be set
# - specify firmware booting cmdline parameter
for d in /sys/firmware/* ; do
+ if [ -d ${d}/ethernet0 ] ; then
+ read ibft_mac < ${d}/ethernet0/mac
+ ibft_mod=$(get_ibft_mod $ibft_mac)
+ fi
+ if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
+ read ibft_mac < ${d}/ethernet1/mac
+ ibft_mod=$(get_ibft_mod $ibft_mac)
+ fi
if [ -d ${d}/initiator ] ; then
- if [ ${d##*/} = "ibft" ] ; then
+ if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
echo -n "ip=ibft "
fi
echo -n "rd.iscsi.firmware=1"

View File

@ -0,0 +1,45 @@
From 54e28d79b9f67b8be349ae97f92dde2c6c118e11 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:02 +0100
Subject: [PATCH] 95iscsi: More empty cmdline fixes
This fixes up some 95iscsi/module-setup.sh which might print out empty
commandline files.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index d30e64f..29bba82 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -76,12 +76,6 @@ depends() {
installkernel() {
local _arch=$(uname -m)
- # Detect iBFT and perform mandatory steps
- if [[ $hostonly_cmdline == "yes" ]] ; then
- install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
- echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
- fi
-
instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
iscsi_module_filter() {
@@ -131,6 +125,13 @@ install() {
inst_multiple umount iscsistart hostname iscsi-iname
inst_multiple -o iscsiuio
inst_libdir_file 'libgcc_s.so*'
+
+ # Detect iBFT and perform mandatory steps
+ if [[ $hostonly_cmdline == "yes" ]] ; then
+ local _ibftconf=$(install_ibft)
+ [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+ fi
+
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"

View File

@ -0,0 +1,142 @@
From c4d8793c67cb75804dfb8b14985e125a22f212eb Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:03 +0100
Subject: [PATCH] 95iscsi: generate commandline for software iscsi
When installing on an software iscsi root we need to generate
the correct commandline, otherwise the system cannot boot.
References: bnc#880108
Patch: 0093
When using software iscsi we should be using the existing
configuration from the system for the time being.
References: bnc#884768
Patch: 0095
Avoid bad ip route call on empty address
Patch: 0143
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 91 +++++++++++++++++++++++++++++++++++++--
1 file changed, 88 insertions(+), 3 deletions(-)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 29bba82..cd6cb4b 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -67,6 +67,84 @@ install_ibft() {
done
}
+install_iscsiroot() {
+ local devpath=$1
+ local scsi_path iscsi_lun session c d conn
+ local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
+
+ scsi_path=${devpath%%/block*}
+ [ "$scsi_path" = "$devpath" ] && return 1
+ iscsi_lun=${scsi_path##*:}
+ [ "$iscsi_lun" = "$scsi_path" ] && return 1
+ session=${devpath%%/target*}
+ [ "$session" = "$devpath" ] && return 1
+ iscsi_session=${session##*/}
+ [ "$iscsi_session" = "$session" ] && return 1
+
+ for d in ${session}/* ; do
+ case $d in
+ *connection*)
+ c=${d##*/}
+ conn=${d}/iscsi_connection/${c}
+ if [ -d ${conn} ] ; then
+ iscsi_address=$(cat ${conn}/persistent_address)
+ iscsi_port=$(cat ${conn}/persistent_port)
+ fi
+ ;;
+ *session)
+ if [ -d ${d}/${iscsi_session} ] ; then
+ iscsi_initiator=$(cat ${d}/${iscsi_session}/initiatorname)
+ iscsi_targetname=$(cat ${d}/${iscsi_session}/targetname)
+ fi
+ ;;
+ esac
+ done
+
+ [ -z "$iscsi_address" ] && return
+ local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
+ ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
+ printf 'ip=%s:static ' ${ifname}
+
+ if [ -e /sys/class/net/$ifname/address ] ; then
+ ifmac=$(cat /sys/class/net/$ifname/address)
+ printf 'ifname=%s:%s ' ${ifname} ${ifmac}
+ fi
+
+ if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
+ if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then
+ iscsi_port=
+ fi
+ if [ -n "$iscsi_lun" -a "$iscsi_lun" -eq 0 ] ; then
+ iscsi_lun=
+ fi
+ # In IPv6 case rd.iscsi.initatior= must pass address in [] brackets
+ case "$iscsi_address" in
+ *:*)
+ iscsi_address="[$iscsi_address]"
+ ;;
+ esac
+ echo "rd.iscsi.initiator=${iscsi_initiator} netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+ fi
+ return 0
+}
+
+
+install_softiscsi() {
+ [ -d /sys/firmware/ibft ] && return 0
+
+ is_softiscsi() {
+ local _dev=$1
+ local iscsi_dev
+
+ [[ -L "/sys/dev/block/$_dev" ]] || return
+ iscsi_dev=$(cd -P /sys/dev/block/$_dev; echo $PWD)
+ install_iscsiroot $iscsi_dev
+ }
+
+ for_each_host_dev_and_slaves_all is_softiscsi || return 255
+ return 0
+}
+
# called by dracut
depends() {
echo network rootfs-block
@@ -117,7 +195,14 @@ installkernel() {
# called by dracut
cmdline() {
- install_ibft
+ local _iscsiconf=$(install_ibft)
+ {
+ if [ "$_iscsiconf" ] ; then
+ echo ${_iscsiconf}
+ else
+ install_softiscsi
+ fi
+ } | sort | uniq
}
# called by dracut
@@ -128,8 +213,8 @@ install() {
# Detect iBFT and perform mandatory steps
if [[ $hostonly_cmdline == "yes" ]] ; then
- local _ibftconf=$(install_ibft)
- [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+ local _iscsiconf=$(cmdline)
+ [[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
fi
inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"

View File

@ -0,0 +1,70 @@
From f34a2ef14df05affa3347d7191ff324bcb547e79 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:04 +0100
Subject: [PATCH] iscsi: iscsi.initiator and others can and must only show up
once
Make sure duplicates of iscsi.initiator vanish.
Only get one rd.iscsi.* paramter value. If getargs is used and several
parameters are parsed, one gets two values separated by whitespace in a
variable which breaks later code and is not suppported.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/iscsiroot.sh | 18 +++++++++---------
modules.d/95iscsi/module-setup.sh | 5 ++++-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh
index 7351427..5bfb017 100755
--- a/modules.d/95iscsi/iscsiroot.sh
+++ b/modules.d/95iscsi/iscsiroot.sh
@@ -81,23 +81,23 @@ handle_netroot()
local p
# override conf settings by command line options
- arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
+ arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
[ -n "$arg" ] && iscsi_initiator=$arg
- arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
+ arg=$(getarg rd.iscsi.target.name -d iscsi_target_name=)
[ -n "$arg" ] && iscsi_target_name=$arg
- arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
+ arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
[ -n "$arg" ] && iscsi_target_ip=$arg
- arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
+ arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=)
[ -n "$arg" ] && iscsi_target_port=$arg
- arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
+ arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
[ -n "$arg" ] && iscsi_target_group=$arg
- arg=$(getargs rd.iscsi.username -d iscsi_username=)
+ arg=$(getarg rd.iscsi.username -d iscsi_username=)
[ -n "$arg" ] && iscsi_username=$arg
- arg=$(getargs rd.iscsi.password -d iscsi_password)
+ arg=$(getarg rd.iscsi.password -d iscsi_password)
[ -n "$arg" ] && iscsi_password=$arg
- arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
+ arg=$(getarg rd.iscsi.in.username -d iscsi_in_username=)
[ -n "$arg" ] && iscsi_in_username=$arg
- arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
+ arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
[ -n "$arg" ] && iscsi_in_password=$arg
for p in $(getargs rd.iscsi.param -d iscsi_param); do
iscsi_param="$iscsi_param --param $p"
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index cd6cb4b..9975e59 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -123,7 +123,10 @@ install_iscsiroot() {
iscsi_address="[$iscsi_address]"
;;
esac
- echo "rd.iscsi.initiator=${iscsi_initiator} netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+ # Must be two separate lines, so that "sort | uniq" commands later
+ # can sort out rd.iscsi.initiator= duplicates
+ echo "rd.iscsi.initiator=${iscsi_initiator}"
+ echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
fi
return 0
}

View File

@ -0,0 +1,104 @@
From 56663e7e322cdba5d66cb45424489fd84791a544 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:05 +0100
Subject: [PATCH] Implement 'rd.timeout' to modify the device timeout
When generating units for devices the administrator might
want to use a different timeout than the default.
So implement a new parameter 'rd.timeout' for this.
References: bnc#878770
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.cmdline.7.asc | 7 ++++++-
modules.d/98systemd/rootfs-generator.sh | 7 +++++--
modules.d/99base/dracut-lib.sh | 6 +++++-
3 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 8e4835d..5ff84ef 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -142,11 +142,16 @@ Misc
have been loaded. This parameter can be specified multiple times.
**rd.retry=**__<seconds>__::
- specify how long dracut should wait for devices to appear.
+ specify how long dracut should retry the initqueue to configure devices.
The default is 30 seconds. After 2/3 of the time, degraded raids are force
started. If you have hardware, which takes a very long time to announce its
drives, you might want to extend this value.
+**rd.timeout=**__<seconds>__::
+ specify how long dracut should wait for devices to appear. The
+ default is '0', which means 'forever'. Note that this timeout
+ should be longer than rd.retry to allow for proper configuration.
+
**rd.noverifyssl**::
accept self-signed certificates for ssl downloads.
diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
index 9523729..5b06137 100755
--- a/modules.d/98systemd/rootfs-generator.sh
+++ b/modules.d/98systemd/rootfs-generator.sh
@@ -5,8 +5,11 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
generator_wait_for_dev()
{
local _name
+ local _timeout
_name="$(str_replace "$1" '/' '\x2f')"
+ _timeout=$(getarg rd.timeout)
+ _timeout=${_timeout:-0}
[ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
@@ -27,7 +30,7 @@ generator_wait_for_dev()
mkdir -p /run/systemd/generator/${_name}.device.d
{
echo "[Unit]"
- echo "JobTimeoutSec=0"
+ echo "JobTimeoutSec=$_timeout"
} > /run/systemd/generator/${_name}.device.d/timeout.conf
fi
}
@@ -58,6 +61,6 @@ case "$root" in
rootok=1 ;;
esac
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}"
+[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}" "$RDRETRY"
exit 0
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 5fc5615..f7cffc4 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -890,12 +890,16 @@ wait_for_dev()
local _name
local _needreload
local _noreload
+ local _timeout
if [ "$1" = "-n" ]; then
_noreload=1
shift
fi
+ _timeout=$(getarg rd.timeout)
+ _timeout=${_timeout:-0}
+
_name="$(str_replace "$1" '/' '\x2f')"
type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
@@ -922,7 +926,7 @@ wait_for_dev()
mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
{
echo "[Unit]"
- echo "JobTimeoutSec=0"
+ echo "JobTimeoutSec=$_timeout"
} > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
_needreload=1

View File

@ -0,0 +1,35 @@
From 3244bf59816096377edee6f8937f16838dc1a709 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:06 +0100
Subject: [PATCH] Do not call 'lvm' for non-LVM device-mapper devices
If a device-mapper device is not created by LVM it's pointless
to call any 'lvm' programs got extract details; they'll be
failing anyway. So check the UUID before calling 'lvm'.
This speeds up initrd creation and avoids I/O errors on
multipath devices.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut-functions.sh | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 17a71f0..edd8ea9 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -698,10 +698,12 @@ for_each_host_dev_and_slaves()
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
- local _lv _vg _pv
+ local _lv _vg _pv _dm
for i in /dev/mapper/*; do
[[ $i == /dev/mapper/control ]] && continue
_lv=$(get_maj_min $i)
+ _dm=/sys/dev/block/$_lv/dm
+ [[ -f $_dm/uuid && $(<$_dm/uuid) =~ LVM-* ]] || continue
if [[ $_lv = $2 ]]; then
_vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space

View File

@ -0,0 +1,36 @@
From fe273e3901f0931c3cc1365177f82f03b6560d30 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:07 +0100
Subject: [PATCH] Print stored dracut commandline during initramfs build
When generating the initramfs we should be printing out the
generated dracut commandline used for booting.
This will simplify debugging.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index a542f33..cda7955 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1584,6 +1584,16 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
exit 1
fi
+if [[ $hostonly_cmdline ]] ; then
+ if [ -d $initdir/etc/cmdline.d ];then
+ dinfo "Stored kernel commandline:"
+ for conf in $initdir/etc/cmdline.d/*.conf ; do
+ dinfo "$(< $conf)"
+ done
+ else
+ dinfo "No dracut internal kernel commandline stored in initrd"
+ fi
+fi
rm -f -- "$outfile"
dinfo "*** Creating image file ***"

View File

@ -0,0 +1,55 @@
From e3eec4b8a21a640b7557678b92716a32f8d3dadf Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Thu, 11 Dec 2014 15:46:08 +0100
Subject: [PATCH] Align dev_unit_name() with systemd's function.
Add more corner cases from systemd's
unit_name_from_path_instance() C function.
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/99base/dracut-lib.sh | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index f7cffc4..5c1504f 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -866,18 +866,30 @@ wait_for_mount()
} >> "$hookdir/emergency/90-${_name}.sh"
}
+# get a systemd-compatible unit name from a path
+# (mimicks unit_name_from_path_instance())
dev_unit_name()
{
+ local dev="$1"
+
if command -v systemd-escape >/dev/null; then
- systemd-escape -p "$1"
+ systemd-escape -p "$dev"
return
fi
- _name="${1%%/}"
- _name="${_name##/}"
- _name="$(str_replace "$_name" '-' '\x2d')"
- _name="$(str_replace "$_name" '/' '-')"
- echo "$_name"
+ if [ "$dev" = "/" -o -z "$dev" ]; then
+ printf -- "-"
+ exit 0
+ fi
+
+ dev="${1%%/}"
+ dev="${dev##/}"
+ dev="$(str_replace "$dev" '\' '\x5c')"
+ dev="$(str_replace "$dev" '-' '\x2d')"
+ dev=${dev/#\./\\x2e}
+ dev="$(str_replace "$dev" '/' '-')"
+
+ printf -- "%s" "$dev"
}
# wait_for_dev <dev>

View File

@ -0,0 +1,68 @@
From bd44831b825da5bf38f883344c3e25844bee4df7 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Thu, 11 Dec 2014 15:46:09 +0100
Subject: [PATCH] Generate fallback mount unit for root filesystem
If kernel cmdline has no root= provided, *and* the initrd carries
a default value, create a systemd mount unit to have it available
in /sysroot
References: bnc#855258
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/98systemd/rootfs-generator.sh | 34 ++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
index 5b06137..f3c7d1f 100755
--- a/modules.d/98systemd/rootfs-generator.sh
+++ b/modules.d/98systemd/rootfs-generator.sh
@@ -35,6 +35,35 @@ generator_wait_for_dev()
fi
}
+generator_mount_rootfs()
+{
+ local _type=$2
+ local _flags=$3
+ local _name
+
+ [ -z "$1" ] && return 0
+
+ _name=$(dev_unit_name "$1")
+ [ -d /run/systemd/generator ] || mkdir -p /run/systemd/generator
+ if ! [ -f /run/systemd/generator/sysroot.mount ]; then
+ {
+ echo "[Unit]"
+ echo "Before=initrd-root-fs.target"
+ echo "RequiresOverridable=systemd-fsck@${_name}.service"
+ echo "After=systemd-fsck@${_name}.service"
+ echo "[Mount]"
+ echo "Where=/sysroot"
+ echo "What=$1"
+ echo "Options=${_flags}"
+ echo "Type=${_type}"
+ } > /run/systemd/generator/sysroot.mount
+ fi
+ if ! [ -L /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount ]; then
+ [ -d /run/systemd/generator/initrd-root-fs.target.requires ] || mkdir -p /run/systemd/generator/initrd-root-fs.target.requires
+ ln -s ../sysroot.mount /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount
+ fi
+}
+
root=$(getarg root=)
case "$root" in
block:LABEL=*|LABEL=*)
@@ -61,6 +90,9 @@ case "$root" in
rootok=1 ;;
esac
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}" "$RDRETRY"
+if [ "${root%%:*}" = "block" ]; then
+ generator_wait_for_dev "${root#block:}" "$RDRETRY"
+ grep -q 'root=' /proc/cmdline || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
+fi
exit 0

View File

@ -0,0 +1,31 @@
From 7c2311660f3f540c2ad9471bcc13686899d677cd Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:10 +0100
Subject: [PATCH] 99base: warn on invalid command for initqueue
When 'initqueue' is called with an invalid command it'll generate
invalid job scripts. This will lead to confusing error messages
later on.
So abort in these cases and print out a warning.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/99base/initqueue.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules.d/99base/initqueue.sh b/modules.d/99base/initqueue.sh
index 4a07da3..193cc5c 100755
--- a/modules.d/99base/initqueue.sh
+++ b/modules.d/99base/initqueue.sh
@@ -42,6 +42,10 @@ exe=$1
shift
[ -x "$exe" ] || exe=$(command -v $exe)
+if [ -z "$exe" ] ; then
+ echo "Invalid command"
+ exit 1
+fi
{
[ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'

View File

@ -0,0 +1,36 @@
From 3ae60e559f049ba41d5d198f27509721a245d6ea Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:11 +0100
Subject: [PATCH] Handle module alias properly
Some modules (like ext4) provide aliases by which the modules
can be accessed, too. But when using aliases directly dracut
fails to include the correct module. So translate the alias
into the correct module name before checking the module.
References: bnc#886839
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut-functions.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index edd8ea9..7a12a76 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -1689,6 +1689,13 @@ instmods() {
--*) _mpargs+=" $_mod" ;;
*)
_mod=${_mod##*/}
+ # Check for aliased modules
+ _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
+ _modalias=${_modalias%.ko}
+ if [ "${_modalias##*/}" != "$_mod" ] ; then
+ _mod=${_modalias##*/}
+ fi
+
# if we are already installed, skip this module and go on
# to the next one.
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \

View File

@ -0,0 +1,28 @@
From 517d27a75f678d4c295cbb07687453950b55df5a Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:12 +0100
Subject: [PATCH] 99base: Increase initqueue timeout in non systemd case
In case of systemd is used the timeout already is set to 180s, compare
with file: modules.d/98systemd/dracut-initqueue.sh
Do the same if systemd is not used, e.g. in kdump case.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/99base/init.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 7fcea4a..918dea5 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -166,7 +166,7 @@ make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
RDRETRY=$(getarg rd.retry -d 'rd_retry=')
-RDRETRY=${RDRETRY:-30}
+RDRETRY=${RDRETRY:-180}
RDRETRY=$(($RDRETRY*2))
export RDRETRY
main_loop=0

View File

@ -0,0 +1,27 @@
From 5c84d51b3f258af9035a4031c6b482103adea4d9 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:13 +0100
Subject: [PATCH] 90lvm: Install dm-snapshot module
bnc#888530
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/90lvm/module-setup.sh | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 9ddc56e..5515ac0 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -42,6 +42,10 @@ cmdline() {
done
}
+installkernel() {
+ instmods dm-snapshot
+}
+
# called by dracut
install() {
local _i

View File

@ -0,0 +1,37 @@
From 3838dc47c3f15128f171bfbd0eaf2e3e8641e4e8 Mon Sep 17 00:00:00 2001
From: jloeser <jloeser@suse.de>
Date: Thu, 11 Dec 2014 15:46:14 +0100
Subject: [PATCH] Check for logfile (--logfile option) and create it if
necessary
If a logfile is passed to dracut via --logfile option and doesn't
exist, dracut doesn't create it and logs nothing. Instead, dracut
should try to touch the file and print a warning if creating fails.
References: bnc#892191
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index cda7955..79f36b6 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -816,6 +816,16 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
+# check for logfile and try to create one if it doesn't exist
+if [[ -n "$logfile" ]];then
+ if [[ ! -f "$logfile" ]];then
+ touch "$logfile"
+ if [ ! $? -eq 0 ] ;then
+ printf "%s\n" "dracut: touch $logfile failed." >&2
+ fi
+ fi
+fi
+
# handle compression options.
[[ $compress ]] || compress="gzip"
case $compress in

View File

@ -0,0 +1,91 @@
From 118ca9ecfcc8cec0a428352355592717d0a44109 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:15 +0100
Subject: [PATCH] dracut.sh: Avoid duplicate devices in host_devs
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 79f36b6..a4c7ce5 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -219,6 +219,16 @@ push() {
done
}
+# Fills up host_devs stack variable and makes sure there are no duplicates
+push_host_devs() {
+ local _dev
+ for _dev in ${host_devs[@]}; do
+ [ "$_dev" = "$1" ] && return
+ done
+ push host_devs "$1"
+}
+
+
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
@@ -1062,25 +1072,25 @@ declare -A host_fs_types
for line in "${fstab_lines[@]}"; do
set -- $line
#dev mp fs fsopts
- push host_devs "$1"
+ push_host_devs "$1"
host_fs_types["$1"]="$3"
done
for f in $add_fstab; do
[[ -e $f ]] || continue
while read dev rest; do
- push host_devs "$dev"
+ push_host_devs "$dev"
done < "$f"
done
for dev in $add_device; do
- push host_devs "$dev"
+ push_host_devs "$dev"
done
if (( ${#add_device_l[@]} )); then
while pop add_device_l val; do
add_device+=" $val "
- push host_devs "$val"
+ push_host_devs "$val"
done
fi
@@ -1109,9 +1119,9 @@ if [[ $hostonly ]]; then
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
- push host_devs $_dev
+ push_host_devs $_dev
[[ "$mp" == "/" ]] && root_dev="$_dev"
- push host_devs "$_dev"
+ push_host_devs "$_dev"
done
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
@@ -1140,7 +1150,7 @@ if [[ $hostonly ]]; then
done < /etc/crypttab
fi
- push host_devs "$(readlink -f "$dev")"
+ push_host_devs "$(readlink -f "$dev")"
break
done < /etc/fstab
done < /proc/swaps
@@ -1205,7 +1215,7 @@ for dev in "${!host_fs_types[@]}"; do
fi
if [[ $journaldev ]]; then
dev="$(readlink -f "$dev")"
- push host_devs "$dev"
+ push_host_devs "$dev"
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
fi

View File

@ -0,0 +1,50 @@
From 6df523517f364882c51bbcc5b3245dd568eca3b3 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:16 +0100
Subject: [PATCH] dracut.sh: Fix UUID= fstab parsing in case --mount option is
passed
Dracut parses /etc/fstab when --mount is option is passed (e.g. kdump).
In host_devs variable the real block device must be stored, not UUID=
There are other /etc/fstab syntax possibilities we now warn that they
are not correctly parsed. This will be fixed by another patch
when there is time to test this properly.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index a4c7ce5..2eba19b 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1071,9 +1071,25 @@ declare -A host_fs_types
for line in "${fstab_lines[@]}"; do
set -- $line
+ dev="$1"
#dev mp fs fsopts
- push_host_devs "$1"
- host_fs_types["$1"]="$3"
+ case "$dev" in
+ UUID=*)
+ dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
+ ;;
+ LABEL=*)
+ dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
+ ;;
+ PARTUUID=*)
+ dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
+ ;;
+ PARTLABEL=*)
+ dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
+ ;;
+ esac
+ [ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
+ push_host_devs "$dev"
+ host_fs_types["$dev"]="$3"
done
for f in $add_fstab; do

View File

@ -0,0 +1,47 @@
From 4d25892179e4eff9fc4bd2a2ab45a91c5a372fc2 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:17 +0100
Subject: [PATCH] dracut.usage.asc: Remove distro specific help from manpage
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.usage.asc | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/dracut.usage.asc b/dracut.usage.asc
index 9e788c1..b4a8663 100644
--- a/dracut.usage.asc
+++ b/dracut.usage.asc
@@ -246,23 +246,6 @@ specified multiple times.
If your root partition is on a network drive, you have to have the network
dracut modules installed to create a network aware initramfs image.
-On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
-the _dracut-network_ rpm package:
-
-
-----
-# yum install dracut-network
-----
-
-The resulting initramfs image can be served by a boot manager residing on your
-local hard drive or it can be served by a PXE/TFTP server.
-
-How to setup your PXE/TFTP server can be found in the
-http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
-Hat Enterprise Linux 6 Storage Administration Guide]
-or http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
-Hat Enterprise Linux 7 Storage Administration Guide].
-
If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
server about the ip adress for the machine. The dhcp server can also serve an
additional root-path, which will set the root device for dracut. With this
@@ -302,7 +285,7 @@ This will reduce the size of the initramfs image significantly.
If the boot process does not succeed, you have several options to debug the
situation. Some of the basic operations are covered here. For more information
you should also visit:
-http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
+https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
[[identifying-your-problem-area]]

View File

@ -0,0 +1,88 @@
From 206345ce9b5eda660d82ce552620edc12db4b2e3 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:18 +0100
Subject: [PATCH] nfs: Add ip=... and root=nfs... parameters to internal dracut
cmdline
If the rootfs is an nfs mount, also know as nfsroot, add the correct
parameter to the dracut cmdline.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95nfs/module-setup.sh | 44 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index e1340b3..8eb542c 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -14,7 +14,6 @@ check() {
done
return 255
}
-
return 0
}
@@ -29,6 +28,43 @@ installkernel() {
instmods nfs sunrpc ipv6 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files
}
+cmdline() {
+ local nfs_device
+ local nfs_options
+ local nfs_root
+ local nfs_address
+ local lookup
+ local ifname
+
+ ### nfsroot= ###
+ nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
+ if [ -n "$nfs_device" ];then
+ nfs_root="root=nfs4:$nfs_device"
+ else
+ nfs_device=$(findmnt -t nfs -n -o SOURCE /)
+ [ -z "$nfs_device" ] && return
+ nfs_root="root=nfs:$nfs_device"
+ fi
+ nfs_options=$(findmnt -t nfs4,nfs -n -o OPTIONS /)
+ [ -n "$nfs_options" ] && nfs_root="$nfs_root:$nfs_options"
+ echo "$nfs_root"
+
+ ### ip= ###
+ if [[ $nfs_device = [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device = \[.*\] ]]; then
+ nfs_address="$nfs_device"
+ else
+ lookup=$(host $(echo ${nfs_device%%:*})| head -n1)
+ nfs_address=${lookup##* }
+ fi
+ ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
+ if [ -e /sys/class/net/$ifname/address ] ; then
+ ifmac=$(cat /sys/class/net/$ifname/address)
+ printf 'ifname=%s:%s ' ${ifname} ${ifmac}
+ fi
+
+ printf 'ip=%s:static\n' ${ifname}
+}
+
# called by dracut
install() {
local _i
@@ -37,6 +73,11 @@ install() {
mount.nfs4 umount rpc.idmapd sed /etc/netconfig
inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
+ if [[ $hostonly_cmdline == "yes" ]]; then
+ local _netconf="$(cmdline)"
+ [[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
+ fi
+
if [ -f /lib/modprobe.d/nfs.conf ]; then
inst_multiple /lib/modprobe.d/nfs.conf
else
@@ -75,4 +116,3 @@ install() {
&& chown rpc.rpc "$initdir/var/lib/rpcbind"
dracut_need_initqueue
}
-

View File

@ -0,0 +1,44 @@
From cd72830807e231f8a88bd81c8f2df951c5a6d33e Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:19 +0100
Subject: [PATCH] 95iscsi: parse output from iscsiadm correctly
Due to some obsure reason the IFS parameter is not set correctly
when evaluating get_ibft_mod(). So change the parsing to not rely
on IFS altogether.
References: bnc#886199
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95iscsi/module-setup.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 9975e59..f13119f 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -30,15 +30,16 @@ check() {
get_ibft_mod() {
local ibft_mac=$1
+ local iface_mac iface_mod
# Return the iSCSI offload module for a given MAC address
- iscsiadm -m iface | while read iface_name iface_desc ; do
- IFS=$','
- set -- $iface_desc
- if [ "$ibft_mac" = "$2" ] ; then
- echo $1
+ for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
+ iface_mod=${iface_desc%%,*}
+ iface_mac=${iface_desc#*,}
+ iface_mac=${iface_mac%%,*}
+ if [ "$ibft_mac" = "$iface_mac" ] ; then
+ echo $iface_mod
return 0
fi
- unset IFS
done
}

View File

@ -0,0 +1,45 @@
From 8d40852e8cf5a4b5db38cbbb52c42b348d3c7502 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:20 +0100
Subject: [PATCH] dracut: Do not stop installing drivers if one fails
--add-drivers and --filesystems kernel drivers are added via:
instmods -c
The check option makes the function return if one driver could not get
installed without trying to install further drivers which is bad.
The user is still informed ($_silent is by default no), but all modules
passed to instmods are tried to be loaded, even if one fails.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut-functions.sh | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 7a12a76..b91d8dc 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -1742,18 +1742,16 @@ instmods() {
if (($# == 0)); then # filenames from stdin
while read _mod; do
inst1mod "${_mod%.ko*}" || {
- if [[ "$_check" == "yes" ]]; then
- [[ "$_silent" == "no" ]] && dfatal "Failed to install module $_mod"
- return 1
+ if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
+ dfatal "Failed to install module $_mod"
fi
}
done
fi
while (($# > 0)); do # filenames as arguments
inst1mod ${1%.ko*} || {
- if [[ "$_check" == "yes" ]]; then
- [[ "$_silent" == "no" ]] && dfatal "Failed to install module $1"
- return 1
+ if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
+ dfatal "Failed to install module $1"
fi
}
shift

View File

@ -0,0 +1,36 @@
From c64a94caa98749ceb4fad3c551d8e389f508d6df Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:21 +0100
Subject: [PATCH] 95fcoe: update fcoe interface check
The 'create' sysfs entry has been removed for newer fcoe modules,
so just check if the module directory exists.
References: bnc#877288
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95fcoe/parse-fcoe.sh | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
index 59de56f..9604503 100755
--- a/modules.d/95fcoe/parse-fcoe.sh
+++ b/modules.d/95fcoe/parse-fcoe.sh
@@ -20,14 +20,11 @@
# BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
-[ -e /sys/module/fcoe/parameters/create ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
+[ -d /sys/module/fcoe ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
modprobe bnx2fc >/dev/null 2>&1
udevadm settle --timeout=30
-# FCoE actually supported?
-[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
-
parse_fcoe_opts() {
local IFS=:
set $fcoe

View File

@ -0,0 +1,94 @@
From 8b257fcc86f9a470613c1a5719641144a688acf7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:22 +0100
Subject: [PATCH] 95fcoe: Store current configuration in dracut cmdline
When running with --hostonly-cmdline we should be storing
the current configuration in /etc/cmdline.d so that dracut
will be configure the system automatically.
References: bnc#877288
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95fcoe/module-setup.sh | 52 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index b67aa04..174745a 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -2,7 +2,16 @@
# called by dracut
check() {
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
+ for c in /sys/bus/fcoe/devices/ctlr_* ; do
+ [ -L $c ] || continue
+ fcoe_ctlr=$c
+ done
+ [ -z "$fcoe_ctlr" ] && return 255
+ }
+
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
+
return 0
}
@@ -17,12 +26,55 @@ installkernel() {
instmods fcoe 8021q edd
}
+get_vlan_parent() {
+ local link=$1
+
+ [ -d $link ] || return
+ read iflink < $link/iflink
+ for if in /sys/class/net/* ; do
+ read idx < $if/ifindex
+ if [ $idx -eq $iflink ] ; then
+ echo ${if##*/}
+ fi
+ done
+}
+
+# called by dracut
+cmdline() {
+
+ for c in /sys/bus/fcoe/devices/ctlr_* ; do
+ [ -L $c ] || continue
+ read enabled < $c/enabled
+ [ $enabled -eq 0 ] && continue
+ d=$(cd -P $c; echo $PWD)
+ i=${d%/*}
+ read mac < ${i}/address
+ s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+ if [ -z "$s" ] ; then
+ p=$(get_vlan_parent ${i})
+ if [ "$p" ] ; then
+ s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+ fi
+ fi
+ if [ "$s" = "on" ] ; then
+ dcb="dcb"
+ else
+ dcb="nodcb"
+ fi
+ echo "fcoe=${mac}:${dcb}"
+ done
+}
+
# called by dracut
install() {
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
+ if [[ $hostonly_cmdline == "yes" ]] ; then
+ local _fcoeconf=$(cmdline)
+ [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
+ fi
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"

View File

@ -0,0 +1,36 @@
From 0a68a26cffad7fc75e454b06206c0bbf297361b7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:23 +0100
Subject: [PATCH] 95fcoe: skip VLAN devices in fcoe-up
DCB & fipvlan can only be called on real devices, not VLAN
ones. So skip any VLAN devices which might been added to the
list of network interfaces.
References: bnc#878583
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95fcoe/fcoe-up.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
index b9d0411..7f6eb1b 100755
--- a/modules.d/95fcoe/fcoe-up.sh
+++ b/modules.d/95fcoe/fcoe-up.sh
@@ -16,6 +16,14 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
netif=$1
dcb=$2
+iflink=$(cat /sys/class/net/$netif/iflink)
+ifindex=$(cat /sys/class/net/$netif/ifindex)
+if [ "$iflink" != "$ifindex" ] ; then
+ # Skip VLAN devices
+ exit 0
+fi
+
+ip link set dev $netif up
linkup "$netif"
netdriver=$(readlink -f /sys/class/net/$netif/device/driver)

View File

@ -0,0 +1,76 @@
From 22e837b6458d5d17d1cb6a9b09b7515746d4e098 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:24 +0100
Subject: [PATCH] 95fcoe: start lldpad separately
lldpad is a system-wide process, which must be started only once.
So we should be separate it from fcoe-up, as it might be called
several times.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95fcoe/fcoe-up.sh | 8 --------
modules.d/95fcoe/lldpad.sh | 14 ++++++++++++++
modules.d/95fcoe/module-setup.sh | 1 +
3 files changed, 15 insertions(+), 8 deletions(-)
create mode 100644 modules.d/95fcoe/lldpad.sh
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
index 7f6eb1b..43a0ad5 100755
--- a/modules.d/95fcoe/fcoe-up.sh
+++ b/modules.d/95fcoe/fcoe-up.sh
@@ -30,10 +30,6 @@ netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
netdriver=${netdriver##*/}
if [ "$dcb" = "dcb" ]; then
- # Note lldpad will stay running after switchroot, the system initscripts
- # are to kill it and start a new lldpad to take over. Data is transfered
- # between the 2 using a shm segment
- lldpad -d
# wait for lldpad to be ready
i=0
while [ $i -lt 60 ]; do
@@ -43,10 +39,6 @@ if [ "$dcb" = "dcb" ]; then
i=$(($i+1))
done
- # on some systems lldpad needs some time
- # sleep until we find a better solution
- sleep 30
-
while [ $i -lt 60 ]; do
dcbtool sc "$netif" dcb on && break
info "Retrying to turn dcb on"
diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh
new file mode 100644
index 0000000..d06a3bd
--- /dev/null
+++ b/modules.d/95fcoe/lldpad.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Note lldpad will stay running after switchroot, the system initscripts
+# are to kill it and start a new lldpad to take over. Data is transfered
+# between the 2 using a shm segment
+lldpad -d
+# wait for lldpad to be ready
+i=0
+while [ $i -lt 60 ]; do
+ lldptool -p && break
+ info "Waiting for lldpad to be ready"
+ sleep 1
+ i=$(($i+1))
+done
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index 174745a..9c67f17 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -78,6 +78,7 @@ install() {
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
+ inst_hook pre-trigger 03 "$moddir/lldpad.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
dracut_need_initqueue
}

View File

@ -0,0 +1,61 @@
From 94920084351349cba579ce80a89321ab6544653c Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:25 +0100
Subject: [PATCH] Enhance suse.conf and debug module example with SUSE-specific
settings
SUSE is using specific settings for dracut, so add them
to the suse.conf.example file.
Add vi and find to the debug module add some help text to the suse.conf
file when and how to use it.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.conf.d/suse.conf.example | 21 +++++++++++++++++++++
modules.d/95debug/module-setup.sh | 3 +--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/dracut.conf.d/suse.conf.example b/dracut.conf.d/suse.conf.example
index 1e7f80e..37ffd72 100644
--- a/dracut.conf.d/suse.conf.example
+++ b/dracut.conf.d/suse.conf.example
@@ -1,3 +1,24 @@
+# SUSE specifc dracut settings
+#
+# SUSE by default always builds a as small as possible initrd for performance
+# and resource reasons.
+# If you like to build a generic initrd which works on other platforms than
+# on the one dracut/mkinitrd got called comment out below setting(s).
+hostonly="yes"
+hostonly_cmdline="yes"
+
+compress="xz -0 --check=crc32 --memlimit-compress=50%"
+
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_drivers+=" i2o_scsi"
+# Below adds additional tools to the initrd which are not urgently necessary to
+# bring up the system, but help to debug problems.
+# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
+# are installed and add more if you need them. This specifically helps if you
+# use:
+# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
+# mount|pre-pivot|cleanup]
+# boot parameter or if you are forced to enter the dracut emergency shell.
+
+# add_dracutmodules+=debug
diff --git a/modules.d/95debug/module-setup.sh b/modules.d/95debug/module-setup.sh
index 625f7fb..5a9aaac 100755
--- a/modules.d/95debug/module-setup.sh
+++ b/modules.d/95debug/module-setup.sh
@@ -14,8 +14,7 @@ depends() {
# called by dracut
install() {
inst_multiple -o ps grep more cat rm strace free showmount \
- ping netstat rpcinfo vi scp ping6 ssh \
+ ping netstat rpcinfo vi scp ping6 ssh find vi \
fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
-
}

View File

@ -0,0 +1,25 @@
From 681462eca8bd87383c9cb8c0bc34ebad827c4421 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:26 +0100
Subject: [PATCH] 40network: add missing _arch variable declaration
The module_setup.sh script was missing an '_arch' declaration,
causing network not to be installed on s390.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/40network/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 55bee4c..f7e0a87 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -17,6 +17,7 @@ depends() {
# called by dracut
installkernel() {
# Include wired net drivers, excluding wireless
+ local _arch=$(uname -m)
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'

View File

@ -0,0 +1,29 @@
From a262ad91e82729b661049f24a5d5968d08ce161c Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:27 +0100
Subject: [PATCH] 99base: Add chown binary
nvidia driver needs this via modprobe script.
Needs to do change the group after a device node got created.
Add chown instead of chgrp which can also change the owner of a file.
Ask Stefand Dirsch <sndirsch@suse.de> for details.
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/99base/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index 7d30320..a1046af 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -15,7 +15,7 @@ depends() {
install() {
local _d
- inst_multiple mount mknod mkdir sleep chroot \
+ inst_multiple mount mknod mkdir sleep chroot chown \
sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid
inst $(command -v modprobe) /sbin/modprobe

View File

@ -0,0 +1,28 @@
From ce8f354dbd5a54be247ee8a96aa14b555503f3b6 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:28 +0100
Subject: [PATCH] 90kernel-modules: install scsi_dh_alua
Install the missing scsi_dh_alua module, too.
References: bnc#871617
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/90kernel-modules/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 2fa263c..1a8fcff 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -41,7 +41,7 @@ installkernel() {
uhci-hcd \
xhci-hcd
- instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
+ instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
hid-logitech-dj hid-microsoft hid-lcpower firewire-ohci \
pcmcia hid-hyperv hv-vmbus hyperv-keyboard

View File

@ -0,0 +1,30 @@
From 486030575d3573237e776a630b3df0139c11fab3 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Thu, 11 Dec 2014 15:46:29 +0100
Subject: [PATCH] Fix non-export of journal dev boot options.
cmdline_journal does not contain linefeeds anymore, so read
silently skipped it altogether.
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95rootfs-block/module-setup.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
index 258b32f..c2f71bb 100755
--- a/modules.d/95rootfs-block/module-setup.sh
+++ b/modules.d/95rootfs-block/module-setup.sh
@@ -43,9 +43,8 @@ cmdline() {
# called by dracut
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline_journal | while read journaldev; do
- [[ $journaldev ]] && printf "%s\n" "$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
- done
+ local _journaldev=$(cmdline_journal)
+ [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
fi
inst_multiple umount

View File

@ -0,0 +1,48 @@
From 7700b3df4c753112d9a38745388b1e1fd54ce5c5 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Thu, 11 Dec 2014 15:46:30 +0100
Subject: [PATCH] Also export root= boot param for hostonly-cmdline case.
If there's a root fallback, at least attempt to have it falling
back to the last root filesystem this system ran off of.
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95rootfs-block/module-setup.sh | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
index c2f71bb..81de177 100755
--- a/modules.d/95rootfs-block/module-setup.sh
+++ b/modules.d/95rootfs-block/module-setup.sh
@@ -29,14 +29,18 @@ cmdline_journal() {
return 0
}
-# called by dracut
-cmdline() {
+cmdline_rootfs() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
printf " rootflags=%s" "$(find_mp_fsopts /)"
printf " rootfstype=%s" "$(find_mp_fstype /)"
fi
+}
+
+# called by dracut
+cmdline() {
+ cmdline_rootfs
cmdline_journal
}
@@ -45,6 +49,8 @@ install() {
if [[ $hostonly_cmdline == "yes" ]]; then
local _journaldev=$(cmdline_journal)
[[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
+ local _rootdev=$(cmdline_rootfs)
+ [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
fi
inst_multiple umount

View File

@ -0,0 +1,94 @@
From fe116c1670c622fa117a7765abb17c976cc48333 Mon Sep 17 00:00:00 2001
From: Thorsten Behrens <tbehrens@suse.com>
Date: Thu, 11 Dec 2014 15:46:31 +0100
Subject: [PATCH] Don't create lots of empty cmdline files for hostonly-cmdline
case
This aligns other places piping cmdline() output to cmdline.d files
with the earlier fix for 95rootfs-block.
Signed-off-by: Thorsten Behrens <tbehrens@suse.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/90crypt/module-setup.sh | 4 ++--
modules.d/90dmraid/module-setup.sh | 4 ++--
modules.d/90lvm/module-setup.sh | 4 ++--
modules.d/90mdraid/module-setup.sh | 4 ++--
modules.d/95resume/module-setup.sh | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index 37ae859..ea1e340 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -50,8 +50,8 @@ cmdline() {
install() {
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
- echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
+ local _cryptconf=$(cmdline)
+ [[ $_cryptconf ]] && printf "%s\n" "$_cryptconf" >> "${initdir}/etc/cmdline.d/90crypt.conf"
fi
inst_multiple cryptsetup rmdir readlink umount
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index 508598b..044e01f 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -64,8 +64,8 @@ install() {
local _i
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
- echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+ local _raidconf=$(cmdline)
+ [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf"
fi
inst_multiple dmraid
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 5515ac0..592a2e2 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -53,8 +53,8 @@ install() {
inst lvm
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
- echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
+ local _lvmconf=$(cmdline)
+ [[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
fi
inst_rules "$moddir/64-lvm.rules"
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index ce3394a..747ea8a 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -71,8 +71,8 @@ install() {
inst $(command -v mdadm) /sbin/mdadm
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
- echo >> "${initdir}/etc/cmdline.d/90mdraid.conf"
+ local _raidconf=$(cmdline)
+ [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
fi
# <mdadm-3.3 udev rule
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 1ddb6e4..dfd4350 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -29,8 +29,8 @@ install() {
local _bin
if [[ $hostonly_cmdline == "yes" ]]; then
- cmdline >> "${initdir}/etc/cmdline.d/95resume.conf"
- echo >> "${initdir}/etc/cmdline.d/95resume.conf"
+ local _resumeconf=$(cmdline)
+ [[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
fi
# Optional uswsusp support

View File

@ -0,0 +1,59 @@
From 4b6b46bb2aa9e6a72f96501888035f2d38b82266 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 11 Dec 2014 15:46:32 +0100
Subject: [PATCH] 95rootfs-block: Correctly terminate commandline parameter
95rootfs-block would not terminate the commandline parameter with
a space or newline, instead it'll rely on the main routine from
dracut.sh to do this.
Which will cause unexpected problems for any modules called
after this.
So terminate the commandline parameters correctly here and remove
the newline from dracut.sh.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 1 -
modules.d/95rootfs-block/module-setup.sh | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 2eba19b..f384d2d 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1299,7 +1299,6 @@ if [[ $print_cmdline ]]; then
module_cmdline "$_d_mod"
done
unset moddir
- printf "\n"
exit 0
fi
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
index 81de177..33875f8 100755
--- a/modules.d/95rootfs-block/module-setup.sh
+++ b/modules.d/95rootfs-block/module-setup.sh
@@ -22,7 +22,7 @@ cmdline_journal() {
fi
if [ -n "$journaldev" ]; then
- printf " root.journaldev=%s" "$journaldev"
+ echo "root.journaldev=${journaldev}"
fi
done
fi
@@ -32,9 +32,9 @@ cmdline_journal() {
cmdline_rootfs() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
- printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
- printf " rootflags=%s" "$(find_mp_fsopts /)"
- printf " rootfstype=%s" "$(find_mp_fstype /)"
+ printf "root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
+ printf "rootflags=%s" "$(find_mp_fsopts /)"
+ printf "rootfstype=%s\n" "$(find_mp_fstype /)"
fi
}

View File

@ -0,0 +1,39 @@
From e683985d103f1b0f15a9ccd9678169f4fb7aeb5f Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Thu, 11 Dec 2014 15:46:33 +0100
Subject: [PATCH] dracut: nbd: Only complain of missing binary in hostonly mode
if
rootfs is on nbd
In not hostonly mode, require_binaries will still complain.
If in hostonly mode and the module is explicitly added via -a nbd, then
install() section will still complain later:
dracut-install: ERROR: installing 'nbd-client'
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
modules.d/95nbd/module-setup.sh | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/modules.d/95nbd/module-setup.sh b/modules.d/95nbd/module-setup.sh
index 4f9e350..3cb6f49 100755
--- a/modules.d/95nbd/module-setup.sh
+++ b/modules.d/95nbd/module-setup.sh
@@ -3,8 +3,6 @@
# called by dracut
check() {
local _rootdev
- # If our prerequisites are not met, fail.
- require_binaries nbd-client || return 1
# if an nbd device is not somewhere in the chain of devices root is
# mounted on, fail the hostonly check.
@@ -15,6 +13,7 @@ check() {
[[ -b /dev/block/$_rootdev ]] || return 1
check_block_and_slaves is_nbd "$_rootdev" || return 255
}
+ require_binaries nbd-client || return 1
return 0
}

View File

@ -0,0 +1,72 @@
From bea41b898a93e4437640817964861bbb694b01e6 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Dec 2014 11:22:46 +0100
Subject: [PATCH] dracut-functions.sh: for module handling, strip all ".ko*"
Just strip anything after ".ko" including ".ko", otherwise compressed
modules are not stripped, if they end on e.g. ".ko.gz"
---
dracut-functions.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index b91d8dc..410960d 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -1461,7 +1461,7 @@ install_kmod_with_fw() {
if [[ $omit_drivers ]]; then
local _kmod=${1##*/}
- _kmod=${_kmod%.ko}
+ _kmod=${_kmod%.ko*}
_kmod=${_kmod/-/_}
if [[ "$_kmod" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
@@ -1475,7 +1475,7 @@ install_kmod_with_fw() {
if [[ $silent_omit_drivers ]]; then
local _kmod=${1##*/}
- _kmod=${_kmod%.ko}
+ _kmod=${_kmod%.ko*}
_kmod=${_kmod/-/_}
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
@@ -1599,7 +1599,7 @@ module_is_host_only() {
local _mod=$1
local _modenc a i _k _s _v _aliases
_mod=${_mod##*/}
- _mod=${_mod%.ko}
+ _mod=${_mod%.ko*}
_modenc=${_mod//-/_}
[[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0
@@ -1691,16 +1691,16 @@ instmods() {
_mod=${_mod##*/}
# Check for aliased modules
_modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
- _modalias=${_modalias%.ko}
- if [ "${_modalias##*/}" != "$_mod" ] ; then
+ _modalias=${_modalias%.ko*}
+ if [[ $_modalias ]] && [ "${_modalias##*/}" != "${_mod%.ko*}" ] ; then
_mod=${_modalias##*/}
fi
# if we are already installed, skip this module and go on
# to the next one.
if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
- [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko" ]]; then
- read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko}.ko"
+ [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" ]]; then
+ read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}"
return $_ret
fi
@@ -1730,7 +1730,7 @@ instmods() {
((_ret+=$?))
else
[[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
- echo $_mod >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
+ echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist"
fi
;;
esac

View File

@ -0,0 +1,72 @@
From a17d5cf4941addd0a7e94129062520fd64585a7d Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Dec 2014 11:44:18 +0100
Subject: [PATCH] Revert "95rootfs-block: Correctly terminate commandline
parameter"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 4b6b46bb2aa9e6a72f96501888035f2d38b82266.
$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
instead of:
$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache
rootfstype=btrfs
and also
$ make testimage
*** Store current command line parameters ***
Stored kernel commandline:
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
---
dracut.sh | 1 +
modules.d/95rootfs-block/module-setup.sh | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index f384d2d..2eba19b 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1299,6 +1299,7 @@ if [[ $print_cmdline ]]; then
module_cmdline "$_d_mod"
done
unset moddir
+ printf "\n"
exit 0
fi
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
index 33875f8..81de177 100755
--- a/modules.d/95rootfs-block/module-setup.sh
+++ b/modules.d/95rootfs-block/module-setup.sh
@@ -22,7 +22,7 @@ cmdline_journal() {
fi
if [ -n "$journaldev" ]; then
- echo "root.journaldev=${journaldev}"
+ printf " root.journaldev=%s" "$journaldev"
fi
done
fi
@@ -32,9 +32,9 @@ cmdline_journal() {
cmdline_rootfs() {
local dev=/dev/block/$(find_root_block_device)
if [ -e $dev ]; then
- printf "root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
- printf "rootflags=%s" "$(find_mp_fsopts /)"
- printf "rootfstype=%s\n" "$(find_mp_fstype /)"
+ printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
+ printf " rootflags=%s" "$(find_mp_fsopts /)"
+ printf " rootfstype=%s" "$(find_mp_fstype /)"
fi
}

View File

@ -0,0 +1,31 @@
From 733c71ce9e2d161c9e04772aeb1c5fb38e3fcb3a Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Wed, 17 Dec 2014 12:08:37 +0100
Subject: [PATCH] resume: make use of systemd-hibernate-resume, if existant
In systemd mode, and if systemd-hibernate-resume exists, use it
exclusively.
---
modules.d/95resume/module-setup.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index dfd4350..7fe6df3 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -33,6 +33,15 @@ install() {
[[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
fi
+ # if systemd is included and has the hibernate-resume tool, use it and nothing else
+ if dracut_module_included "systemd" && [[ -x $systemdutildir/systemd-hibernate-resume ]]; then
+ inst_multiple -o \
+ $systemdutildir/system-generators/systemd-hibernate-resume-generator \
+ $systemdsystemunitdir/systemd-hibernate-resume@.service \
+ $systemdutildir/systemd-hibernate-resume
+ return 0
+ fi
+
# Optional uswsusp support
for _bin in /usr/sbin/resume /usr/lib/suspend/resume /usr/lib/uswsusp/resume
do

View File

@ -0,0 +1,29 @@
From 3e7a05f2a5f051a97ac08885f5288bc310c367c2 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 19 Dec 2014 12:47:49 +0100
Subject: [PATCH] systemd: add systemd-journald-audit.socket
---
modules.d/98systemd/module-setup.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index 53e07a2..51ea288 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -83,6 +83,7 @@ install() {
$systemdsystemunitdir/systemd-udevd-kernel.socket \
$systemdsystemunitdir/systemd-ask-password-plymouth.path \
$systemdsystemunitdir/systemd-journald.socket \
+ $systemdsystemunitdir/systemd-journald-audit.socket \
$systemdsystemunitdir/systemd-ask-password-console.service \
$systemdsystemunitdir/systemd-modules-load.service \
$systemdsystemunitdir/systemd-halt.service \
@@ -105,6 +106,7 @@ install() {
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-control.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-udevd-kernel.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-journald.socket \
+ $systemdsystemunitdir/sockets.target.wants/systemd-journald-audit.socket \
$systemdsystemunitdir/sockets.target.wants/systemd-journald-dev-log.socket \
$systemdsystemunitdir/sysinit.target.wants/systemd-udevd.service \
$systemdsystemunitdir/sysinit.target.wants/systemd-udev-trigger.service \

View File

@ -0,0 +1,46 @@
From 332ecaa900a5af83ffae64f3e103270e49de88de Mon Sep 17 00:00:00 2001
From: Erwan Velu <erwan.velu@enovance.com>
Date: Wed, 17 Dec 2014 17:04:19 +0100
Subject: [PATCH] dracut: Don't fail at copying files when including
directories
When including a directory, the files were considered in the directory
name which lead to messages like :
cp: failed to access '/var/tmp/initramfs.L9s2zO///init-func': No such file or directory
This patch does make the destdir more explicit and copy files into the
destination directory instead of destdir/filename/
---
dracut.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 2eba19b..07e4965 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1493,12 +1493,13 @@ while pop include_src src && pop include_target tgt; do
inst $src $tgt
else
ddebug "Including directory: $src"
- mkdir -p "${initdir}/${tgt}"
+ destdir="${initdir}/${tgt}"
+ mkdir -p "$destdir"
# check for preexisting symlinks, so we can cope with the
# symlinks to $prefix
for i in "$src"/*; do
[[ -e "$i" || -h "$i" ]] || continue
- s=${initdir}/${tgt}/${i#$src/}
+ s=${destdir}/${i#$src/}
if [[ -d "$i" ]]; then
if ! [[ -e "$s" ]]; then
mkdir -m 0755 -p "$s"
@@ -1506,7 +1507,7 @@ while pop include_src src && pop include_target tgt; do
fi
cp --reflink=auto --sparse=auto -fa -t "$s" "$i"/*
else
- cp --reflink=auto --sparse=auto -fa -t "$s" "$i"
+ cp --reflink=auto --sparse=auto -fa -t "$destdir" "$i"
fi
done
fi

View File

@ -11,7 +11,7 @@
Name: dracut
Version: 040
Release: 30.git20141208%{?dist}
Release: 78.git20141219%{?dist}
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
@ -59,6 +59,54 @@ Patch26: 0026-40network-Fix-the-syntax-to-correct-the-judgment-sen.patch
Patch27: 0027-initrd-release-move-from-etc-to-usr-lib.patch
Patch28: 0028-dracut.conf.d-fedora.conf.example-turn-on-early_micr.patch
Patch29: 0029-Fixed-the-dracut-shutdown.service.patch
Patch30: 0030-dmsquash-live-setup-the-images-in-run-initramfs.patch
Patch31: 0031-mkinitrd-suse-Update-to-sles12-SUSE-state.patch
Patch32: 0032-systemd-always-tries-to-load-autofs4.patch
Patch33: 0033-Fixup-mdraid-setup.patch
Patch34: 0034-95udev-rules-Include-correct-sg3_utils-rules.patch
Patch35: 0035-90multipath-install-correct-multipath-rules.patch
Patch36: 0036-95iscsi-Autodetect-iSCSI-firmware.patch
Patch37: 0037-95iscsi-Install-libgcc_s-library.patch
Patch38: 0038-95iscsi-Set-correct-iscsi_started-value-for-iSCSI-fi.patch
Patch39: 0039-95iscsi-strip-one-set-of-quotes-when-calling-initque.patch
Patch40: 0040-95iscsi-Fixup-bnx2i-offload-booting.patch
Patch41: 0041-95iscsi-More-empty-cmdline-fixes.patch
Patch42: 0042-95iscsi-generate-commandline-for-software-iscsi.patch
Patch43: 0043-iscsi-iscsi.initiator-and-others-can-and-must-only-s.patch
Patch44: 0044-Implement-rd.timeout-to-modify-the-device-timeout.patch
Patch45: 0045-Do-not-call-lvm-for-non-LVM-device-mapper-devices.patch
Patch46: 0046-Print-stored-dracut-commandline-during-initramfs-bui.patch
Patch47: 0047-Align-dev_unit_name-with-systemd-s-function.patch
Patch48: 0048-Generate-fallback-mount-unit-for-root-filesystem.patch
Patch49: 0049-99base-warn-on-invalid-command-for-initqueue.patch
Patch50: 0050-Handle-module-alias-properly.patch
Patch51: 0051-99base-Increase-initqueue-timeout-in-non-systemd-cas.patch
Patch52: 0052-90lvm-Install-dm-snapshot-module.patch
Patch53: 0053-Check-for-logfile-logfile-option-and-create-it-if-ne.patch
Patch54: 0054-dracut.sh-Avoid-duplicate-devices-in-host_devs.patch
Patch55: 0055-dracut.sh-Fix-UUID-fstab-parsing-in-case-mount-optio.patch
Patch56: 0056-dracut.usage.asc-Remove-distro-specific-help-from-ma.patch
Patch57: 0057-nfs-Add-ip-.-and-root-nfs.-parameters-to-internal-dr.patch
Patch58: 0058-95iscsi-parse-output-from-iscsiadm-correctly.patch
Patch59: 0059-dracut-Do-not-stop-installing-drivers-if-one-fails.patch
Patch60: 0060-95fcoe-update-fcoe-interface-check.patch
Patch61: 0061-95fcoe-Store-current-configuration-in-dracut-cmdline.patch
Patch62: 0062-95fcoe-skip-VLAN-devices-in-fcoe-up.patch
Patch63: 0063-95fcoe-start-lldpad-separately.patch
Patch64: 0064-Enhance-suse.conf-and-debug-module-example-with-SUSE.patch
Patch65: 0065-40network-add-missing-_arch-variable-declaration.patch
Patch66: 0066-99base-Add-chown-binary.patch
Patch67: 0067-90kernel-modules-install-scsi_dh_alua.patch
Patch68: 0068-Fix-non-export-of-journal-dev-boot-options.patch
Patch69: 0069-Also-export-root-boot-param-for-hostonly-cmdline-cas.patch
Patch70: 0070-Don-t-create-lots-of-empty-cmdline-files-for-hostonl.patch
Patch71: 0071-95rootfs-block-Correctly-terminate-commandline-param.patch
Patch72: 0072-dracut-nbd-Only-complain-of-missing-binary-in-hoston.patch
Patch73: 0073-dracut-functions.sh-for-module-handling-strip-all-.k.patch
Patch74: 0074-Revert-95rootfs-block-Correctly-terminate-commandlin.patch
Patch75: 0075-resume-make-use-of-systemd-hibernate-resume-if-exist.patch
Patch76: 0076-systemd-add-systemd-journald-audit.socket.patch
Patch77: 0077-dracut-Don-t-fail-at-copying-files-when-including-di.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -507,6 +555,9 @@ rm -rf -- $RPM_BUILD_ROOT
%endif
%changelog
* Fri Dec 19 2014 Harald Hoyer <harald@redhat.com> 040-78.git20141219
- git snapshot
* Mon Dec 08 2014 Harald Hoyer <harald@redhat.com> 040-30.git20141208
- fixed dracut-shutdown