Start agetty on kernel cmdline-provided console

This makes interactive installations over serial consoles possible with
nothing more than specifying the console= kernel parameter.

Changed inittab id "s0" -> "z0" to avoid conflict with line ttyS0. (Gerardo)

Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
This commit is contained in:
Simo Leone 2011-03-03 02:53:02 -08:00 committed by Gerardo Exequiel Pozzi
parent daf622d948
commit d812cc131e

View File

@ -86,11 +86,32 @@ do_fix_perms ()
stat_done stat_done
} }
# If an alternate console was specified on the kernel command line,
# start agetty on it too.
do_special_console()
{
cmdline_console="$(kernel_cmdline console)"
[ $? -ne 0 ] && return
dev="${cmdline_console%%,*}"
args="${cmdline_console##*,}"
baud="${args%%[neo]*}" && baud="${baud:-"9600"}"
[ "x${args}" != "x${args%%r}" ] && rts="-h"
stat_busy "Starting agetty on console: ${cmdline_console}"
echo "${dev}" >> /etc/securetty
echo "z0:2345:respawn:/sbin/agetty ${rts} ${baud} ${dev} linux" >> /etc/inittab
/sbin/telinit q
stat_done
}
case "$1" in case "$1" in
start) start)
do_locale_gen do_locale_gen
do_makeuser do_makeuser
do_fix_perms do_fix_perms
do_special_console
;; ;;
esac esac
exit 0 exit 0