From: Michael Prokop Date: Mon, 31 May 2010 21:59:46 +0000 (+0200) Subject: console/serial bootoption: allow manually specifying speed settings. X-Git-Tag: v0.9.10~1 X-Git-Url: http://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=229c1272d15be52423ec2f6914d5664313501cac;hp=975698c289322e14b730adaae36a907b30fc251e console/serial bootoption: allow manually specifying speed settings. --- diff --git a/autoconfig.functions b/autoconfig.functions index c0c1111..f55b0d3 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -575,8 +575,33 @@ fi # activate serial console {{{ config_console(){ if checkbootparam 'console'; then - einfo "Bootoption for serial console detected, activating console login." - sed -i 's/^#grmlserial#//' /etc/inittab + einfo "Bootoption for serial console detected:" + + local serial="$(getbootparam console=ttyS)" + option="${serial##*,}" + + # default to: + local speed="115200,57600,38400,19200,9600,4800,2400,1200"; + # ... unless overriden by command line: + case "$option" in + 115200*) speed=115200 ;; + 57600*) speed=57600 ;; + 38400*) speed=38400 ;; + 19200*) speed=19200 ;; + 9600*) speed=9600 ;; + 4800*) speed=4800 ;; + 2400*) speed=2400 ;; + 1200*) speed=1200 ;; + esac + + eindent + einfo "Setting baud rate to ${speed}." + sed -i "s/%serialspeed%/$speed/" /etc/inittab ; eend $? + + einfo "Activating console login." + sed -i 's/^#grmlserial#//' /etc/inittab ; eend $? + eoutdent + /sbin/telinit q eend $? fi