From b38677281579d373d1e669b6172d7c9886610c70 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Jun 07 2016 08:24:44 +0000 Subject: dracut-044-75 - fix for systemd >= 230 - git snapshot --- diff --git a/0017-dracut.cmdline-remove-extra-from-ip-doc.patch b/0017-dracut.cmdline-remove-extra-from-ip-doc.patch new file mode 100644 index 0000000..ef102db --- /dev/null +++ b/0017-dracut.cmdline-remove-extra-from-ip-doc.patch @@ -0,0 +1,22 @@ +From 0a7d7f63106ce5a7f9869aacb21d0474621811e7 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Jan 2016 09:17:40 +0100 +Subject: [PATCH] dracut.cmdline: remove extra ":" from ip= doc + +--- + dracut.cmdline.7.asc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index e160e3b..c4c5588 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -492,7 +492,7 @@ cannot be used in conjunction with the **ifname** argument for the + same . + ===================== + +-**ip=**____:[____]:____:____:____:____:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__:[:[____][:____]]:: ++**ip=**____:[____]:____:____:____:____:__{none|off|dhcp|on|any|dhcp6|auto6|ibft}__[:[____][:____]]:: + explicit network configuration. If you want do define a IPv6 address, put it + in brackets (e.g. [2001:DB8::1]). This parameter can be specified multiple + times. ____ is optional and is the address of the remote endpoint diff --git a/0018-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch b/0018-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch new file mode 100644 index 0000000..4d0180c --- /dev/null +++ b/0018-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch @@ -0,0 +1,30 @@ +From b019952f6df9b1dae54dd097f012e6c05fe6af00 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Jan 2016 09:32:24 +0100 +Subject: [PATCH] dracut.sh: fail hard, if we find modules and modules.dep is + missing + +If modules are present in /lib/modules/ and modules.dep +is empty, depmod was not run most likely. +--- + dracut.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 6dc9858..98dbe0b 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -925,7 +925,12 @@ abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile" + + if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then + if ! [[ -f $srcmods/modules.dep ]]; then +- dwarn "$srcmods/modules.dep is missing. Did you run depmod?" ++ if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then ++ dfatal "$srcmods/modules.dep is missing. Did you run depmod?" ++ exit 1 ++ else ++ dwarn "$srcmods/modules.dep is missing. Did you run depmod?" ++ fi + elif ! ( command -v gzip &>/dev/null && command -v xz &>/dev/null); then + read _mod < $srcmods/modules.dep + _mod=${_mod%%:*} diff --git a/0019-network-net-lib.sh-correctly-set-mac-address-for-ip-.patch b/0019-network-net-lib.sh-correctly-set-mac-address-for-ip-.patch new file mode 100644 index 0000000..08f2cce --- /dev/null +++ b/0019-network-net-lib.sh-correctly-set-mac-address-for-ip-.patch @@ -0,0 +1,25 @@ +From efbc47b8e43ad173d3319f3f6e87b0a60aad9f37 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Jan 2016 13:43:38 +0100 +Subject: [PATCH] network/net-lib.sh: correctly set mac address for + ip=...:: + +if ip=...:: was specified, macadress was not set +--- + modules.d/40network/net-lib.sh | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh +index 256826e..31f1a56 100755 +--- a/modules.d/40network/net-lib.sh ++++ b/modules.d/40network/net-lib.sh +@@ -427,6 +427,9 @@ ip_to_var() { + ;; + [0-9]*) + mtu="$8" ++ if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then ++ macaddr="${9}:${10}:${11}:${12}:${13}:${14}" ++ fi + ;; + *) + if [ -n "${9}" -a -n "${10}" -a -n "${11}" -a -n "${12}" -a -n "${13}" -a -n "${14}" ]; then diff --git a/0020-dracut-functions.sh-fix-check_vol_slaves-volume-grou.patch b/0020-dracut-functions.sh-fix-check_vol_slaves-volume-grou.patch new file mode 100644 index 0000000..2af695d --- /dev/null +++ b/0020-dracut-functions.sh-fix-check_vol_slaves-volume-grou.patch @@ -0,0 +1,25 @@ +From 2fd8588da51a0e43684852dcdabe327aca684a9f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 18 Jan 2016 16:59:42 +0100 +Subject: [PATCH] dracut-functions.sh:fix check_vol_slaves() volume group name + stripping + +commit 466a59984a095f33993cffd5a3bea40826469b03 removed whitespace +stripping from lvm volume group names. +--- + dracut-functions.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index 59747ec..c7ea9f5 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -580,7 +580,7 @@ check_vol_slaves() { + if [[ $_lv = $2 ]]; then + _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null) + # strip space +- _vg=$(printf "%s\n" "$_vg") ++ _vg="${_vg//[[:space:]]/}" + if [[ $_vg ]]; then + for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null) + do diff --git a/0021-multipath-fix-majmin_to_mpath_dev.patch b/0021-multipath-fix-majmin_to_mpath_dev.patch new file mode 100644 index 0000000..1efbfe2 --- /dev/null +++ b/0021-multipath-fix-majmin_to_mpath_dev.patch @@ -0,0 +1,38 @@ +From 28058a2e373eb268d9b1cd5b65c2ad607961dad1 Mon Sep 17 00:00:00 2001 +From: Pekka Wallendahl +Date: Mon, 18 Jan 2016 20:28:22 +0200 +Subject: [PATCH] multipath: fix majmin_to_mpath_dev() + +* Multipath device names only start with the mpath-prefix if the option + use_userfriendly_names is set true in /etc/multipath.conf and if user + has not set any aliases in the said file. Thus the for-loop should go + through all files in /dev/mapper/, not just ones starting with 'mpath' + +* Bash is perfectly capable to extend `/dev/mapper/*` notation without a + need to pass it to an external ls + +* Changed the function to use a local variable $_dev instead of the + global $dev, which seemed to be the original intention as the local + _dev was defined but not used +--- + modules.d/90multipath/module-setup.sh | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index 831c99f..a808678 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -9,9 +9,10 @@ is_mpath() { + + majmin_to_mpath_dev() { + local _dev +- for i in `ls -1 /dev/mapper/mpath*`; do +- dev=$(get_maj_min $i) +- if [ "$dev" = "$1" ]; then ++ for i in /dev/mapper/*; do ++ [[ $i == /dev/mapper/control ]] && continue ++ _dev=$(get_maj_min $i) ++ if [ "$_dev" = "$1" ]; then + echo $i + return + fi diff --git a/0022-Fixed-vlan-bonding-bridging-team-logic.patch b/0022-Fixed-vlan-bonding-bridging-team-logic.patch new file mode 100644 index 0000000..3377fb7 --- /dev/null +++ b/0022-Fixed-vlan-bonding-bridging-team-logic.patch @@ -0,0 +1,805 @@ +From 24a78b269745b0b16a2bdc03c35015b2cb9d0408 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Jan 2016 11:34:10 +0100 +Subject: [PATCH] Fixed vlan, bonding, bridging, team logic + +Call ifup for the slaves and assemble afterwards. +--- + modules.d/40network/ifup.sh | 364 ++++++++++++++++++------------------ + modules.d/40network/net-genrules.sh | 26 ++- + modules.d/40network/parse-bond.sh | 25 +-- + modules.d/40network/parse-bridge.sh | 28 +-- + modules.d/40network/parse-team.sh | 26 +-- + modules.d/40network/parse-vlan.sh | 4 +- + modules.d/45ifcfg/write-ifcfg.sh | 21 +-- + test/TEST-20-NFS/test.sh | 4 +- + test/TEST-30-ISCSI/test.sh | 4 +- + test/TEST-50-MULTINIC/test.sh | 17 +- + 10 files changed, 249 insertions(+), 270 deletions(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index eca7478..14ca86d 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -15,76 +15,12 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh + + # $netif reads easier than $1 + netif=$1 +-use_bridge='false' +-use_vlan='false' + +-# enslave this interface to bond? +-for i in /tmp/bond.*.info; do +- [ -e "$i" ] || continue +- unset bondslaves +- unset bondname +- . "$i" +- for slave in $bondslaves ; do +- if [ "$netif" = "$slave" ] ; then +- netif=$bondname +- break 2 +- fi +- done +-done +- +-if [ -e /tmp/team.info ]; then +- . /tmp/team.info +- for slave in $teamslaves ; do +- if [ "$netif" = "$slave" ] ; then +- netif=$teammaster +- fi +- done +-fi +- +-if [ -e /tmp/vlan.info ]; then +- . /tmp/vlan.info +- if [ "$netif" = "$phydevice" ]; then +- if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then +- : # We need to really setup bond (recursive call) +- elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then +- : # We need to really setup team (recursive call) +- else +- netif="$vlanname" +- use_vlan='true' +- fi +- fi +-fi +- +-# bridge this interface? +-if [ -e /tmp/bridge.info ]; then +- . /tmp/bridge.info +- for ethname in $bridgeslaves ; do +- if [ "$netif" = "$ethname" ]; then +- if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then +- : # We need to really setup bond (recursive call) +- elif [ "$netif" = "$teammaster" ] && [ -n "$DO_TEAM_SETUP" ] ; then +- : # We need to really setup team (recursive call) +- elif [ "$netif" = "$vlanname" ] && [ -n "$DO_VLAN_SETUP" ]; then +- : # We need to really setup vlan (recursive call) +- else +- netif="$bridgename" +- use_bridge='true' +- fi +- fi +- done +-fi +- +-# disable manual ifup while netroot is set for simplifying our logic +-# in netroot case we prefer netroot to bringup $netif automaticlly +-[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2" +- +-if [ -n "$manualup" ]; then +- >/tmp/net.$netif.manualup +- rm -f /tmp/net.${netif}.did-setup +-else +- [ -e /tmp/net.${netif}.did-setup ] && exit 0 +- [ -e /sys/class/net/$netif/address ] && \ +- [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0 ++# loopback is always handled the same way ++if [ "$netif" = "lo" ] ; then ++ ip link set lo up ++ ip addr add 127.0.0.1/8 dev lo ++ exit 0 + fi + + # Run dhclient +@@ -188,134 +124,203 @@ do_static() { + return 0 + } + +-# loopback is always handled the same way +-if [ "$netif" = "lo" ] ; then +- ip link set lo up +- ip addr add 127.0.0.1/8 dev lo ++get_vid() { ++ case "$1" in ++ vlan*) ++ echo ${1#vlan} ++ ;; ++ *.*) ++ echo ${1##*.} ++ ;; ++ esac ++} ++ ++# check, if we need VLAN's for this interface ++if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then ++ NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif" ++ modprobe -b -q 8021q ++ ++ for i in /tmp/vlan.*.${netif}; do ++ [ -e "$i" ] || continue ++ read vlanname < "$i" ++ if [ -n "$vlanname" ]; then ++ linkup "$phydevice" ++ ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)" ++ ifup "$vlanname" ++ fi ++ done + exit 0 + fi + +-# start bond if needed +-if [ -e /tmp/bond.${netif}.info ]; then +- . /tmp/bond.${netif}.info +- +- if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device +- modprobe bonding +- echo "+$netif" > /sys/class/net/bonding_masters +- ip link set $netif down +- +- # Stolen from ifup-eth +- # add the bits to setup driver parameters here +- for arg in $bondoptions ; do +- key=${arg%%=*}; +- value=${arg##*=}; +- # %{value:0:1} is replaced with non-bash specific construct +- if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then +- OLDIFS=$IFS; +- IFS=','; +- for arp_ip in $value; do +- echo +$arp_ip > /sys/class/net/${netif}/bonding/$key +- done +- IFS=$OLDIFS; +- else +- echo $value > /sys/class/net/${netif}/bonding/$key ++# bridge this interface? ++if [ -z "$NO_BRIDGE_MASTER" ]; then ++ for i in /tmp/bridge.*.info; do ++ [ -e "$i" ] || continue ++ unset bridgeslaves ++ unset bridgename ++ . "$i" ++ for ethname in $bridgeslaves ; do ++ [ "$netif" != "$ethname" ] && continue ++ ++ NO_BRIDGE_MASTER=yes NO_AUTO_DHCP=yes ifup $ethname ++ linkup $ethname ++ if [ ! -e /tmp/bridge.$bridgename.up ]; then ++ brctl addbr $bridgename ++ brctl setfd $bridgename 0 ++ > /tmp/bridge.$bridgename.up + fi ++ brctl addif $bridgename $ethname ++ ifup $bridgename ++ exit 0 + done ++ done ++fi + +- linkup $netif +- ++# enslave this interface to bond? ++if [ -z "$NO_BOND_MASTER" ]; then ++ for i in /tmp/bond.*.info; do ++ [ -e "$i" ] || continue ++ unset bondslaves ++ unset bondname ++ . "$i" + for slave in $bondslaves ; do +- ip link set $slave down +- cat /sys/class/net/$slave/address > /tmp/net.${netif}.${slave}.hwaddr +- echo "+$slave" > /sys/class/net/$bondname/bonding/slaves +- linkup $slave +- done ++ [ "$netif" != "$slave" ] && continue + +- # add the bits to setup the needed post enslavement parameters +- for arg in $BONDING_OPTS ; do +- key=${arg%%=*}; +- value=${arg##*=}; +- if [ "${key}" = "primary" ]; then +- echo $value > /sys/class/net/${netif}/bonding/$key +- fi ++ # already setup ++ [ -e /tmp/bond.$bondname.up ] && exit 0 ++ ++ # wait for all slaves to show up ++ for slave in $bondslaves ; do ++ # try to create the slave (maybe vlan or bridge) ++ NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave ++ ++ if ! ip link show dev $slave >/dev/null 2>&1; then ++ # wait for the last slave to show up ++ exit 0 ++ fi ++ done ++ ++ modprobe -q -b bonding ++ echo "+$bondname" > /sys/class/net/bonding_masters 2>/dev/null ++ ip link set $bondname down ++ ++ # Stolen from ifup-eth ++ # add the bits to setup driver parameters here ++ for arg in $bondoptions ; do ++ key=${arg%%=*}; ++ value=${arg##*=}; ++ # %{value:0:1} is replaced with non-bash specific construct ++ if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then ++ OLDIFS=$IFS; ++ IFS=','; ++ for arp_ip in $value; do ++ echo +$arp_ip > /sys/class/net/${bondname}/bonding/$key ++ done ++ IFS=$OLDIFS; ++ else ++ echo $value > /sys/class/net/${bondname}/bonding/$key ++ fi ++ done ++ ++ linkup $bondname ++ ++ for slave in $bondslaves ; do ++ cat /sys/class/net/$slave/address > /tmp/net.${bondname}.${slave}.hwaddr ++ ip link set $slave down ++ echo "+$slave" > /sys/class/net/$bondname/bonding/slaves ++ linkup $slave ++ done ++ ++ # add the bits to setup the needed post enslavement parameters ++ for arg in $bondoptions ; do ++ key=${arg%%=*}; ++ value=${arg##*=}; ++ if [ "${key}" = "primary" ]; then ++ echo $value > /sys/class/net/${bondname}/bonding/$key ++ fi ++ done ++ ++ > /tmp/bond.$bondname.up ++ ++ NO_BOND_MASTER=yes ifup $bondname ++ exit $? + done +- fi ++ done + fi + +-if [ -e /tmp/team.info ]; then +- . /tmp/team.info +- if [ "$netif" = "$teammaster" ] && [ ! -e /tmp/net.$teammaster.up ] ; then +- # We shall only bring up those _can_ come up +- # in case of some slave is gone in active-backup mode +- working_slaves="" ++if [ -z "$NO_TEAM_MASTER" ]; then ++ for i in /tmp/team.*.info; do ++ [ -e "$i" ] || continue ++ unset teammaster ++ unset teamslaves ++ . "$i" + for slave in $teamslaves ; do +- ip link set $slave up 2>/dev/null +- if wait_for_if_up $slave; then +- working_slaves+="$slave " +- fi +- done +- # Do not add slaves now +- teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf +- for slave in $working_slaves; do +- # team requires the slaves to be down before joining team +- ip link set $slave down +- teamdctl $teammaster port add $slave +- done +- ip link set $teammaster up +- fi +-fi ++ [ "$netif" != "$slave" ] && continue + +-# XXX need error handling like dhclient-script ++ [ -e /tmp/team.$teammaster.up ] && exit 0 + +-if [ -e /tmp/bridge.info ]; then +- . /tmp/bridge.info +-# start bridge if necessary +- if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then +- brctl addbr $bridgename +- brctl setfd $bridgename 0 +- for ethname in $bridgeslaves ; do +- if [ "$ethname" = "$bondname" ] ; then +- DO_BOND_SETUP=yes ifup $bondname -m +- elif [ "$ethname" = "$teammaster" ] ; then +- DO_TEAM_SETUP=yes ifup $teammaster -m +- elif [ "$ethname" = "$vlanname" ]; then +- DO_VLAN_SETUP=yes ifup $vlanname -m +- else +- linkup $ethname ++ # wait for all slaves to show up ++ for slave in $teamslaves ; do ++ # try to create the slave (maybe vlan or bridge) ++ NO_BOND_MASTER=yes NO_AUTO_DHCP=yes ifup $slave ++ ++ if ! ip link show dev $slave >/dev/null 2>&1; then ++ # wait for the last slave to show up ++ exit 0 ++ fi ++ done ++ ++ if [ ! -e /tmp/team.$teammaster.up ] ; then ++ # We shall only bring up those _can_ come up ++ # in case of some slave is gone in active-backup mode ++ working_slaves="" ++ for slave in $teamslaves ; do ++ ip link set $slave up 2>/dev/null ++ if wait_for_if_up $slave; then ++ working_slaves+="$slave " ++ fi ++ done ++ # Do not add slaves now ++ teamd -d -U -n -N -t $teammaster -f /etc/teamd/$teammaster.conf ++ for slave in $working_slaves; do ++ # team requires the slaves to be down before joining team ++ ip link set $slave down ++ teamdctl $teammaster port add $slave ++ done ++ ++ ip link set $teammaster up ++ ++ > /tmp/team.$teammaster.up ++ NO_TEAM_MASTER=yes ifup $teammaster ++ exit $? + fi +- brctl addif $bridgename $ethname + done +- fi ++ done + fi + +-get_vid() { +- case "$1" in +- vlan*) +- echo ${1#vlan} +- ;; +- *.*) +- echo ${1##*.} +- ;; +- esac +-} ++# all synthetic interfaces done.. now check if the interface is available ++if ! ip link show dev $netif >/dev/null 2>&1; then ++ exit 1 ++fi + +-if [ "$netif" = "$vlanname" ] && [ ! -e /tmp/net.$vlanname.up ]; then +- modprobe 8021q +- if [ "$phydevice" = "$bondname" ] ; then +- DO_BOND_SETUP=yes ifup $phydevice -m +- elif [ "$phydevice" = "$teammaster" ] ; then +- DO_TEAM_SETUP=yes ifup $phydevice -m +- else +- linkup "$phydevice" +- fi +- ip link add dev "$vlanname" link "$phydevice" type vlan id "$(get_vid $vlanname)" +- ip link set "$vlanname" up ++# disable manual ifup while netroot is set for simplifying our logic ++# in netroot case we prefer netroot to bringup $netif automaticlly ++[ -n "$2" -a "$2" = "-m" ] && [ -z "$netroot" ] && manualup="$2" ++ ++if [ -n "$manualup" ]; then ++ >/tmp/net.$netif.manualup ++ rm -f /tmp/net.${netif}.did-setup ++else ++ [ -e /tmp/net.${netif}.did-setup ] && exit 0 ++ [ -e /sys/class/net/$netif/address ] && \ ++ [ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0 + fi + ++ + # No ip lines default to dhcp + ip=$(getarg ip) + +-if [ -z "$ip" ]; then ++if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then + for s in $(getargs nameserver); do + [ -n "$s" ] || continue + echo nameserver $s >> /tmp/net.$netif.resolv.conf +@@ -348,9 +353,7 @@ for p in $(getargs ip=); do + esac + + # If this option isn't directed at our interface, skip it +- [ -n "$dev" ] && [ "$dev" != "$netif" ] && \ +- [ "$use_bridge" != 'true' ] && \ +- [ "$use_vlan" != 'true' ] && continue ++ [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue + + # setup nameserver + for s in "$dns1" "$dns2" $(getargs nameserver); do +@@ -402,15 +405,8 @@ for p in $(getargs ip=); do + fi + done + +-# netif isn't the top stack? Then we should exit here. +-# eg. netif is bond0. br0 is on top of it. dhcp br0 is correct but dhcp +-# bond0 doesn't make sense. +-if [ -n "$DO_BOND_SETUP" -o -n "$DO_TEAM_SETUP" -o -n "$DO_VLAN_SETUP" ]; then +- exit 0 +-fi +- + # no ip option directed at our interface? +-if [ ! -e /tmp/net.${netif}.up ]; then ++if [ -z "$NO_AUTO_DHCP" ] && [ ! -e /tmp/net.${netif}.up ]; then + if [ -e /tmp/net.bootdev ]; then + BOOTDEV=$(cat /tmp/net.bootdev) + if [ "$netif" = "$BOOTDEV" ] || [ "$BOOTDEV" = "$(cat /sys/class/net/${netif}/address)" ]; then +diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh +index b1c156c..5df50bd 100755 +--- a/modules.d/40network/net-genrules.sh ++++ b/modules.d/40network/net-genrules.sh +@@ -12,11 +12,14 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + # Write udev rules + { + # bridge: attempt only the defined interface +- if [ -e /tmp/bridge.info ]; then +- . /tmp/bridge.info ++ for i in /tmp/bridge.*.info; do ++ [ -e "$i" ] || continue ++ unset bridgeslaves ++ unset bridgename ++ . "$i" + IFACES="$IFACES ${bridgeslaves%% *}" + MASTER_IFACES="$MASTER_IFACES $bridgename" +- fi ++ done + + # bond: attempt only the defined interface (override bridge defines) + for i in /tmp/bond.*.info; do +@@ -35,11 +38,18 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + MASTER_IFACES="$MASTER_IFACES ${teammaster}" + fi + +- if [ -e /tmp/vlan.info ]; then +- . /tmp/vlan.info +- IFACES="$IFACES $phydevice" +- MASTER_IFACES="$MASTER_IFACES ${vlanname}" +- fi ++ for j in /tmp/vlan.*.phy; do ++ [ -e "$j" ] || continue ++ unset phydevice ++ . "$j" ++ for i in /tmp/vlan.*.${phydevice}; do ++ [ -e "$i" ] || continue ++ unset vlanname ++ . "$i" ++ IFACES="$IFACES $phydevice" ++ MASTER_IFACES="$MASTER_IFACES ${vlanname}" ++ done ++ done + + if [ -z "$IFACES" ]; then + [ -e /tmp/net.ifaces ] && read IFACES < /tmp/net.ifaces +diff --git a/modules.d/40network/parse-bond.sh b/modules.d/40network/parse-bond.sh +index 25c51b8..80b3b07 100755 +--- a/modules.d/40network/parse-bond.sh ++++ b/modules.d/40network/parse-bond.sh +@@ -10,14 +10,6 @@ + # bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr + # + +-# return if bond already parsed +-[ -n "$bondname" ] && return +- +-# Check if bond parameter is valid +-if getarg bond= >/dev/null ; then +- : +-fi +- + # We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup + # Ditto for bonding options + parsebond() { +@@ -28,7 +20,6 @@ parsebond() { + v=${v#*:} + done + +- unset bondname bondslaves bondoptions + case $# in + 0) bondname=bond0; bondslaves="eth0 eth1" ;; + 1) bondname=$1; bondslaves="eth0 eth1" ;; +@@ -38,14 +29,13 @@ parsebond() { + esac + } + +-unset bondname bondslaves bondoptions +- + # Parse bond for bondname, bondslaves, bondmode and bondoptions +-if getarg bond >/dev/null; then +- # Read bond= parameters if they exist +- bond="$(getarg bond=)" +- if [ ! "$bond" = "bond" ]; then +- parsebond "$(getarg bond=)" ++for bond in $(getargs bond=); do ++ unset bondname ++ unset bondslaves ++ unset bondoptions ++ if [ "$bond" != "bond" ]; then ++ parsebond "$bond" + fi + # Simple default bond + if [ -z "$bondname" ]; then +@@ -57,5 +47,4 @@ if getarg bond >/dev/null; then + echo "bondname=$bondname" > /tmp/bond.${bondname}.info + echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.${bondname}.info + echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.${bondname}.info +- return +-fi ++done +diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh +index 212f259..5c3af29 100755 +--- a/modules.d/40network/parse-bridge.sh ++++ b/modules.d/40network/parse-bridge.sh +@@ -7,14 +7,6 @@ + # bridge without parameters assumes bridge=br0:eth0 + # + +-# return if bridge already parsed +-[ -n "$bridgename" ] && return +- +-# Check if bridge parameter is valid +-if getarg bridge= >/dev/null ; then +- command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed" +-fi +- + parsebridge() { + local v=${1}: + set -- +@@ -22,8 +14,6 @@ parsebridge() { + set -- "$@" "${v%%:*}" + v=${v#*:} + done +- +- unset bridgename bridgeslaves + case $# in + 0) bridgename=br0; bridgeslaves=$iface ;; + 1) die "bridge= requires two parameters" ;; +@@ -32,14 +22,13 @@ parsebridge() { + esac + } + +-unset bridgename bridgeslaves +- +-iface=eth0 +- + # Parse bridge for bridgename and bridgeslaves +-if bridge="$(getarg bridge)"; then ++for bridge in $(getargs bridge=); do ++ unset bridgename ++ unset bridgeslaves ++ iface=eth0 + # Read bridge= parameters if they exist +- if [ -n "$bridge" ]; then ++ if [ "$bridge" != "bridge" ]; then + parsebridge $bridge + fi + # Simple default bridge +@@ -47,7 +36,6 @@ if bridge="$(getarg bridge)"; then + bridgename=br0 + bridgeslaves=$iface + fi +- echo "bridgename=$bridgename" > /tmp/bridge.info +- echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info +- return +-fi ++ echo "bridgename=$bridgename" > /tmp/bridge.${bridgename}.info ++ echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.${bridgename}.info ++done +diff --git a/modules.d/40network/parse-team.sh b/modules.d/40network/parse-team.sh +index 318c0e1..cc5cba7 100755 +--- a/modules.d/40network/parse-team.sh ++++ b/modules.d/40network/parse-team.sh +@@ -6,14 +6,6 @@ + # teamslaves is a comma-separated list of physical (ethernet) interfaces + # + +-# return if team already parsed +-[ -n "$teammaster" ] && return +- +-# Check if team parameter is valid +-if getarg team= >/dev/null ; then +- : +-fi +- + parseteam() { + local v=${1}: + set -- +@@ -22,23 +14,17 @@ parseteam() { + v=${v#*:} + done + +- unset teammaster teamslaves + case $# in + 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;; + *) die "team= requires two parameters" ;; + esac + } + +-unset teammaster teamslaves + +-if getarg team>/dev/null; then +- # Read team= parameters if they exist +- team="$(getarg team=)" +- if [ ! "$team" = "team" ]; then +- parseteam "$(getarg team=)" +- fi ++for team in $(getargs team=); do ++ unset teammaster teamslaves ++ parseteam "$(getarg team=)" + +- echo "teammaster=$teammaster" > /tmp/team.info +- echo "teamslaves=\"$teamslaves\"" >> /tmp/team.info +- return +-fi ++ echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info ++ echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info ++done +diff --git a/modules.d/40network/parse-vlan.sh b/modules.d/40network/parse-vlan.sh +index 3ba2289..b2a9c1c 100755 +--- a/modules.d/40network/parse-vlan.sh ++++ b/modules.d/40network/parse-vlan.sh +@@ -36,7 +36,7 @@ if getarg vlan >/dev/null; then + parsevlan "$(getarg vlan=)" + fi + +- echo "vlanname=\"$vlanname\"" > /tmp/vlan.info +- echo "phydevice=\"$phydevice\"" >> /tmp/vlan.info ++ echo "$phydevice" > /tmp/vlan.${phydevice}.phy ++ echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice} + return + fi +diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh +index 251d684..c3774ae 100755 +--- a/modules.d/45ifcfg/write-ifcfg.sh ++++ b/modules.d/45ifcfg/write-ifcfg.sh +@@ -5,14 +5,6 @@ type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh + + udevadm settle --timeout=30 + +-if [ -e /tmp/bridge.info ]; then +- . /tmp/bridge.info +-fi +- +-if [ -e /tmp/vlan.info ]; then +- . /tmp/vlan.info +-fi +- + mkdir -m 0755 -p /tmp/ifcfg/ + mkdir -m 0755 -p /tmp/ifcfg-leases/ + +@@ -129,6 +121,8 @@ for netup in /tmp/net.*.did-setup ; do + unset bondslaves + unset bondname + unset bondoptions ++ unset bridgename ++ unset bridgeslaves + unset uuid + unset ip + unset gw +@@ -140,17 +134,22 @@ for netup in /tmp/net.*.did-setup ; do + unset vlan + + [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info ++ [ -e /tmp/bridge.${netif}.info ] && . /tmp/bridge.${netif}.info + + uuid=$(cat /proc/sys/kernel/random/uuid) + if [ "$netif" = "$bridgename" ]; then + bridge=yes + elif [ "$netif" = "$bondname" ]; then +- # $netif can't be bridge and bond at the same time ++ # $netif can't be bridge and bond at the same time + bond=yes + fi +- if [ "$netif" = "$vlanname" ]; then ++ ++ for i in /tmp/vlan.${netif}.*; do ++ [ ! -e "$i" ] && continue ++ . "$i" + vlan=yes +- fi ++ break ++ done + + { + echo "# Generated by dracut initrd" +diff --git a/test/TEST-20-NFS/test.sh b/test/TEST-20-NFS/test.sh +index 61e4c1a..ceca1f0 100755 +--- a/test/TEST-20-NFS/test.sh ++++ b/test/TEST-20-NFS/test.sh +@@ -16,8 +16,8 @@ run_server() { + -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext3 \ + -m 256M -smp 2 \ + -display none \ +- -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ + -net socket,listen=127.0.0.1:12320 \ ++ -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ + -serial ${SERIAL:-null} \ + -watchdog i6300esb -watchdog-action poweroff \ + -append "rd.debug loglevel=77 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ +@@ -134,7 +134,7 @@ test_nfsv3() { + "root=nfs:192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1 + + client_test "NFSv3 Bridge root=nfs:..." 52:54:00:12:34:04 \ +- "root=nfs:192.168.50.1:/nfs/client bridge" 192.168.50.1 -wsize=4096 || return 1 ++ "root=nfs:192.168.50.1:/nfs/client bridge net.ifnames=0" 192.168.50.1 -wsize=4096 || return 1 + + client_test "NFSv3 Legacy root=IP:path" 52:54:00:12:34:04 \ + "root=192.168.50.1:/nfs/client" 192.168.50.1 -wsize=4096 || return 1 +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index fc4bdce..00c1fbd 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -85,7 +85,7 @@ do_test_run() { + "rd.iscsi.initiator=$initiator" \ + || return 1 + +- run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ ++ run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ + "root=LABEL=sysroot" \ + "ip=192.168.50.101:::255.255.255.0::ens3:off" \ + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ +@@ -94,7 +94,7 @@ do_test_run() { + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.iscsi.waitnet=0" \ +- || return 1 ++ || return 0 + + run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ + "root=LABEL=sysroot" \ +diff --git a/test/TEST-50-MULTINIC/test.sh b/test/TEST-50-MULTINIC/test.sh +index fdeb840..484ebee 100755 +--- a/test/TEST-50-MULTINIC/test.sh ++++ b/test/TEST-50-MULTINIC/test.sh +@@ -18,7 +18,7 @@ run_server() { + -display none \ + -net socket,listen=127.0.0.1:12350 \ + -net nic,macaddr=52:54:01:12:34:56,model=e1000 \ +- ${SERIAL:+-serial "$SERIAL"} \ ++ -serial ${SERIAL:-null} \ + -watchdog i6300esb -watchdog-action poweroff \ + -append "loglevel=7 root=/dev/sda rootfstype=ext3 rw console=ttyS0,115200n81 selinux=0" \ + -initrd "$TESTDIR"/initramfs.server \ +@@ -90,7 +90,10 @@ test_run() { + echo "Failed to start server" 1>&2 + return 1 + fi +- test_client || { kill_server; return 1; } ++ test_client ++ ret=$? ++ kill_server ++ return $ret + } + + test_client() { +@@ -133,7 +136,15 @@ test_client() { + "root=dhcp ip=ens3:dhcp ip=ens4:dhcp ip=ens5:dhcp bootdev=ens5" \ + "ens3 ens4 ens5" || return 1 + +- kill_server ++ client_test "MULTINIC bonding" \ ++ 00 01 02 \ ++ "root=nfs:192.168.50.1:/nfs/client ip=bond0:dhcp bond=bond0:ens3,ens4,ens5:mode=balance-rr" \ ++ "bond0" || return 1 ++ ++ client_test "MULTINIC bridging" \ ++ 00 01 02 \ ++ "root=nfs:192.168.50.1:/nfs/client ip=bridge0:dhcp bridge=bridge0:ens3,ens4,ens5" \ ++ "bridge0" || return 1 + return 0 + } + diff --git a/0023-TEST-30-ISCSI-some-tests-have-unknown-return-code.patch b/0023-TEST-30-ISCSI-some-tests-have-unknown-return-code.patch new file mode 100644 index 0000000..92a53da --- /dev/null +++ b/0023-TEST-30-ISCSI-some-tests-have-unknown-return-code.patch @@ -0,0 +1,56 @@ +From bb1b924792a688ea3da7e7f4503527e5bc0b18fb Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Jan 2016 14:43:43 +0100 +Subject: [PATCH] TEST-30-ISCSI: some tests have unknown return code + +by design +--- + test/TEST-30-ISCSI/test.sh | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/test/TEST-30-ISCSI/test.sh b/test/TEST-30-ISCSI/test.sh +index 00c1fbd..940edb6 100755 +--- a/test/TEST-30-ISCSI/test.sh ++++ b/test/TEST-30-ISCSI/test.sh +@@ -85,7 +85,7 @@ do_test_run() { + "rd.iscsi.initiator=$initiator" \ + || return 1 + +- run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ ++ run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0" \ + "root=LABEL=sysroot" \ + "ip=192.168.50.101:::255.255.255.0::ens3:off" \ + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ +@@ -94,9 +94,9 @@ do_test_run() { + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.iscsi.waitnet=0" \ +- || return 0 ++ || return 1 + +- run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ ++ run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ + "root=LABEL=sysroot" \ + "ip=192.168.50.101:::255.255.255.0::ens3:off" \ + "ip=192.168.51.101:::255.255.255.0::ens4:off" \ +@@ -105,9 +105,9 @@ do_test_run() { + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ +- || return 1 ++ || : + +- run_client "netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \ ++ run_client "FAILME: netroot=iscsi target1 target2 rd.iscsi.waitnet=0 rd.iscsi.testroute=0 default GW" \ + "root=LABEL=sysroot" \ + "ip=192.168.50.101::192.168.50.1:255.255.255.0::ens3:off" \ + "ip=192.168.51.101::192.168.51.1:255.255.255.0::ens4:off" \ +@@ -116,7 +116,7 @@ do_test_run() { + "rd.iscsi.firmware" \ + "rd.iscsi.initiator=$initiator" \ + "rd.iscsi.waitnet=0 rd.iscsi.testroute=0" \ +- || return 1 ++ || : + + return 0 + } diff --git a/0024-network-add-mtu-to-list-of-variables-to-store-in-ove.patch b/0024-network-add-mtu-to-list-of-variables-to-store-in-ove.patch new file mode 100644 index 0000000..c2e6857 --- /dev/null +++ b/0024-network-add-mtu-to-list-of-variables-to-store-in-ove.patch @@ -0,0 +1,22 @@ +From 9542f2fee4a398ed00730e6ffb7de5fe315aa093 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 19 Jan 2016 15:12:39 +0100 +Subject: [PATCH] network: add mtu to list of variables to store in override + +--- + modules.d/40network/ifup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 14ca86d..7c179bd 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -362,7 +362,7 @@ for p in $(getargs ip=); do + done + + # Store config for later use +- for i in ip srv gw mask hostname macaddr dns1 dns2; do ++ for i in ip srv gw mask hostname macaddr mtu dns1 dns2; do + eval '[ "$'$i'" ] && echo '$i'="$'$i'"' + done > /tmp/net.$netif.override + diff --git a/0025-Correctly-handle-module-aliases.patch b/0025-Correctly-handle-module-aliases.patch new file mode 100644 index 0000000..c892968 --- /dev/null +++ b/0025-Correctly-handle-module-aliases.patch @@ -0,0 +1,46 @@ +From 43819af68c7789ec932c25e699c56889fdf7276c Mon Sep 17 00:00:00 2001 +From: Fabian Vogt +Date: Thu, 21 Jan 2016 17:13:07 +0100 +Subject: [PATCH] Correctly handle module aliases + +Handle module aliases correctly to not generate unbootable +initrds with different kernel versions when modules were renamed +or replaced. + +Signed-off-by: Fabian Vogt +--- + dracut.sh | 21 +++++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/dracut.sh b/dracut.sh +index 98dbe0b..ae8772b 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1195,6 +1195,27 @@ if [[ $hostonly ]]; then + while read m rest || [ -n "$m" ]; do + host_modules["$m"]=1 + done = 4.4, mpt2sas isn't loaded, ++ # so it's not included. ++ # Both ways result in an unbootable initrd. ++ ++ # also add aliases of loaded modules ++ for mod in "${!host_modules[@]}"; do ++ aliases=$(modinfo -F alias "$mod" 2>&1) ++ for alias in $aliases; do ++ host_modules["$alias"]=1 ++ done ++ # mod might be an alias in the target kernel, find the real module ++ mod_filename=$(modinfo -k "$kernel" "$mod" -F filename) ++ [ $? -ne 0 ] && continue ++ host_modules["$(basename -s .ko "$mod_filename")"]=1 ++ done + fi + + unset m diff --git a/0026-network-if-rd.neednet-0-we-don-t-need-a-bootdev.patch b/0026-network-if-rd.neednet-0-we-don-t-need-a-bootdev.patch new file mode 100644 index 0000000..a4ae128 --- /dev/null +++ b/0026-network-if-rd.neednet-0-we-don-t-need-a-bootdev.patch @@ -0,0 +1,44 @@ +From f4f8fb5c10cc8d0047123324197aff25f0a63e04 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 26 Jan 2016 12:26:03 +0100 +Subject: [PATCH] network: if rd.neednet=0 we don't need a bootdev + +otherwise dracut would wait for the bootdev interface to appear and be +setup +--- + modules.d/40network/parse-ip-opts.sh | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/modules.d/40network/parse-ip-opts.sh b/modules.d/40network/parse-ip-opts.sh +index 12f4765..5779ef8 100755 +--- a/modules.d/40network/parse-ip-opts.sh ++++ b/modules.d/40network/parse-ip-opts.sh +@@ -40,6 +40,8 @@ if [ -n "$NEEDBOOTDEV" ] && getargbool 1 rd.neednet; then + #[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines" + echo "rd.neednet=1" > /etc/cmdline.d/dracut-neednet.conf + info "Multiple ip= arguments: assuming rd.neednet=1" ++else ++ unset NEEDBOOTDEV + fi + + # Check ip= lines +@@ -48,17 +50,14 @@ for p in $(getargs ip=); do + ip_to_var $p + + # make first device specified the BOOTDEV +- if [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then ++ if [ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEV" ] && [ -n "$dev" ]; then + BOOTDEV="$dev" +- [ -n "$NEEDBOOTDEV" ] && info "Setting bootdev to '$BOOTDEV'" ++ info "Setting bootdev to '$BOOTDEV'" + fi + + # skip ibft since we did it above + [ "$autoconf" = "ibft" ] && continue + +- # We need to have an ip= line for the specified bootdev +- [ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1 +- + # Empty autoconf defaults to 'dhcp' + if [ -z "$autoconf" ] ; then + warn "Empty autoconf values default to dhcp" diff --git a/0027-kernel-modules-add-usb-storage.patch b/0027-kernel-modules-add-usb-storage.patch new file mode 100644 index 0000000..b85cc67 --- /dev/null +++ b/0027-kernel-modules-add-usb-storage.patch @@ -0,0 +1,25 @@ +From b4dd861a0b916368bad9413fdc5d90482fcbd65a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 26 Jan 2016 14:56:05 +0100 +Subject: [PATCH] kernel-modules: add usb-storage + +To save the rdsosreport.txt to a USB stick, the usb-storage module is +needed +--- + modules.d/90kernel-modules/module-setup.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index c5f2397..13f48c9 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -47,7 +47,8 @@ installkernel() { + "=drivers/input/keyboard" + + instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ +- atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus ++ atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ ++ usb-storage + + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules diff --git a/0028-kernel-modules-join-instmods-and-install-all-usb-sto.patch b/0028-kernel-modules-join-instmods-and-install-all-usb-sto.patch new file mode 100644 index 0000000..55abd55 --- /dev/null +++ b/0028-kernel-modules-join-instmods-and-install-all-usb-sto.patch @@ -0,0 +1,48 @@ +From 6bc2096cf58c4b52f23ecc1bf8dc301d6122dfb5 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Tue, 26 Jan 2016 14:59:28 +0100 +Subject: [PATCH] kernel-modules: join instmods and install all usb/storage + +--- + modules.d/90kernel-modules/module-setup.sh | 18 ++++++++---------- + 1 file changed, 8 insertions(+), 10 deletions(-) + +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index 13f48c9..300adc7 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -39,16 +39,17 @@ installkernel() { + ehci-hcd ehci-pci ehci-platform \ + ohci-hcd ohci-pci \ + uhci-hcd \ +- xhci-hcd xhci-pci xhci-plat-hcd +- +- hostonly='' instmods \ ++ xhci-hcd xhci-pci xhci-plat-hcd \ + "=drivers/hid" \ + "=drivers/input/serio" \ +- "=drivers/input/keyboard" ++ "=drivers/input/keyboard" \ ++ "=drivers/usb/storage" + +- instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ +- atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ +- usb-storage ++ instmods \ ++ yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ ++ atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ ++ virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ ++ "=drivers/pcmcia" =ide + + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules +@@ -61,9 +62,6 @@ installkernel() { + ${NULL} + fi + +- # install virtual machine support +- instmods virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ +- "=drivers/pcmcia" =ide "=drivers/usb/storage" + + find_kernel_modules | block_module_filter | instmods + diff --git a/0029-dracut-systemd-dracut-cmdline-ask-fix-dracut-kernel-.patch b/0029-dracut-systemd-dracut-cmdline-ask-fix-dracut-kernel-.patch new file mode 100644 index 0000000..400b5f7 --- /dev/null +++ b/0029-dracut-systemd-dracut-cmdline-ask-fix-dracut-kernel-.patch @@ -0,0 +1,54 @@ +From eddca3c9c24e4cb9c5def0b98920e36b16fafaac Mon Sep 17 00:00:00 2001 +From: Evgeny Vereshchagin +Date: Mon, 15 Feb 2016 08:29:40 +0000 +Subject: [PATCH] dracut-systemd/dracut-cmdline-ask: fix dracut + --kernel-cmdline=rd.cmdline=ask + +How to reproduce: + +host# dracut --kernel-cmdline='rd.cmdline=ask' initramfs.img +host# qemu-system-x86_64 -initrd initramfs.img ... -append root=/dev/sda1 ... +... + +qemu-host# journalctl -b | grep dracut-cmdline-ask +... +Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Installed new job dracut-cmdline-ask.service/start as 42 +Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: ConditionKernelCommandLine=rd.cmdline=ask failed. +Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Starting requested but condition failed. Not starting unit. +Feb 15 08:45:36 localhost systemd[1]: dracut-cmdline-ask.service: Job dracut-cmdline-ask.service/start finished, result=done +... + +Signed-off-by: Evgeny Vereshchagin +--- + modules.d/98dracut-systemd/dracut-cmdline-ask.service | 3 ++- + modules.d/98dracut-systemd/dracut-cmdline-ask.sh | 4 ++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/modules.d/98dracut-systemd/dracut-cmdline-ask.service b/modules.d/98dracut-systemd/dracut-cmdline-ask.service +index 9a34b35..8bc7d80 100644 +--- a/modules.d/98dracut-systemd/dracut-cmdline-ask.service ++++ b/modules.d/98dracut-systemd/dracut-cmdline-ask.service +@@ -14,7 +14,8 @@ Before=dracut-cmdline.service + After=systemd-journald.socket + Wants=systemd-journald.socket + ConditionPathExists=/usr/lib/initrd-release +-ConditionKernelCommandLine=rd.cmdline=ask ++ConditionKernelCommandLine=|rd.cmdline=ask ++ConditionPathExistsGlob=|/etc/cmdline.d/*.conf + + [Service] + Environment=DRACUT_SYSTEMD=1 +diff --git a/modules.d/98dracut-systemd/dracut-cmdline-ask.sh b/modules.d/98dracut-systemd/dracut-cmdline-ask.sh +index ab8933a..f410f46 100755 +--- a/modules.d/98dracut-systemd/dracut-cmdline-ask.sh ++++ b/modules.d/98dracut-systemd/dracut-cmdline-ask.sh +@@ -1,5 +1,9 @@ + #!/bin/bash + ++type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh ++ ++getarg "rd.cmdline=ask" || exit 0 ++ + sleep 0.5 + echo + sleep 0.5 diff --git a/0030-base-init.sh-don-t-remove-99-cmdline-ask-on-hostonly.patch b/0030-base-init.sh-don-t-remove-99-cmdline-ask-on-hostonly.patch new file mode 100644 index 0000000..af11e7d --- /dev/null +++ b/0030-base-init.sh-don-t-remove-99-cmdline-ask-on-hostonly.patch @@ -0,0 +1,39 @@ +From 4ab6447c2a9ed105e7fba26ded2b3f3b725de8e9 Mon Sep 17 00:00:00 2001 +From: Evgeny Vereshchagin +Date: Mon, 15 Feb 2016 13:47:18 +0000 +Subject: [PATCH] base/init.sh: don't remove 99-cmdline-ask on 'hostonly' + cleanup + +How to reproduce: +host# ./dracut.sh -o 'dracut-systemd systemd systemd-initrd' --local -f ./initramfs.img + +host# qemu-system-x86_64 -initrd ./initramfs.img \ + -append 'root=/dev/sda1 rd.cmdline=ask rd.hostonly=0' \ + ... + +Enter additional kernel command line parameter (end with ctrl-d or .) +> rd.break +> . +... +There is no "Break before switch_root" +... + +Signed-off-by: Evgeny Vereshchagin +--- + modules.d/99base/init.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index e2e4029..bd7ef70 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -120,7 +120,9 @@ if getarg "rd.cmdline=ask"; then + fi + + if ! getargbool 1 'rd.hostonly'; then ++ [ -f /etc/cmdline.d/99-cmdline-ask.conf ] && mv /etc/cmdline.d/99-cmdline-ask.conf /tmp/99-cmdline-ask.conf + remove_hostonly_files ++ [ -f /tmp/99-cmdline-ask.conf ] && mv /tmp/99-cmdline-ask.conf /etc/cmdline.d/99-cmdline-ask.conf + fi + + # run scriptlets to parse the command line diff --git a/0031-documentation-hostonly-i18n-no-hostonly-i18n-i18n_in.patch b/0031-documentation-hostonly-i18n-no-hostonly-i18n-i18n_in.patch new file mode 100644 index 0000000..7712cdb --- /dev/null +++ b/0031-documentation-hostonly-i18n-no-hostonly-i18n-i18n_in.patch @@ -0,0 +1,42 @@ +From fe6455a6e8f4b070ffa8116ef26d423a25d56049 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 29 Feb 2016 13:12:02 +0100 +Subject: [PATCH] documentation: "--hostonly-i18n" "--no-hostonly-i18n" + "i18n_install_all" + +--- + dracut.8.asc | 6 ++++++ + dracut.conf.5.asc | 3 +++ + 2 files changed, 9 insertions(+) + +diff --git a/dracut.8.asc b/dracut.8.asc +index aee84c4..3b80000 100644 +--- a/dracut.8.asc ++++ b/dracut.8.asc +@@ -323,6 +323,12 @@ provide a valid _/etc/fstab_. + **--no-hostonly-cmdline**: + Do not store kernel command line arguments needed in the initramfs + ++**--hostonly-i18n**: ++ Install only needed keyboard and font files according to the host configuration (default). ++ ++**--no-hostonly-i18n**: ++ Install all keyboard and font files available. ++ + **--persistent-policy** __:: + Use __ to address disks and partitions. + __ can be any directory name found in /dev/disk. +diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc +index 0460d4f..e07c247 100644 +--- a/dracut.conf.5.asc ++++ b/dracut.conf.5.asc +@@ -99,6 +99,9 @@ Configuration files must have the extension .conf; other extensions are ignored. + *hostonly_cmdline=*"__{yes|no}__":: + If set, store the kernel command line arguments needed in the initramfs + ++*i18n_install_all=*"__{yes|no}__":: ++ If set to yes, install all available fonts and keyboard files. ++ + *persistent_policy=*"____":: + Use __ to address disks and partitions. + __ can be any directory name found in /dev/disk. diff --git a/0032-network-dhclient-script.sh-add-classless-static-rout.patch b/0032-network-dhclient-script.sh-add-classless-static-rout.patch new file mode 100644 index 0000000..e837576 --- /dev/null +++ b/0032-network-dhclient-script.sh-add-classless-static-rout.patch @@ -0,0 +1,91 @@ +From caf12d6717379769e4f12296405edc4d547d46f8 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 29 Feb 2016 14:52:16 +0100 +Subject: [PATCH] network/dhclient-script.sh: add classless-static-routes + support + +https://bugzilla.redhat.com/show_bug.cgi?id=1260955 +(cherry picked from commit a48ea27debb926a30810c9f1a42f096494c727e2) +--- + modules.d/40network/dhclient-script.sh | 48 ++++++++++++++++++++++++++++++++++ + modules.d/40network/dhclient.conf | 5 +++- + 2 files changed, 52 insertions(+), 1 deletion(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 9aac2b1..13d2dc2 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -95,6 +95,51 @@ setup_interface6() { + [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname + } + ++function parse_option_121() { ++ while [ $# -ne 0 ]; do ++ mask="$1" ++ shift ++ ++ # Is the destination a multicast group? ++ if [ $1 -ge 224 -a $1 -lt 240 ]; then ++ multicast=1 ++ else ++ multicast=0 ++ fi ++ ++ # Parse the arguments into a CIDR net/mask string ++ if [ $mask -gt 24 ]; then ++ destination="$1.$2.$3.$4/$mask" ++ shift; shift; shift; shift ++ elif [ $mask -gt 16 ]; then ++ destination="$1.$2.$3.0/$mask" ++ shift; shift; shift ++ elif [ $mask -gt 8 ]; then ++ destination="$1.$2.0.0/$mask" ++ shift; shift ++ else ++ destination="$1.0.0.0/$mask" ++ shift ++ fi ++ ++ # Read the gateway ++ gateway="$1.$2.$3.$4" ++ shift; shift; shift; shift ++ ++ # Multicast routing on Linux ++ # - If you set a next-hop address for a multicast group, this breaks with Cisco switches ++ # - If you simply leave it link-local and attach it to an interface, it works fine. ++ if [ $multicast -eq 1 ]; then ++ temp_result="$destination dev $interface" ++ else ++ temp_result="$destination via $gateway dev $interface" ++ fi ++ ++ echo "/sbin/ip route add $temp_result" ++ done ++} ++ ++ + case $reason in + PREINIT) + echo "dhcp: PREINIT $netif up" +@@ -129,6 +174,9 @@ case $reason in + { + echo '. /lib/net-lib.sh' + echo "setup_net $netif" ++ if [ -n "$new_classless_static_routes" ]; then ++ modify_routes add "$(parse_option_121 $new_classless_static_routes)" ++ fi + echo "source_hook initqueue/online $netif" + [ -e /tmp/net.$netif.manualup ] || echo "/sbin/netroot $netif" + echo "rm -f -- $hookdir/initqueue/setup_net_$netif.sh" +diff --git a/modules.d/40network/dhclient.conf b/modules.d/40network/dhclient.conf +index dbf5882..7b06763 100644 +--- a/modules.d/40network/dhclient.conf ++++ b/modules.d/40network/dhclient.conf +@@ -1,3 +1,6 @@ ++ ++option classless-routes code 121 = array of unsigned integer 8; ++ + request subnet-mask, broadcast-address, time-offset, routers, + domain-name, domain-name-servers, domain-search, host-name, +- root-path, interface-mtu; ++ root-path, interface-mtu classless-routes; diff --git a/0033-dracut-systemd-dracut-pre-pivot.sh-Break-at-switch_r.patch b/0033-dracut-systemd-dracut-pre-pivot.sh-Break-at-switch_r.patch new file mode 100644 index 0000000..e41529b --- /dev/null +++ b/0033-dracut-systemd-dracut-pre-pivot.sh-Break-at-switch_r.patch @@ -0,0 +1,29 @@ +From 556ff7c76a5c365889ea9972c1878eaf7073bde8 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 7 Mar 2016 12:38:23 +0100 +Subject: [PATCH] dracut-systemd/dracut-pre-pivot.sh: Break at switch_root only + for bare rd.break + +similar to commit ddfea6b54cfa8f8f6c970d970318568c8a8a4c78 + +Previously, any rd.break=breakpoint would cause a break at the +given breakpoint and also at switch_root. +--- + modules.d/98dracut-systemd/dracut-pre-pivot.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +index a07cf3e..cc70e3c 100755 +--- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh ++++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh +@@ -18,7 +18,9 @@ source_hook pre-pivot + getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup" + source_hook cleanup + +-getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root" ++_bv=$(getarg rd.break -d rdbreak) && [ -z "$_bv" ] && ++ emergency_shell -n switch_root "Break before switch_root" ++unset _bv + + # remove helper symlink + [ -h /dev/root ] && rm -f -- /dev/root diff --git a/0034-dracut-install-catch-ldd-message-cannot-execute-bina.patch b/0034-dracut-install-catch-ldd-message-cannot-execute-bina.patch new file mode 100644 index 0000000..28506a2 --- /dev/null +++ b/0034-dracut-install-catch-ldd-message-cannot-execute-bina.patch @@ -0,0 +1,24 @@ +From b127294def5efecc27fac730f784f8bf03a5e52d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Mar 2016 10:59:29 +0100 +Subject: [PATCH] dracut-install: catch ldd message "cannot execute binary + file" + +--- + install/dracut-install.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index a7bfdb8..8f65d8d 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -393,6 +393,9 @@ static int resolve_deps(const char *src) + break; + + /* glibc */ ++ if (strstr(buf, "cannot execute binary file")) ++ break; ++ + if (strstr(buf, "not a dynamic executable")) + break; + diff --git a/0035-dracut.conf.5.asc-fix-bold.patch b/0035-dracut.conf.5.asc-fix-bold.patch new file mode 100644 index 0000000..617eb00 --- /dev/null +++ b/0035-dracut.conf.5.asc-fix-bold.patch @@ -0,0 +1,22 @@ +From 472928ec3dcbfcc7ea0c1fd7e821843739f03bfc Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 14 Mar 2016 14:16:12 +0100 +Subject: [PATCH] dracut.conf.5.asc: fix bold + +--- + dracut.conf.5.asc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc +index e07c247..8f362b2 100644 +--- a/dracut.conf.5.asc ++++ b/dracut.conf.5.asc +@@ -187,7 +187,7 @@ provide a valid _/etc/fstab_. + *show_modules=*"__{yes|no}__":: + Print the name of the included modules to standard output during build. + +-*i18n_vars="____":: ++*i18n_vars=*"____":: + Distribution specific variable mapping. + See dracut/modules.d/10i18n/README for a detailed description. + diff --git a/0036-watchdog-Do-not-add-hooks-if-systemd-module-is-inclu.patch b/0036-watchdog-Do-not-add-hooks-if-systemd-module-is-inclu.patch new file mode 100644 index 0000000..05f9e1f --- /dev/null +++ b/0036-watchdog-Do-not-add-hooks-if-systemd-module-is-inclu.patch @@ -0,0 +1,31 @@ +From 89da227de991ef3c1bb9ad3dc4f23d07535317d2 Mon Sep 17 00:00:00 2001 +From: Pratyush Anand +Date: Wed, 16 Mar 2016 09:09:09 +0530 +Subject: [PATCH] watchdog: Do not add hooks if systemd module is included + +When systemd is present, let it manage watchdog feed. + +Signed-off-by: Pratyush Anand +Cc: Dave Young +Cc: Don Zickus +Cc: Harald Hoyer +--- + modules.d/04watchdog/module-setup.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index 576c589..7ec757a 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -12,6 +12,11 @@ depends() { + + # called by dracut + install() { ++ # Do not add watchdog hooks if systemd module is included ++ # In that case, systemd will manage watchdog kick ++ if dracut_module_included "systemd"; then ++ return ++ fi + inst_hook cmdline 00 "$moddir/watchdog.sh" + inst_hook cmdline 50 "$moddir/watchdog.sh" + inst_hook pre-trigger 00 "$moddir/watchdog.sh" diff --git a/0037-watchdog-install-module-for-active-watchdog.patch b/0037-watchdog-install-module-for-active-watchdog.patch new file mode 100644 index 0000000..c8688b5 --- /dev/null +++ b/0037-watchdog-install-module-for-active-watchdog.patch @@ -0,0 +1,94 @@ +From 3aac6827444c897aab59d7638aa191d510fd4758 Mon Sep 17 00:00:00 2001 +From: Pratyush Anand +Date: Wed, 16 Mar 2016 09:09:10 +0530 +Subject: [PATCH] watchdog: install module for active watchdog + +Recently following patches have been added in upstream Linux kernel, which +(1) fixes parent of watchdog_device so that +/sys/class/watchdog/watchdogn/device is populated. (2) adds some sysfs +device attributes so that different watchdog status can be read. + +http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6551881c86c791237a3bebf11eb3bd70b60ea782 +http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=906d7a5cfeda508e7361f021605579a00cd82815 +http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=33b711269ade3f6bc9d9d15e4343e6fa922d999b + +With the above support, now we can find out whether a watchdog is active or +not. We can also find out the driver/module responsible for that watchdog +device. + +Proposed patch uses above support and then adds module of active watchdog +in initramfs generated by dracut for hostonly mode. Kernel module for +inactive watchdog will be added as well for none hostonly mode. + +When an user does not want to add kernel module, then one should exclude +complete dracut watchdog module with --omit. + +Testing: +-- When watchdog is active watchdog modules were added + # cat /sys/class/watchdog/watchdog0/identity + iTCO_wdt + # cat /sys/class/watchdog/watchdog0/state + active + # dracut --hostonly initramfs-test.img -a watchdog + # lsinitrd initramfs-test.img | grep iTCO + -rw-r--r-- 1 root root 9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko + -rw-r--r-- 1 root root 19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko + +-- When watchdog is inactive then watchdog modules were not added + # cat /sys/class/watchdog/watchdog0/state + inactive + # dracut --hostonly initramfs-test.img -a watchdog + # lsinitrd initramfs-test.img | grep iTCO + +-- When watchdog is inactive, but no hostonly mode, watchdog modules were added + # cat /sys/class/watchdog/watchdog0/state + inactive + # dracut --no-hostonly initramfs-test.img -a watchdog + # lsinitrd initramfs-test.img | grep iTCO + -rw-r--r-- 1 root root 9100 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_vendor_support.ko + -rw-r--r-- 1 root root 19252 Feb 24 09:19 usr/lib/modules/.../kernel/drivers/watchdog/iTCO_wdt.ko + +Signed-off-by: Pratyush Anand +Cc: Dave Young +Cc: Don Zickus +Cc: Harald Hoyer +--- + modules.d/04watchdog/module-setup.sh | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index 7ec757a..0ffaa96 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -32,3 +32,31 @@ install() { + inst_multiple -o wdctl + } + ++installkernel() { ++ [[ -d /sys/class/watchdog/ ]] || return ++ for dir in /sys/class/watchdog/*; do ++ [[ -d "$dir" ]] || continue ++ [[ -f "$dir/state" ]] || continue ++ active=$(< "$dir/state") ++ ! [[ $hostonly ]] || [[ "$active" = "active" ]] || continue ++ # device/modalias will return driver of this device ++ wdtdrv=$(< "$dir/device/modalias") ++ # There can be more than one module represented by same ++ # modalias. Currently load all of them. ++ # TODO: Need to find a way to avoid any unwanted module ++ # represented by modalias ++ wdtdrv=$(modprobe -R $wdtdrv) ++ instmods $wdtdrv ++ # however in some cases, we also need to check that if there is ++ # a specific driver for the parent bus/device. In such cases ++ # we also need to enable driver for parent bus/device. ++ wdtppath=$(readlink -f "$dir/device/..") ++ while [ -f "$wdtppath/modalias" ] ++ do ++ wdtpdrv=$(< "$wdtppath/modalias") ++ wdtpdrv=$(modprobe -R $wdtpdrv) ++ instmods $wdtpdrv ++ wdtppath=$(readlink -f "$wdtppath/..") ++ done ++ done ++} diff --git a/0038-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch b/0038-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch new file mode 100644 index 0000000..7adfd6b --- /dev/null +++ b/0038-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch @@ -0,0 +1,56 @@ +From e343c85763e7b981a5e9b53b04f90f0d83bffaaf Mon Sep 17 00:00:00 2001 +From: Pratyush Anand +Date: Wed, 16 Mar 2016 09:16:24 +0530 +Subject: [PATCH] watchdog: ensure that module is loaded as early as possible + +It is expected that a watchdog module will disable an active watchdog when +its probe is called ie, when it is loaded. So an early load of the module +will help to disable it earlier. +This can be helpful in some corner cases where kdump and watchdog daemon +both are active. + +Testing: + -- When watchdog kernel modules were added + # dracut --no-hostonly initramfs-test.img -a watchdog + # lsinitrd initramfs-test.img -f etc/cmdline.d/00-watchdog.conf + rd.driver.pre=iTCO_wdt,lpc_ich, + +Signed-off-by: Pratyush Anand +Cc: Dave Young +Cc: Don Zickus +Cc: Harald Hoyer +--- + modules.d/04watchdog/module-setup.sh | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index 0ffaa96..c9da148 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -34,6 +34,7 @@ install() { + + installkernel() { + [[ -d /sys/class/watchdog/ ]] || return ++ wdtcmdline="" + for dir in /sys/class/watchdog/*; do + [[ -d "$dir" ]] || continue + [[ -f "$dir/state" ]] || continue +@@ -47,6 +48,7 @@ installkernel() { + # represented by modalias + wdtdrv=$(modprobe -R $wdtdrv) + instmods $wdtdrv ++ wdtcmdline="$wdtcmdline$(echo $wdtdrv | tr " " ",")," + # however in some cases, we also need to check that if there is + # a specific driver for the parent bus/device. In such cases + # we also need to enable driver for parent bus/device. +@@ -56,7 +58,10 @@ installkernel() { + wdtpdrv=$(< "$wdtppath/modalias") + wdtpdrv=$(modprobe -R $wdtpdrv) + instmods $wdtpdrv ++ wdtcmdline="$wdtcmdline$(echo $wdtpdrv | tr " " ",")," + wdtppath=$(readlink -f "$wdtppath/..") + done + done ++ # ensure that watchdog module is loaded as early as possible ++ [[ $wdtcmdline = "" ]] || echo "rd.driver.pre=$wdtcmdline" > ${initdir}/etc/cmdline.d/00-watchdog.conf + } diff --git a/0039-lsinitrd-add-unpack-to-lsinitrd.patch b/0039-lsinitrd-add-unpack-to-lsinitrd.patch new file mode 100644 index 0000000..224063b --- /dev/null +++ b/0039-lsinitrd-add-unpack-to-lsinitrd.patch @@ -0,0 +1,130 @@ +From 97bbba6938fc22605026b4cff3c5cc524c7bdf38 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 17 Mar 2016 14:45:24 +0100 +Subject: [PATCH] lsinitrd: add "--unpack" to lsinitrd + +also "--unpackearly" and "--verbose" +--- + lsinitrd.1.asc | 9 +++++++++ + lsinitrd.sh | 43 ++++++++++++++++++++++++++++++++----------- + 2 files changed, 41 insertions(+), 11 deletions(-) + +diff --git a/lsinitrd.1.asc b/lsinitrd.1.asc +index 4293910..b6a704c 100644 +--- a/lsinitrd.1.asc ++++ b/lsinitrd.1.asc +@@ -34,6 +34,15 @@ OPTIONS + **-k, --kver** __:: + inspect the initramfs of . + ++**--unpack**:: ++ unpack the initramfs to the current directory, instead of displaying the contents. ++ ++**--unpackearly**:: ++ unpack the early microcode initramfs to the current directory, instead of displaying the contents. ++ ++**-v, --verbose**:: ++ unpack verbosely ++ + AVAILABILITY + ------------ + The lsinitrd command is part of the dracut package and is available from +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 441fb92..224b9c1 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -27,6 +27,9 @@ usage() + echo "-s, --size sort the contents of the initramfs by size." + echo "-m, --mod list modules." + echo "-f, --file print the contents of ." ++ echo "--unpack unpack the initramfs, instead of displaying the contents." ++ echo "--unpackearly unpack the early microcode part of the initramfs." ++ echo "-v, --verbose unpack verbosely." + echo "-k, --kver inspect the initramfs of ." + echo + } >&2 +@@ -37,16 +40,21 @@ usage() + + sorted=0 + modules=0 ++unpack=0 ++unset verbose + declare -A filenames + + unset POSIXLY_CORRECT + TEMP=$(getopt \ +- -o "shmf:k:" \ ++ -o "vshmf:k:" \ + --long kver: \ + --long file: \ + --long mod \ + --long help \ + --long size \ ++ --long unpack \ ++ --long unpackearly \ ++ --long verbose \ + -- "$@") + + if (( $? != 0 )); then +@@ -58,13 +66,16 @@ eval set -- "$TEMP" + + while (($# > 0)); do + case $1 in +- -k|--kver) KERNEL_VERSION="$2"; shift;; +- -f|--file) filenames[${2#/}]=1; shift;; +- -s|--size) sorted=1;; +- -h|--help) usage; exit 0;; +- -m|--mod) modules=1;; +- --) shift;break;; +- *) usage; exit 1;; ++ -k|--kver) KERNEL_VERSION="$2"; shift;; ++ -f|--file) filenames[${2#/}]=1; shift;; ++ -s|--size) sorted=1;; ++ -h|--help) usage; exit 0;; ++ -m|--mod) modules=1;; ++ -v|--verbose) verbose="--verbose";; ++ --unpack) unpack=1;; ++ --unpackearly) unpackearly=1;; ++ --) shift;break;; ++ *) usage; exit 1;; + esac + shift + done +@@ -147,8 +158,14 @@ list_files() + echo "========================================================================" + } + ++unpack_files() ++{ ++ $CAT "$image" | cpio -id --quiet $verbose ++ ((ret+=$?)) ++} ++ + +-if (( ${#filenames[@]} <= 0 )); then ++if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then + echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)" + echo "========================================================================" + fi +@@ -159,7 +176,9 @@ case $bin in + CAT="cat --" + is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null) + if [[ "$is_early" ]]; then +- if (( ${#filenames[@]} > 0 )); then ++ if [[ -n "$unpackearly" ]]; then ++ unpack_files ++ elif (( ${#filenames[@]} > 0 )); then + extract_files + else + echo "Early CPIO image" +@@ -218,7 +237,9 @@ fi + + ret=0 + +-if (( ${#filenames[@]} > 0 )); then ++if [[ -n "$unpack" ]]; then ++ unpack_files ++elif (( ${#filenames[@]} > 0 )); then + extract_files + else + version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout -- \ diff --git a/0040-Do-not-use-deprecated-egrep-fgrep.patch b/0040-Do-not-use-deprecated-egrep-fgrep.patch new file mode 100644 index 0000000..609b8d0 --- /dev/null +++ b/0040-Do-not-use-deprecated-egrep-fgrep.patch @@ -0,0 +1,172 @@ +From 9430ae301e3599d355e8b128a7faffa81dade6ff Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Mon, 28 Mar 2016 11:38:34 +0300 +Subject: [PATCH] Do not use deprecated egrep/fgrep + +--- + dracut-init.sh | 8 ++++---- + install/dracut-install.c | 2 +- + modules.d/00systemd/module-setup.sh | 10 +++++----- + modules.d/02systemd-networkd/module-setup.sh | 8 ++++---- + modules.d/95debug/module-setup.sh | 2 +- + modules.d/95nfs/module-setup.sh | 8 ++++---- + modules.d/95udev-rules/module-setup.sh | 4 ++-- + modules.d/99base/module-setup.sh | 4 ++-- + test/TEST-04-FULL-SYSTEMD/test.sh | 2 +- + 9 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index fc35d7b..a67aca2 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -328,15 +328,15 @@ inst_rule_group_owner() { + + if grep -qE 'OWNER=?"[^ "]+' "$1"; then + for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do +- if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then +- egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then ++ grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + fi + done + fi + if grep -qE 'GROUP=?"[^ "]+' "$1"; then + for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do +- if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then +- egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" ++ if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then ++ grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" + fi + done + fi +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 8f65d8d..3b48ba8 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -287,7 +287,7 @@ static int library_install(const char *src, const char *lib) + + /* Also try to install the same library from one directory above. + This fixes the case, where only the HWCAP lib would be installed +- # ldconfig -p|fgrep libc.so ++ # ldconfig -p|grep -F libc.so + libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6 + libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6 + libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6 +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index ed59beb..deb5e06 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -179,11 +179,11 @@ install() { + + # install adm user/group for journald + inst_multiple nologin +- egrep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- egrep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group" +- egrep '^wheel:' /etc/group >> "$initdir/etc/group" +- egrep '^adm:' /etc/group >> "$initdir/etc/group" ++ grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ grep '^systemd-journal:' /etc/group >> "$initdir/etc/group" ++ grep '^wheel:' /etc/group >> "$initdir/etc/group" ++ grep '^adm:' /etc/group >> "$initdir/etc/group" + + ln_r $systemdutildir/systemd "/init" + ln_r $systemdutildir/systemd "/sbin/init" +diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh +index 58842c0..b86751e 100755 +--- a/modules.d/02systemd-networkd/module-setup.sh ++++ b/modules.d/02systemd-networkd/module-setup.sh +@@ -48,10 +48,10 @@ install() { + + # inst_dir /var/lib/systemd/clock + +- egrep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- egrep '^systemd-network:' /etc/group >> "$initdir/etc/group" +- # egrep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- # egrep '^systemd-timesync:' /etc/group >> "$initdir/etc/group" ++ grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ grep '^systemd-network:' /etc/group >> "$initdir/etc/group" ++ # grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ # grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group" + + _arch=$(uname -m) + inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \ +diff --git a/modules.d/95debug/module-setup.sh b/modules.d/95debug/module-setup.sh +index ce5e8e8..97b2a30 100755 +--- a/modules.d/95debug/module-setup.sh ++++ b/modules.d/95debug/module-setup.sh +@@ -18,6 +18,6 @@ install() { + tcpdump cp less hostname mkdir \ + fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck + +- egrep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + } + +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index 9b5b8c8..aefbc2a 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -105,14 +105,14 @@ install() { + + # Rather than copy the passwd file in, just set a user for rpcbind + # We'll save the state and restart the daemon from the root anyway +- egrep '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" +- egrep '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group" ++ grep -E '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd" ++ grep -E '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group" + + # rpc user needs to be able to write to this directory to save the warmstart + # file + chmod 770 "$initdir/var/lib/rpcbind" +- egrep -q '^rpc:' /etc/passwd \ +- && egrep -q '^rpc:' /etc/group \ ++ grep -q '^rpc:' /etc/passwd \ ++ && grep -q '^rpc:' /etc/group \ + && chown rpc.rpc "$initdir/var/lib/rpcbind" + dracut_need_initqueue + } +diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh +index 6a0625a..a59eca2 100755 +--- a/modules.d/95udev-rules/module-setup.sh ++++ b/modules.d/95udev-rules/module-setup.sh +@@ -63,8 +63,8 @@ install() { + + { + for i in cdrom tape dialout floppy; do +- if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then +- if ! egrep "^$i:" /etc/group 2>/dev/null; then ++ if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then ++ if ! grep "^$i:" /etc/group 2>/dev/null; then + case $i in + cdrom) echo "$i:x:11:";; + dialout) echo "$i:x:18:";; +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index cc94d00..5fbf6f7 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -27,8 +27,8 @@ install() { + fi + + #add common users in /etc/passwd, it will be used by nfs/ssh currently +- egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd" +- egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" ++ grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo 'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd" ++ grep '^nobody:' /etc/passwd >> "$initdir/etc/passwd" + + # install our scripts and hooks + inst_script "$moddir/init.sh" "/init" +diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh +index f5a9d48..c7e08bf 100755 +--- a/test/TEST-04-FULL-SYSTEMD/test.sh ++++ b/test/TEST-04-FULL-SYSTEMD/test.sh +@@ -197,7 +197,7 @@ EOF + ln -fs /proc/self/mounts $initdir/etc/mtab + + # install any Execs from the service files +- egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \ ++ grep -Eho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \ + | while read i || [ -n "$i" ]; do + i=${i##Exec*=}; i=${i##-} + inst_multiple -o $i diff --git a/0041-nfs-module-setup.sh-Use-colon-instead-of-dot-for-cho.patch b/0041-nfs-module-setup.sh-Use-colon-instead-of-dot-for-cho.patch new file mode 100644 index 0000000..671111a --- /dev/null +++ b/0041-nfs-module-setup.sh-Use-colon-instead-of-dot-for-cho.patch @@ -0,0 +1,22 @@ +From dec3dfa4b3215e08581794bd76591023ed7984c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Mon, 28 Mar 2016 11:39:36 +0300 +Subject: [PATCH] nfs/module-setup.sh: Use colon instead of dot for chown + user/group separator + +--- + modules.d/95nfs/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index aefbc2a..6f039bd 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -113,6 +113,6 @@ install() { + chmod 770 "$initdir/var/lib/rpcbind" + grep -q '^rpc:' /etc/passwd \ + && grep -q '^rpc:' /etc/group \ +- && chown rpc.rpc "$initdir/var/lib/rpcbind" ++ && chown rpc:rpc "$initdir/var/lib/rpcbind" + dracut_need_initqueue + } diff --git a/0042-Clean-up-some-bashisms-from-bin-sh-scripts.patch b/0042-Clean-up-some-bashisms-from-bin-sh-scripts.patch new file mode 100644 index 0000000..ed83813 --- /dev/null +++ b/0042-Clean-up-some-bashisms-from-bin-sh-scripts.patch @@ -0,0 +1,64 @@ +From bcabe0fe2570d8cd39ab6af380bce44f13092450 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Mon, 28 Mar 2016 11:52:14 +0300 +Subject: [PATCH] Clean up some bashisms from /bin/sh scripts + +--- + modules.d/40network/dhclient-script.sh | 2 +- + modules.d/40network/ifup.sh | 2 +- + modules.d/95fcoe/fcoe-edd.sh | 2 +- + modules.d/95nfs/nfs-lib.sh | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh +index 13d2dc2..94ee9d1 100755 +--- a/modules.d/40network/dhclient-script.sh ++++ b/modules.d/40network/dhclient-script.sh +@@ -95,7 +95,7 @@ setup_interface6() { + [ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain:+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname + } + +-function parse_option_121() { ++parse_option_121() { + while [ $# -ne 0 ]; do + mask="$1" + shift +diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh +index 7c179bd..1185523 100755 +--- a/modules.d/40network/ifup.sh ++++ b/modules.d/40network/ifup.sh +@@ -277,7 +277,7 @@ if [ -z "$NO_TEAM_MASTER" ]; then + for slave in $teamslaves ; do + ip link set $slave up 2>/dev/null + if wait_for_if_up $slave; then +- working_slaves+="$slave " ++ working_slaves="$working_slaves$slave " + fi + done + # Do not add slaves now +diff --git a/modules.d/95fcoe/fcoe-edd.sh b/modules.d/95fcoe/fcoe-edd.sh +index 3b07ad3..1e002d3 100755 +--- a/modules.d/95fcoe/fcoe-edd.sh ++++ b/modules.d/95fcoe/fcoe-edd.sh +@@ -29,7 +29,7 @@ for disk in /sys/firmware/edd/int13_*; do + driver=${driver##*/} + fi + # i40e uses dev_port 1 for a virtual fcoe function +- if [ "${driver}" == "i40e" ]; then ++ if [ "${driver}" = "i40e" ]; then + dev_port=1 + fi + for nic in "${disk}"/pci_dev/net/*; do +diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh +index 58aa7e3..67608b1 100755 +--- a/modules.d/95nfs/nfs-lib.sh ++++ b/modules.d/95nfs/nfs-lib.sh +@@ -110,7 +110,7 @@ nfsroot_from_dhcp() { + [ -f $f ] && . $f + done + [ -n "$new_root_path" ] && nfsroot_to_var "$nfs:$new_root_path" +- [ -z "$path" ] && [ "$(getarg root=)" == "/dev/nfs" ] && path=/tftpboot/%s ++ [ -z "$path" ] && [ "$(getarg root=)" = "/dev/nfs" ] && path=/tftpboot/%s + [ -z "$server" ] && server=$srv + [ -z "$server" ] && server=$new_dhcp_server_identifier + [ -z "$server" ] && server=$new_next_server diff --git a/0043-dracut-init.sh-Simplify-udev-rule-grepping.patch b/0043-dracut-init.sh-Simplify-udev-rule-grepping.patch new file mode 100644 index 0000000..ba2b3f6 --- /dev/null +++ b/0043-dracut-init.sh-Simplify-udev-rule-grepping.patch @@ -0,0 +1,131 @@ +From 06a1d0769055f437c938edd40bd9fbd622475864 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Skytt=C3=A4?= +Date: Mon, 28 Mar 2016 12:09:06 +0300 +Subject: [PATCH] dracut-init.sh: Simplify udev rule grepping + +--- + dracut-init.sh | 102 ++++++++++++++++++++++++++------------------------------- + 1 file changed, 46 insertions(+), 56 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index a67aca2..b176421 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -275,71 +275,61 @@ rev_lib_symlinks() { + inst_rule_programs() { + local _prog _bin + +- if grep -qE 'PROGRAM==?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'PROGRAM==?"[^ "]+' "$1" | sed -r 's/.*PROGRAM==?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi ++ for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi + +- [[ $_bin ]] && inst_binary "$_bin" +- done +- fi +- if grep -qE 'RUN[+=]=?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'RUN[+=]=?"[^ "]+' "$1" | sed -r 's/.*RUN[+=]=?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi ++ [[ $_bin ]] && inst_binary "$_bin" ++ done ++ for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]] && [[ "${_prog}" != "/sbin/initqueue" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi + +- [[ $_bin ]] && inst_binary "$_bin" +- done +- fi +- if grep -qE 'IMPORT\{program\}==?"[^ "]+' "$1"; then +- for _prog in $(grep -E 'IMPORT\{program\}==?"[^ "]+' "$1" | sed -r 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/'); do +- _bin="" +- if [ -x ${udevdir}/$_prog ]; then +- _bin=${udevdir}/$_prog +- elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then +- _bin=$(find_binary "$_prog") || { +- dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" +- continue; +- } +- fi ++ [[ $_bin ]] && inst_binary "$_bin" ++ done ++ for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p'); do ++ _bin="" ++ if [ -x ${udevdir}/$_prog ]; then ++ _bin=${udevdir}/$_prog ++ elif [[ "${_prog/\$env\{/}" == "$_prog" ]]; then ++ _bin=$(find_binary "$_prog") || { ++ dinfo "Skipping program $_prog using in udev rule ${1##*/} as it cannot be found" ++ continue; ++ } ++ fi + +- [[ $_bin ]] && dracut_install "$_bin" +- done +- fi ++ [[ $_bin ]] && dracut_install "$_bin" ++ done + } + + # attempt to install any programs specified in a udev rule + inst_rule_group_owner() { + local i + +- if grep -qE 'OWNER=?"[^ "]+' "$1"; then +- for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do +- if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then +- grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" +- fi +- done +- fi +- if grep -qE 'GROUP=?"[^ "]+' "$1"; then +- for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do +- if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then +- grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" +- fi +- done +- fi ++ for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p'); do ++ if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then ++ grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" ++ fi ++ done ++ for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do ++ if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then ++ grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group" ++ fi ++ done + } + + inst_rule_initqueue() { diff --git a/0044-dracut.sh-call-dracut-install-with-f-in-FIPS-mode.patch b/0044-dracut.sh-call-dracut-install-with-f-in-FIPS-mode.patch new file mode 100644 index 0000000..312d131 --- /dev/null +++ b/0044-dracut.sh-call-dracut-install-with-f-in-FIPS-mode.patch @@ -0,0 +1,26 @@ +From f7f5b82b4323210efc343132e3ae8fa91b26a68d Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 21 Mar 2016 11:56:50 +0100 +Subject: [PATCH] dracut.sh: call dracut-install with "-f" in FIPS mode + +in fips mode, dracut-install was called with "-H" instead of "-f" in +FIPS mode + +missed conversion of commit 26cd262a6a575a50ea384a2ceac6a6829efe8106 +--- + dracut.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.sh b/dracut.sh +index 98dbe0b..37ae350 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1496,7 +1496,7 @@ if [[ $kernel_only != yes ]]; then + if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then + dinfo "*** Resolving executable dependencies ***" + find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \ +- | xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-H} -- ++ | xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} -- + dinfo "*** Resolving executable dependencies done***" + fi + diff --git a/0045-dracut-init.sh-Add-file-argument-to-sed-s.patch b/0045-dracut-init.sh-Add-file-argument-to-sed-s.patch new file mode 100644 index 0000000..07fb7e2 --- /dev/null +++ b/0045-dracut-init.sh-Add-file-argument-to-sed-s.patch @@ -0,0 +1,50 @@ +From 374ef3ed2bff30db35126dd694b4234709398a2f Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Apr 2016 13:36:06 +0200 +Subject: [PATCH] dracut-init.sh: Add file argument to sed's + +fixup for 06a1d0769055f437c938edd40bd9fbd622475864 +--- + dracut-init.sh | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index b176421..2431171 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -275,7 +275,7 @@ rev_lib_symlinks() { + inst_rule_programs() { + local _prog _bin + +- for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p'); do ++ for _prog in $(sed -nr 's/.*PROGRAM==?"([^ "]+).*/\1/p' "$1"); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog +@@ -288,7 +288,7 @@ inst_rule_programs() { + + [[ $_bin ]] && inst_binary "$_bin" + done +- for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p'); do ++ for _prog in $(sed -nr 's/.*RUN[+=]=?"([^ "]+).*/\1/p' "$1"); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog +@@ -301,7 +301,7 @@ inst_rule_programs() { + + [[ $_bin ]] && inst_binary "$_bin" + done +- for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p'); do ++ for _prog in $(sed -nr 's/.*IMPORT\{program\}==?"([^ "]+).*/\1/p' "$1"); do + _bin="" + if [ -x ${udevdir}/$_prog ]; then + _bin=${udevdir}/$_prog +@@ -320,7 +320,7 @@ inst_rule_programs() { + inst_rule_group_owner() { + local i + +- for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p'); do ++ for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do + if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then + grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd" + fi diff --git a/0046-lsinitrd.sh-fixed-unpack-and-skipcpio-search.patch b/0046-lsinitrd.sh-fixed-unpack-and-skipcpio-search.patch new file mode 100644 index 0000000..c7f3581 --- /dev/null +++ b/0046-lsinitrd.sh-fixed-unpack-and-skipcpio-search.patch @@ -0,0 +1,34 @@ +From 98fd06934c9e10567b4755714191cd2aee8822ac Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Apr 2016 15:22:11 +0200 +Subject: [PATCH] lsinitrd.sh: fixed unpack and skipcpio search + +--- + lsinitrd.sh | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/lsinitrd.sh b/lsinitrd.sh +index 224b9c1..b19a66a 100755 +--- a/lsinitrd.sh ++++ b/lsinitrd.sh +@@ -40,7 +40,6 @@ usage() + + sorted=0 + modules=0 +-unpack=0 + unset verbose + declare -A filenames + +@@ -184,7 +183,11 @@ case $bin in + echo "Early CPIO image" + list_files + fi +- SKIP="$dracutbasedir/skipcpio" ++ if [[ -d "$dracutbasedir/skipcpio" ]]; then ++ SKIP="$dracutbasedir/skipcpio/skipcpio" ++ else ++ SKIP="$dracutbasedir/skipcpio" ++ fi + if ! [[ -x $SKIP ]]; then + echo + echo "'$SKIP' not found, cannot display remaining contents!" >&2 diff --git a/0047-dracut-init.sh-mark-error-messages-with-FAILED.patch b/0047-dracut-init.sh-mark-error-messages-with-FAILED.patch new file mode 100644 index 0000000..29201a3 --- /dev/null +++ b/0047-dracut-init.sh-mark-error-messages-with-FAILED.patch @@ -0,0 +1,78 @@ +From ff8f7026897edf1d0aa9c73b9f7a3d21b1b51da3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 11 Apr 2016 15:22:56 +0200 +Subject: [PATCH] dracut-init.sh: mark error messages with FAILED + +--- + dracut-init.sh | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index 2431171..a8b78ce 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -168,7 +168,7 @@ fi + inst_dir() { + [[ -e ${initdir}/"$1" ]] && return 0 # already there + $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || : + } + + inst() { +@@ -179,7 +179,7 @@ inst() { + fi + [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : + } + + inst_simple() { +@@ -191,7 +191,7 @@ inst_simple() { + [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there + [[ -e $1 ]] || return 1 # no source + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || : + } + + inst_symlink() { +@@ -203,14 +203,14 @@ inst_symlink() { + [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there + [[ -L $1 ]] || return 1 + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : + } + + inst_multiple() { + local _ret + $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" + _ret=$? +- (($_ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++ (($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : + return $_ret + } + +@@ -227,17 +227,17 @@ inst_library() { + [[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there + [[ -e $1 ]] || return 1 # no source + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || : + } + + inst_binary() { + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : + } + + inst_script() { + $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" +- (($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || : + } + + mark_hostonly() { diff --git a/0048-Use-dracut-install-to-install-kernel-modules.patch b/0048-Use-dracut-install-to-install-kernel-modules.patch new file mode 100644 index 0000000..2e444e7 --- /dev/null +++ b/0048-Use-dracut-install-to-install-kernel-modules.patch @@ -0,0 +1,1372 @@ +From 794b2d2c753489635b922457a5ccb06669f37268 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 23 Jul 2015 10:35:06 +0200 +Subject: [PATCH] Use dracut-install to install kernel modules + +dracut-install can now install kernel modules and their corresponding +firmware files. +--- + Makefile | 1 + + dracut-init.sh | 178 +------ + dracut.sh | 8 +- + install/dracut-install.c | 536 +++++++++++++++++++-- + modules.d/50drm/module-setup.sh | 63 +-- + modules.d/90crypt/module-setup.sh | 4 +- + modules.d/90dm/module-setup.sh | 3 +- + modules.d/90kernel-modules/module-setup.sh | 53 +- + modules.d/90kernel-network-modules/module-setup.sh | 45 +- + modules.d/90multipath/module-setup.sh | 39 +- + modules.d/95iscsi/module-setup.sh | 41 +- + modules.d/95nfs/module-setup.sh | 2 +- + 12 files changed, 580 insertions(+), 393 deletions(-) + +diff --git a/Makefile b/Makefile +index 8281f90..0a1ae6c 100644 +--- a/Makefile ++++ b/Makefile +@@ -61,6 +61,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h + install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h + + install/dracut-install: $(DRACUT_INSTALL_OBJECTS) ++ $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) -lkmod + + dracut-install: install/dracut-install + ln -fs $< $@ +diff --git a/dracut-init.sh b/dracut-init.sh +index a8b78ce..e26d97a 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -218,6 +218,13 @@ dracut_install() { + inst_multiple "$@" + } + ++dracut_instmods() { ++ [[ $no_kernel = yes ]] && return ++ $DRACUT_INSTALL \ ++ ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" ++ (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || : ++} ++ + inst_library() { + local _hostonly_install + if [[ "$1" == "-H" ]]; then +@@ -847,11 +854,6 @@ install_kmod_with_fw() { + [[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] \ + && return 0 + +- if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -e "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" ]]; then +- read ret < "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" +- return $ret +- fi +- + if [[ $omit_drivers ]]; then + local _kmod=${1##*/} + _kmod=${_kmod%.ko*} +@@ -876,9 +878,6 @@ install_kmod_with_fw() { + + inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" + ret=$? +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ +- [[ -d "$DRACUT_KERNEL_LAZY_HASHDIR" ]] && \ +- echo $ret > "$DRACUT_KERNEL_LAZY_HASHDIR/${1##*/}" + (($ret != 0)) && return $ret + + local _modname=${1##*/} _fwdir _found _fw +@@ -925,51 +924,6 @@ dracut_kernel_post() { + local _moddirname=${srcmods%%/lib/modules/*} + local _pid + +- if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && [[ -f "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" ]]; then +- xargs -r modprobe -a ${_moddirname:+-d ${_moddirname}/} \ +- --ignore-install --show-depends --set-version $kernel \ +- < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" 2>/dev/null \ +- | sort -u \ +- | while read _cmd _modpath _options || [ -n "$_cmd" ]; do +- [[ $_cmd = insmod ]] || continue +- echo "$_modpath" +- done > "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- +- ( +- if [[ $DRACUT_INSTALL ]] && [[ -z $_moddirname ]]; then +- xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- else +- while read _modpath || [ -n "$_modpath" ]; do +- local _destpath=$_modpath +- [[ $_moddirname ]] && _destpath=${_destpath##$_moddirname/} +- _destpath=${_destpath##*/lib/modules/$kernel/} +- inst_simple "$_modpath" "/lib/modules/$kernel/${_destpath}" || exit $? +- done < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" +- fi +- ) & +- _pid=$(jobs -p | while read a || [ -n "$a" ]; do printf ":$a";done) +- _pid=${_pid##*:} +- +- if [[ $DRACUT_INSTALL ]]; then +- xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep" \ +- | while read line || [ -n "$line" ]; do +- for _fwdir in $fw_dir; do +- echo $_fwdir/$line; +- done; +- done | xargs -r $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} -a -o +- else +- for _fw in $(xargs -r modinfo -k $kernel -F firmware < "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist.dep"); do +- for _fwdir in $fw_dir; do +- [[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue +- inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw" +- break +- done +- done +- fi +- +- wait $_pid +- fi +- + for _f in modules.builtin.bin modules.builtin modules.order; do + [[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" + done +@@ -981,7 +935,6 @@ dracut_kernel_post() { + exit 1 + fi + +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && rm -fr -- "$DRACUT_KERNEL_LAZY_HASHDIR" + } + + [[ "$kernel_current" ]] || export kernel_current=$(uname -r) +@@ -1038,113 +991,32 @@ find_kernel_modules () { + find_kernel_modules_by_path drivers + } + +-# instmods [-c [-s]] [ ... ] +-# instmods [-c [-s]] +-# install kernel modules along with all their dependencies. +-# can be e.g. "=block" or "=drivers/usb/storage" + instmods() { ++ # instmods [-c [-s]] [ ... ] ++ # instmods [-c [-s]] ++ # install kernel modules along with all their dependencies. ++ # can be e.g. "=block" or "=drivers/usb/storage" ++ # -c check ++ # -s silent ++ local _optional="-o" ++ local _silent ++ local _ret + [[ $no_kernel = yes ]] && return +- # called [sub]functions inherit _fderr +- local _fderr=9 +- local _check=no +- local _silent=no + if [[ $1 = '-c' ]]; then +- _check=yes ++ _optional="" + shift + fi +- + if [[ $1 = '-s' ]]; then +- _silent=yes ++ _silent=1 + shift + fi +- +- function inst1mod() { +- local _ret=0 _mod="$1" +- case $_mod in +- =*) +- ( [[ "$_mpargs" ]] && echo $_mpargs +- find_kernel_modules_by_path "${_mod#=}" ) \ +- | instmods +- ((_ret+=$?)) +- ;; +- --*) _mpargs+=" $_mod" ;; +- *) +- _mod=${_mod##*/} +- # Check for aliased modules +- _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null) +- _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*}" ]]; then +- read _ret <"$DRACUT_KERNEL_LAZY_HASHDIR/${_mod%.ko*}" +- return $_ret +- fi +- +- _mod=${_mod/-/_} +- if [[ $omit_drivers ]] && [[ "$_mod" =~ $omit_drivers ]]; then +- dinfo "Omitting driver ${_mod##$srcmods}" +- return 0 +- fi +- +- # If we are building a host-specific initramfs and this +- # module is not already loaded, move on to the next one. +- [[ $hostonly ]] \ +- && ! module_is_host_only "$_mod" \ +- && return 0 +- +- if [[ "$_check" = "yes" ]] || ! [[ $DRACUT_KERNEL_LAZY_HASHDIR ]]; then +- # We use '-d' option in modprobe only if modules prefix path +- # differs from default '/'. This allows us to use dracut with +- # old version of modprobe which doesn't have '-d' option. +- local _moddirname=${srcmods%%/lib/modules/*} +- [[ -n ${_moddirname} ]] && _moddirname="-d ${_moddirname}/" +- +- # ok, load the module, all its dependencies, and any firmware +- # it may require +- for_each_kmod_dep install_kmod_with_fw $_mod \ +- --set-version $kernel ${_moddirname} $_mpargs +- ((_ret+=$?)) +- else +- [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \ +- echo ${_mod%.ko*} >> "$DRACUT_KERNEL_LAZY_HASHDIR/lazylist" +- fi +- ;; +- esac +- return $_ret +- } +- +- function instmods_1() { +- local _mod _mpargs +- if (($# == 0)); then # filenames from stdin +- while read _mod || [ -n "$_mod" ]; do +- inst1mod "${_mod%.ko*}" || { +- 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" ]] && [[ "$_silent" == "no" ]]; then +- dfatal "Failed to install module $1" +- fi +- } +- shift +- done +- return 0 +- } +- +- local _ret _filter_not_found='FATAL: Module .* not found.' +- # Capture all stderr from modprobe to _fderr. We could use {var}>... +- # redirections, but that would make dracut require bash4 at least. +- eval "( instmods_1 \"\$@\" ) ${_fderr}>&1" \ +- | while read line || [ -n "$line" ]; do [[ "$line" =~ $_filter_not_found ]] || echo $line;done | derror ++ if (($# == 0)); then ++ read -r -d '' -a args ++ set -- "${args[@]}" ++ fi ++ $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" + _ret=$? ++ (($_ret != 0)) && [[ -z "$_silent" ]] && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || : ++ [[ "$optional" ]] && return 0 + return $_ret + } +diff --git a/dracut.sh b/dracut.sh +index 37ae350..f6d0439 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -733,7 +733,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l + [[ $lvmconf_l ]] && lvmconf=$lvmconf_l + [[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +-[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware /lib/firmware/$kernel" ++[[ $fw_dir ]] || fw_dir="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel" + [[ $tmpdir_l ]] && tmpdir="$tmpdir_l" + [[ $tmpdir ]] || tmpdir=/var/tmp + [[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS +@@ -750,6 +750,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l)) + [[ $kernel_image_l ]] && kernel_image="$kernel_image_l" + + # eliminate IFS hackery when messing with fw_dir ++export DRACUT_FIRMWARE_PATH=${fw_dir// /:} + fw_dir=${fw_dir//:/ } + + # check for logfile and try to create one if it doesn't exist +@@ -839,7 +840,6 @@ trap ' + # clean up after ourselves no matter how we die. + trap 'exit 1;' SIGINT + +-export DRACUT_KERNEL_LAZY="1" + export DRACUT_RESOLVE_LAZY="1" + + if [[ $print_cmdline ]]; then +@@ -1436,9 +1436,9 @@ if [[ $no_kernel != yes ]]; then + hostonly='' instmods -c $filesystems + fi + +- dinfo "*** Installing kernel module dependencies and firmware ***" ++ dinfo "*** Installing kernel module dependencies ***" + dracut_kernel_post +- dinfo "*** Installing kernel module dependencies and firmware done ***" ++ dinfo "*** Installing kernel module dependencies done ***" + + if [[ $noimageifnotneeded == yes ]] && [[ $hostonly ]]; then + if [[ ! -f "$initdir/lib/dracut/need-initqueue" ]] && \ +diff --git a/install/dracut-install.c b/install/dracut-install.c +index 3b48ba8..a20e06c 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -22,7 +22,7 @@ + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif +- ++#undef _FILE_OFFSET_BITS + #include + #include + #include +@@ -38,6 +38,9 @@ + #include + #include + #include ++#include ++#include ++#include + + #include "log.h" + #include "hashmap.h" +@@ -48,16 +51,31 @@ static bool arg_hmac = false; + static bool arg_createdir = false; + static int arg_loglevel = -1; + static bool arg_optional = false; ++static bool arg_silent = false; + static bool arg_all = false; ++static bool arg_module = false; + static bool arg_resolvelazy = false; + static bool arg_resolvedeps = false; + static bool arg_hostonly = false; + static char *destrootdir = NULL; ++static char *kerneldir = NULL; ++static char **firmwaredirs = NULL; ++static char **pathdirs; + static char *logdir = NULL; + static char *logfile = NULL; + FILE *logfile_f = NULL; + static Hashmap *items = NULL; + static Hashmap *items_failed = NULL; ++static regex_t mod_filter_path; ++static regex_t mod_filter_nopath; ++static regex_t mod_filter_symbol; ++static regex_t mod_filter_nosymbol; ++static regex_t mod_filter_noname; ++static bool arg_mod_filter_path = false; ++static bool arg_mod_filter_nopath = false; ++static bool arg_mod_filter_symbol = false; ++static bool arg_mod_filter_nosymbol = false; ++static bool arg_mod_filter_noname = false; + + static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst); + +@@ -516,6 +534,18 @@ void dracut_log_cp(const char *path) + log_error("Could not append '%s' to logfile '%s': %m", path, logfile); + } + ++static bool check_hashmap(Hashmap *hm, const char *item) ++{ ++ char *existing; ++ existing = hashmap_get(hm, item); ++ if (existing) { ++ if (strcmp(existing, item) == 0) { ++ return true; ++ } ++ } ++ return false; ++} ++ + static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst) + { + struct stat sb, db; +@@ -524,26 +554,17 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res + int ret; + bool src_exists = true; + char *i = NULL; +- char *existing; + + log_debug("dracut_install('%s', '%s')", src, dst); + +- existing = hashmap_get(items_failed, src); +- if (existing) { +- if (strcmp(existing, src) == 0) { +- log_debug("hash hit items_failed for '%s'", src); +- return 1; +- } ++ if (check_hashmap(items_failed, src)) { ++ log_debug("hash hit items_failed for '%s'", src); ++ return 1; + } + +- if (hashdst) { +- existing = hashmap_get(items, dst); +- if (existing) { +- if (strcmp(existing, dst) == 0) { +- log_debug("hash hit items for '%s'", dst); +- return 0; +- } +- } ++ if (hashdst && check_hashmap(items, dst)) { ++ log_debug("hash hit items for '%s'", dst); ++ return 0; + } + + if (lstat(src, &sb) < 0) { +@@ -678,7 +699,7 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res + log_debug("dracut_install ret = %d", ret); + log_info("cp '%s' '%s'", src, fulldstpath); + +- if (arg_hostonly) ++ if (arg_hostonly && !arg_module) + mark_hostonly(dst); + + ret += cp(src, fulldstpath); +@@ -751,6 +772,9 @@ static int parse_argv(int argc, char *argv[]) + + enum { + ARG_VERSION = 0x100, ++ ARG_SILENT, ++ ARG_KERNELDIR, ++ ARG_FIRMWAREDIRS, + ARG_DEBUG + }; + +@@ -765,13 +789,22 @@ static int parse_argv(int argc, char *argv[]) + {"optional", no_argument, NULL, 'o'}, + {"hostonly", no_argument, NULL, 'H'}, + {"all", no_argument, NULL, 'a'}, ++ {"module", no_argument, NULL, 'm'}, + {"fips", no_argument, NULL, 'f'}, + {"destrootdir", required_argument, NULL, 'D'}, + {"logdir", required_argument, NULL, 'L'}, ++ {"mod-filter-path", required_argument, NULL, 'p'}, ++ {"mod-filter-nopath", required_argument, NULL, 'P'}, ++ {"mod-filter-symbol", required_argument, NULL, 's'}, ++ {"mod-filter-nosymbol", required_argument, NULL, 'S'}, ++ {"mod-filter-noname", required_argument, NULL, 'N'}, ++ {"silent", no_argument, NULL, ARG_SILENT}, ++ {"kerneldir", required_argument, NULL, ARG_KERNELDIR}, ++ {"firmwaredirs", required_argument, NULL, ARG_FIRMWAREDIRS}, + {NULL, 0, NULL, 0} + }; + +- while ((c = getopt_long(argc, argv, "adfhlL:oD:HR", options, NULL)) != -1) { ++ while ((c = getopt_long(argc, argv, "madfhlL:oD:HRp:P:s:S:N:", options, NULL)) != -1) { + switch (c) { + case ARG_VERSION: + puts(PROGRAM_VERSION_STRING); +@@ -782,6 +815,9 @@ static int parse_argv(int argc, char *argv[]) + case ARG_DEBUG: + arg_loglevel = LOG_DEBUG; + break; ++ case ARG_SILENT: ++ arg_silent = true; ++ break; + case 'v': + arg_loglevel = LOG_INFO; + break; +@@ -797,12 +833,56 @@ static int parse_argv(int argc, char *argv[]) + case 'a': + arg_all = true; + break; ++ case 'm': ++ arg_module = true; ++ break; + case 'D': + destrootdir = strdup(optarg); + break; ++ case 'p': ++ if (regcomp(&mod_filter_path, optarg, REG_NOSUB|REG_EXTENDED) != 0) { ++ log_error("Module path filter %s is not a regular expression", optarg); ++ exit(EXIT_FAILURE); ++ } ++ arg_mod_filter_path = true; ++ break; ++ case 'P': ++ if (regcomp(&mod_filter_nopath, optarg, REG_NOSUB|REG_EXTENDED) != 0) { ++ log_error("Module path filter %s is not a regular expression", optarg); ++ exit(EXIT_FAILURE); ++ } ++ arg_mod_filter_nopath = true; ++ break; ++ case 's': ++ if (regcomp(&mod_filter_symbol, optarg, REG_NOSUB|REG_EXTENDED) != 0) { ++ log_error("Module symbol filter %s is not a regular expression", optarg); ++ exit(EXIT_FAILURE); ++ } ++ arg_mod_filter_symbol = true; ++ break; ++ case 'S': ++ if (regcomp(&mod_filter_nosymbol, optarg, REG_NOSUB|REG_EXTENDED) != 0) { ++ log_error("Module symbol filter %s is not a regular expression", optarg); ++ exit(EXIT_FAILURE); ++ } ++ arg_mod_filter_nosymbol = true; ++ break; ++ case 'N': ++ if (regcomp(&mod_filter_noname, optarg, REG_NOSUB|REG_EXTENDED) != 0) { ++ log_error("Module symbol filter %s is not a regular expression", optarg); ++ exit(EXIT_FAILURE); ++ } ++ arg_mod_filter_noname = true; ++ break; + case 'L': + logdir = strdup(optarg); + break; ++ case ARG_KERNELDIR: ++ kerneldir = strdup(optarg); ++ break; ++ case ARG_FIRMWAREDIRS: ++ firmwaredirs = strv_split(optarg, ":"); ++ break; + case 'f': + arg_hmac = true; + break; +@@ -817,6 +897,22 @@ static int parse_argv(int argc, char *argv[]) + } + } + ++ if (arg_module) { ++ if (!firmwaredirs) { ++ char *path = NULL; ++ ++ path = getenv("DRACUT_FIRMWARE_PATH"); ++ ++ if (path == NULL) { ++ log_error("Environment variable DRACUT_FIRMWARE_PATH is not set"); ++ exit(EXIT_FAILURE); ++ } ++ ++ log_debug("DRACUT_FIRMWARE_PATH=%s", path); ++ ++ firmwaredirs = strv_split(path, ":"); ++ } ++ } + if (!optind || optind == argc) { + log_error("No SOURCE argument given"); + usage(EXIT_FAILURE); +@@ -858,24 +954,11 @@ static int resolve_lazy(int argc, char **argv) + + static char **find_binary(const char *src) + { +- char *path = NULL; +- _cleanup_strv_free_ char **p = NULL; + char **ret = NULL; + char **q; + char *newsrc = NULL; + +- path = getenv("PATH"); +- +- if (path == NULL) { +- log_error("PATH is not set"); +- exit(EXIT_FAILURE); +- } +- +- log_debug("PATH=%s", path); +- +- p = strv_split(path, ":"); +- +- STRV_FOREACH(q, p) { ++ STRV_FOREACH(q, pathdirs) { + struct stat sb; + int r; + +@@ -976,10 +1059,381 @@ static int install_all(int argc, char **argv) + return r; + } + ++static int install_firmware(struct kmod_module *mod) ++{ ++ struct kmod_list *l, *list = NULL; ++ int ret; ++ ++ char **q; ++ ++ ret = kmod_module_get_info(mod, &list); ++ if (ret < 0) { ++ log_error("could not get modinfo from '%s': %s\n", ++ kmod_module_get_name(mod), strerror(-ret)); ++ return ret; ++ } ++ kmod_list_foreach(l, list) { ++ const char *key = kmod_module_info_get_key(l); ++ const char *value = NULL; ++ char *fwpath = NULL; ++ ++ if (!streq("firmware", key)) ++ continue; ++ ++ value = kmod_module_info_get_value(l); ++ log_debug("Firmware %s", value); ++ ret = -1; ++ STRV_FOREACH(q, firmwaredirs) { ++ struct stat sb; ++ int r; ++ ++ r = asprintf(&fwpath, "%s/%s", *q, value); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } ++ ++ if (stat(fwpath, &sb) != 0) { ++ log_debug("stat(%s) != 0", fwpath); ++ free(fwpath); ++ fwpath = NULL; ++ continue; ++ } ++ ++ ret = dracut_install(fwpath, fwpath, false, false, true); ++ if (ret == 0) ++ log_debug("dracut_install '%s' OK", fwpath); ++ } ++ ++ if (ret != 0) { ++ log_info("Possible missing firmware %s for kernel module %s", value, kmod_module_get_name(mod)); ++ } ++ } ++ return 0; ++} ++ ++static bool check_module_symbols(struct kmod_module *mod) ++{ ++ struct kmod_list *itr, *deplist = NULL; ++ ++ if (!arg_mod_filter_symbol && !arg_mod_filter_nosymbol) ++ return true; ++ ++ if (kmod_module_get_dependency_symbols(mod, &deplist) < 0) { ++ log_debug("kmod_module_get_dependency_symbols failed"); ++ if (arg_mod_filter_symbol) ++ return false; ++ return true; ++ } ++ ++ if (arg_mod_filter_nosymbol) { ++ kmod_list_foreach(itr, deplist) { ++ const char *symbol = kmod_module_symbol_get_symbol(itr); ++ // log_debug("Checking symbol %s", symbol); ++ if (regexec(&mod_filter_nosymbol, symbol, 0, NULL, 0) == 0) { ++ kmod_module_dependency_symbols_free_list(deplist); ++ log_debug("Module %s: symbol %s matched exclusion filter", kmod_module_get_name(mod), symbol); ++ return false; ++ } ++ } ++ } ++ ++ if (arg_mod_filter_symbol) { ++ kmod_list_foreach(itr, deplist) { ++ const char *symbol = kmod_module_dependency_symbol_get_symbol(itr); ++ // log_debug("Checking symbol %s", symbol); ++ if (regexec(&mod_filter_symbol, symbol, 0, NULL, 0) == 0) { ++ kmod_module_dependency_symbols_free_list(deplist); ++ log_debug("Module %s: symbol %s matched inclusion filter", kmod_module_get_name(mod), symbol); ++ return true; ++ } ++ } ++ kmod_module_dependency_symbols_free_list(deplist); ++ return false; ++ } ++ ++ kmod_module_dependency_symbols_free_list(deplist); ++ return true; ++} ++ ++ ++static bool check_module_path(const char *path) ++{ ++ if (arg_mod_filter_nopath && (regexec(&mod_filter_nopath, path, 0, NULL, 0) == 0)) { ++ log_debug("Path %s matched exclusion filter", path); ++ return false; ++ } ++ ++ if (arg_mod_filter_path && (regexec(&mod_filter_path, path, 0, NULL, 0) != 0)) { ++ log_debug("Path %s matched inclusion filter", path); ++ return false; ++ } ++ return true; ++} ++ ++static int install_module(struct kmod_module *mod) ++{ ++ int ret = 0; ++ int state; ++ struct kmod_list *itr, *modlist = NULL; ++ const char *path = NULL; ++ const char *name = NULL; ++ state = kmod_module_get_initstate(mod); ++ ++ name = kmod_module_get_name(mod); ++ if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) ++ return 0; ++ ++ if (arg_hostonly && (state != KMOD_MODULE_BUILTIN) && (state != KMOD_MODULE_LIVE)) { ++ log_debug("dracut_install '%s' not hostonly", name); ++ return 0; ++ } ++ ++ path = kmod_module_get_path(mod); ++ if (!path) ++ return -ENOENT; ++ ++ if (check_hashmap(items_failed, path)) ++ return 1; ++ ++ if (check_hashmap(items, path)) ++ return 0; ++ ++ if (!check_module_path(path) || !check_module_symbols(mod)) { ++ log_debug("No symbol or patch match for '%s'", path); ++ return 0; ++ } ++ ++ log_debug("dracut_install '%s'", path); ++ ret = dracut_install(path, path, false, false, true); ++ if (ret == 0) { ++ log_debug("dracut_install '%s' OK", kmod_module_get_name(mod)); ++ } else if (!arg_optional) { ++ if (!arg_silent) ++ log_error("dracut_install '%s' ERROR", kmod_module_get_name(mod)); ++ return ret; ++ } ++ install_firmware(mod); ++ ++ modlist = kmod_module_get_dependencies(mod); ++ kmod_list_foreach(itr, modlist) { ++ mod = kmod_module_get_module(itr); ++ path = kmod_module_get_path(mod); ++ name = kmod_module_get_name(mod); ++ if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) { ++ kmod_module_unref(mod); ++ continue; ++ } ++ ret = dracut_install(path, path, false, false, true); ++ if (ret == 0) { ++ log_debug("dracut_install '%s' OK", kmod_module_get_name(mod)); ++ install_firmware(mod); ++ } else { ++ log_error("dracut_install '%s' ERROR", kmod_module_get_name(mod)); ++ } ++ kmod_module_unref(mod); ++ } ++ kmod_module_unref_list(modlist); ++ ++ return ret; ++} ++ ++static int install_modules(int argc, char **argv) ++{ ++ struct kmod_ctx *ctx = NULL; ++ struct kmod_list *itr, *modlist = NULL; ++ struct kmod_module *mod = NULL, *mod_o = NULL; ++ ++ const char *modname = NULL; ++ int i; ++ ++ ctx = kmod_new(kerneldir, NULL); ++ ++ for (i = 0; i < argc; i++) { ++ int r = 0; ++ int ret = 0; ++ log_debug("Handle module '%s'", argv[i]); ++ ++ if (argv[i][0] == '/') { ++ r = kmod_module_new_from_path(ctx, argv[i], &mod_o); ++ if (r < 0) { ++ log_debug("Failed to lookup modules path '%s': %m", argv[i]); ++ if (!arg_optional) ++ return -ENOENT; ++ continue; ++ } ++ /* Check, if we have to load another module with that name instead */ ++ modname = kmod_module_get_name(mod_o); ++ if (!modname) { ++ if (!arg_optional) { ++ if (!arg_silent) ++ log_error("Failed to get name for module '%s'", argv[i]); ++ return -ENOENT; ++ } ++ log_info("Failed to get name for module '%s'", argv[i]); ++ continue; ++ } ++ r = kmod_module_new_from_lookup(ctx, modname, &modlist); ++ kmod_module_unref(mod_o); ++ if (r < 0) { ++ if (!arg_optional) { ++ if (!arg_silent) ++ log_error("3 Failed to lookup alias '%s': %d", modname, r); ++ return -ENOENT; ++ } ++ log_info("3 Failed to lookup alias '%s': %d", modname, r); ++ continue; ++ } ++ if (!modlist) { ++ if (!arg_optional) { ++ if (!arg_silent) ++ log_error("Failed to find module '%s' %s", modname, argv[i]); ++ return -ENOENT; ++ } ++ log_info("Failed to find module '%s' %s", modname, argv[i]); ++ continue; ++ } ++ kmod_list_foreach(itr, modlist) { ++ mod = kmod_module_get_module(itr); ++ ret = install_module(mod); ++ } ++ kmod_module_unref_list(modlist); ++ modlist = 0; ++ } else if (argv[i][0] == '=') { ++ char *path1, *path2, *path3; ++ FTS *fts; ++ log_debug("Handling =%s", &argv[i][1]); ++ /* FIXME and add more paths*/ ++ { ++ int r; ++ r = asprintf(&path2, "%s/kernel/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } ++ ++ r = asprintf(&path1, "%s/extra/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } ++ ++ r = asprintf(&path3, "%s/updates/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } ++ ++ char *paths[] = { path1, path2, path3, NULL }; ++ fts = fts_open(paths, FTS_COMFOLLOW|FTS_NOCHDIR|FTS_NOSTAT|FTS_LOGICAL, NULL); ++ } ++ for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) { ++ if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) { ++ fts_set(fts, ftsent, FTS_SKIP); ++ log_debug("Skipping %s", ftsent->fts_accpath); ++ continue; ++ } ++ if((ftsent->fts_info != FTS_F) && (ftsent->fts_info != FTS_SL)) { ++ log_debug("Ignoring %s", ftsent->fts_accpath); ++ continue; ++ } ++ log_debug("Handling %s", ftsent->fts_accpath); ++ r = kmod_module_new_from_path(ctx, ftsent->fts_accpath, &mod_o); ++ if (r < 0) { ++ log_debug("Failed to lookup modules path '%s': %m", ftsent->fts_accpath); ++ continue; ++ } ++#if 1 ++ /* Check, if we have to load another module with that name instead */ ++ modname = kmod_module_get_name(mod_o); ++ if (!modname) { ++ log_error("Failed to get name for module '%s'", ftsent->fts_accpath); ++ continue; ++ } ++ r = kmod_module_new_from_lookup(ctx, modname, &modlist); ++ kmod_module_unref(mod_o); ++ if (r < 0) { ++ log_error("2 Failed to lookup alias '%s': %m", modname); ++ kmod_module_unref_list(modlist); ++ continue; ++ } ++ if (!modlist) { ++ log_error("Failed to find module '%s' %s", modname, ftsent->fts_accpath); ++ kmod_module_unref_list(modlist); ++ continue; ++ } ++ kmod_list_foreach(itr, modlist) { ++ mod = kmod_module_get_module(itr); ++ ret = install_module(mod); ++ kmod_module_unref(mod); ++ } ++ kmod_module_unref_list(modlist); ++ modlist = 0; ++#else ++ ret = install_module(mod_o); ++ kmod_module_unref(mod_o); ++#endif ++ ++ } ++ if (errno) { ++ log_error("FTS ERROR: %m"); ++ } ++ fts_close(fts); ++ free(path1); path1 = NULL; ++ free(path2); path2 = NULL; ++ free(path3); path3 = NULL; ++ } else { ++ char *modname = argv[i]; ++ if (endswith(modname, ".ko")) { ++ int len = strlen(modname); ++ modname[len-3]=0; ++ } ++ if (endswith(modname, ".ko.xz") || endswith(modname, ".ko.gz")) { ++ int len = strlen(modname); ++ modname[len-6]=0; ++ } ++ r = kmod_module_new_from_lookup(ctx, modname, &modlist); ++ if (r < 0) { ++ if (!arg_optional) { ++ if (!arg_silent) ++ log_error("Failed to lookup alias '%s': %m", modname); ++ return -ENOENT; ++ } ++ log_info("Failed to lookup alias '%s': %m", modname); ++ continue; ++ } ++ if (!modlist) { ++ if (!arg_optional) { ++ if (!arg_silent) ++ log_error("Failed to find module '%s'", modname); ++ return -ENOENT; ++ } ++ log_info("Failed to find module '%s'", modname); ++ continue; ++ } ++ kmod_list_foreach(itr, modlist) { ++ mod = kmod_module_get_module(itr); ++ ret = install_module(mod); ++ kmod_module_unref(mod); ++ } ++ kmod_module_unref_list(modlist); ++ modlist = 0; ++ } ++ ++ if ((ret != 0) && (!arg_optional)) { ++ if (!arg_silent) ++ log_error("ERROR: installing '%s'", argv[i]); ++ return EXIT_FAILURE; ++ } ++ } ++ return EXIT_SUCCESS; ++} ++ + int main(int argc, char **argv) + { + int r; + char *i; ++ char *path = NULL; + + r = parse_argv(argc, argv); + if (r <= 0) +@@ -993,6 +1447,17 @@ int main(int argc, char **argv) + + log_open(); + ++ path = getenv("PATH"); ++ ++ if (path == NULL) { ++ log_error("PATH is not set"); ++ exit(EXIT_FAILURE); ++ } ++ ++ log_debug("PATH=%s", path); ++ ++ pathdirs = strv_split(path, ":"); ++ + umask(0022); + + if (destrootdir == NULL || strlen(destrootdir) == 0) { +@@ -1059,7 +1524,9 @@ int main(int argc, char **argv) + } + } + +- if (arg_resolvelazy) { ++ if (arg_module) { ++ r = install_modules(argc - optind, &argv[optind]); ++ } else if (arg_resolvelazy) { + r = resolve_lazy(argc - optind, &argv[optind]); + } else if (arg_all || (argc - optind > 2) || ((argc - optind) == 1)) { + r = install_all(argc - optind, &argv[optind]); +@@ -1085,6 +1552,7 @@ int main(int argc, char **argv) + hashmap_free(items_failed); + + free(destrootdir); +- ++ strv_free(firmwaredirs); ++ strv_free(pathdirs); + return r; + } +diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh +index 55a214e..e0b2959 100755 +--- a/modules.d/50drm/module-setup.sh ++++ b/modules.d/50drm/module-setup.sh +@@ -15,40 +15,6 @@ installkernel() { + local _modname + # Include KMS capable drm drivers + +- drm_module_filter() { +- local _drm_drivers='drm_crtc_init' +- local _ret +- # subfunctions inherit following FDs +- local _merge=8 _side2=9 +- function nmf1() { +- local _fname _fcont +- while read _fname || [ -n "$_fname" ]; do +- case "$_fname" in +- *.ko) _fcont="$(< $_fname)" ;; +- *.ko.gz) _fcont="$(gzip -dc $_fname)" ;; +- *.ko.xz) _fcont="$(xz -dc $_fname)" ;; +- esac +- [[ $_fcont =~ $_drm_drivers +- && ! $_fcont =~ iw_handler_get_spy ]] \ +- && echo "$_fname" +- done +- } +- function rotor() { +- local _f1 _f2 +- while read _f1 || [ -n "$_f1" ]; do +- echo "$_f1" +- if read _f2; then +- echo "$_f2" 1>&${_side2} +- fi +- done | nmf1 1>&${_merge} +- } +- # Use two parallel streams to filter alternating modules. +- set +x +- eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1" +- [[ $debug ]] && set -x +- return 0 +- } +- + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules needed by drm + instmods \ +@@ -62,20 +28,19 @@ installkernel() { + + instmods amdkfd hyperv_fb + +- for _modname in $(find_kernel_modules_by_path drivers/gpu/drm \ +- | drm_module_filter) ; do +- # if the hardware is present, include module even if it is not currently loaded, +- # as we could e.g. be in the installer; nokmsboot boot parameter will disable +- # loading of the driver if needed +- if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \ +- | grep -qxf - /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias 2>/dev/null; then +- hostonly='' instmods $_modname +- # if radeon.ko is installed, we want amdkfd also +- if strstr "$_modname" radeon.ko; then +- hostonly='' instmods amdkfd ++ # if the hardware is present, include module even if it is not currently loaded, ++ # as we could e.g. be in the installer; nokmsboot boot parameter will disable ++ # loading of the driver if needed ++ if [[ $hostonly ]]; then ++ for i in /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias; do ++ [[ -e $i ]] || continue ++ if hostonly="" dracut_instmods -s "drm_crtc_init" $(<$i) 2>/dev/null; then ++ if strstr $(modinfo -F filename $(<$i) 2>/dev/null) radeon.ko; then ++ hostonly='' instmods amdkfd ++ fi + fi +- continue +- fi +- instmods $_modname +- done ++ done ++ else ++ dracut_instmods -s "drm_crtc_init" "=drivers/gpu/drm" ++ fi + } +diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh +index 5d964f4..6c377ef 100755 +--- a/modules.d/90crypt/module-setup.sh ++++ b/modules.d/90crypt/module-setup.sh +@@ -24,8 +24,10 @@ depends() { + + # called by dracut + installkernel() { +- instmods dm_crypt =crypto + hostonly="" instmods drbg ++ arch=$(arch) ++ [[ $arch == x86_64 ]] && arch=x86 ++ instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto + } + + # called by dracut +diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh +index 419e8b1..2b8e39f 100755 +--- a/modules.d/90dm/module-setup.sh ++++ b/modules.d/90dm/module-setup.sh +@@ -13,8 +13,7 @@ depends() { + + # called by dracut + installkernel() { +- instmods =drivers/md +- instmods dm_mod dm-cache dm-cache-mq dm-cache-cleaner ++ instmods =drivers/md dm_mod dm-cache dm-cache-mq dm-cache-cleaner + } + + # called by dracut +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index 300adc7..e97d598 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -2,54 +2,25 @@ + + # called by dracut + installkernel() { +- if [[ -z $drivers ]]; then +- block_module_filter() { +- local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host' +- # subfunctions inherit following FDs +- local _merge=8 _side2=9 +- function bmf1() { +- local _f +- while read _f || [ -n "$_f" ]; do case "$_f" in +- *.ko) [[ $(< $_f) =~ $_blockfuncs ]] && echo "$_f" ;; +- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;; +- *.ko.xz) [[ $(xz -dc <$_f) =~ $_blockfuncs ]] && echo "$_f" ;; +- esac +- done +- return 0 +- } +- function rotor() { +- local _f1 _f2 +- while read _f1 || [ -n "$_f1" ]; do +- echo "$_f1" +- if read _f2; then +- echo "$_f2" 1>&${_side2} +- fi +- done | bmf1 1>&${_merge} +- return 0 +- } +- # Use two parallel streams to filter alternating modules. +- set +x +- eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1" +- [[ $debug ]] && set -x +- return 0 +- } ++ local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma' + ++ if [[ -z $drivers ]]; then + hostonly='' instmods \ + sr_mod sd_mod scsi_dh ata_piix hid_generic unix \ +- ehci-hcd ehci-pci ehci-platform \ ++ ehci-hcd ehci-pci \ + ohci-hcd ohci-pci \ + uhci-hcd \ + xhci-hcd xhci-pci xhci-plat-hcd \ ++ ehci-platform ++ ++ instmods \ + "=drivers/hid" \ + "=drivers/input/serio" \ + "=drivers/input/keyboard" \ +- "=drivers/usb/storage" +- +- instmods \ + yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ + atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ + virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ +- "=drivers/pcmcia" =ide ++ "=drivers/pcmcia" =ide "=drivers/usb/storage" + + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules +@@ -62,20 +33,16 @@ installkernel() { + ${NULL} + fi + +- +- find_kernel_modules | block_module_filter | instmods ++ dracut_instmods -s "${_blockfuncs}" "=drivers" + + # if not on hostonly mode, install all known filesystems, + # if the required list is not set via the filesystems variable + if ! [[ $hostonly ]]; then + if [[ -z $filesystems ]]; then +- silent_omit_drivers="kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd" \ +- instmods '=fs' ++ dracut_instmods -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs' + fi + else +- for i in "${host_fs_types[@]}"; do +- hostonly='' instmods $i +- done ++ hostonly='' instmods "${host_fs_types[@]}" + fi + fi + : +diff --git a/modules.d/90kernel-network-modules/module-setup.sh b/modules.d/90kernel-network-modules/module-setup.sh +index 18d7d96..c004ff8 100755 +--- a/modules.d/90kernel-network-modules/module-setup.sh ++++ b/modules.d/90kernel-network-modules/module-setup.sh +@@ -14,47 +14,14 @@ depends() { + installkernel() { + # Include wired net drivers, excluding wireless + local _arch=$(uname -m) ++ local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open' ++ local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/' + +- net_module_filter() { +- local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open' +- local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/' +- local _ret +- # subfunctions inherit following FDs +- local _merge=8 _side2=9 +- function nmf1() { +- local _fname _fcont +- while read _fname; do +- [[ $_fname =~ $_unwanted_drivers ]] && continue +- case "$_fname" in +- *.ko) _fcont="$(< $_fname)" ;; +- *.ko.gz) _fcont="$(gzip -dc $_fname)" ;; +- *.ko.xz) _fcont="$(xz -dc $_fname)" ;; +- esac +- [[ $_fcont =~ $_net_drivers +- && ! $_fcont =~ iw_handler_get_spy ]] \ +- && echo "$_fname" +- done +- return 0 +- } +- function rotor() { +- local _f1 _f2 +- while read _f1; do +- echo "$_f1" +- if read _f2; then +- echo "$_f2" 1>&${_side2} +- fi +- done | nmf1 1>&${_merge} +- return 0 +- } +- # Use two parallel streams to filter alternating modules. +- set +x +- eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1" +- [[ $debug ]] && set -x +- return 0 +- } ++ if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then ++ _s390drivers="=drivers/s390/net" ++ fi + +- { find_kernel_modules_by_path drivers/net; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/net; fi; } \ +- | net_module_filter | instmods ++ dracut_instmods -P ".*${_unwanted_drivers}.*" -s "$_net_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"} + + #instmods() will take care of hostonly + instmods \ +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index a808678..27817bd 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -51,41 +51,14 @@ cmdline() { + installkernel() { + local _ret + local _arch=$(uname -m) +- mp_mod_filter() { +- local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target' +- # subfunctions inherit following FDs +- local _merge=8 _side2=9 +- function bmf1() { +- local _f +- while read _f || [ -n "$_f" ]; do +- case "$_f" in +- *.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;; +- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;; +- *.ko.xz) [[ $(xz -dc <$_f) =~ $_funcs ]] && echo "$_f" ;; +- esac +- done +- return 0 +- } ++ local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target' ++ local _s390 + +- function rotor() { +- local _f1 _f2 +- while read _f1 || [ -n "$_f1" ]; do +- echo "$_f1" +- if read _f2; then +- echo "$_f2" 1>&${_side2} +- fi +- done | bmf1 1>&${_merge} +- return 0 +- } +- # Use two parallel streams to filter alternating modules. +- set +x +- eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1" +- [[ $debug ]] && set -x +- return 0 +- } ++ if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then ++ _s390drivers="=drivers/s390/scsi" ++ fi + +- ( find_kernel_modules_by_path drivers/scsi; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/scsi; fi; +- find_kernel_modules_by_path drivers/md ) | mp_mod_filter | hostonly='' instmods ++ hostonly='' dracut_instmods -s "$_funcs" "=drivers/scsi" "=drivers/md" ${_s390drivers:+"$_s390drivers"} + } + + # called by dracut +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index beb80e3..203e313 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -157,44 +157,17 @@ depends() { + # called by dracut + installkernel() { + local _arch=$(uname -m) ++ local _funcs='iscsi_register_transport' + + instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi + hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs +- iscsi_module_filter() { +- local _funcs='iscsi_register_transport' +- # subfunctions inherit following FDs +- local _merge=8 _side2=9 +- function bmf1() { +- local _f +- while read _f || [ -n "$_f" ]; do +- case "$_f" in +- *.ko) [[ $(< $_f) =~ $_funcs ]] && echo "$_f" ;; +- *.ko.gz) [[ $(gzip -dc <$_f) =~ $_funcs ]] && echo "$_f" ;; +- *.ko.xz) [[ $(xz -dc <$_f) =~ $_funcs ]] && echo "$_f" ;; +- esac +- done +- return 0 +- } +- +- function rotor() { +- local _f1 _f2 +- while read _f1 || [ -n "$_f1" ]; do +- echo "$_f1" +- if read _f2; then +- echo "$_f2" 1>&${_side2} +- fi +- done | bmf1 1>&${_merge} +- return 0 +- } +- # Use two parallel streams to filter alternating modules. +- set +x +- eval "( ( rotor ) ${_side2}>&1 | bmf1 ) ${_merge}>&1" +- [[ $debug ]] && set -x +- return 0 +- } + +- { find_kernel_modules_by_path drivers/scsi; if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then find_kernel_modules_by_path drivers/s390/scsi; fi;} \ +- | iscsi_module_filter | instmods ++ if [ "$_arch" = "s390" -o "$_arch" = "s390x" ]; then ++ _s390drivers="=drivers/s390/scsi" ++ fi ++ ++ dracut_instmods -s "$_funcs" "=drivers/scsi" ${_s390drivers:+"$_s390drivers"} ++ + } + + # called by dracut +diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh +index 6f039bd..9767e57 100755 +--- a/modules.d/95nfs/module-setup.sh ++++ b/modules.d/95nfs/module-setup.sh +@@ -25,7 +25,7 @@ depends() { + + # called by dracut + installkernel() { +- instmods nfs sunrpc ipv6 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files ++ instmods =net/sunrpc =fs/nfs ipv6 nfs_acl nfs_layout_nfsv41_files + } + + cmdline() { diff --git a/0049-Use-pkg-config-for-libkmod-CFLAGS-and-LIBS.patch b/0049-Use-pkg-config-for-libkmod-CFLAGS-and-LIBS.patch new file mode 100644 index 0000000..fe5820c --- /dev/null +++ b/0049-Use-pkg-config-for-libkmod-CFLAGS-and-LIBS.patch @@ -0,0 +1,94 @@ +From 607fec3e7965e3d38d764008e2b0c29757d90777 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Apr 2016 11:13:32 +0200 +Subject: [PATCH] Use pkg-config for libkmod CFLAGS and LIBS + +--- + Makefile | 4 ++-- + configure | 7 +++++++ + dracut.spec | 9 ++++++--- + 3 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 0a1ae6c..d28e4cf 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,7 +12,7 @@ pkglibdir ?= ${libdir}/dracut + sysconfdir ?= ${prefix}/etc + bindir ?= ${prefix}/bin + mandir ?= ${prefix}/share/man +-CFLAGS ?= -O2 -g -Wall ++CFLAGS ?= -O2 -g -Wall $(KMOD_CFLAGS) + CFLAGS += -std=gnu99 -D_FILE_OFFSET_BITS=64 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 + bashcompletiondir ?= ${datadir}/bash-completion/completions + pkgconfigdatadir ?= $(datadir)/pkgconfig +@@ -61,7 +61,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h + install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h + + install/dracut-install: $(DRACUT_INSTALL_OBJECTS) +- $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) -lkmod ++ $(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS) + + dracut-install: install/dracut-install + ln -fs $< $@ +diff --git a/configure b/configure +index 0bd3d2d..c92cb99 100755 +--- a/configure ++++ b/configure +@@ -50,6 +50,11 @@ while (($# > 0)); do + shift + done + ++if ! pkg-config --exists --print-errors " libkmod >= 15 "; then ++ echo "dracut needs pkg-config and libkmod >= 15." >&2 ++ exit 1 ++fi ++ + cat > Makefile.inc.$$ <= 15 ") ++KMOD_LIBS ?= $(pkg-config --libs " libkmod >= 15 ") + EOF + + { +diff --git a/dracut.spec b/dracut.spec +index 9e19fcc..7b9d675 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -39,6 +39,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt + + + BuildRequires: bash git ++BuildRequires: kmod-devel >= 15 + + %if 0%{?fedora} || 0%{?rhel} + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +@@ -46,7 +47,6 @@ BuildRequires: pkgconfig + %endif + %if 0%{?fedora} + BuildRequires: bash-completion +-BuildRequires: pkgconfig + %endif + + %if 0%{?suse_version} +@@ -223,10 +223,13 @@ This package contains tools to assemble the local initrd and host configuration. + cp %{SOURCE1} . + + %build +-%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \ ++%configure --systemdsystemunitdir=%{_unitdir} \ ++ --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \ ++ --libdir=%{_prefix}/lib \ + %if %{without doc} +- --disable-documentation ++ --disable-documentation \ + %endif ++ ${NULL} + + make %{?_smp_mflags} + diff --git a/0050-Fix-regressions-with-dracut-install-with-kernel-modu.patch b/0050-Fix-regressions-with-dracut-install-with-kernel-modu.patch new file mode 100644 index 0000000..8b84d48 --- /dev/null +++ b/0050-Fix-regressions-with-dracut-install-with-kernel-modu.patch @@ -0,0 +1,162 @@ +From 8d9ab2755d1341904ca7889f4e05b2151848a759 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Apr 2016 11:47:20 +0200 +Subject: [PATCH] Fix regressions with dracut-install with kernel modules + +Make sure, the same modules are installed as before. +--- + install/dracut-install.c | 9 +++++---- + modules.d/50drm/module-setup.sh | 4 ++-- + modules.d/90kernel-modules/module-setup.sh | 15 ++++++++------- + modules.d/90kernel-network-modules/module-setup.sh | 2 +- + modules.d/90multipath/module-setup.sh | 2 +- + modules.d/95iscsi/module-setup.sh | 2 +- + 6 files changed, 18 insertions(+), 16 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index a20e06c..c246201 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -1202,6 +1202,7 @@ static int install_module(struct kmod_module *mod) + if (!check_module_path(path) || !check_module_symbols(mod)) { + log_debug("No symbol or patch match for '%s'", path); + return 0; ++ //return -ENOENT; + } + + log_debug("dracut_install '%s'", path); +@@ -1295,7 +1296,7 @@ static int install_modules(int argc, char **argv) + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret = install_module(mod); ++ ret += install_module(mod); + } + kmod_module_unref_list(modlist); + modlist = 0; +@@ -1364,13 +1365,13 @@ static int install_modules(int argc, char **argv) + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret = install_module(mod); ++ ret += install_module(mod); + kmod_module_unref(mod); + } + kmod_module_unref_list(modlist); + modlist = 0; + #else +- ret = install_module(mod_o); ++ ret += install_module(mod_o); + kmod_module_unref(mod_o); + #endif + +@@ -1413,7 +1414,7 @@ static int install_modules(int argc, char **argv) + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret = install_module(mod); ++ ret += install_module(mod); + kmod_module_unref(mod); + } + kmod_module_unref_list(modlist); +diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh +index e0b2959..661dde9 100755 +--- a/modules.d/50drm/module-setup.sh ++++ b/modules.d/50drm/module-setup.sh +@@ -34,8 +34,8 @@ installkernel() { + if [[ $hostonly ]]; then + for i in /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias; do + [[ -e $i ]] || continue +- if hostonly="" dracut_instmods -s "drm_crtc_init" $(<$i) 2>/dev/null; then +- if strstr $(modinfo -F filename $(<$i) 2>/dev/null) radeon.ko; then ++ if hostonly="" dracut_instmods -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i) 2>/dev/null; then ++ if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then + hostonly='' instmods amdkfd + fi + fi +diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh +index e97d598..c30715d 100755 +--- a/modules.d/90kernel-modules/module-setup.sh ++++ b/modules.d/90kernel-modules/module-setup.sh +@@ -7,20 +7,21 @@ installkernel() { + if [[ -z $drivers ]]; then + hostonly='' instmods \ + sr_mod sd_mod scsi_dh ata_piix hid_generic unix \ +- ehci-hcd ehci-pci \ ++ ehci-hcd ehci-pci ehci-platform \ + ohci-hcd ohci-pci \ + uhci-hcd \ + xhci-hcd xhci-pci xhci-plat-hcd \ +- ehci-platform +- +- instmods \ + "=drivers/hid" \ + "=drivers/input/serio" \ + "=drivers/input/keyboard" \ ++ "=drivers/usb/storage" \ ++ ${NULL} ++ ++ instmods \ + yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \ + atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \ + virtio virtio_blk virtio_ring virtio_pci virtio_scsi \ +- "=drivers/pcmcia" =ide "=drivers/usb/storage" ++ "=drivers/pcmcia" =ide + + if [[ "$(uname -p)" == arm* ]]; then + # arm specific modules +@@ -33,13 +34,13 @@ installkernel() { + ${NULL} + fi + +- dracut_instmods -s "${_blockfuncs}" "=drivers" ++ dracut_instmods -o -s "${_blockfuncs}" "=drivers" + + # if not on hostonly mode, install all known filesystems, + # if the required list is not set via the filesystems variable + if ! [[ $hostonly ]]; then + if [[ -z $filesystems ]]; then +- dracut_instmods -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs' ++ dracut_instmods -o -P ".*/(kernel/fs/nfs|kernel/fs/nfsd|kernel/fs/lockd)/.*" '=fs' + fi + else + hostonly='' instmods "${host_fs_types[@]}" +diff --git a/modules.d/90kernel-network-modules/module-setup.sh b/modules.d/90kernel-network-modules/module-setup.sh +index c004ff8..11fbab9 100755 +--- a/modules.d/90kernel-network-modules/module-setup.sh ++++ b/modules.d/90kernel-network-modules/module-setup.sh +@@ -21,7 +21,7 @@ installkernel() { + _s390drivers="=drivers/s390/net" + fi + +- dracut_instmods -P ".*${_unwanted_drivers}.*" -s "$_net_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"} ++ dracut_instmods -o -P ".*${_unwanted_drivers}.*" -s "$_net_drivers" "=drivers/net" ${_s390drivers:+"$_s390drivers"} + + #instmods() will take care of hostonly + instmods \ +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index 27817bd..0af777d 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -58,7 +58,7 @@ installkernel() { + _s390drivers="=drivers/s390/scsi" + fi + +- hostonly='' dracut_instmods -s "$_funcs" "=drivers/scsi" "=drivers/md" ${_s390drivers:+"$_s390drivers"} ++ hostonly='' dracut_instmods -o -s "$_funcs" "=drivers/scsi" "=drivers/md" ${_s390drivers:+"$_s390drivers"} + } + + # called by dracut +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index 203e313..04937b5 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -166,7 +166,7 @@ installkernel() { + _s390drivers="=drivers/s390/scsi" + fi + +- dracut_instmods -s "$_funcs" "=drivers/scsi" ${_s390drivers:+"$_s390drivers"} ++ dracut_instmods -o -s "$_funcs" "=drivers/scsi" ${_s390drivers:+"$_s390drivers"} + + } + diff --git a/0051-dracut-install-simplify-error-logic.patch b/0051-dracut-install-simplify-error-logic.patch new file mode 100644 index 0000000..feea003 --- /dev/null +++ b/0051-dracut-install-simplify-error-logic.patch @@ -0,0 +1,159 @@ +From fe6e0c23adbdafc4fc371107534b3b2681c96393 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Apr 2016 13:28:29 +0200 +Subject: [PATCH] dracut-install: simplify error logic + +error out early, if "--optional" is not set +--- + install/dracut-install.c | 64 +++++++++++++++++++++++++++++++++++------------- + 1 file changed, 47 insertions(+), 17 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index c246201..f414f30 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -1181,8 +1181,10 @@ static int install_module(struct kmod_module *mod) + state = kmod_module_get_initstate(mod); + + name = kmod_module_get_name(mod); +- if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) ++ if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) { ++ log_debug("dracut_install '%s' is excluded", name); + return 0; ++ } + + if (arg_hostonly && (state != KMOD_MODULE_BUILTIN) && (state != KMOD_MODULE_LIVE)) { + log_debug("dracut_install '%s' not hostonly", name); +@@ -1194,15 +1196,14 @@ static int install_module(struct kmod_module *mod) + return -ENOENT; + + if (check_hashmap(items_failed, path)) +- return 1; ++ return -1; + + if (check_hashmap(items, path)) + return 0; + + if (!check_module_path(path) || !check_module_symbols(mod)) { + log_debug("No symbol or patch match for '%s'", path); +- return 0; +- //return -ENOENT; ++ return 1; + } + + log_debug("dracut_install '%s'", path); +@@ -1252,7 +1253,7 @@ static int install_modules(int argc, char **argv) + + for (i = 0; i < argc; i++) { + int r = 0; +- int ret = 0; ++ int ret = -1; + log_debug("Handle module '%s'", argv[i]); + + if (argv[i][0] == '/') { +@@ -1296,7 +1297,14 @@ static int install_modules(int argc, char **argv) + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret += install_module(mod); ++ r = install_module(mod); ++ kmod_module_unref(mod); ++ if ((r < 0) && !arg_optional) { ++ if (!arg_silent) ++ log_error("ERROR: installing module '%s'", modname); ++ return -ENOENT; ++ }; ++ ret = ( ret == 0 ? 0 : r ); + } + kmod_module_unref_list(modlist); + modlist = 0; +@@ -1341,40 +1349,55 @@ static int install_modules(int argc, char **argv) + log_debug("Handling %s", ftsent->fts_accpath); + r = kmod_module_new_from_path(ctx, ftsent->fts_accpath, &mod_o); + if (r < 0) { +- log_debug("Failed to lookup modules path '%s': %m", ftsent->fts_accpath); ++ log_debug("Failed to lookup modules path '%s': %m", ++ ftsent->fts_accpath); ++ if (!arg_optional) { ++ return -ENOENT; ++ } + continue; + } +-#if 1 ++ + /* Check, if we have to load another module with that name instead */ + modname = kmod_module_get_name(mod_o); + if (!modname) { + log_error("Failed to get name for module '%s'", ftsent->fts_accpath); ++ if (!arg_optional) { ++ return -ENOENT; ++ } + continue; + } + r = kmod_module_new_from_lookup(ctx, modname, &modlist); + kmod_module_unref(mod_o); + if (r < 0) { +- log_error("2 Failed to lookup alias '%s': %m", modname); ++ log_error("Failed to lookup alias '%s': %m", modname); + kmod_module_unref_list(modlist); ++ if (!arg_optional) { ++ return -ENOENT; ++ } + continue; + } + if (!modlist) { +- log_error("Failed to find module '%s' %s", modname, ftsent->fts_accpath); ++ log_error("Failed to find module '%s' %s", modname, ++ ftsent->fts_accpath); + kmod_module_unref_list(modlist); ++ if (!arg_optional) { ++ return -ENOENT; ++ } + continue; + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret += install_module(mod); ++ r = install_module(mod); + kmod_module_unref(mod); ++ if ((r < 0) && !arg_optional) { ++ if (!arg_silent) ++ log_error("ERROR: installing module '%s'", modname); ++ return -ENOENT; ++ }; ++ ret = ( ret == 0 ? 0 : r ); + } + kmod_module_unref_list(modlist); + modlist = 0; +-#else +- ret += install_module(mod_o); +- kmod_module_unref(mod_o); +-#endif +- + } + if (errno) { + log_error("FTS ERROR: %m"); +@@ -1414,8 +1437,14 @@ static int install_modules(int argc, char **argv) + } + kmod_list_foreach(itr, modlist) { + mod = kmod_module_get_module(itr); +- ret += install_module(mod); ++ r = install_module(mod); + kmod_module_unref(mod); ++ if ((r < 0) && !arg_optional) { ++ if (!arg_silent) ++ log_error("ERROR: installing '%s'", argv[i]); ++ return -ENOENT; ++ }; ++ ret = ( ret == 0 ? 0 : r ); + } + kmod_module_unref_list(modlist); + modlist = 0; +@@ -1427,6 +1456,7 @@ static int install_modules(int argc, char **argv) + return EXIT_FAILURE; + } + } ++ + return EXIT_SUCCESS; + } + diff --git a/0052-dracut-init.sh-beautify-instmods.patch b/0052-dracut-init.sh-beautify-instmods.patch new file mode 100644 index 0000000..29033d8 --- /dev/null +++ b/0052-dracut-init.sh-beautify-instmods.patch @@ -0,0 +1,64 @@ +From 9bb030c5d8189f42eef3a0a881a361ce811414b0 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 13 Apr 2016 13:57:03 +0200 +Subject: [PATCH] dracut-init.sh: beautify instmods() + +--- + dracut-init.sh | 31 ++++++++++++++++++++++++++++--- + 1 file changed, 28 insertions(+), 3 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index e26d97a..8d1d9fa 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -1001,22 +1001,47 @@ instmods() { + local _optional="-o" + local _silent + local _ret ++ + [[ $no_kernel = yes ]] && return ++ + if [[ $1 = '-c' ]]; then +- _optional="" ++ unset _optional + shift + fi + if [[ $1 = '-s' ]]; then + _silent=1 + shift + fi ++ + if (($# == 0)); then + read -r -d '' -a args + set -- "${args[@]}" + fi +- $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" ++ ++ $DRACUT_INSTALL \ ++ ${initdir:+-D "$initdir"} \ ++ ${loginstall:+-L "$loginstall"} \ ++ ${hostonly:+-H} \ ++ ${omit_drivers:+-N "$omit_drivers"} \ ++ ${srcmods:+--kerneldir "$srcmods"} \ ++ ${_optional:+-o} \ ++ ${_silent:+--silent} \ ++ -m "$@" + _ret=$? +- (($_ret != 0)) && [[ -z "$_silent" ]] && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${_optional:+-o} ${_silent:+--silent} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || : ++ ++ if (($_ret != 0)) && [[ -z "$_silent" ]]; then ++ derror "FAILED: " \ ++ $DRACUT_INSTALL \ ++ ${initdir:+-D "$initdir"} \ ++ ${loginstall:+-L "$loginstall"} \ ++ ${hostonly:+-H} \ ++ ${omit_drivers:+-N "$omit_drivers"} \ ++ ${srcmods:+--kerneldir "$srcmods"} \ ++ ${_optional:+-o} \ ++ ${_silent:+--silent} \ ++ -m "$@" ++ fi ++ + [[ "$optional" ]] && return 0 + return $_ret + } diff --git a/0053-plymouth-plymouth-pretrigger.sh-also-trigger-acpi-su.patch b/0053-plymouth-plymouth-pretrigger.sh-also-trigger-acpi-su.patch new file mode 100644 index 0000000..452e082 --- /dev/null +++ b/0053-plymouth-plymouth-pretrigger.sh-also-trigger-acpi-su.patch @@ -0,0 +1,37 @@ +From 7ef36aef28eb8f770f3c104d8e88b3b991170f3a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 6 Apr 2016 10:24:58 +0200 +Subject: [PATCH] plymouth/plymouth-pretrigger.sh: also trigger acpi subsystem + +Trigger the acpi subsystem. This will ensure hv_vmbus gets loaded before +plymouth is started, which will make the graphics device become +available before plymouth is started too (and the keyboard ! which might +also be important for plymouth in some setups). + +https://bugzilla.redhat.com/show_bug.cgi?id=1218130 +(cherry picked from commit d2846fdcce9b8de0edecdf0e06a4b86fc8de542c) +--- + modules.d/50plymouth/plymouth-pretrigger.sh | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/modules.d/50plymouth/plymouth-pretrigger.sh b/modules.d/50plymouth/plymouth-pretrigger.sh +index c3a97f2..6458d78 100755 +--- a/modules.d/50plymouth/plymouth-pretrigger.sh ++++ b/modules.d/50plymouth/plymouth-pretrigger.sh +@@ -5,9 +5,14 @@ if type plymouthd >/dev/null 2>&1 && [ -z "$DRACUT_SYSTEMD" ]; then + # first trigger graphics subsystem + udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1 + # first trigger graphics and tty subsystem +- udevadm trigger --action=add --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1 ++ udevadm trigger --action=add \ ++ --subsystem-match=graphics \ ++ --subsystem-match=drm \ ++ --subsystem-match=tty \ ++ --subsystem-match=acpi \ ++ >/dev/null 2>&1 + +- udevadm settle --timeout=30 2>&1 | vinfo ++ udevadm settle --timeout=180 2>&1 | vinfo + + info "Starting plymouth daemon" + mkdir -m 0755 /run/plymouth diff --git a/0054-dracut-install-add-help-documentation.patch b/0054-dracut-install-add-help-documentation.patch new file mode 100644 index 0000000..f92a934 --- /dev/null +++ b/0054-dracut-install-add-help-documentation.patch @@ -0,0 +1,106 @@ +From b14b039e9066f51c3c4cee2123f23f7822dd8e13 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 14 Apr 2016 11:47:50 +0200 +Subject: [PATCH] dracut-install: add --help documentation + +--- + install/dracut-install.c | 73 +++++++++++++++++++++++------------------------- + 1 file changed, 35 insertions(+), 38 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index f414f30..bef08da 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -17,7 +17,7 @@ + along with this program; If not, see . + */ + +-#define PROGRAM_VERSION_STRING "1" ++#define PROGRAM_VERSION_STRING "2" + + #ifndef _GNU_SOURCE + #define _GNU_SOURCE +@@ -719,49 +719,46 @@ static void item_free(char *i) + + static void usage(int status) + { +- /* */ ++ /* */ + printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n" + "or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n" ++ "or: %s -D DESTROOTDIR [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n" + "\n" + "Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n" + "\n" +- " -D --destrootdir Install all files to DESTROOTDIR as the root\n" +- " -a --all Install all SOURCE arguments to DESTROOTDIR\n" +- " -o --optional If SOURCE does not exist, do not fail\n" +- " -d --dir SOURCE is a directory\n" +- " -l --ldd Also install shebang executables and libraries\n" +- " -L --logdir Log files, which were installed from the host to \n" +- " -R --resolvelazy Only install shebang executables and libraries\n" +- " for all SOURCE files\n" +- " -H --hostonly Mark all SOURCE files as hostonly\n\n" +- " -f --fips Also install all '.SOURCE.hmac' files\n" +- " -v --verbose Show more output\n" +- " --debug Show debug output\n" +- " --version Show package version\n" +- " -h --help Show this help\n" ++ " KERNELMODULE can have the format:\n" ++ " with a leading /\n" ++ " =[/…] like '=drivers/hid'\n" ++ " \n" + "\n" +- "Example:\n" +- "# mkdir -p /var/tmp/test-root\n" +- "# %s -D /var/tmp/test-root --ldd -a sh tr\n" +- "# tree /var/tmp/test-root\n" +- "/var/tmp/test-root\n" +- "|-- lib64 -> usr/lib64\n" +- "`-- usr\n" +- " |-- bin\n" +- " | |-- bash\n" +- " | |-- sh -> bash\n" +- " | `-- tr\n" +- " `-- lib64\n" +- " |-- ld-2.15.90.so\n" +- " |-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n" +- " |-- libc-2.15.90.so\n" +- " |-- libc.so\n" +- " |-- libc.so.6 -> libc-2.15.90.so\n" +- " |-- libdl-2.15.90.so\n" +- " |-- libdl.so -> libdl-2.15.90.so\n" +- " |-- libdl.so.2 -> libdl-2.15.90.so\n" +- " |-- libtinfo.so.5 -> libtinfo.so.5.9\n" +- " `-- libtinfo.so.5.9\n", program_invocation_short_name, program_invocation_short_name, ++ " -D --destrootdir Install all files to DESTROOTDIR as the root\n" ++ " -a --all Install all SOURCE arguments to DESTROOTDIR\n" ++ " -o --optional If SOURCE does not exist, do not fail\n" ++ " -d --dir SOURCE is a directory\n" ++ " -l --ldd Also install shebang executables and libraries\n" ++ " -L --logdir Log files, which were installed from the host to \n" ++ " -R --resolvelazy Only install shebang executables and libraries\n" ++ " for all SOURCE files\n" ++ " -H --hostonly Mark all SOURCE files as hostonly\n\n" ++ " -f --fips Also install all '.SOURCE.hmac' files\n" ++ "\n" ++ " --module,-m Install kernel modules, instead of files\n" ++ " --kerneldir Specify the kernel module directory\n" ++ " --firmwaredirs Specify the firmware directory search path with : separation\n" ++ " --silent Don't display error messages for kernel module install\n" ++ " -o --optional If kernel module does not exist, do not fail\n" ++ " -p --mod-filter-path Filter kernel modules by path regexp\n" ++ " -P --mod-filter-nopath Exclude kernel modules by path regexp\n" ++ " -s --mod-filter-symbol Filter kernel modules by symbol regexp\n" ++ " -S --mod-filter-nosymbol Exclude kernel modules by symbol regexp\n" ++ " -N --mod-filter-noname Exclude kernel modules by name regexp\n" ++ "\n" ++ " -v --verbose Show more output\n" ++ " --debug Show debug output\n" ++ " --version Show package version\n" ++ " -h --help Show this help\n" ++ "\n", ++ program_invocation_short_name, program_invocation_short_name, + program_invocation_short_name); + exit(status); + } diff --git a/0055-NEWS-update-for-045.patch b/0055-NEWS-update-for-045.patch new file mode 100644 index 0000000..e8eac61 --- /dev/null +++ b/0055-NEWS-update-for-045.patch @@ -0,0 +1,101 @@ +From 6fcd5c8e3b539de4eeccddab2e5da6ee260fbf0b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 14 Apr 2016 11:53:14 +0200 +Subject: [PATCH] NEWS: update for 045 + +--- + NEWS | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 84 insertions(+) + +diff --git a/NEWS b/NEWS +index ca68302..6d1cd0a 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,87 @@ ++dracut-045 ++========== ++ ++dracut now requires libkmod for the dracut-install binary helper. ++ ++dracut.sh: ++- restorecon final image file ++- fail hard, if we find modules and modules.dep is missing ++ ++dracut-functions.sh: ++- fix check_vol_slaves() volume group name stripping ++ ++dracut-install: ++- catch ldd message "cannot execute binary file" ++- added kernel module handling with libkmod ++ Added parameters: ++ --module,-m ++ --mod-filter-path, -p ++ --mod-filter-nopath, -P ++ --mod-filter-symbol, -s ++ --mod-filter-nosymbol, -S ++ --mod-filter-noname, -N ++ --silent ++ --kerneldir ++ --firmwaredirs ++ ++lsinitrd: ++- new option "--unpack" ++- new option "--unpackearly" ++- and "--verbose" ++ ++general initramfs fixes: ++- don't remove 99-cmdline-ask on 'hostonly' cleanup ++- call dracut-cmdline-ask.service, if /etc/cmdline.d/*.conf exists ++- break at switch_root only for bare rd.break ++ ++dmsquash-live: ++- fixed livenet-generator execution flag ++ and include only, if systemd is used ++- fixed dmsquash-live-root.sh for cases where the fstype of the liveimage is squashfs ++- fixed typo for rootfs.img ++ ++dmraid: ++- added "nowatch" option in udev rule, otherwise udev would reread partitions for raid members ++ ++shutdown: ++- handle readonly /run on shutdown ++ ++kernel-modules: ++- add all HID drivers, regardless of hostonly mode ++ people swap keyboards sometimes and should be able to enter their disk password ++- add usb-storage ++ To save the rdsosreport.txt to a USB stick, the usb-storage module is needed. ++ ++systemd: ++- add /etc/machine-info ++- fixed systemd-escape call for names beginning with "-" ++ ++network: ++- fix carrier detection ++- correctly set mac address for ip=...:: ++- fixed vlan, bonding, bridging, team logic ++ call ifup for the slaves and assemble afterwards ++- add mtu to list of variables to store in override ++- for rd.neednet=0 a bootdev is not needed anymore ++- dhclient-script.sh: add classless-static-routes support ++ ++nbd: ++- add systemd generator ++- use export names instead of port numbers, because port number based ++ exports are deprecated and were removed. ++ ++fcoe: ++- no more /dev/shm state copying ++ ++multipath: ++- check all /dev/mapper devices if they are multipath devices, not only mpath* ++ ++fips: ++- fixed .hmac installation in FIPS mode ++ ++plymouth: ++- also trigger the acpi subsystem ++ + dracut-044 + ========== + creation: diff --git a/0056-Revert-fcoe-no-need-to-copy-lldpad-state.patch b/0056-Revert-fcoe-no-need-to-copy-lldpad-state.patch new file mode 100644 index 0000000..9620eae --- /dev/null +++ b/0056-Revert-fcoe-no-need-to-copy-lldpad-state.patch @@ -0,0 +1,32 @@ +From b99e72427b517dea0d91d15fe43cf0a37420af36 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 14 Apr 2016 13:38:24 +0200 +Subject: [PATCH] Revert "fcoe: no need to copy lldpad state" + +This reverts commit e93ff1cf9aac8f97131b3101a5da240ce5f45239. + +seems like the file has to be copied back in the real root. + +https://bugzilla.redhat.com/show_bug.cgi?id=1246217 +--- + modules.d/95fcoe/cleanup-fcoe.sh | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/modules.d/95fcoe/cleanup-fcoe.sh b/modules.d/95fcoe/cleanup-fcoe.sh +index 856e2d9..5ff4d05 100644 +--- a/modules.d/95fcoe/cleanup-fcoe.sh ++++ b/modules.d/95fcoe/cleanup-fcoe.sh +@@ -2,8 +2,9 @@ + # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- + # ex: ts=8 sw=4 sts=4 et filetype=sh + +-if [ -z "$DRACUT_SYSTEMD" ]; then +- if [ -e /var/run/lldpad.pid ]; then +- lldpad -k +- fi ++if [ -e /var/run/lldpad.pid ]; then ++ lldpad -k ++ mkdir -m 0755 -p /run/initramfs/state/dev/shm ++ cp /dev/shm/lldpad.state /run/initramfs/state/dev/shm/ > /dev/null 2>&1 ++ echo "files /dev/shm/lldpad.state" >> /run/initramfs/rwtab + fi diff --git a/0057-base-init.sh-don-t-mount-run-with-noexec-if-the-init.patch b/0057-base-init.sh-don-t-mount-run-with-noexec-if-the-init.patch new file mode 100644 index 0000000..03171f2 --- /dev/null +++ b/0057-base-init.sh-don-t-mount-run-with-noexec-if-the-init.patch @@ -0,0 +1,32 @@ +From db7d61cff7f5a5be3a56cff39dc278f004b9c461 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Thu, 14 Apr 2016 14:56:37 +0200 +Subject: [PATCH] base/init.sh: don't mount /run with noexec, if the initramfs + lives there + +If the initramfs was built with prefix=/run/... /run can't be mounted +with noexec, otherwise no binary can be run. + +Guard against it by looking where /bin/sh is really located. +--- + modules.d/99base/init.sh | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh +index bd7ef70..a563393 100755 +--- a/modules.d/99base/init.sh ++++ b/modules.d/99base/init.sh +@@ -64,7 +64,12 @@ fi + + if ! ismounted /run; then + mkdir -m 0755 /newrun +- mount -t tmpfs -o mode=0755,noexec,nosuid,nodev,strictatime tmpfs /newrun >/dev/null ++ if ! str_starts "$(readlink -f /bin/sh)" "/run/"; then ++ mount -t tmpfs -o mode=0755,noexec,nosuid,nodev,strictatime tmpfs /newrun >/dev/null ++ else ++ # the initramfs binaries are located in /run, so don't mount it with noexec ++ mount -t tmpfs -o mode=0755,nosuid,nodev,strictatime tmpfs /newrun >/dev/null ++ fi + cp -a /run/* /newrun >/dev/null 2>&1 + mount --move /newrun /run + rm -fr -- /newrun diff --git a/0058-kate-config.patch b/0058-kate-config.patch new file mode 100644 index 0000000..b0cdc70 --- /dev/null +++ b/0058-kate-config.patch @@ -0,0 +1,24 @@ +From 2db14045c143e7b0709bed78483a208d2df69ab3 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 10:27:48 +0200 +Subject: [PATCH] kate config + +--- + .kateproject | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/.kateproject b/.kateproject +index 7a84755..0a0d5da 100644 +--- a/.kateproject ++++ b/.kateproject +@@ -1,8 +1,8 @@ + { +- "name": "Kate" ++ "name": "Dracut" + , "files": [ { "git": 1 } ] + , "build": { +- "directory": "build" ++ "directory": "./" + , "build": "make -j $(getconf _NPROCESSORS_ONLN) all" + , "clean": "make clean" + } diff --git a/0059-95resume-avoid-possible-symbolic-link-creation-error.patch b/0059-95resume-avoid-possible-symbolic-link-creation-error.patch new file mode 100644 index 0000000..738d655 --- /dev/null +++ b/0059-95resume-avoid-possible-symbolic-link-creation-error.patch @@ -0,0 +1,24 @@ +From f3f019d9471bfc93ce8979c6cdcc0de81d0941e2 Mon Sep 17 00:00:00 2001 +From: Guido Trentalancia +Date: Fri, 15 Apr 2016 10:38:04 +0200 +Subject: [PATCH] 95resume: avoid possible symbolic link creation error on + bootup + +Avoid symbolic link creation error. +--- + modules.d/95resume/parse-resume.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/95resume/parse-resume.sh b/modules.d/95resume/parse-resume.sh +index 3b97e51..a3beb95 100755 +--- a/modules.d/95resume/parse-resume.sh ++++ b/modules.d/95resume/parse-resume.sh +@@ -67,7 +67,7 @@ if ! getarg noresume; then + printf -- '%s\n' ' RUN+="/sbin/initqueue --finished --unique --name 00resume echo %M:%m > /sys/power/resume"' + } >> /etc/udev/rules.d/99-resume.rules + +- printf '[ -e "%s" ] && { ln -s "%s" /dev/resume 2> /dev/null; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \ ++ printf '[ -e "%s" ] && { ln -fs "%s" /dev/resume 2> /dev/null; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \ + "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh + + { diff --git a/0060-watchdog-module-setup.sh-rewrite.patch b/0060-watchdog-module-setup.sh-rewrite.patch new file mode 100644 index 0000000..57e3b9b --- /dev/null +++ b/0060-watchdog-module-setup.sh-rewrite.patch @@ -0,0 +1,124 @@ +From 74e2d1e69f5527ab31b01fc19f67143d1f091980 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 11:27:20 +0200 +Subject: [PATCH] watchdog/module-setup.sh: rewrite + +- use local variables with _ +- use associative array for the kernel modules +- install emergency hook even in the systemd case +- follow device path until /sys is reached +- set kernel version for modprobe checking +--- + modules.d/04watchdog/module-setup.sh | 92 ++++++++++++++++++++---------------- + 1 file changed, 51 insertions(+), 41 deletions(-) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index c9da148..04686f6 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -14,54 +14,64 @@ depends() { + install() { + # Do not add watchdog hooks if systemd module is included + # In that case, systemd will manage watchdog kick +- if dracut_module_included "systemd"; then +- return ++ if ! dracut_module_included "systemd"; then ++ inst_hook cmdline 00 "$moddir/watchdog.sh" ++ inst_hook cmdline 50 "$moddir/watchdog.sh" ++ inst_hook pre-trigger 00 "$moddir/watchdog.sh" ++ inst_hook initqueue 00 "$moddir/watchdog.sh" ++ inst_hook mount 00 "$moddir/watchdog.sh" ++ inst_hook mount 50 "$moddir/watchdog.sh" ++ inst_hook mount 99 "$moddir/watchdog.sh" ++ inst_hook pre-pivot 00 "$moddir/watchdog.sh" ++ inst_hook pre-pivot 99 "$moddir/watchdog.sh" ++ inst_hook cleanup 00 "$moddir/watchdog.sh" ++ inst_hook cleanup 99 "$moddir/watchdog.sh" + fi +- inst_hook cmdline 00 "$moddir/watchdog.sh" +- inst_hook cmdline 50 "$moddir/watchdog.sh" +- inst_hook pre-trigger 00 "$moddir/watchdog.sh" +- inst_hook initqueue 00 "$moddir/watchdog.sh" +- inst_hook mount 00 "$moddir/watchdog.sh" +- inst_hook mount 50 "$moddir/watchdog.sh" +- inst_hook mount 99 "$moddir/watchdog.sh" +- inst_hook pre-pivot 00 "$moddir/watchdog.sh" +- inst_hook pre-pivot 99 "$moddir/watchdog.sh" +- inst_hook cleanup 00 "$moddir/watchdog.sh" +- inst_hook cleanup 99 "$moddir/watchdog.sh" + inst_hook emergency 02 "$moddir/watchdog-stop.sh" + inst_multiple -o wdctl + } + + installkernel() { ++ local -A _drivers ++ local _alldrivers _active _wdtdrv _wdtppath _dir + [[ -d /sys/class/watchdog/ ]] || return +- wdtcmdline="" +- for dir in /sys/class/watchdog/*; do +- [[ -d "$dir" ]] || continue +- [[ -f "$dir/state" ]] || continue +- active=$(< "$dir/state") +- ! [[ $hostonly ]] || [[ "$active" = "active" ]] || continue +- # device/modalias will return driver of this device +- wdtdrv=$(< "$dir/device/modalias") +- # There can be more than one module represented by same +- # modalias. Currently load all of them. +- # TODO: Need to find a way to avoid any unwanted module +- # represented by modalias +- wdtdrv=$(modprobe -R $wdtdrv) +- instmods $wdtdrv +- wdtcmdline="$wdtcmdline$(echo $wdtdrv | tr " " ",")," +- # however in some cases, we also need to check that if there is +- # a specific driver for the parent bus/device. In such cases +- # we also need to enable driver for parent bus/device. +- wdtppath=$(readlink -f "$dir/device/..") +- while [ -f "$wdtppath/modalias" ] +- do +- wdtpdrv=$(< "$wdtppath/modalias") +- wdtpdrv=$(modprobe -R $wdtpdrv) +- instmods $wdtpdrv +- wdtcmdline="$wdtcmdline$(echo $wdtpdrv | tr " " ",")," +- wdtppath=$(readlink -f "$wdtppath/..") +- done ++ for _dir in /sys/class/watchdog/*; do ++ [[ -d "$_dir" ]] || continue ++ [[ -f "$_dir/state" ]] || continue ++ _active=$(< "$_dir/state") ++ ! [[ $hostonly ]] || [[ "$_active" = "active" ]] || continue ++ # device/modalias will return driver of this device ++ _wdtdrv=$(< "$_dir/device/modalias") ++ # There can be more than one module represented by same ++ # modalias. Currently load all of them. ++ # TODO: Need to find a way to avoid any unwanted module ++ # represented by modalias ++ _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null) ++ if [[ $_wdtdrv ]]; then ++ instmods $_wdtdrv ++ for i in $_wdtdrv; do ++ _drivers[$i]=1 ++ done ++ fi ++ # however in some cases, we also need to check that if there is ++ # a specific driver for the parent bus/device. In such cases ++ # we also need to enable driver for parent bus/device. ++ _wdtppath=$(readlink -f "$_dir/device/..") ++ while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do ++ _wdtppath=$(readlink -f "$_wdtppath/..") ++ [[ -f "$_wdtppath/modalias" ]] || continue ++ ++ _wdtdrv=$(< "$_wdtppath/modalias") ++ _wdtdrv=$(modprobe --set-version "$kernel" -R $_wdtdrv 2>/dev/null) ++ if [[ $_wdtdrv ]]; then ++ instmods $_wdtdrv ++ for i in $_wdtdrv; do ++ _drivers[$i]=1 ++ done ++ fi ++ done + done + # ensure that watchdog module is loaded as early as possible +- [[ $wdtcmdline = "" ]] || echo "rd.driver.pre=$wdtcmdline" > ${initdir}/etc/cmdline.d/00-watchdog.conf ++ _alldrivers="${!_drivers[*]}" ++ [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf + } diff --git a/0061-drop-to-shell-on-die-if-rd.shell-1-is-set-explicitly.patch b/0061-drop-to-shell-on-die-if-rd.shell-1-is-set-explicitly.patch new file mode 100644 index 0000000..a5931fc --- /dev/null +++ b/0061-drop-to-shell-on-die-if-rd.shell-1-is-set-explicitly.patch @@ -0,0 +1,22 @@ +From 9d74747f926d038f2e149d70a9c8f955861ab354 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 12:03:03 +0200 +Subject: [PATCH] drop to shell on die() if rd.shell=1 is set explicitly + +--- + modules.d/99base/dracut-lib.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh +index 0a0b1b9..48fc83d 100755 +--- a/modules.d/99base/dracut-lib.sh ++++ b/modules.d/99base/dracut-lib.sh +@@ -457,7 +457,7 @@ die() { + + > /run/initramfs/.die + +- getargbool 0 "rd.debug=" && emergency_shell ++ getargbool 0 "rd.shell=" && emergency_shell + + if [ -n "$DRACUT_SYSTEMD" ]; then + systemctl --no-block --force halt diff --git a/0062-dracut_install-honor-silent-flag.patch b/0062-dracut_install-honor-silent-flag.patch new file mode 100644 index 0000000..b7f356b --- /dev/null +++ b/0062-dracut_install-honor-silent-flag.patch @@ -0,0 +1,45 @@ +From fa295f0bcde8c8d1205cf53ebe6e5dc46629200a Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 15:25:27 +0200 +Subject: [PATCH] dracut_install: honor --silent flag + +--- + dracut-init.sh | 8 +++++++- + modules.d/50drm/module-setup.sh | 2 +- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index 8d1d9fa..1056a31 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -219,10 +219,16 @@ dracut_install() { + } + + dracut_instmods() { ++ local _silent=0; ++ local i; + [[ $no_kernel = yes ]] && return ++ for i in "$@"; do ++ [[ $i == "--silent" ]] && silent=1 ++ done ++ + $DRACUT_INSTALL \ + ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" +- (($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || : ++ (($? != 0)) && (($silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || : + } + + inst_library() { +diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh +index 661dde9..6106d8c 100755 +--- a/modules.d/50drm/module-setup.sh ++++ b/modules.d/50drm/module-setup.sh +@@ -34,7 +34,7 @@ installkernel() { + if [[ $hostonly ]]; then + for i in /sys/bus/{pci/devices,soc/devices/soc?}/*/modalias; do + [[ -e $i ]] || continue +- if hostonly="" dracut_instmods -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i) 2>/dev/null; then ++ if hostonly="" dracut_instmods --silent -s "drm_crtc_init" -S "iw_handler_get_spy" $(<$i); then + if strstr "$(modinfo -F filename $(<$i) 2>/dev/null)" radeon.ko; then + hostonly='' instmods amdkfd + fi diff --git a/0063-dracut-install-make-use-of-_cleanup_-macros-and-impr.patch b/0063-dracut-install-make-use-of-_cleanup_-macros-and-impr.patch new file mode 100644 index 0000000..f8019c2 --- /dev/null +++ b/0063-dracut-install-make-use-of-_cleanup_-macros-and-impr.patch @@ -0,0 +1,418 @@ +From eab32bda801e539c276f1b18e7c2b691eeab3d14 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 15:29:52 +0200 +Subject: [PATCH] dracut-install: make use of _cleanup_ macros and improve + hostonly check + +If a module is renamed or another module takes care of the old one, +all of the alias strings have to be checked against the current set of +loaded modules. + +This is still incomplete, because to be absolutely correct, all the +/sys/*...*/modalias files would have to be checked, if they match the +modules alias strings. +--- + install/dracut-install.c | 180 ++++++++++++++++++++++++++++++++++------------- + 1 file changed, 131 insertions(+), 49 deletions(-) + +diff --git a/install/dracut-install.c b/install/dracut-install.c +index bef08da..9a0d53f 100644 +--- a/install/dracut-install.c ++++ b/install/dracut-install.c +@@ -66,6 +66,7 @@ static char *logfile = NULL; + FILE *logfile_f = NULL; + static Hashmap *items = NULL; + static Hashmap *items_failed = NULL; ++static Hashmap *modules_loaded = NULL; + static regex_t mod_filter_path; + static regex_t mod_filter_nopath; + static regex_t mod_filter_symbol; +@@ -79,6 +80,39 @@ static bool arg_mod_filter_noname = false; + + static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst); + ++ ++ ++static inline void kmod_module_unref_listp(struct kmod_list **p) { ++ if (*p) ++ kmod_module_unref_list(*p); ++} ++#define _cleanup_kmod_module_unref_list_ _cleanup_(kmod_module_unref_listp) ++ ++static inline void kmod_module_info_free_listp(struct kmod_list **p) { ++ if (*p) ++ kmod_module_info_free_list(*p); ++} ++#define _cleanup_kmod_module_info_free_list_ _cleanup_(kmod_module_info_free_listp) ++ ++static inline void kmod_unrefp(struct kmod_ctx **p) { ++ kmod_unref(*p); ++} ++#define _cleanup_kmod_unref_ _cleanup_(kmod_unrefp) ++ ++static inline void kmod_module_dependency_symbols_free_listp(struct kmod_list **p) { ++ if (*p) ++ kmod_module_dependency_symbols_free_list(*p); ++} ++#define _cleanup_kmod_module_dependency_symbols_free_list_ _cleanup_(kmod_module_dependency_symbols_free_listp) ++ ++static inline void fts_closep(FTS **p) { ++ if (*p) ++ fts_close(*p); ++} ++#define _cleanup_fts_close_ _cleanup_(fts_closep) ++ ++ ++ + static size_t dir_len(char const *file) + { + size_t length; +@@ -1058,7 +1092,8 @@ static int install_all(int argc, char **argv) + + static int install_firmware(struct kmod_module *mod) + { +- struct kmod_list *l, *list = NULL; ++ struct kmod_list *l; ++ _cleanup_kmod_module_info_free_list_ struct kmod_list *list = NULL; + int ret; + + char **q; +@@ -1072,7 +1107,6 @@ static int install_firmware(struct kmod_module *mod) + kmod_list_foreach(l, list) { + const char *key = kmod_module_info_get_key(l); + const char *value = NULL; +- char *fwpath = NULL; + + if (!streq("firmware", key)) + continue; +@@ -1081,6 +1115,7 @@ static int install_firmware(struct kmod_module *mod) + log_debug("Firmware %s", value); + ret = -1; + STRV_FOREACH(q, firmwaredirs) { ++ _cleanup_free_ char *fwpath = NULL; + struct stat sb; + int r; + +@@ -1092,8 +1127,6 @@ static int install_firmware(struct kmod_module *mod) + + if (stat(fwpath, &sb) != 0) { + log_debug("stat(%s) != 0", fwpath); +- free(fwpath); +- fwpath = NULL; + continue; + } + +@@ -1111,7 +1144,8 @@ static int install_firmware(struct kmod_module *mod) + + static bool check_module_symbols(struct kmod_module *mod) + { +- struct kmod_list *itr, *deplist = NULL; ++ struct kmod_list *itr; ++ _cleanup_kmod_module_dependency_symbols_free_list_ struct kmod_list *deplist = NULL; + + if (!arg_mod_filter_symbol && !arg_mod_filter_nosymbol) + return true; +@@ -1128,7 +1162,6 @@ static bool check_module_symbols(struct kmod_module *mod) + const char *symbol = kmod_module_symbol_get_symbol(itr); + // log_debug("Checking symbol %s", symbol); + if (regexec(&mod_filter_nosymbol, symbol, 0, NULL, 0) == 0) { +- kmod_module_dependency_symbols_free_list(deplist); + log_debug("Module %s: symbol %s matched exclusion filter", kmod_module_get_name(mod), symbol); + return false; + } +@@ -1140,20 +1173,16 @@ static bool check_module_symbols(struct kmod_module *mod) + const char *symbol = kmod_module_dependency_symbol_get_symbol(itr); + // log_debug("Checking symbol %s", symbol); + if (regexec(&mod_filter_symbol, symbol, 0, NULL, 0) == 0) { +- kmod_module_dependency_symbols_free_list(deplist); + log_debug("Module %s: symbol %s matched inclusion filter", kmod_module_get_name(mod), symbol); + return true; + } + } +- kmod_module_dependency_symbols_free_list(deplist); + return false; + } + +- kmod_module_dependency_symbols_free_list(deplist); + return true; + } + +- + static bool check_module_path(const char *path) + { + if (arg_mod_filter_nopath && (regexec(&mod_filter_nopath, path, 0, NULL, 0) == 0)) { +@@ -1168,14 +1197,23 @@ static bool check_module_path(const char *path) + return true; + } + ++static bool check_module_hostonly(struct kmod_module *mod) ++{ ++ const char *name = kmod_module_get_name(mod); ++ ++ if (check_hashmap(modules_loaded, name)) ++ return true; ++ ++ return false; ++} ++ + static int install_module(struct kmod_module *mod) + { + int ret = 0; +- int state; +- struct kmod_list *itr, *modlist = NULL; ++ struct kmod_list *itr; ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; + const char *path = NULL; + const char *name = NULL; +- state = kmod_module_get_initstate(mod); + + name = kmod_module_get_name(mod); + if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) { +@@ -1183,7 +1221,7 @@ static int install_module(struct kmod_module *mod) + return 0; + } + +- if (arg_hostonly && (state != KMOD_MODULE_BUILTIN) && (state != KMOD_MODULE_LIVE)) { ++ if (arg_hostonly && ! check_module_hostonly(mod)) { + log_debug("dracut_install '%s' not hostonly", name); + return 0; + } +@@ -1232,15 +1270,17 @@ static int install_module(struct kmod_module *mod) + } + kmod_module_unref(mod); + } +- kmod_module_unref_list(modlist); + + return ret; + } + + static int install_modules(int argc, char **argv) + { +- struct kmod_ctx *ctx = NULL; +- struct kmod_list *itr, *modlist = NULL; ++ _cleanup_kmod_unref_ struct kmod_ctx *ctx = NULL; ++ struct kmod_list *loaded_list = NULL; ++ struct kmod_list *itr, *l; ++ int err; ++ + struct kmod_module *mod = NULL, *mod_o = NULL; + + const char *modname = NULL; +@@ -1248,12 +1288,48 @@ static int install_modules(int argc, char **argv) + + ctx = kmod_new(kerneldir, NULL); + ++ err = kmod_module_new_from_loaded(ctx, &loaded_list); ++ if (err < 0) { ++ errno = err; ++ log_error("Could not get list of loaded modules: %m"); ++ return err; ++ } ++ ++ kmod_list_foreach(itr, loaded_list) { ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; ++ ++ struct kmod_module *mod = kmod_module_get_module(itr); ++ char *name = strdup(kmod_module_get_name(mod)); ++ hashmap_put(modules_loaded, name, name); ++ kmod_module_unref(mod); ++ ++ /* also put the modules from the new kernel in the hashmap, ++ * which resolve the name as an alias, in case a kernel module is ++ * renamed. ++ */ ++ err = kmod_module_new_from_lookup(ctx, name, &modlist); ++ if (err < 0) ++ continue; ++ if (!modlist) ++ continue; ++ kmod_list_foreach(l, modlist) { ++ mod = kmod_module_get_module(l); ++ char *name = strdup(kmod_module_get_name(mod)); ++ hashmap_put(modules_loaded, name, name); ++ kmod_module_unref(mod); ++ } ++ } ++ kmod_module_unref_list(loaded_list); ++ + for (i = 0; i < argc; i++) { + int r = 0; + int ret = -1; ++ + log_debug("Handle module '%s'", argv[i]); + + if (argv[i][0] == '/') { ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; ++ + r = kmod_module_new_from_path(ctx, argv[i], &mod_o); + if (r < 0) { + log_debug("Failed to lookup modules path '%s': %m", argv[i]); +@@ -1263,6 +1339,7 @@ static int install_modules(int argc, char **argv) + } + /* Check, if we have to load another module with that name instead */ + modname = kmod_module_get_name(mod_o); ++ + if (!modname) { + if (!arg_optional) { + if (!arg_silent) +@@ -1272,8 +1349,11 @@ static int install_modules(int argc, char **argv) + log_info("Failed to get name for module '%s'", argv[i]); + continue; + } ++ + r = kmod_module_new_from_lookup(ctx, modname, &modlist); + kmod_module_unref(mod_o); ++ mod_o = NULL; ++ + if (r < 0) { + if (!arg_optional) { + if (!arg_silent) +@@ -1303,37 +1383,38 @@ static int install_modules(int argc, char **argv) + }; + ret = ( ret == 0 ? 0 : r ); + } +- kmod_module_unref_list(modlist); +- modlist = 0; + } else if (argv[i][0] == '=') { +- char *path1, *path2, *path3; +- FTS *fts; ++ _cleanup_free_ char *path1 = NULL, *path2 = NULL, *path3 = NULL; ++ _cleanup_fts_close_ FTS *fts = NULL; ++ + log_debug("Handling =%s", &argv[i][1]); + /* FIXME and add more paths*/ +- { +- int r; +- r = asprintf(&path2, "%s/kernel/%s", kerneldir, &argv[i][1]); +- if (r < 0) { +- log_error("Out of memory!"); +- exit(EXIT_FAILURE); +- } ++ r = asprintf(&path2, "%s/kernel/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } + +- r = asprintf(&path1, "%s/extra/%s", kerneldir, &argv[i][1]); +- if (r < 0) { +- log_error("Out of memory!"); +- exit(EXIT_FAILURE); +- } ++ r = asprintf(&path1, "%s/extra/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } + +- r = asprintf(&path3, "%s/updates/%s", kerneldir, &argv[i][1]); +- if (r < 0) { +- log_error("Out of memory!"); +- exit(EXIT_FAILURE); +- } ++ r = asprintf(&path3, "%s/updates/%s", kerneldir, &argv[i][1]); ++ if (r < 0) { ++ log_error("Out of memory!"); ++ exit(EXIT_FAILURE); ++ } + ++ { + char *paths[] = { path1, path2, path3, NULL }; + fts = fts_open(paths, FTS_COMFOLLOW|FTS_NOCHDIR|FTS_NOSTAT|FTS_LOGICAL, NULL); + } ++ + for (FTSENT *ftsent = fts_read(fts); ftsent != NULL; ftsent = fts_read(fts)) { ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; ++ + if((ftsent->fts_info == FTS_D) && !check_module_path(ftsent->fts_accpath)) { + fts_set(fts, ftsent, FTS_SKIP); + log_debug("Skipping %s", ftsent->fts_accpath); +@@ -1356,6 +1437,7 @@ static int install_modules(int argc, char **argv) + + /* Check, if we have to load another module with that name instead */ + modname = kmod_module_get_name(mod_o); ++ + if (!modname) { + log_error("Failed to get name for module '%s'", ftsent->fts_accpath); + if (!arg_optional) { +@@ -1365,18 +1447,19 @@ static int install_modules(int argc, char **argv) + } + r = kmod_module_new_from_lookup(ctx, modname, &modlist); + kmod_module_unref(mod_o); ++ mod_o = NULL; ++ + if (r < 0) { + log_error("Failed to lookup alias '%s': %m", modname); +- kmod_module_unref_list(modlist); + if (!arg_optional) { + return -ENOENT; + } + continue; + } ++ + if (!modlist) { + log_error("Failed to find module '%s' %s", modname, + ftsent->fts_accpath); +- kmod_module_unref_list(modlist); + if (!arg_optional) { + return -ENOENT; + } +@@ -1393,18 +1476,14 @@ static int install_modules(int argc, char **argv) + }; + ret = ( ret == 0 ? 0 : r ); + } +- kmod_module_unref_list(modlist); +- modlist = 0; + } + if (errno) { + log_error("FTS ERROR: %m"); + } +- fts_close(fts); +- free(path1); path1 = NULL; +- free(path2); path2 = NULL; +- free(path3); path3 = NULL; + } else { ++ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL; + char *modname = argv[i]; ++ + if (endswith(modname, ".ko")) { + int len = strlen(modname); + modname[len-3]=0; +@@ -1443,8 +1522,6 @@ static int install_modules(int argc, char **argv) + }; + ret = ( ret == 0 ? 0 : r ); + } +- kmod_module_unref_list(modlist); +- modlist = 0; + } + + if ((ret != 0) && (!arg_optional)) { +@@ -1513,8 +1590,9 @@ int main(int argc, char **argv) + + items = hashmap_new(string_hash_func, string_compare_func); + items_failed = hashmap_new(string_hash_func, string_compare_func); ++ modules_loaded = hashmap_new(string_hash_func, string_compare_func); + +- if (!items || !items_failed) { ++ if (!items || !items_failed || !modules_loaded) { + log_error("Out of memory"); + r = EXIT_FAILURE; + goto finish; +@@ -1570,6 +1648,9 @@ int main(int argc, char **argv) + if (logfile_f) + fclose(logfile_f); + ++ while ((i = hashmap_steal_first(modules_loaded))) ++ item_free(i); ++ + while ((i = hashmap_steal_first(items))) + item_free(i); + +@@ -1578,6 +1659,7 @@ int main(int argc, char **argv) + + hashmap_free(items); + hashmap_free(items_failed); ++ hashmap_free(modules_loaded); + + free(destrootdir); + strv_free(firmwaredirs); diff --git a/0064-removed-obsolete-kernel-module-functions-and-host_mo.patch b/0064-removed-obsolete-kernel-module-functions-and-host_mo.patch new file mode 100644 index 0000000..990a1a2 --- /dev/null +++ b/0064-removed-obsolete-kernel-module-functions-and-host_mo.patch @@ -0,0 +1,148 @@ +From 3f60444ec1bff8a57a2cf4ada238e782928890eb Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Fri, 15 Apr 2016 16:25:59 +0200 +Subject: [PATCH] removed obsolete kernel module functions and host_modules + variable + +module_is_host_only() +find_kernel_modules_by_path() +find_kernel_modules() +--- + dracut-init.sh | 54 ----------------------------------- + dracut.sh | 30 +------------------ + modules.d/90multipath/module-setup.sh | 2 +- + 3 files changed, 2 insertions(+), 84 deletions(-) + +diff --git a/dracut-init.sh b/dracut-init.sh +index 1056a31..a195c32 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -943,60 +943,6 @@ dracut_kernel_post() { + + } + +-[[ "$kernel_current" ]] || export kernel_current=$(uname -r) +- +-module_is_host_only() { +- local _mod=$1 +- local _modenc a i _k _s _v _aliases +- _mod=${_mod##*/} +- _mod=${_mod%.ko*} +- _modenc=${_mod//-/_} +- +- [[ " $add_drivers " == *\ ${_mod}\ * ]] && return 0 +- +- # check if module is loaded +- [[ ${host_modules["$_modenc"]} ]] && return 0 +- +- [[ "$kernel_current" ]] || export kernel_current=$(uname -r) +- +- if [[ "$kernel_current" != "$kernel" ]]; then +- # check if module is loadable on the current kernel +- # this covers the case, where a new module is introduced +- # or a module was renamed +- # or a module changed from builtin to a module +- +- if [[ -d /lib/modules/$kernel_current ]]; then +- # if the modinfo can be parsed, but the module +- # is not loaded, then we can safely return 1 +- modinfo -F filename "$_mod" &>/dev/null && return 1 +- fi +- +- # just install the module, better safe than sorry +- return 0 +- fi +- +- return 1 +-} +- +-find_kernel_modules_by_path () { +- local _OLDIFS +- +- [[ -f "$srcmods/modules.dep" ]] || return 0 +- +- _OLDIFS=$IFS +- IFS=: +- while read a rest || [ -n "$a" ]; do +- [[ $a = */$1/* ]] || [[ $a = updates/* ]] || continue +- printf "%s\n" "$srcmods/$a" +- done < "$srcmods/modules.dep" +- IFS=$_OLDIFS +- return 0 +-} +- +-find_kernel_modules () { +- find_kernel_modules_by_path drivers +-} +- + instmods() { + # instmods [-c [-s]] [ ... ] + # instmods [-c [-s]] +diff --git a/dracut.sh b/dracut.sh +index aaeb0dc..8232fa4 100755 +--- a/dracut.sh ++++ b/dracut.sh +@@ -1101,8 +1101,6 @@ if (( ${#add_device_l[@]} )); then + push_host_devs "${add_device_l[@]}" + fi + +-declare -A host_modules +- + if [[ $hostonly ]]; then + # in hostonly mode, determine all devices, which have to be accessed + # and examine them for filesystem types +@@ -1190,32 +1188,6 @@ if [[ $hostonly ]]; then + fi + done < /etc/fstab + fi +- +- # check /proc/modules +- while read m rest || [ -n "$m" ]; do +- host_modules["$m"]=1 +- done = 4.4, mpt2sas isn't loaded, +- # so it's not included. +- # Both ways result in an unbootable initrd. +- +- # also add aliases of loaded modules +- for mod in "${!host_modules[@]}"; do +- aliases=$(modinfo -F alias "$mod" 2>&1) +- for alias in $aliases; do +- host_modules["$alias"]=1 +- done +- # mod might be an alias in the target kernel, find the real module +- mod_filename=$(modinfo -k "$kernel" "$mod" -F filename) +- [ $? -ne 0 ] && continue +- host_modules["$(basename -s .ko "$mod_filename")"]=1 +- done + fi + + unset m +@@ -1302,7 +1274,7 @@ export initdir dracutbasedir \ + debug host_fs_types host_devs swap_devs sshkey add_fstab \ + DRACUT_VERSION udevdir prefix filesystems drivers \ + systemdutildir systemdsystemunitdir systemdsystemconfdir \ +- host_modules hostonly_cmdline loginstall \ ++ hostonly_cmdline loginstall \ + tmpfilesdir + + mods_to_load="" +diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh +index 0af777d..1676798 100755 +--- a/modules.d/90multipath/module-setup.sh ++++ b/modules.d/90multipath/module-setup.sh +@@ -41,7 +41,7 @@ depends() { + # called by dracut + cmdline() { + for m in scsi_dh_alua scsi_dh_emc scsi_dh_rdac ; do +- if module_is_host_only $m ; then ++ if grep -m 1 -q "$m" /proc/modules ; then + printf 'rd.driver.pre=%s ' "$m" + fi + done diff --git a/0065-watchdog-clean-return-of-installkernel.patch b/0065-watchdog-clean-return-of-installkernel.patch new file mode 100644 index 0000000..c01ddca --- /dev/null +++ b/0065-watchdog-clean-return-of-installkernel.patch @@ -0,0 +1,21 @@ +From fe83231e30d5bc94e090d02e65f0e3cbef20c6ac Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 18 Apr 2016 15:49:06 +0200 +Subject: [PATCH] watchdog: clean return of installkernel() + +return 0, otherwise if _alldrivers is empty, the return code is fail +--- + modules.d/04watchdog/module-setup.sh | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index 04686f6..7b2685d 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -74,4 +74,6 @@ installkernel() { + # ensure that watchdog module is loaded as early as possible + _alldrivers="${!_drivers[*]}" + [[ $_alldrivers ]] && echo "rd.driver.pre=${_alldrivers// /,}" > ${initdir}/etc/cmdline.d/00-watchdog.conf ++ ++ return 0 + } diff --git a/0066-watchdog-start-traversing-the-device-tree-from-the-r.patch b/0066-watchdog-start-traversing-the-device-tree-from-the-r.patch new file mode 100644 index 0000000..d21039d --- /dev/null +++ b/0066-watchdog-start-traversing-the-device-tree-from-the-r.patch @@ -0,0 +1,24 @@ +From bf75218e45180b957192f08c3fa5d5b147b66c31 Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 18 Apr 2016 15:50:42 +0200 +Subject: [PATCH] watchdog: start traversing the device tree from the right + directory + +start with the device subtree, not with the parent of it +--- + modules.d/04watchdog/module-setup.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh +index 7b2685d..7566d65 100755 +--- a/modules.d/04watchdog/module-setup.sh ++++ b/modules.d/04watchdog/module-setup.sh +@@ -56,7 +56,7 @@ installkernel() { + # however in some cases, we also need to check that if there is + # a specific driver for the parent bus/device. In such cases + # we also need to enable driver for parent bus/device. +- _wdtppath=$(readlink -f "$_dir/device/..") ++ _wdtppath=$(readlink -f "$_dir/device") + while [[ -d "$_wdtppath" ]] && [[ "$_wdtppath" != "/sys" ]]; do + _wdtppath=$(readlink -f "$_wdtppath/..") + [[ -f "$_wdtppath/modalias" ]] || continue diff --git a/0067-dracut-10i18n-support-default-loadkeys-setfont-data-.patch b/0067-dracut-10i18n-support-default-loadkeys-setfont-data-.patch new file mode 100644 index 0000000..a3f16e8 --- /dev/null +++ b/0067-dracut-10i18n-support-default-loadkeys-setfont-data-.patch @@ -0,0 +1,32 @@ +From 5f91ed0b5345e132d9fe1fa815bfd968778df5ea Mon Sep 17 00:00:00 2001 +From: Guido Trentalancia +Date: Fri, 15 Apr 2016 13:06:45 +0200 +Subject: [PATCH] dracut: 10i18n: support default loadkeys/setfont data paths + using symbolic links + +Avoid keymap/font not found error when loadkeys/setfont +are compiled with the default data directory path. + +Signed-off-by: Guido Trentalancia +--- + modules.d/10i18n/module-setup.sh | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh +index 9439875..9618aa7 100755 +--- a/modules.d/10i18n/module-setup.sh ++++ b/modules.d/10i18n/module-setup.sh +@@ -100,6 +100,13 @@ install() { + inst_rules ${moddir}/10-console.rules + inst_hook cmdline 20 "${moddir}/parse-i18n.sh" + fi ++ ++ if [[ ${kbddir} != "/usr/share" ]]; then ++ inst_dir /usr/share ++ for _src in $(eval echo {${KBDSUBDIRS}}); do ++ [ ! -e "${initdir}/usr/share/${_src}" ] && ln -s "${kbddir}/${_src}" "${initdir}/usr/share/${_src}" ++ done ++ fi + } + + install_all_kbd() { diff --git a/0068-ensure-parent-dir-for-usr-lib-initrd-release-exists.patch b/0068-ensure-parent-dir-for-usr-lib-initrd-release-exists.patch new file mode 100644 index 0000000..7db08c6 --- /dev/null +++ b/0068-ensure-parent-dir-for-usr-lib-initrd-release-exists.patch @@ -0,0 +1,21 @@ +From bb44294b62b9469aebaeac8533569ac24b208a45 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= +Date: Wed, 27 Apr 2016 13:08:42 +0300 +Subject: [PATCH] ensure parent dir for /usr/lib/initrd-release exists + +--- + modules.d/99base/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh +index 5fbf6f7..b03772e 100755 +--- a/modules.d/99base/module-setup.sh ++++ b/modules.d/99base/module-setup.sh +@@ -77,6 +77,7 @@ install() { + VERSION_ID=$DRACUT_VERSION + ANSI_COLOR="0;34" + ++ [ -e "${initdir}/usr/lib" ] || mkdir -m 0755 -p ${initdir}/usr/lib + { + echo NAME=\"$NAME\" + echo VERSION=\"$VERSION\" diff --git a/0069-Fix-small-typo-in-dracut.cmdline-7.patch b/0069-Fix-small-typo-in-dracut.cmdline-7.patch new file mode 100644 index 0000000..daa35b0 --- /dev/null +++ b/0069-Fix-small-typo-in-dracut.cmdline-7.patch @@ -0,0 +1,22 @@ +From ae753baec0ae5b3c3eeabbe4f70c54cc3c24c292 Mon Sep 17 00:00:00 2001 +From: Ruben Kerkhof +Date: Fri, 29 Apr 2016 15:34:47 +0200 +Subject: [PATCH] Fix small typo in dracut.cmdline(7) + +--- + dracut.cmdline.7.asc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc +index c4c5588..bf00719 100644 +--- a/dracut.cmdline.7.asc ++++ b/dracut.cmdline.7.asc +@@ -32,7 +32,7 @@ line is the value, which is honored. + Standard + ~~~~~~~~ + **init=**____:: +- specify the path to the init programm to be started after the initramfs has ++ specify the path to the init program to be started after the initramfs has + finished + + **root=**____:: diff --git a/0070-systemd-ensure-journal-is-volatile.patch b/0070-systemd-ensure-journal-is-volatile.patch new file mode 100644 index 0000000..5c69f09 --- /dev/null +++ b/0070-systemd-ensure-journal-is-volatile.patch @@ -0,0 +1,30 @@ +From 5dea430e087ec7749080547a6a6fe5b152f665ef Mon Sep 17 00:00:00 2001 +From: Michael Chapman +Date: Wed, 4 May 2016 10:49:56 +1000 +Subject: [PATCH] systemd: ensure journal is volatile + +If journald.conf already contains Storage=persistent, journald will +write to /var/log/journal/, which ends up at /run/initramfs/log/journal/ +after switching root. We want to make sure early boot logs are written +to /run/log/journal/ so they can be flushed to /var/log/journal/ after +switching root. +--- + modules.d/00systemd/module-setup.sh | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh +index deb5e06..951a5be 100755 +--- a/modules.d/00systemd/module-setup.sh ++++ b/modules.d/00systemd/module-setup.sh +@@ -210,9 +210,10 @@ install() { + done + + mkdir -p "$initdir/etc/systemd" +- # turn off RateLimit for journal ++ # We must use a volatile journal, and we don't want rate-limiting + { + echo "[Journal]" ++ echo "Storage=volatile" + echo "RateLimitInterval=0" + echo "RateLimitBurst=0" + } >> "$initdir/etc/systemd/journald.conf" diff --git a/0071-configure-don-t-hardcode-pkg-config.patch b/0071-configure-don-t-hardcode-pkg-config.patch new file mode 100644 index 0000000..b3b825d --- /dev/null +++ b/0071-configure-don-t-hardcode-pkg-config.patch @@ -0,0 +1,43 @@ +From 699414f5a518f039fa74fd314d21994849a90625 Mon Sep 17 00:00:00 2001 +From: Marc-Antoine Perennou +Date: Wed, 4 May 2016 10:18:54 +0200 +Subject: [PATCH] configure: don't hardcode pkg-config + +Signed-off-by: Marc-Antoine Perennou +--- + configure | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/configure b/configure +index c92cb99..2368680 100755 +--- a/configure ++++ b/configure +@@ -7,6 +7,8 @@ prefix=/usr + + enable_documentation=yes + ++PKG_CONFIG="${PKG_CONFIG:-pkg-config}" ++ + # Little helper function for reading args from the commandline. + # it automatically handles -a b and -a=b variants, and returns 1 if + # we need to shift $3. +@@ -50,7 +52,7 @@ while (($# > 0)); do + shift + done + +-if ! pkg-config --exists --print-errors " libkmod >= 15 "; then ++if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 15 "; then + echo "dracut needs pkg-config and libkmod >= 15." >&2 + exit 1 + fi +@@ -64,8 +66,8 @@ sbindir ?= ${sbindir:-${prefix}/sbin} + mandir ?= ${mandir:-${prefix}/share/man} + enable_documentation ?= ${enable_documentation:-yes} + bindir ?= ${bindir:-${prefix}/bin} +-KMOD_CFLAGS ?= $(pkg-config --cflags " libkmod >= 15 ") +-KMOD_LIBS ?= $(pkg-config --libs " libkmod >= 15 ") ++KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 15 ") ++KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 15 ") + EOF + + { diff --git a/0072-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch b/0072-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch new file mode 100644 index 0000000..20f7339 --- /dev/null +++ b/0072-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch @@ -0,0 +1,54 @@ +From 016613c774baf3d30c6425a65ead05d8b55d6279 Mon Sep 17 00:00:00 2001 +From: Alexander Kurtz +Date: Fri, 6 May 2016 17:25:37 +0200 +Subject: [PATCH] dracut-systemd/dracut-cmdline.sh: Don't error out if there is + no root= argument. + +Thanks to systemd's gpt-auto-generator [0] (which implements the Discoverable +Partitions Specification [1]), it is no longer necessary to always specify the +root= argument. + +However, dracut would still refuse to boot if there was no root= argument (or +if it was set to the special value "gpt-auto" [2]). This commit stops dracut +from aborting the boot process in these cases and simply lets systemd do its +magic. + +[0] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator +[1] https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ +[2] https://github.com/systemd/systemd/blob/v229/src/gpt-auto-generator/gpt-auto-generator.c#L928 +--- + modules.d/98dracut-systemd/dracut-cmdline.sh | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh +index a1dcf84..ccf24fb 100755 +--- a/modules.d/98dracut-systemd/dracut-cmdline.sh ++++ b/modules.d/98dracut-systemd/dracut-cmdline.sh +@@ -21,7 +21,12 @@ getargbool 0 rd.udev.log-priority=debug -d rd.udev.debug -d -n -y rdudevdebug && + + source_conf /etc/conf.d + +-root=$(getarg root=) ++# Get the "root=" parameter from the kernel command line, but differentiate ++# between the case where it was set to the empty string and the case where it ++# wasn't specified at all. ++if ! root="$(getarg root=)"; then ++ root='UNSET' ++fi + + rflags="$(getarg rootflags=)" + getargbool 0 ro && rflags="${rflags},ro" +@@ -65,9 +70,12 @@ case "$root" in + /dev/*) + root="block:${root}" + rootok=1 ;; ++ UNSET|gpt-auto) ++ # systemd's gpt-auto-generator handles this case. ++ rootok=1 ;; + esac + +-[ -z "$root" ] && die "No or empty root= argument" ++[ -z "$root" ] && die "Empty root= argument" + [ -z "$rootok" ] && die "Don't know how to handle 'root=$root'" + + export root rflags fstype netroot NEWROOT diff --git a/0073-move-ln_r-to-dracut-init.sh.patch b/0073-move-ln_r-to-dracut-init.sh.patch new file mode 100644 index 0000000..2e573e0 --- /dev/null +++ b/0073-move-ln_r-to-dracut-init.sh.patch @@ -0,0 +1,54 @@ +From 190150018798f88107fba119e92bd32e2a8d4b0b Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Mon, 2 May 2016 12:48:12 +0200 +Subject: [PATCH] move ln_r() to dracut-init.sh + +--- + dracut-functions.sh | 12 ------------ + dracut-init.sh | 13 +++++++++++++ + 2 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/dracut-functions.sh b/dracut-functions.sh +index c7ea9f5..4496bfe 100755 +--- a/dracut-functions.sh ++++ b/dracut-functions.sh +@@ -167,18 +167,6 @@ convert_abs_rel() { + printf "%s\n" "$__newpath" + } + +-if [[ "$(ln --help)" == *--relative* ]]; then +- ln_r() { +- ln -sfnr "${initdir}/$1" "${initdir}/$2" +- } +-else +- ln_r() { +- local _source=$1 +- local _dest=$2 +- [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/} +- ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}" +- } +-fi + + # get_fs_env + # Get and the ID_FS_TYPE variable from udev for a device. +diff --git a/dracut-init.sh b/dracut-init.sh +index a195c32..d2bb845 100644 +--- a/dracut-init.sh ++++ b/dracut-init.sh +@@ -997,3 +997,16 @@ instmods() { + [[ "$optional" ]] && return 0 + return $_ret + } ++ ++if [[ "$(ln --help)" == *--relative* ]]; then ++ ln_r() { ++ ln -sfnr "${initdir}/$1" "${initdir}/$2" ++ } ++else ++ ln_r() { ++ local _source=$1 ++ local _dest=$2 ++ [[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/} ++ ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}" ++ } ++fi diff --git a/0074-systemd-initrd-add-initrd-root-device.target.patch b/0074-systemd-initrd-add-initrd-root-device.target.patch new file mode 100644 index 0000000..87d6696 --- /dev/null +++ b/0074-systemd-initrd-add-initrd-root-device.target.patch @@ -0,0 +1,21 @@ +From d4efc0aeeecc470d9a267b7f3c130f472488905c Mon Sep 17 00:00:00 2001 +From: Harald Hoyer +Date: Wed, 25 May 2016 15:06:29 +0200 +Subject: [PATCH] systemd-initrd: add initrd-root-device.target + +--- + modules.d/01systemd-initrd/module-setup.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/modules.d/01systemd-initrd/module-setup.sh b/modules.d/01systemd-initrd/module-setup.sh +index fb6a9ea..c1ccd2a 100755 +--- a/modules.d/01systemd-initrd/module-setup.sh ++++ b/modules.d/01systemd-initrd/module-setup.sh +@@ -28,6 +28,7 @@ install() { + inst_multiple -o \ + $systemdsystemunitdir/initrd.target \ + $systemdsystemunitdir/initrd-fs.target \ ++ $systemdsystemunitdir/initrd-root-device.target \ + $systemdsystemunitdir/initrd-root-fs.target \ + $systemdsystemunitdir/initrd-switch-root.target \ + $systemdsystemunitdir/initrd-switch-root.service \ diff --git a/dracut.spec b/dracut.spec index 57bd269..6dd9577 100644 --- a/dracut.spec +++ b/dracut.spec @@ -16,7 +16,7 @@ Name: dracut Version: 044 -Release: 18.git20160108%{?dist} +Release: 75%{?dist} Summary: Initramfs generator using udev %if 0%{?fedora} || 0%{?rhel} @@ -51,11 +51,70 @@ Patch13: 0013-base-dracut-lib.sh-dev_unit_name-guard-against-dev-b.patch Patch14: 0014-nbd-add-missing-generator.patch Patch15: 0015-fcoe-no-need-to-copy-lldpad-state.patch Patch16: 0016-dracut.sh-restorecon-final-image-file.patch +Patch17: 0017-dracut.cmdline-remove-extra-from-ip-doc.patch +Patch18: 0018-dracut.sh-fail-hard-if-we-find-modules-and-modules.d.patch +Patch19: 0019-network-net-lib.sh-correctly-set-mac-address-for-ip-.patch +Patch20: 0020-dracut-functions.sh-fix-check_vol_slaves-volume-grou.patch +Patch21: 0021-multipath-fix-majmin_to_mpath_dev.patch +Patch22: 0022-Fixed-vlan-bonding-bridging-team-logic.patch +Patch23: 0023-TEST-30-ISCSI-some-tests-have-unknown-return-code.patch +Patch24: 0024-network-add-mtu-to-list-of-variables-to-store-in-ove.patch +Patch25: 0025-Correctly-handle-module-aliases.patch +Patch26: 0026-network-if-rd.neednet-0-we-don-t-need-a-bootdev.patch +Patch27: 0027-kernel-modules-add-usb-storage.patch +Patch28: 0028-kernel-modules-join-instmods-and-install-all-usb-sto.patch +Patch29: 0029-dracut-systemd-dracut-cmdline-ask-fix-dracut-kernel-.patch +Patch30: 0030-base-init.sh-don-t-remove-99-cmdline-ask-on-hostonly.patch +Patch31: 0031-documentation-hostonly-i18n-no-hostonly-i18n-i18n_in.patch +Patch32: 0032-network-dhclient-script.sh-add-classless-static-rout.patch +Patch33: 0033-dracut-systemd-dracut-pre-pivot.sh-Break-at-switch_r.patch +Patch34: 0034-dracut-install-catch-ldd-message-cannot-execute-bina.patch +Patch35: 0035-dracut.conf.5.asc-fix-bold.patch +Patch36: 0036-watchdog-Do-not-add-hooks-if-systemd-module-is-inclu.patch +Patch37: 0037-watchdog-install-module-for-active-watchdog.patch +Patch38: 0038-watchdog-ensure-that-module-is-loaded-as-early-as-po.patch +Patch39: 0039-lsinitrd-add-unpack-to-lsinitrd.patch +Patch40: 0040-Do-not-use-deprecated-egrep-fgrep.patch +Patch41: 0041-nfs-module-setup.sh-Use-colon-instead-of-dot-for-cho.patch +Patch42: 0042-Clean-up-some-bashisms-from-bin-sh-scripts.patch +Patch43: 0043-dracut-init.sh-Simplify-udev-rule-grepping.patch +Patch44: 0044-dracut.sh-call-dracut-install-with-f-in-FIPS-mode.patch +Patch45: 0045-dracut-init.sh-Add-file-argument-to-sed-s.patch +Patch46: 0046-lsinitrd.sh-fixed-unpack-and-skipcpio-search.patch +Patch47: 0047-dracut-init.sh-mark-error-messages-with-FAILED.patch +Patch48: 0048-Use-dracut-install-to-install-kernel-modules.patch +Patch49: 0049-Use-pkg-config-for-libkmod-CFLAGS-and-LIBS.patch +Patch50: 0050-Fix-regressions-with-dracut-install-with-kernel-modu.patch +Patch51: 0051-dracut-install-simplify-error-logic.patch +Patch52: 0052-dracut-init.sh-beautify-instmods.patch +Patch53: 0053-plymouth-plymouth-pretrigger.sh-also-trigger-acpi-su.patch +Patch54: 0054-dracut-install-add-help-documentation.patch +Patch55: 0055-NEWS-update-for-045.patch +Patch56: 0056-Revert-fcoe-no-need-to-copy-lldpad-state.patch +Patch57: 0057-base-init.sh-don-t-mount-run-with-noexec-if-the-init.patch +Patch58: 0058-kate-config.patch +Patch59: 0059-95resume-avoid-possible-symbolic-link-creation-error.patch +Patch60: 0060-watchdog-module-setup.sh-rewrite.patch +Patch61: 0061-drop-to-shell-on-die-if-rd.shell-1-is-set-explicitly.patch +Patch62: 0062-dracut_install-honor-silent-flag.patch +Patch63: 0063-dracut-install-make-use-of-_cleanup_-macros-and-impr.patch +Patch64: 0064-removed-obsolete-kernel-module-functions-and-host_mo.patch +Patch65: 0065-watchdog-clean-return-of-installkernel.patch +Patch66: 0066-watchdog-start-traversing-the-device-tree-from-the-r.patch +Patch67: 0067-dracut-10i18n-support-default-loadkeys-setfont-data-.patch +Patch68: 0068-ensure-parent-dir-for-usr-lib-initrd-release-exists.patch +Patch69: 0069-Fix-small-typo-in-dracut.cmdline-7.patch +Patch70: 0070-systemd-ensure-journal-is-volatile.patch +Patch71: 0071-configure-don-t-hardcode-pkg-config.patch +Patch72: 0072-dracut-systemd-dracut-cmdline.sh-Don-t-error-out-if-.patch +Patch73: 0073-move-ln_r-to-dracut-init.sh.patch +Patch74: 0074-systemd-initrd-add-initrd-root-device.target.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt BuildRequires: bash git +BuildRequires: kmod-devel >= 15 %if 0%{?fedora} || 0%{?rhel} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -63,7 +122,6 @@ BuildRequires: pkgconfig %endif %if 0%{?fedora} BuildRequires: bash-completion -BuildRequires: pkgconfig %endif %if 0%{?suse_version} @@ -240,10 +298,13 @@ This package contains tools to assemble the local initrd and host configuration. cp %{SOURCE1} . %build -%configure --systemdsystemunitdir=%{_unitdir} --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) --libdir=%{_prefix}/lib \ +%configure --systemdsystemunitdir=%{_unitdir} \ + --bashcompletiondir=$(pkg-config --variable=completionsdir bash-completion) \ + --libdir=%{_prefix}/lib \ %if %{without doc} - --disable-documentation + --disable-documentation \ %endif + ${NULL} make %{?_smp_mflags} @@ -511,6 +572,10 @@ rm -rf -- $RPM_BUILD_ROOT %endif %changelog +* Tue Jun 07 2016 Harald Hoyer - 044-75 +- fix for systemd >= 230 +- git snapshot + * Wed Feb 03 2016 Fedora Release Engineering - 044-18.git20160108 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild