From 6f3a6da561a3e1a6cdb1aa4765610773e13c2dca Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 7 Jun 2018 22:29:03 -0500 Subject: system/mkinitfs: new package --- ...eatures-add-virtio_net-to-network-modules.patch | 21 ++++ ...features-virtio_net-depends-on-virtio_pci.patch | 23 ++++ system/mkinitfs/0001-generate-mkinitfs.conf.patch | 49 +++++++++ ...fs-do-not-relocate-mountpoint-for-netboot.patch | 28 +++++ ...fs-add-primitive-support-for-LUKS2-contai.patch | 31 ++++++ .../0001-skip-hooks-on-diskless-install.patch | 30 +++++ ...nit-add-disk-and-network-detection-on-s39.patch | 97 +++++++++++++++++ ...tramfs-init-add-support-for-ssh-installer.patch | 121 +++++++++++++++++++++ system/mkinitfs/APKBUILD | 48 ++++++++ system/mkinitfs/mkinitfs.post-install | 8 ++ system/mkinitfs/mkinitfs.post-upgrade | 1 + system/mkinitfs/mkinitfs.pre-upgrade | 13 +++ system/mkinitfs/mkinitfs.trigger | 33 ++++++ 13 files changed, 503 insertions(+) create mode 100644 system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch create mode 100644 system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch create mode 100644 system/mkinitfs/0001-generate-mkinitfs.conf.patch create mode 100644 system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch create mode 100644 system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch create mode 100644 system/mkinitfs/0001-skip-hooks-on-diskless-install.patch create mode 100644 system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch create mode 100644 system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch create mode 100644 system/mkinitfs/APKBUILD create mode 100644 system/mkinitfs/mkinitfs.post-install create mode 120000 system/mkinitfs/mkinitfs.post-upgrade create mode 100644 system/mkinitfs/mkinitfs.pre-upgrade create mode 100644 system/mkinitfs/mkinitfs.trigger (limited to 'system') diff --git a/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch b/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch new file mode 100644 index 000000000..012738163 --- /dev/null +++ b/system/mkinitfs/0001-features-add-virtio_net-to-network-modules.patch @@ -0,0 +1,21 @@ +From d15cc41a7892d48f8255225003a89b91f0c13349 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter +Date: Sun, 29 Apr 2018 11:15:18 +0000 +Subject: [PATCH] features: add virtio_net to network modules + +--- + features.d/network.modules | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/features.d/network.modules b/features.d/network.modules +index 311df0b..caa37a8 100644 +--- a/features.d/network.modules ++++ b/features.d/network.modules +@@ -2,3 +2,4 @@ kernel/drivers/net/ethernet + kernel/net/packet/af_packet.ko + kernel/drivers/net/hyperv + kernel/drivers/net/vmxnet3 ++kernel/drivers/net/virtio_net* +-- +2.17.0 + diff --git a/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch b/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch new file mode 100644 index 000000000..8b01d294a --- /dev/null +++ b/system/mkinitfs/0001-features-virtio_net-depends-on-virtio_pci.patch @@ -0,0 +1,23 @@ +From 56d4208345b8da08ada6e6176a0a46cf94f89516 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter +Date: Sun, 29 Apr 2018 21:14:36 +0000 +Subject: [PATCH] features: virtio_net depends on virtio_pci + +--- + features.d/network.modules | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/features.d/network.modules b/features.d/network.modules +index caa37a8..e4f084c 100644 +--- a/features.d/network.modules ++++ b/features.d/network.modules +@@ -2,4 +2,5 @@ kernel/drivers/net/ethernet + kernel/net/packet/af_packet.ko + kernel/drivers/net/hyperv + kernel/drivers/net/vmxnet3 +-kernel/drivers/net/virtio_net* ++kernel/drivers/virtio/virtio_pci.ko ++kernel/drivers/net/virtio_net.ko +-- +2.17.0 + diff --git a/system/mkinitfs/0001-generate-mkinitfs.conf.patch b/system/mkinitfs/0001-generate-mkinitfs.conf.patch new file mode 100644 index 000000000..a556879d7 --- /dev/null +++ b/system/mkinitfs/0001-generate-mkinitfs.conf.patch @@ -0,0 +1,49 @@ +From 9e1b472701fa1785989f6757243a3d81e97944f2 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +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/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch b/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch new file mode 100644 index 000000000..e6e580a14 --- /dev/null +++ b/system/mkinitfs/0001-initramfs-do-not-relocate-mountpoint-for-netboot.patch @@ -0,0 +1,28 @@ +From 1d115251816a3f83a008883f1b9665c3d8f4d3a4 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter +Date: Tue, 20 Feb 2018 10:18:11 +0000 +Subject: [PATCH] initramfs: do not relocate mountpoint for netboot + +mountpoint cannot be located when repo is external. +--- + initramfs-init.in | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/initramfs-init.in b/initramfs-init.in +index 95fcd97..bf2d9bd 100755 +--- a/initramfs-init.in ++++ b/initramfs-init.in +@@ -221,6 +221,10 @@ relocate_mount() { + return + fi + while read dir; do ++ # skip http(s)/ftp repos for netboot ++ if ! [ -d "$dir" ]; then ++ continue ++ fi + local dev=$(df -P "$dir" | tail -1 | awk '{print $1}') + local mnt=$(find_mnt $dev $fstab) + if [ -n "$mnt" ]; then +-- +2.16.1 + diff --git a/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch b/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch new file mode 100644 index 000000000..7681be46b --- /dev/null +++ b/system/mkinitfs/0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch @@ -0,0 +1,31 @@ +From 15e312961e1bc86da98f2d3dc1d43331bd6f98f7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=B6ren=20Tempel?= +Date: Sat, 20 Jan 2018 00:50:15 +0100 +Subject: [PATCH] nlplug-findfs: add primitive support for LUKS2 containers + +Since we previously specified an explicit request_type for the +crypt_load() function nlplug-findfs couldn't open LUKS2 containers. By +using CRYPT_LUKS crypt_load accepts any known LUKUS container format. + +We could add an additional command line flag to nlplug-finds for +specifying the request_type but I guess this is good enough for now. +--- + nlplug-findfs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nlplug-findfs.c b/nlplug-findfs.c +index be525cc..7fb5468 100644 +--- a/nlplug-findfs.c ++++ b/nlplug-findfs.c +@@ -582,7 +582,7 @@ static void *cryptsetup_thread(void *data) + goto notify_out; + } + +- r = crypt_load(cd, CRYPT_LUKS1, params); ++ r = crypt_load(cd, CRYPT_LUKS, params); + if (r < 0) { + warnx("crypt_load(%s)", data_devnode); + goto free_out; +-- +2.15.0 + diff --git a/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch b/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch new file mode 100644 index 000000000..a20ebc200 --- /dev/null +++ b/system/mkinitfs/0001-skip-hooks-on-diskless-install.patch @@ -0,0 +1,30 @@ +From 0bd97e8aef5208bc92c3e72049f7fea198a90bd1 Mon Sep 17 00:00:00 2001 +From: Henrik Riomar +Date: Mon, 8 Jan 2018 16:37:44 +0100 +Subject: [PATCH] skip hooks on diskless install + +We can not run hooks before musl and busybox is installed. + +Use the new flag --initramfs-diskless-boot in order to skip hooks. +This flag also implies --initdb and the relevant --force flags for +initramfs diskless boot. +--- + initramfs-init.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/initramfs-init.in b/initramfs-init.in +index f3a3ee5..7c78c58 100755 +--- a/initramfs-init.in ++++ b/initramfs-init.in +@@ -598,7 +598,7 @@ if [ "$KOPT_chart" = yes ]; then + pkgs="$pkgs acct" + fi + +-apkflags="--initdb --progress --force" ++apkflags="--initramfs-diskless-boot --progress" + if [ -z "$ALPINE_REPO" ]; then + apkflags="$apkflags --no-network" + else +-- +2.15.0 + diff --git a/system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch b/system/mkinitfs/0002-initramfs-init-add-disk-and-network-detection-on-s39.patch new file mode 100644 index 000000000..aef8293a1 --- /dev/null +++ b/system/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" +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/system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch b/system/mkinitfs/0003-initramfs-init-add-support-for-ssh-installer.patch new file mode 100644 index 000000000..bcc4e0d49 --- /dev/null +++ b/system/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" +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/system/mkinitfs/APKBUILD b/system/mkinitfs/APKBUILD new file mode 100644 index 000000000..ecb51abeb --- /dev/null +++ b/system/mkinitfs/APKBUILD @@ -0,0 +1,48 @@ +# Maintainer: +pkgname=mkinitfs +pkgver=3.2.0 +_ver=${pkgver%_git*} +pkgrel=14 +pkgdesc="Tool to generate initramfs images for Alpine" +url="https://git.alpinelinux.org/cgit/mkinitfs" +arch="all" +license="GPL-2.0" +# currently we do not ship any testsuite +options="!check" +makedepends_build="" +makedepends_host="busybox kmod-dev util-linux-dev cryptsetup-dev linux-headers" +makedepends="$makedepends_build $makedepends_host" +depends="busybox>=1.28.2-r1 apk-tools>=2.9.1 lddtree>=1.25" +install="$pkgname.pre-upgrade $pkgname.post-install $pkgname.post-upgrade" +triggers="$pkgname.trigger=/usr/share/kernel/*" +source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$_ver.tar.xz + 0001-skip-hooks-on-diskless-install.patch + 0001-nlplug-findfs-add-primitive-support-for-LUKS2-contai.patch + 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" + +build() { + cd "$builddir" + make VERSION=$pkgver-r$pkgrel +} + +package() { + cd "$builddir" + make install DESTDIR="$pkgdir" +} + +sha512sums="906bfbce677d4ece9c9fea7b2a529121740bc9d96ea011be083303cc5c56162f09271b0a673e9e335234ccf2f293109bda1eda333698a95357d0772c86f498af mkinitfs-3.2.0.tar.xz +f5c9b21e53c663dac1b8f33f929dbe067492f0dc1bd5ef5310ef531033f31fc3fa0b6de6dce03cecaf90b8ed47b278d0f1f7c64dbbeede7621c895ee3ea79864 0001-skip-hooks-on-diskless-install.patch +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 +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" diff --git a/system/mkinitfs/mkinitfs.post-install b/system/mkinitfs/mkinitfs.post-install new file mode 100644 index 000000000..a2a404b09 --- /dev/null +++ b/system/mkinitfs/mkinitfs.post-install @@ -0,0 +1,8 @@ +#!/bin/sh + +# safety. if nlplug-findfs is missing in the initramfs image we may end up +# with an unbootable system. + +if ! grep -q -w /sbin/nlplug-findfs /etc/mkinitfs/features.d/base.files; then + echo "/sbin/nlplug-findfs" >> /etc/mkinitfs/features.d/base.files +fi diff --git a/system/mkinitfs/mkinitfs.post-upgrade b/system/mkinitfs/mkinitfs.post-upgrade new file mode 120000 index 000000000..78caf2e57 --- /dev/null +++ b/system/mkinitfs/mkinitfs.post-upgrade @@ -0,0 +1 @@ +mkinitfs.post-install \ No newline at end of file diff --git a/system/mkinitfs/mkinitfs.pre-upgrade b/system/mkinitfs/mkinitfs.pre-upgrade new file mode 100644 index 000000000..0ece527f9 --- /dev/null +++ b/system/mkinitfs/mkinitfs.pre-upgrade @@ -0,0 +1,13 @@ +#!/bin/sh + +mkdir -p /etc/mkinitfs/features.d +for i in files modules; do + for j in /etc/mkinitfs/$i.d/*; do + [ -e "$j" ] || continue + case "$j" in + *.apk-new) continue;; + esac + mv $j /etc/mkinitfs/features.d/${j##*/}.$i + done +done +exit 0 diff --git a/system/mkinitfs/mkinitfs.trigger b/system/mkinitfs/mkinitfs.trigger new file mode 100644 index 000000000..e8acc9785 --- /dev/null +++ b/system/mkinitfs/mkinitfs.trigger @@ -0,0 +1,33 @@ +#!/bin/sh + +for i in "$@"; do + # get last element in path + flavor=${i##*/} + if ! [ -f "$i"/kernel.release ]; then + # kernel was uninstalled + rm -f $( readlink -f /boot/initramfs-$flavor ) \ + /boot/initramfs-$flavor /boot/vmlinuz-$flavor \ + /boot/$flavor /boot/$flavor.gz /$flavor /$flavor.gz + continue + fi + abi_release=$(cat "$i"/kernel.release) + initfs=initramfs-$flavor + mkinitfs -o /boot/$initfs $abi_release +done + +# extlinux will use path relative partition, so if /boot is on a +# separate partition we want /boot/ resolve to / +if ! [ -e /boot/boot ]; then + ln -sf . /boot/boot +fi + +# cleanup unused initramfs +for i in /boot/initramfs-[0-9]*; do + [ -f $i ] || continue + if ! [ -f /boot/vmlinuz-${i#/boot/initramfs-} ]; then + rm "$i" + fi +done + +sync +exit 0 -- cgit v1.2.3-60-g2f50