rc: syscons: Add UEFI special case

Changing cursor, screenmap and setting blanktime doesn't work when booted
with vt(4) and UEFI so add a special case for those depending on machdep.bootmethods.
I have no way to test if this can work with vt(4) and bios boot so just in case
keep calling those for this.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38293
This commit is contained in:
Emmanuel Vadot 2023-01-31 11:26:36 +01:00
parent eac920e670
commit 3662862f55

View file

@ -50,8 +50,11 @@ _sc_config=
_sc_console=
_sc_initdone=
_sc_keymap_msg=
_sc_bootmethod=
sc_init()
{
local bootmethod
if [ -z "${_sc_initdone}" ]; then
if [ -z "${_sc_console}" ]; then
if [ x`sysctl -n kern.vty` = x"vt" ]; then
@ -61,6 +64,23 @@ sc_init()
fi
_sc_config="${_sc_console}"
fi
if [ -z "${_sc_bootmethod}" ]; then
bootmethod=$(sysctl -qn machdep.bootmethod)
case ${bootmethod} in
UEFI)
_sc_bootmethod="uefi"
;;
BIOS)
_sc_bootmethod="bios"
;;
PVH)
_sc_bootmethod="pvh"
;;
*)
_sc_bootmethod="uefi" # Default to UEFI
;;
esac
fi
echo -n "Configuring ${_sc_config}:"
_sc_initdone=yes
fi
@ -259,16 +279,8 @@ syscons_precmd()
return 0
}
syscons_start()
syscons_bios_start()
{
# keyboard
#
if [ -n "${keyboard}" ]; then
syscons_setkeyboard ${keyboard}
fi
syscons_configure_keyboard
# cursor type
#
case ${cursor} in
@ -291,6 +303,47 @@ syscons_start()
;;
esac
# blank time
#
case ${blanktime} in
[Nn][Oo] | '')
;;
*)
sc_init
echo -n ' blanktime'; vidcontrol < ${viddev} -t ${blanktime}
;;
esac
# screen saver
#
case ${saver} in
[Nn][Oo] | '')
;;
*)
sc_init
echo -n ' screensaver'
for i in `kldstat | awk '$5 ~ "_saver\.ko$" { print $5 }'`; do
kldunload ${i}
done
load_kld -e _saver ${saver}_saver
;;
esac
}
syscons_start()
{
# keyboard
#
if [ -n "${keyboard}" ]; then
syscons_setkeyboard ${keyboard}
fi
syscons_configure_keyboard
if [ "${_sc_bootmethod}" = "bios" ]; then
syscons_bios_start
fi
# font 8x16
#
case ${font8x16} in
@ -324,32 +377,6 @@ syscons_start()
;;
esac
# blank time
#
case ${blanktime} in
[Nn][Oo] | '')
;;
*)
sc_init
echo -n ' blanktime'; vidcontrol < ${viddev} -t ${blanktime}
;;
esac
# screen saver
#
case ${saver} in
[Nn][Oo] | '')
;;
*)
sc_init
echo -n ' screensaver'
for i in `kldstat | awk '$5 ~ "_saver\.ko$" { print $5 }'`; do
kldunload ${i}
done
load_kld -e _saver ${saver}_saver
;;
esac
# set this mode for all virtual screens
#
if [ -n "${allscreens_flags}" ]; then