[systemd-devel] controlling serial console using a token

Praveen kumar R praveenrgowda at gmail.com
Sun Apr 19 20:39:09 PDT 2015


This is the snippet of the code in the systemV init system that controls
the serial console login
depending on the token

 TOKENEXIST=`grep "TOKEN=" /proc/cmdline`
    TOKEN=0
    if [ "X$TOKENEXIST" != "X" ]; then
           #If token is pass as a command line arg, use it.
           TOKEN=`sed 's/.*TOKEN=//; s/ .*//' /proc/cmdline`
    fi

    TOKENOVERRIDE=`grep "TOKENOVERRIDE=" /proc/cmdline`
    if [ "X$TOKENOVERRIDE" != "X" ]; then
           #If token is pass as a command line arg, use it.
           OVERRIDE=`sed 's/.*TOKENOVERRIDE=//; s/ .*//' /proc/cmdline`
           let "TOKEN = $TOKEN & $OVERRIDE"
    fi

    echo "TOKEN = $TOKEN"

    let "CONSOLE_LOGIN = $TOKEN & 512"
    if [ $CONSOLE_LOGIN -ne 0 ];  then
        echo "[`eval $uptime`]: Begin Console Access"
        /etc/console_login &
        echo "eCM console is enabled"
        export ENABLE_ECM_CONSOLE=y
    else
        echo "[`eval $uptime`]: Token doesn't allow console access"
        export ENABLE_ECM_CONSOLE=n
    fi



I am trying to implement the same in the sytemd init system.


On Sun, Apr 19, 2015 at 11:48 AM, Andrei Borzenkov <arvidjaar at gmail.com>
wrote:

> В Sat, 18 Apr 2015 19:54:50 +0530
> Praveen kumar R <praveenrgowda at gmail.com> пишет:
>
> > Yes it's a kernel command line arg, it is board specific token introduced
> > to control the serial console.
> > if defined serial console should not be enabled.
> >
>
> Sorry I do not understand this sentence. "define" what? Please give
> exact example of kernel command line and explain what behavior you
> expect in this case.
>
> > we have this in place for other system initializing system - sytemV ,
> where
> > depending
> >
> > On Fri, Apr 17, 2015 at 4:24 PM, Lennart Poettering <
> lennart at poettering.net
> > <javascript:_e(%7B%7D,'cvml','lennart at poettering.net');>> wrote:
> >
> > > On Fri, 17.04.15 15:54, Praveen kumar R (praveenrgowda at gmail.com
> > > <javascript:_e(%7B%7D,'cvml','praveenrgowda at gmail.com');>) wrote:
> > >
> > > > I have a token passed on by command line argument on which I need to
> > > decide
> > > > to start the serial
> > >
> > > On which command line? Kernel command line? What kind of "token"?
> > >
> > > > console or not. I plan to tweak the getty*ttyS0.service and add the
> > > > script which validates the token and starts the console.
> > > >
> > > > Is this the right approach or is there any better way of handling it
> ??
> > >
> > > To get a login getty on the serial port its sufficient to add
> > > console=ttyS0... to the kernel cmdline. systemd automatically starts a
> > > serial getty automatically on the first terminal the kernel console is
> > > pointing to.
> > >
> > > Lennart
> > >
> > > --
> > > Lennart Poettering, Red Hat
> > >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150420/0cff9594/attachment.html>


More information about the systemd-devel mailing list