aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/mkinitfs/0001-generate-mkinitfs.conf.patch49
-rw-r--r--main/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch97
-rw-r--r--main/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch121
-rw-r--r--main/mkinitfs/APKBUILD10
4 files changed, 275 insertions, 2 deletions
diff --git a/main/mkinitfs/0001-generate-mkinitfs.conf.patch b/main/mkinitfs/0001-generate-mkinitfs.conf.patch
new file mode 100644
index 0000000000..a556879d72
--- /dev/null
+++ b/main/mkinitfs/0001-generate-mkinitfs.conf.patch
@@ -0,0 +1,49 @@
+From 9e1b472701fa1785989f6757243a3d81e97944f2 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 14 May 2018 16:32:08 +0200
+Subject: [PATCH 1/3] generate mkinitfs.conf
+
+we may want have conditional default config depending on architecture
+---
+ Makefile | 7 +++++--
+ mkinitfs.conf | 2 --
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+ delete mode 100644 mkinitfs.conf
+
+diff --git a/Makefile b/Makefile
+index 68959fe..fc01d1a 100644
+--- a/Makefile
++++ b/Makefile
+@@ -70,12 +70,13 @@ SED_REPLACE := -e 's:@VERSION@:$(FULL_VERSION):g' \
+ -e 's:@sysconfdir@:$(sysconfdir):g' \
+ -e 's:@datadir@:$(datadir):g'
+
++DEFAULT_FEATURES ?= ata base cdrom ext2 ext4 keymap kms mmc raid scsi usb virtio
+
+
+-all: $(SBIN_FILES) $(SCRIPTS)
++all: $(SBIN_FILES) $(SCRIPTS) $(CONF_FILES)
+
+ clean:
+- rm -f $(SCRIPTS)
++ rm -f $(SCRIPTS) mkinitfs.conf
+
+ help:
+ @echo mkinitfs $(VERSION)
+@@ -116,3 +117,5 @@ install: $(SBIN_FILES) $(SHARE_FILES) $(CONF_FILES)
+ $(INSTALL) -D $$i $(DESTDIR)/usr/share/mkinitfs/$$i;\
+ done
+
++mkinitfs.conf:
++ echo 'features="$(DEFAULT_FEATURES)"' > $@
+diff --git a/mkinitfs.conf b/mkinitfs.conf
+deleted file mode 100644
+index 67a5444..0000000
+--- a/mkinitfs.conf
++++ /dev/null
+@@ -1,2 +0,0 @@
+-# run mkinitfs -L for a list of available features
+-features="ata base cdrom ext2 ext3 ext4 keymap kms mmc raid scsi usb virtio"
+--
+2.17.0
+
diff --git a/main/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch b/main/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
new file mode 100644
index 0000000000..aef8293a12
--- /dev/null
+++ b/main/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
@@ -0,0 +1,97 @@
+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
+
diff --git a/main/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch b/main/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch
new file mode 100644
index 0000000000..bcc4e0d493
--- /dev/null
+++ b/main/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch
@@ -0,0 +1,121 @@
+From 64be7028a529d940f81fda31a8e1dfa2281e4989 Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Mon, 21 May 2018 11:54:44 +0000
+Subject: [PATCH 3/3] initramfs-init: add support for ssh installer
+
+This commit allows starting 'firstboot' service (see aports/openrc),
+which will setup installation through SSH if specified in kernel
+parameters.
+
+Real wget is used instead since busybox's wget is broken without
+openssl binary #8917. Credits to clandmeter.
+
+- Allow adding DNS server in configure_ip()
+- Prefix kernel parameters with KOPT_
+---
+ initramfs-init.in | 37 ++++++++++++++++++++++++++++++++-----
+ 1 file changed, 32 insertions(+), 5 deletions(-)
+
+diff --git a/initramfs-init.in b/initramfs-init.in
+index 933c8c1..f33f010 100755
+--- a/initramfs-init.in
++++ b/initramfs-init.in
+@@ -183,6 +183,8 @@ configure_ip() {
+ local netmask="$4"
+ local device="$6"
+ local autoconf="$7"
++ local dns1="$8"
++ local dns2="$9"
+ case "$client_ip" in
+ off|none|'') return;;
+ dhcp) autoconf="dhcp";;
+@@ -209,6 +211,8 @@ configure_ip() {
+ ebegin "Setting IP ($device)..."
+ ip_set "$device" "$client_ip" "$netmask" "$gw_ip"
+ eend $?
++ [ -n "$dns1" ] && echo "nameserver $dns1" >> /etc/resolv.conf
++ [ -n "$dns2" ] && echo "nameserver $dns2" >> /etc/resolv.conf
+ fi
+ MAC_ADDRESS=$(cat /sys/class/net/$device/address)
+ }
+@@ -262,6 +266,19 @@ setup_nbd() {
+ [ "$n" != 0 ] || return 1
+ }
+
++# possible cmdline options which could have secure urls.
++# this does not include apkovl as it need to be fetched inside of initramfs
++need_wget() {
++ local opt= ret=1
++ for opt in modloop ssh_key; do
++ eval "opt=\$KOPT_$opt"
++ case "$opt" in
++ https://*|ftps://*) ret=0;;
++ esac
++ done
++ return $ret
++}
++
+ # read the kernel options. we need surve things like:
+ # acpi_osi="!Windows 2006" xen-pciback.hide=(01:00.0)
+ set -- $(cat /proc/cmdline)
+@@ -269,7 +286,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 s390x_net dasd"
++ overlaytmpfs rootfstype rootflags nbd resume s390x_net dasd ssh_key ssh_pass"
+
+ for opt; do
+ case "$opt" in
+@@ -345,20 +362,20 @@ 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
++if [ -n "$KOPT_dasd" ]; then
+ for mod in dasd_mod dasd_eckd_mod dasd_fba_mod; do
+ modprobe $mod
+ done
+- for _dasd in $(echo "$dasd" | tr ',' ' ' ); do
++ for _dasd in $(echo "$KOPT_dasd" | tr ',' ' ' ); do
+ echo 1 > /sys/bus/ccw/devices/"${_dasd%%:*}"/online
+ done
+ fi
+
+-if [ "${s390x_net%%,*}" = "qeth_l2" ]; then
++if [ "${KOPT_s390x_net%%,*}" = "qeth_l2" ]; then
+ for mod in qeth qeth_l2 qeth_l3; do
+ modprobe $mod
+ done
+- _channel="${s390x_net#*,}"
++ _channel="${KOPT_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
+@@ -540,6 +557,8 @@ if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
+ rc_add killprocs shutdown
+ rc_add savecache shutdown
+
++ rc_add firstboot default
++
+ rm -f "$sysroot/etc/.default_boot_services"
+ fi
+
+@@ -622,6 +641,14 @@ if [ "$KOPT_chart" = yes ]; then
+ pkgs="$pkgs acct"
+ fi
+
++# add openssh
++if [ -n "$KOPT_ssh_key" ] || [ -n "$KOPT_ssh_pass" ]; then
++ pkgs="$pkgs openssh"
++fi
++
++# add wget if using secure urls in cmdline
++need_wget && pkgs="$pkgs wget"
++
+ apkflags="--initramfs-diskless-boot --progress"
+ if [ -z "$ALPINE_REPO" ]; then
+ apkflags="$apkflags --no-network"
+--
+2.17.0
+
diff --git a/main/mkinitfs/APKBUILD b/main/mkinitfs/APKBUILD
index 7a356177ee..5da95da54e 100644
--- a/main/mkinitfs/APKBUILD
+++ b/main/mkinitfs/APKBUILD
@@ -2,7 +2,7 @@
pkgname=mkinitfs
pkgver=3.2.0
_ver=${pkgver%_git*}
-pkgrel=12
+pkgrel=13
pkgdesc="Tool to generate initramfs images for Alpine"
url="https://git.alpinelinux.org/cgit/mkinitfs"
arch="all"
@@ -21,6 +21,9 @@ source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$_ver.tar.xz
0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
0001-features-add-virtio_net-to-network-modules.patch
0001-features-virtio_net-depends-on-virtio_pci.patch
+ 0001-generate-mkinitfs.conf.patch
+ 0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
+ 0003-initramfs-init-add-support-for-ssh-installer.patch
"
builddir="$srcdir/$pkgname-$_ver"
@@ -39,4 +42,7 @@ f5c9b21e53c663dac1b8f33f929dbe067492f0dc1bd5ef5310ef531033f31fc3fa0b6de6dce03cec
4d298d73cc6e557c51de805721ef4b9f002498af5dd9f0aebfd6620ec84d1fadde76888bc2d40efc71dc0a8497aa0586ac65d596eb0021bfed633adcc3aca3b4 0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch
4387357cfcd3441c5d8777e42c0e62a73fa446aacd2faac081947afc39bdd8fb91e12b34f3b69a6827bd7d0705f54514b77c0ff4c38ee0d70553050117c42576 0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch
530a33638e7ba1faceed9a5cb0a2e08bec5d29d160a99730b7a2fb6c98f93a511908df8ab14cc47884397c9affee899a23896aab1c6c9073015ce077cc16552f 0001-features-add-virtio_net-to-network-modules.patch
-e5a6a25ea51b0ef16f525af20f8e44e64f5c4bb56f46b220151fc03cfa2c530ec55e2755a5dca766f9dad467815b5949bd22e029bcda89fbcef0d40bb3fd1a0f 0001-features-virtio_net-depends-on-virtio_pci.patch"
+e5a6a25ea51b0ef16f525af20f8e44e64f5c4bb56f46b220151fc03cfa2c530ec55e2755a5dca766f9dad467815b5949bd22e029bcda89fbcef0d40bb3fd1a0f 0001-features-virtio_net-depends-on-virtio_pci.patch
+3dfc39cf9c97ed63869b7d36f9c666b6d4d2250240ed64a6e827056e4fc0ed2d2cb03f63772761404e745fa57e8ea2e3157107c323866fa8f32f7195c0555770 0001-generate-mkinitfs.conf.patch
+92ef3fb695aa060ff4d7c682eead8eae0065c4e28dc155d233cfdbd6b7ac55d1d5ba0258e3f48fb47512acd8594a893c809c5b93ad7715c99a1697331c27491d 0002-initramfs-init-add-disk-and-network-detection-on-s39.patch
+64840c34d91549c6e68a22a6eb0093d84a53a78ebbe3f12287e0ccb0fabbb1bb7829ca246522e0bdfdb45c32b0afb598447dfc688f261911c3d1d48d55f05503 0003-initramfs-init-add-support-for-ssh-installer.patch"