[RFC] procd: Use /dev/console for serial console if exists

Daniel Golle daniel at makrotopia.org
Sat Apr 24 14:54:26 BST 2021


On Sat, Apr 24, 2021 at 03:39:51AM -1000, Paul Spooren wrote:
> 
> On 4/24/21 1:01 AM, Gaurav Pathak wrote:
> > Modified inittab.c to use "/dev/console" as preferred console if exists.
> > 
> > Signed-off-by: Gaurav Pathak <gaurav.pathak at pantacor.com>
> > ---
> 
> Could you please elaborate why this is useful?

Container environments typically provide /dev/console PTY, hence it's
nice to be able to login on that console.

> 
> > Edited inittab.c to check and use "/dev/console" as the first
> > console device before parsing "/sys/class/tty/console/active".
> >   inittab.c | 8 +++++++-
> >   1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/inittab.c b/inittab.c
> > index 2c2270c..716bcee 100644
> > --- a/inittab.c
> > +++ b/inittab.c
> > @@ -190,7 +190,13 @@ static void askconsole(struct init_action *a)
> >   	 */
> >   	tty = get_cmdline_val("console", line, sizeof(line));
> >   	if (tty == NULL) {
> > -		tty = get_active_console(line, sizeof(line));
> > +                if (dev_exist("/dev/console")) {
> > +                        tty = "/dev/console";
> > +                }
> > +                else {
> > +                        tty = get_active_console(line, sizeof(line));
> > +                }
> > +
> >   	}
> >   	if (tty != NULL) {
> >   		split = strchr(tty, ',');
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list