home: hub: mkinitfs

Download patch

ref: 651392c6c61b8066f8b5dcf27e8b5a36c38969c9
parent: 9345e8f8bfc14cc4b4edee07ad9ed804b94850ac
author: Natanael Copa <ncopa@alpinelinux.org>
date: Thu Apr 14 07:11:28 CDT 2022

init: make switch_root reopen stdio if console=hvc0 is set

The driver for the primary console might be compiled as a kernel module
in which case the primary console will not be available until modules
are loaded.

Fix openrc output by passing the console device to switch_root.

Fixes https://gitlab.alpinelinux.org/alpine/mkinitfs/-/merge_requests/99
Ref https://gitlab.alpinelinux.org/alpine/aports/-/issues/13677

--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -358,6 +358,7 @@
 	console=*)
 		opt="${opt#*=}"
 		KOPT_consoles="${opt%%,*} $KOPT_consoles"
+		switch_root_opts="-c /dev/${opt%%,*}"
 		continue
 		;;
 	esac
@@ -563,7 +564,7 @@
 		fi
 	done
 	sync
-	exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
+	exec /bin/busybox switch_root $switch_root_opts $sysroot $chart_init "$KOPT_init" $KOPT_init_args
 	echo "initramfs emergency recovery shell launched"
 	exec /bin/busybox sh
 fi
@@ -844,7 +845,7 @@
 
 [ "$KOPT_splash" = "init" ] && echo exit > $sysroot/$splashfile
 echo ""
-exec /bin/busybox switch_root $sysroot $chart_init "$KOPT_init" $KOPT_init_args
+exec /bin/busybox switch_root $switch_root_opts $sysroot $chart_init "$KOPT_init" $KOPT_init_args
 
 [ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
 echo "initramfs emergency recovery shell launched"