summaryrefslogblamecommitdiff
path: root/legacy/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
blob: aef8293a12a2023ecb742c040f529c3442328a52 (plain) (tree)
































































































                                                                                       
From 7f77e0b383330265be27f551b2e384a6a8648afa Mon Sep 17 00:00:00 2001
From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
Date: Mon, 14 May 2018 10:14:29 -0500
Subject: [PATCH 2/3] initramfs-init: add disk and network detection on s390x

- Allow including dasd and qeth modules when building initramfs
- Add detection for dasd and qeth devices from cmdline in init
---
 Makefile                    |  7 ++++++-
 features.d/dasd_mod.modules |  1 +
 features.d/qeth.modules     |  1 +
 initramfs-init.in           | 21 ++++++++++++++++++++-
 4 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 features.d/dasd_mod.modules
 create mode 100644 features.d/qeth.modules

diff --git a/Makefile b/Makefile
index fc01d1a..40dc284 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,9 @@ CONF_FILES	:= mkinitfs.conf \
 		features.d/xfs.files \
 		features.d/xfs.modules \
 		features.d/zfs.files \
-		features.d/zfs.modules
+		features.d/zfs.modules \
+		features.d/qeth.modules \
+		features.d/dasd_mod.modules
 
 SCRIPTS		:= mkinitfs bootchartd initramfs-init
 IN_FILES	:= $(addsuffix .in,$(SCRIPTS))
@@ -71,6 +73,9 @@ SED_REPLACE	:= -e 's:@VERSION@:$(FULL_VERSION):g' \
 		-e 's:@datadir@:$(datadir):g'
 
 DEFAULT_FEATURES ?= ata base cdrom ext2 ext4 keymap kms mmc raid scsi usb virtio
+ifeq ($(shell uname -m), s390x)
+DEFAULT_FEATURES += qeth dasd_mod
+endif
 
 
 all:	$(SBIN_FILES) $(SCRIPTS) $(CONF_FILES)
diff --git a/features.d/dasd_mod.modules b/features.d/dasd_mod.modules
new file mode 100644
index 0000000..ce843c5
--- /dev/null
+++ b/features.d/dasd_mod.modules
@@ -0,0 +1 @@
+kernel/drivers/s390/block/dasd*
diff --git a/features.d/qeth.modules b/features.d/qeth.modules
new file mode 100644
index 0000000..bb5c320
--- /dev/null
+++ b/features.d/qeth.modules
@@ -0,0 +1 @@
+kernel/drivers/s390/net/qeth*
diff --git a/initramfs-init.in b/initramfs-init.in
index bf2d9bd..933c8c1 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -269,7 +269,7 @@ set -- $(cat /proc/cmdline)
 myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm cryptheader cryptoffset
 	cryptdiscards debug_init dma init_args keep_apk_new modules ovl_dev pkgs quiet
 	root_size root usbdelay ip alpine_repo apkovl alpine_start splash blacklist
-	overlaytmpfs rootfstype rootflags nbd resume"
+	overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd"
 
 for opt; do
 	case "$opt" in
@@ -345,6 +345,25 @@ mount -t devpts -o gid=5,mode=0620,noexec,nosuid devpts /dev/pts
 [ -d /dev/shm ] || mkdir /dev/shm
 mount -t tmpfs -o nodev,nosuid,noexec shm /dev/shm
 
+if [ -n "$dasd" ]; then
+	for mod in dasd_mod dasd_eckd_mod dasd_fba_mod; do
+		modprobe $mod
+	done
+	for _dasd in $(echo "$dasd" | tr ',' ' ' ); do
+		echo 1 > /sys/bus/ccw/devices/"${_dasd%%:*}"/online
+	done
+fi
+
+if [ "${s390x_net%%,*}" = "qeth_l2" ]; then
+	for mod in qeth qeth_l2 qeth_l3; do
+		modprobe $mod
+	done
+	_channel="${s390x_net#*,}"
+	echo "$_channel" > /sys/bus/ccwgroup/drivers/qeth/group
+	echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/layer2
+	echo 1 > /sys/bus/ccwgroup/drivers/qeth/"${_channel%%,*}"/online
+fi
+
 # load available drivers to get access to modloop media
 ebegin "Loading boot drivers"
 
-- 
2.17.0