mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [PATCH 00/10] SUSE S/390 integration
@ 2013-11-27 15:44 Hannes Reinecke
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

Hi all,

SUSE is keeping the S/390 device configuration in udev rules,
on rule per device.
And it doesn't have the RH-specific configuration scripts (obviously).
This patchset abstracts away the RH-specific configuration and
adds modules to make dracut boot on SLES installations.

Please apply.

Hannes Reinecke (10):
  95dasd: Install kernel modules only once
  95dasd: Only install module if normalize_dasd_arg is present
  95dasd_mod: make dasd_cio_free optional
  95zfcp: Make installation optional
  95znet: Make installation optional
  Install /bin/mount
  Fixup keymap setting for openSUSE
  Check for plymouth lib directories
  Add DASD configuration for SuSE
  Add zfcp scripts for SUSE

 dracut-functions.sh                    | 37 ++++++++++++++++++++++
 modules.d/10i18n/module-setup.sh       |  3 ++
 modules.d/50plymouth/module-setup.sh   | 17 ++++++++---
 modules.d/95dasd/module-setup.sh       |  7 ++---
 modules.d/95dasd_mod/module-setup.sh   |  3 +-
 modules.d/95dasd_mod/parse-dasd-mod.sh |  4 ++-
 modules.d/95dasd_rules/module-setup.sh | 27 ++++++++++++++++
 modules.d/95dasd_rules/parse-dasd.sh   | 56 ++++++++++++++++++++++++++++++++++
 modules.d/95zfcp/module-setup.sh       |  4 +--
 modules.d/95zfcp_rules/module-setup.sh | 25 +++++++++++++++
 modules.d/95zfcp_rules/parse-zfcp.sh   | 54 ++++++++++++++++++++++++++++++++
 modules.d/95znet/module-setup.sh       |  1 +
 modules.d/99fs-lib/module-setup.sh     |  1 +
 13 files changed, 224 insertions(+), 15 deletions(-)
 create mode 100755 modules.d/95dasd_rules/module-setup.sh
 create mode 100755 modules.d/95dasd_rules/parse-dasd.sh
 create mode 100755 modules.d/95zfcp_rules/module-setup.sh
 create mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh

-- 
1.8.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 01/10] 95dasd: Install kernel modules only once
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 02/10] 95dasd: Only install module if normalize_dasd_arg is present Hannes Reinecke
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

Move kernel module selection to 95dasd_mod and make 95dasd depend
on that module.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/95dasd/module-setup.sh | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh
index 861df29..16207bc 100755
--- a/modules.d/95dasd/module-setup.sh
+++ b/modules.d/95dasd/module-setup.sh
@@ -11,15 +11,11 @@ check() {
 
 # called by dracut
 depends() {
+    echo "dasd_mod"
     return 0
 }
 
 # called by dracut
-installkernel() {
-    instmods dasd_mod dasd_eckd_mod dasd_fba_mod dasd_diag_mod
-}
-
-# called by dracut
 install() {
     inst_hook cmdline 30 "$moddir/parse-dasd.sh"
     inst_multiple dasdinfo dasdconf.sh normalize_dasd_arg
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 02/10] 95dasd: Only install module if normalize_dasd_arg is present
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
  2013-11-27 15:44   ` [PATCH 01/10] 95dasd: Install kernel modules only once Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional Hannes Reinecke
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

normalize_dasd_arg is a RedHat specific script, so no point
installing this module if the script isn't present.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/95dasd/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules.d/95dasd/module-setup.sh b/modules.d/95dasd/module-setup.sh
index 16207bc..9c93d40 100755
--- a/modules.d/95dasd/module-setup.sh
+++ b/modules.d/95dasd/module-setup.sh
@@ -5,6 +5,7 @@
 # called by dracut
 check() {
     local _arch=$(uname -m)
+    [ -x /sbin/normalize_dasd_arg ] || return 1
     [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
     return 0
 }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
  2013-11-27 15:44   ` [PATCH 01/10] 95dasd: Install kernel modules only once Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 02/10] 95dasd: Only install module if normalize_dasd_arg is present Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
       [not found]     ` <1385567061-13247-4-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
  2013-11-27 15:44   ` [PATCH 04/10] 95zfcp: Make installation optional Hannes Reinecke
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

dasd_cio_free is a RedHat-specific tool, so make it optional.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 dracut-functions.sh                    | 9 +++++++++
 modules.d/95dasd_mod/module-setup.sh   | 3 ++-
 modules.d/95dasd_mod/parse-dasd-mod.sh | 4 +++-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dracut-functions.sh b/dracut-functions.sh
index 2872516..c2cf67a 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -741,6 +741,15 @@ inst_multiple() {
     return $ret
 }
 
+inst_multiple_optional() {
+    local ret
+        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
+    $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@"
+    ret=$?
+    (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@" || :
+    return $ret
+}
+
 dracut_install() {
     inst_multiple "$@"
 }
diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh
index 011010d..4546059 100755
--- a/modules.d/95dasd_mod/module-setup.sh
+++ b/modules.d/95dasd_mod/module-setup.sh
@@ -23,6 +23,7 @@ installkernel() {
 # called by dracut
 install() {
     inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
-    inst_multiple dasd_cio_free grep sed seq
+    inst_multiple grep sed seq
+    inst_multiple_optional dasd_cio_free
 }
 
diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh
index 87c88ed..0236d12 100755
--- a/modules.d/95dasd_mod/parse-dasd-mod.sh
+++ b/modules.d/95dasd_mod/parse-dasd-mod.sh
@@ -15,4 +15,6 @@ if [ -n "$mod_args" ]; then
 fi
 
 unset dasd_arg
-dasd_cio_free
+if [ -x /sbin/dasd_cio_free ] ; then
+    dasd_cio_free
+fi
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 04/10] 95zfcp: Make installation optional
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (2 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 05/10] 95znet: " Hannes Reinecke
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

zfcp_cio_free is a RedHat-specific tool, so do not install this
module if the program isn't present.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/95zfcp/module-setup.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/modules.d/95zfcp/module-setup.sh b/modules.d/95zfcp/module-setup.sh
index 5d9b506..dfbeed5 100755
--- a/modules.d/95zfcp/module-setup.sh
+++ b/modules.d/95zfcp/module-setup.sh
@@ -5,6 +5,7 @@
 # called by dracut
 check() {
     arch=$(uname -m)
+    [ -x /sbin/zfcp_cio_free ] || return 1
     [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
 
     return 0
@@ -12,9 +13,6 @@ check() {
 
 # called by dracut
 depends() {
-    arch=$(uname -m)
-    [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
-
     return 0
 }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 05/10] 95znet: Make installation optional
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (3 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 04/10] 95zfcp: Make installation optional Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 06/10] Install /bin/mount Hannes Reinecke
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

znet_cio_free is a RedHat-specific tool, so do not install this
module on systems where the program is missing.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/95znet/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh
index 4c211a9..5012b77 100755
--- a/modules.d/95znet/module-setup.sh
+++ b/modules.d/95znet/module-setup.sh
@@ -5,6 +5,7 @@
 # called by dracut
 check() {
     arch=$(uname -m)
+    [ -z /sbin/znet_cio_free ] || return 1
     [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
 
     return 0
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 06/10] Install /bin/mount
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (4 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 05/10] 95znet: " Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
       [not found]     ` <1385567061-13247-7-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
  2013-11-27 15:44   ` [PATCH 07/10] Fixup keymap setting for openSUSE Hannes Reinecke
                     ` (3 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

systemd relies on /bin/mount to be present, so install it.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/99fs-lib/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
index 7979bab..b24207d 100755
--- a/modules.d/99fs-lib/module-setup.sh
+++ b/modules.d/99fs-lib/module-setup.sh
@@ -85,4 +85,5 @@ install() {
     fi
 
     inst_multiple -o $_helpers fsck
+    inst /usr/bin/mount /bin/mount
 }
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 07/10] Fixup keymap setting for openSUSE
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (5 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 06/10] Install /bin/mount Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 08/10] Check for plymouth lib directories Hannes Reinecke
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

openSUSE is using compressed keymaps.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/10i18n/module-setup.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index 0741c64..f07b148 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
@@ -161,6 +161,9 @@ install() {
         # Gentoo user may have KEYMAP set to something like "-u pl2",
         KEYMAP=${KEYMAP#-* }
 
+        # openSUSE user may have KEYMAP set to something like ".gz"
+        KEYMAP=${KEYMAP/.gz/}
+
         # KEYTABLE is a bit special - it defines base keymap name and UNICODE
         # determines whether non-UNICODE or UNICODE version is used
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 08/10] Check for plymouth lib directories
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (6 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 07/10] Fixup keymap setting for openSUSE Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 09/10] Add DASD configuration for SuSE Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 10/10] Add zfcp scripts for SUSE Hannes Reinecke
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

SUSE installs plymount files in /usr/lib, not /usr/libexec.
So check for both when including plymouth support.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/50plymouth/module-setup.sh | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh
index 1360924..7ccf9e4 100755
--- a/modules.d/50plymouth/module-setup.sh
+++ b/modules.d/50plymouth/module-setup.sh
@@ -15,12 +15,19 @@ depends() {
 
 # called by dracut
 install() {
-    if grep -q nash /usr/libexec/plymouth/plymouth-populate-initrd \
-        || [ ! -x /usr/libexec/plymouth/plymouth-populate-initrd ]; then
+    if [ -d /usr/libexec/plymouth ] ; then
+        _plymouth=/usr/libexec/plymouth;
+    elif [ -d /usr/lib/plymouth ] ; then
+        _plymouth=/usr/lib/plymouth
+    fi
+    if [ -n "$_plymouth" ] ; then
+        if grep -q nash ${_plymouth}/plymouth-populate-initrd \
+        || [ ! -x ${_plymouth}/plymouth-populate-initrd ]; then
         . "$moddir"/plymouth-populate-initrd.sh
-    else
-        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
-            /usr/libexec/plymouth/plymouth-populate-initrd -t "$initdir"
+        else
+            PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
+                ${_plymouth}/plymouth-populate-initrd -t "$initdir"
+        fi
     fi
 
     inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 09/10] Add DASD configuration for SuSE
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (7 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 08/10] Check for plymouth lib directories Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  2013-11-27 15:44   ` [PATCH 10/10] Add zfcp scripts for SUSE Hannes Reinecke
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

On SuSE the DASD configuration is kept in udev rules, one rule
file per device. So add a new module for copying and creating
these rules during boot.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 dracut-functions.sh                    | 28 +++++++++++++++++
 modules.d/95dasd_rules/module-setup.sh | 27 ++++++++++++++++
 modules.d/95dasd_rules/parse-dasd.sh   | 56 ++++++++++++++++++++++++++++++++++
 3 files changed, 111 insertions(+)
 create mode 100755 modules.d/95dasd_rules/module-setup.sh
 create mode 100755 modules.d/95dasd_rules/parse-dasd.sh

diff --git a/dracut-functions.sh b/dracut-functions.sh
index c2cf67a..27f1507 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -908,6 +908,34 @@ inst_rules() {
     done
 }
 
+inst_rules_wildcard() {
+    local _target=/etc/udev/rules.d _rule _found
+
+    inst_dir "${udevdir}/rules.d"
+    inst_dir "$_target"
+    for _rule in ${udevdir}/rules.d/$1 ${dracutbasedir}/rules.d/$1 ; do
+        if [[ -e $_rule ]]; then
+            inst_rule_programs "$_rule"
+            inst_rule_group_owner "$_rule"
+            inst_rule_initqueue "$_rule"
+            inst_simple "$_rule"
+            _found=$_rule
+        fi
+    done
+    if [ -n ${hostonly} ] ; then
+        for _rule in ${_target}/$1 ; do
+            if [[ -f $_rule ]]; then
+                inst_rule_programs "$_rule"
+                inst_rule_group_owner "$_rule"
+                inst_rule_initqueue "$_rule"
+                inst_simple "$_rule"
+                _found=$_rule
+            fi
+        done
+    fi
+    [[ $_found ]] || dinfo "Skipping udev rule: $_rule"
+}
+
 prepare_udev_rules() {
     [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
 
diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh
new file mode 100755
index 0000000..d313171
--- /dev/null
+++ b/modules.d/95dasd_rules/module-setup.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# called by dracut
+check() {
+    local _arch=$(uname -m)
+    [ -x /sbin/dasd_configure ] || return 1
+    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
+    return 0
+}
+
+# called by dracut
+depends() {
+    echo 'dasd_mod'
+    return 0
+}
+
+# called by dracut
+install() {
+    inst_multiple /usr/lib/udev/collect
+    inst_hook cmdline 30 "$moddir/parse-dasd.sh"
+    if [[ $hostonly ]] ; then
+        inst_rules_wildcard 51-dasd-*.rules
+    fi
+    inst_rules 59-dasd.rules
+}
diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh
new file mode 100755
index 0000000..9389c44
--- /dev/null
+++ b/modules.d/95dasd_rules/parse-dasd.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+create_udev_rule() {
+    local ccw=$1
+    local _drv _cu_type _dev_type
+    local _rule=/etc/udev/rules.d/51-dasd-${ccw}.rules
+
+    if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
+        read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
+        read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
+    fi
+    case "$_cu_type" in
+    3990/*|2105/*|2107/*|1750/*|9343/*)
+            _drv=dasd-eckd
+            ;;
+    6310/*)
+            _drv=dasd-fba
+            ;;
+    3880/*)
+        case "$_dev_type" in
+            3380/*)
+                _drv=dasd_eckd
+                ;;
+            3370/*)
+                _drv=dasd-fba
+                ;;
+        esac
+        ;;
+    esac
+    [ -z "${_drv}" ] && return 0
+
+    [ -e ${_rule} ] && return 0
+
+    cat > $_rule <<EOF
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="$_drv", IMPORT{program}="collect $ccw %k ${ccw} $_drv"
+ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
+EOF
+}
+
+for dasd_arg in $(getargs root=) $(getargs resume=); do
+    (
+        case $dasd_arg in
+            /dev/disk/by-path/ccw-*)
+                ccw_arg=${dasd_arg##*/}
+                break;
+        esac
+        if [ -n "$ccw_arg" ] ; then
+            IFS="-"
+            set -- $ccw_arg
+            create_udev_rule $2
+        fi
+    )
+done
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 10/10] Add zfcp scripts for SUSE
       [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
                     ` (8 preceding siblings ...)
  2013-11-27 15:44   ` [PATCH 09/10] Add DASD configuration for SuSE Hannes Reinecke
@ 2013-11-27 15:44   ` Hannes Reinecke
  9 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-27 15:44 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

SuSE is storing the zfcp configuration in udev files, so we should
be including these.

Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
---
 modules.d/95zfcp_rules/module-setup.sh | 25 ++++++++++++++++
 modules.d/95zfcp_rules/parse-zfcp.sh   | 54 ++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)
 create mode 100755 modules.d/95zfcp_rules/module-setup.sh
 create mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh

diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh
new file mode 100755
index 0000000..9a1ab20
--- /dev/null
+++ b/modules.d/95zfcp_rules/module-setup.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# called by dracut
+check() {
+    local _arch=$(uname -m)
+    [ -x /sbin/zfcp_disk_configure ] || return 1
+    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
+    return 0
+}
+
+# called by dracut
+depends() {
+    return 0
+}
+
+# called by dracut
+install() {
+    inst_multiple /usr/lib/udev/collect
+    inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
+    if [[ $hostonly ]] ; then
+        inst_rules_wildcard 51-zfcp-*.rules
+    fi
+}
diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh
new file mode 100755
index 0000000..94f2b49
--- /dev/null
+++ b/modules.d/95zfcp_rules/parse-zfcp.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+create_udev_rule() {
+    local ccw=$1
+    local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
+
+    local _cu_type _dev_type
+    local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
+
+    if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
+        read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
+        read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
+    fi
+    if [ "$_cu_type" != "1731/03" ] ; then
+        return 0;
+    fi
+    if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ] ; then
+        return 0;
+    fi
+
+    [ -e ${_rule} ] && return 0
+
+    if [ ! -f "$_rule" ] ; then
+        cat > $_rule <<EOF
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
+ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
+EOF
+    fi
+    wwpn=${2%:*}
+    lun=${2#*:}
+    m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
+    if [ -z "$m" ] ; then
+        cat >> $_rule <<EOF
+ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
+EOF
+    fi
+}
+
+for zfcp_arg in $(getargs root=) $(getargs resume=); do
+    (
+        case $zfcp_arg in
+            /dev/disk/by-path/ccw-*)
+                ccw_arg=${zfcp_arg##*/}
+                break;
+        esac
+        if [ -n "$ccw_arg" ] ; then
+            IFS="-"
+            set -- $ccw_arg
+            create_udev_rule $2 $4
+    )
+done
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional
       [not found]     ` <1385567061-13247-4-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
@ 2013-11-28 12:51       ` Harald Hoyer
       [not found]         ` <52973C68.8040504-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Harald Hoyer @ 2013-11-28 12:51 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/27/2013 04:44 PM, Hannes Reinecke wrote:
> dasd_cio_free is a RedHat-specific tool, so make it optional.
> 
> Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
> ---
>  dracut-functions.sh                    | 9 +++++++++
>  modules.d/95dasd_mod/module-setup.sh   | 3 ++-
>  modules.d/95dasd_mod/parse-dasd-mod.sh | 4 +++-
>  3 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/dracut-functions.sh b/dracut-functions.sh
> index 2872516..c2cf67a 100755
> --- a/dracut-functions.sh
> +++ b/dracut-functions.sh
> @@ -741,6 +741,15 @@ inst_multiple() {
>      return $ret
>  }
>  
> +inst_multiple_optional() {
> +    local ret
> +        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
> +    $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@"
> +    ret=$?
> +    (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@" || :
> +    return $ret
> +}
> +


Why so complicated and not use "inst_multiple -o" ??
Or, if you prefer inst_multiple_optional, replace all other occurences of
"inst_multiple -o" with inst_multiple_optional also.

>  dracut_install() {
>      inst_multiple "$@"
>  }
> diff --git a/modules.d/95dasd_mod/module-setup.sh b/modules.d/95dasd_mod/module-setup.sh
> index 011010d..4546059 100755
> --- a/modules.d/95dasd_mod/module-setup.sh
> +++ b/modules.d/95dasd_mod/module-setup.sh
> @@ -23,6 +23,7 @@ installkernel() {
>  # called by dracut
>  install() {
>      inst_hook cmdline 31 "$moddir/parse-dasd-mod.sh"
> -    inst_multiple dasd_cio_free grep sed seq
> +    inst_multiple grep sed seq
> +    inst_multiple_optional dasd_cio_free
>  }
>  
> diff --git a/modules.d/95dasd_mod/parse-dasd-mod.sh b/modules.d/95dasd_mod/parse-dasd-mod.sh
> index 87c88ed..0236d12 100755
> --- a/modules.d/95dasd_mod/parse-dasd-mod.sh
> +++ b/modules.d/95dasd_mod/parse-dasd-mod.sh
> @@ -15,4 +15,6 @@ if [ -n "$mod_args" ]; then
>  fi
>  
>  unset dasd_arg
> -dasd_cio_free
> +if [ -x /sbin/dasd_cio_free ] ; then
> +    dasd_cio_free
> +fi
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional
       [not found]         ` <52973C68.8040504-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2013-11-28 12:53           ` Hannes Reinecke
  0 siblings, 0 replies; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-28 12:53 UTC (permalink / raw)
  To: Harald Hoyer; +Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/28/2013 01:51 PM, Harald Hoyer wrote:
> On 11/27/2013 04:44 PM, Hannes Reinecke wrote:
>> dasd_cio_free is a RedHat-specific tool, so make it optional.
>>
>> Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
>> ---
>>  dracut-functions.sh                    | 9 +++++++++
>>  modules.d/95dasd_mod/module-setup.sh   | 3 ++-
>>  modules.d/95dasd_mod/parse-dasd-mod.sh | 4 +++-
>>  3 files changed, 14 insertions(+), 2 deletions(-)
>>
>> diff --git a/dracut-functions.sh b/dracut-functions.sh
>> index 2872516..c2cf67a 100755
>> --- a/dracut-functions.sh
>> +++ b/dracut-functions.sh
>> @@ -741,6 +741,15 @@ inst_multiple() {
>>      return $ret
>>  }
>>  
>> +inst_multiple_optional() {
>> +    local ret
>> +        #dinfo "initdir=$initdir $DRACUT_INSTALL -l $@"
>> +    $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@"
>> +    ret=$?
>> +    (($ret != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} -o -a ${DRACUT_RESOLVE_DEPS:+-l}  ${DRACUT_FIPS_MODE:+-H} "$@" || :
>> +    return $ret
>> +}
>> +
> 
> 
> Why so complicated and not use "inst_multiple -o" ??
> Or, if you prefer inst_multiple_optional, replace all other occurences of
> "inst_multiple -o" with inst_multiple_optional also.
> 
Ah. Okay, will be doing it.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare-l3A5Bk7waGM@public.gmane.org			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 06/10] Install /bin/mount
       [not found]     ` <1385567061-13247-7-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
@ 2013-11-28 13:23       ` Hannes Reinecke
       [not found]         ` <529743C7.80906-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 15+ messages in thread
From: Hannes Reinecke @ 2013-11-28 13:23 UTC (permalink / raw)
  To: Harald Hoyer
  Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA,
	Hannes Reinecke

On 11/27/2013 04:44 PM, Hannes Reinecke wrote:
> systemd relies on /bin/mount to be present, so install it.
> 
> Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
> ---
>  modules.d/99fs-lib/module-setup.sh | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
> index 7979bab..b24207d 100755
> --- a/modules.d/99fs-lib/module-setup.sh
> +++ b/modules.d/99fs-lib/module-setup.sh
> @@ -85,4 +85,5 @@ install() {
>      fi
>  
>      inst_multiple -o $_helpers fsck
> +    inst /usr/bin/mount /bin/mount
>  }
> 
After much debate and soul-searching it was found that

a) /bin/mount is _REQUIRED_ to be present
b) dracut will only copy /usr/bin/mount

So if /bin is _not_ a symlink to /usr/bin, but the individual
programs are, /bin/mount doesn't find it's way into the initrd.
Nor do several other programs.

How to approach this fundamentally?
I would prefer to have 'inst' checking for symlinks, and copy them
over if required.
Adding them manually seems ineffectual to me.
But I'll do whatever is desired here ...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare-l3A5Bk7waGM@public.gmane.org			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 06/10] Install /bin/mount
       [not found]         ` <529743C7.80906-l3A5Bk7waGM@public.gmane.org>
@ 2013-11-28 14:08           ` Harald Hoyer
  0 siblings, 0 replies; 15+ messages in thread
From: Harald Hoyer @ 2013-11-28 14:08 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: Thomas Renninger, initramfs-u79uwXL29TY76Z2rM5mHXA

On 11/28/2013 02:23 PM, Hannes Reinecke wrote:
> On 11/27/2013 04:44 PM, Hannes Reinecke wrote:
>> systemd relies on /bin/mount to be present, so install it.
>>
>> Signed-off-by: Hannes Reinecke <hare-l3A5Bk7waGM@public.gmane.org>
>> ---
>>  modules.d/99fs-lib/module-setup.sh | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
>> index 7979bab..b24207d 100755
>> --- a/modules.d/99fs-lib/module-setup.sh
>> +++ b/modules.d/99fs-lib/module-setup.sh
>> @@ -85,4 +85,5 @@ install() {
>>      fi
>>  
>>      inst_multiple -o $_helpers fsck
>> +    inst /usr/bin/mount /bin/mount
>>  }
>>
> After much debate and soul-searching it was found that
> 
> a) /bin/mount is _REQUIRED_ to be present
> b) dracut will only copy /usr/bin/mount
> 
> So if /bin is _not_ a symlink to /usr/bin, but the individual
> programs are, /bin/mount doesn't find it's way into the initrd.
> Nor do several other programs.
> 
> How to approach this fundamentally?
> I would prefer to have 'inst' checking for symlinks, and copy them
> over if required.
> Adding them manually seems ineffectual to me.
> But I'll do whatever is desired here ...
> 
> Cheers,
> 
> Hannes
> 

Like already discussed, we should alter dracut-install to search all PATH
elements, instead of just taking the first one.

http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/install/dracut-install.c#n787

http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/install/dracut-install.c#n851

http://git.kernel.org/cgit/boot/dracut/dracut.git/tree/install/dracut-install.c#n883

Will do, and also cleanup dracut-install.c in the process.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-11-28 14:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-27 15:44 [PATCH 00/10] SUSE S/390 integration Hannes Reinecke
     [not found] ` <1385567061-13247-1-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
2013-11-27 15:44   ` [PATCH 01/10] 95dasd: Install kernel modules only once Hannes Reinecke
2013-11-27 15:44   ` [PATCH 02/10] 95dasd: Only install module if normalize_dasd_arg is present Hannes Reinecke
2013-11-27 15:44   ` [PATCH 03/10] 95dasd_mod: make dasd_cio_free optional Hannes Reinecke
     [not found]     ` <1385567061-13247-4-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
2013-11-28 12:51       ` Harald Hoyer
     [not found]         ` <52973C68.8040504-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-28 12:53           ` Hannes Reinecke
2013-11-27 15:44   ` [PATCH 04/10] 95zfcp: Make installation optional Hannes Reinecke
2013-11-27 15:44   ` [PATCH 05/10] 95znet: " Hannes Reinecke
2013-11-27 15:44   ` [PATCH 06/10] Install /bin/mount Hannes Reinecke
     [not found]     ` <1385567061-13247-7-git-send-email-hare-l3A5Bk7waGM@public.gmane.org>
2013-11-28 13:23       ` Hannes Reinecke
     [not found]         ` <529743C7.80906-l3A5Bk7waGM@public.gmane.org>
2013-11-28 14:08           ` Harald Hoyer
2013-11-27 15:44   ` [PATCH 07/10] Fixup keymap setting for openSUSE Hannes Reinecke
2013-11-27 15:44   ` [PATCH 08/10] Check for plymouth lib directories Hannes Reinecke
2013-11-27 15:44   ` [PATCH 09/10] Add DASD configuration for SuSE Hannes Reinecke
2013-11-27 15:44   ` [PATCH 10/10] Add zfcp scripts for SUSE Hannes Reinecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox