Commit 651392c6 authored by Natanael Copa's avatar Natanael Copa
Browse files

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
parent 9345e8f8
......@@ -358,6 +358,7 @@ for opt; do
console=*)
opt="${opt#*=}"
KOPT_consoles="${opt%%,*} $KOPT_consoles"
switch_root_opts="-c /dev/${opt%%,*}"
continue
;;
esac
......@@ -563,7 +564,7 @@ if [ -n "$KOPT_root" ]; then
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 @@ sync
[ "$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"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment