Discussion:
[Buildroot] Run getty on multiple ttys and Box-drawing character
MOHAMMAD RASIM
2018-06-22 16:37:59 UTC
Permalink
Hi
I'm running buildroot-2018.02.3 on an arm64 board from initrd and have a
couple of questions:

1- How can I set buildroot to run getty on multiple ttys. the standard
BR2_TARGET_GENERIC_GETTY doesn't accept multiple ttys to be set, I normally
edit output/target/etc/inittab and add the other tty. So is this the
standard way of adding a tty or is there some setting I'm missing?
also, there is an official kernel parameter called console that can be used
to set up gettys, so for example, if I run Ubuntu initramfs I can pass the
following arguments to the kernel:

console=ttyS0,115200n8 console=tty0

and so the initramfs run a getty on each tty I passed, so why doesn't
buildroot use these values to run gettys?

2- I'm running a python script that uses curses library to display a box on
the framebuffer, the problem is that the box doesn't show with the box
drawing characters <https://en.wikipedia.org/wiki/Box-drawing_character>
instead the borders are shown as letters. so what do I need to enable?
I've already added en_US.UTF-8 to BR2_GENERATE_LOCALE but still I don't get
the box characters.
Peter Korsgaard
2018-06-22 17:53:41 UTC
Permalink
Post by MOHAMMAD RASIM
Hi
I'm running buildroot-2018.02.3 on an arm64 board from initrd and have a
1- How can I set buildroot to run getty on multiple ttys. the standard
BR2_TARGET_GENERIC_GETTY doesn't accept multiple ttys to be set, I normally
edit output/target/etc/inittab and add the other tty. So is this the
standard way of adding a tty or is there some setting I'm missing?
Yes, either that or do the inittab modification in a post-build
script. Have a look at board/raspberrypi/post-build.sh for an example.

These options are really just convenience options to cover the common
use cases, they will not fit for all use cases.
Post by MOHAMMAD RASIM
also, there is an official kernel parameter called console that can be used
to set up gettys, so for example, if I run Ubuntu initramfs I can pass the
console=ttyS0,115200n8 console=tty0
and so the initramfs run a getty on each tty I passed, so why doesn't
buildroot use these values to run gettys?
How would you implement this in the busybox inittab?
Post by MOHAMMAD RASIM
2- I'm running a python script that uses curses library to display a box on
the framebuffer, the problem is that the box doesn't show with the box
drawing characters <https://en.wikipedia.org/wiki/Box-drawing_character>
instead the borders are shown as letters. so what do I need to enable?
I've already added en_US.UTF-8 to BR2_GENERATE_LOCALE but still I don't get
the box characters.
Maybe play with your TERM settings? The default value is vt100, which
may not support the specific box drawing characters.
--
Bye, Peter Korsgaard
MOHAMMAD RASIM
2018-06-23 00:25:43 UTC
Permalink
Yes, I've already set up a post-build script that modifies the inittab,
didn't know about the raspberrypi script, could have saved me some time :(

I have two Ideas that can be used for tty:
1- make a startup script in /etc/init.d/ that parses the /proc/cmdline and
start gettys accordingly, I've tried it and it works but obviously, It's
not the right way to do these things(no respawning).

2- in the /init script after mounting devtmpfs and before running (exec
/sbin/init "$@") we add the same code from the post-build script that
parses /proc/cmdline and adds ttys to /etc/inittab (Didn't try this but
seems like the right way to do it).

As for the TERM settings I've set up my TERM to 'xterm-256color' which is
the most capable terminal I know and the characters don't show.
I don't think the problem is related to the terminal, instead, I think It
has something to do with charset and character encoding .

PS: sorry if the message is duplicated, this is the first time I deal with
mailing lists.
Post by MOHAMMAD RASIM
Post by MOHAMMAD RASIM
Hi
I'm running buildroot-2018.02.3 on an arm64 board from initrd and
have a
Post by MOHAMMAD RASIM
1- How can I set buildroot to run getty on multiple ttys. the standard
BR2_TARGET_GENERIC_GETTY doesn't accept multiple ttys to be set, I
normally
Post by MOHAMMAD RASIM
edit output/target/etc/inittab and add the other tty. So is this the
standard way of adding a tty or is there some setting I'm missing?
Yes, either that or do the inittab modification in a post-build
script. Have a look at board/raspberrypi/post-build.sh for an example.
These options are really just convenience options to cover the common
use cases, they will not fit for all use cases.
Post by MOHAMMAD RASIM
also, there is an official kernel parameter called console that can be
used
Post by MOHAMMAD RASIM
to set up gettys, so for example, if I run Ubuntu initramfs I can pass
the
Post by MOHAMMAD RASIM
console=ttyS0,115200n8 console=tty0
and so the initramfs run a getty on each tty I passed, so why doesn't
buildroot use these values to run gettys?
How would you implement this in the busybox inittab?
Post by MOHAMMAD RASIM
2- I'm running a python script that uses curses library to display a
box on
Post by MOHAMMAD RASIM
the framebuffer, the problem is that the box doesn't show with the box
drawing characters <https://en.wikipedia.org/wiki/Box-drawing_character
instead the borders are shown as letters. so what do I need to enable?
I've already added en_US.UTF-8 to BR2_GENERATE_LOCALE but still I don't
get
Post by MOHAMMAD RASIM
the box characters.
Maybe play with your TERM settings? The default value is vt100, which
may not support the specific box drawing characters.
--
Bye, Peter Korsgaard
Carlos Santos
2018-06-24 13:56:42 UTC
Permalink
Sent: Friday, June 22, 2018 9:25:43 PM
Subject: Re: [Buildroot] Run getty on multiple ttys and Box-drawing character
Yes, I've already set up a post-build script that modifies the inittab, didn't
know about the raspberrypi script, could have saved me some time :(
1- make a startup script in /etc/init.d/ that parses the /proc/cmdline and start
gettys accordingly, I've tried it and it works but obviously, It's not the
right way to do these things(no respawning).
2- in the /init script after mounting devtmpfs and before running (exec
/proc/cmdline and adds ttys to /etc/inittab (Didn't try this but seems like the
right way to do it).
This works but is a bit dangerous. If the script fails to parse cmdline
you may get system on which you can not log in. Ensure that you have an
inittab file with least a line containing something like this

cons::respawn:/sbin/getty -L console 115200 vt100

(or the corresponding one for BusyBox init).

Notice also that /init is a script only when rootfs is in a cpio
archive, which is selected along with initrd, but not for other
rootfs configurations.
As for the TERM settings I've set up my TERM to 'xterm-256color' which is the
most capable terminal I know and the characters don't show.
I don't think the problem is related to the terminal, instead, I think It has
something to do with charset and character encoding .
Are you using a terminal emulator (e.g. PuTTY) to access the console?
If yes, check its character encoding configuration.
--
Carlos Santos (Casantos) - DATACOM, P&D
“Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.” — Epitaph of a volunteer
MOHAMMAD RASIM
2018-06-25 19:30:06 UTC
Permalink
Post by Carlos Santos
Sent: Friday, June 22, 2018 9:25:43 PM
Subject: Re: [Buildroot] Run getty on multiple ttys and Box-drawing character
Yes, I've already set up a post-build script that modifies the inittab, didn't
know about the raspberrypi script, could have saved me some time :(
1- make a startup script in /etc/init.d/ that parses the /proc/cmdline and start
gettys accordingly, I've tried it and it works but obviously, It's not the
right way to do these things(no respawning).
2- in the /init script after mounting devtmpfs and before running (exec
/proc/cmdline and adds ttys to /etc/inittab (Didn't try this but seems like the
right way to do it).
This works but is a bit dangerous. If the script fails to parse cmdline
you may get system on which you can not log in. Ensure that you have an
inittab file with least a line containing something like this
cons::respawn:/sbin/getty -L console 115200 vt100
(or the corresponding one for BusyBox init).
Notice also that /init is a script only when rootfs is in a cpio
archive, which is selected along with initrd, but not for other
rootfs configurations.
As for the TERM settings I've set up my TERM to 'xterm-256color' which is the
most capable terminal I know and the characters don't show.
I don't think the problem is related to the terminal, instead, I think It has
something to do with charset and character encoding .
Are you using a terminal emulator (e.g. PuTTY) to access the console?
If yes, check its character encoding configuration.
No, I'm not using PuTTY, I'm running the script in the
framebuffer(/dev/console).
Actually the problem only appears when running from the framebuffer, if
I ssh to the system and run the script I can see the box drawing
normally (because I'm using a terminal emulator, e.g gnome-terminal).
Loading...