Skip to contentSkip to conversation

buildroot inittab getty

Buildroot logos 3 participants 3 messages Oct 19, 2015 – Oct 20, 2015

lore
Share & tools
lore

logos

author
#0 lore raw

Hello,

I am a newbie here.
I had a question today and I tried find the answer in this forum. Failed apparently.
So I decided to post it here.

Buildroot version that I am using is "2015.02, Released March 1st, 2015"

In buildroot menuconfig, I didn't choose "Run a getty (login prompt) after boot",
but in my output/target/etc/inittab, I have this line, ttyS3::respawn:/sbin/getty -L ttyS3 57600 vt100 # GENERIC_SERIAL

system/skeleton/etc/inittab shows, #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

1. How can this happen? Why is the line uncommented? FYI, in my .config file I have
# BR2_TARGET_GENERIC_GETTY is not set

2. Why tty port has changed from ttyS0 to ttyS3?

3. If possible, I'd like to understand inittab file generation process.

4. Maybe this question doesn't belong here,
what option or parameter do I need to setup if I want to login without
typing login name and password after booting?
Currently I have to type "root" and hit enter. (no password setup for root)

Thanks for reading and appreciate any reply including directing me to right place to ask this question.

--
View this message in context: http://buildroot-busybox.2317881.n4.nabble.com/buildroot-inittab-getty-tp115526.html
Sent from the Buildroot (busybox) mailing list archive at Nabble.com.

#1 lore raw

Hello,

Quoted 9 lines · logos

In buildroot menuconfig, I didn't choose "Run a getty (login prompt) after boot",
but in my output/target/etc/inittab, I have this line, ttyS3::respawn:/sbin/getty -L ttyS3 57600 vt100 # GENERIC_SERIAL

system/skeleton/etc/inittab shows, #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

1. How can this happen? Why is the line uncommented?

The line gets uncommented if BR2_TARGET_GENERIC_GETTY=y. The logic doing this is in package/skeleton/skeleton.mk. It gets uncommented so that a getty process is started at boot time to prompt you for your login/password on the right serial port / terminal.

Quoted 2 lines

FYI, in my .config file I have
# BR2_TARGET_GENERIC_GETTY is not set

When BR2_TARGET_GENERIC_GETTY is disabled, it does not get uncommented, I just did a test build with the latest Buildroot:

thomas at skate:~/projets/buildroot (master)$ grep GETTY .config
# BR2_TARGET_GENERIC_GETTY is not set
thomas at skate:~/projets/buildroot (master)$ grep getty output/target/etc/inittab # Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

Quoted 1 line

2. Why tty port has changed from ttyS0 to ttyS3?

Because you have BR2_TARGET_GENERIC_GETTY=y in your configuration, and BR2_TARGET_GENERIC_GETTY_PORT="ttyS3". Or because you are using a custom rootfs skeleton that has a different /etc/inittab.

Quoted 1 line

3. If possible, I'd like to understand inittab file generation process.

1. The skeleton package gets installed. It copies system/skeleton/* to output/target/.

2. The busybox package gets installed. It copies package/busybox/inittab to output/target/etc/inittab.

3. The skeleton package has registered a "target finalize hook" called SKELETON_SYSTEM_GETTY that gets triggered at the very end of the build (after all packages have been built and installed, but before the root filesystem image is generated). This hook, implemented in package/skeleton/skeleton.mk, will tune the inittab by uncommenting the getty line and adjusting the serial port / terminal according to your configuration. This only happens if BR2_TARGET_GENERIC_GETTY=y.

See http://git.buildroot.net/buildroot/tree/package/skeleton/skeleton.mk#n139

Note that the logic in the older Buildroot you're using is different, since at the time, we didn't had a 'skeleton' package.

Quoted 4 lines

4. Maybe this question doesn't belong here,
what option or parameter do I need to setup if I want to login without
typing login name and password after booting?
Currently I have to type "root" and hit enter. (no password setup for root)

Just add a post-build script that tunes your inittab by adding a line that starts a shell.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw
Quoted 58 lines · Thomas Petazzoni

Hello,

Quoted 9 lines · logos

In buildroot menuconfig, I didn't choose "Run a getty (login prompt) after boot",
but in my output/target/etc/inittab, I have this line, ttyS3::respawn:/sbin/getty -L ttyS3 57600 vt100 # GENERIC_SERIAL

system/skeleton/etc/inittab shows, #ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

1. How can this happen? Why is the line uncommented?

The line gets uncommented if BR2_TARGET_GENERIC_GETTY=y. The logic doing this is in package/skeleton/skeleton.mk. It gets uncommented so that a getty process is started at boot time to prompt you for your login/password on the right serial port / terminal.

Quoted 2 lines

FYI, in my .config file I have
# BR2_TARGET_GENERIC_GETTY is not set

When BR2_TARGET_GENERIC_GETTY is disabled, it does not get uncommented, I just did a test build with the latest Buildroot:

thomas at skate:~/projets/buildroot (master)$ grep GETTY .config
# BR2_TARGET_GENERIC_GETTY is not set
thomas at skate:~/projets/buildroot (master)$ grep getty output/target/etc/inittab # Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 # GENERIC_SERIAL

Quoted 1 line

2. Why tty port has changed from ttyS0 to ttyS3?

Because you have BR2_TARGET_GENERIC_GETTY=y in your configuration, and BR2_TARGET_GENERIC_GETTY_PORT="ttyS3". Or because you are using a custom rootfs skeleton that has a different /etc/inittab.

Quoted 1 line

3. If possible, I'd like to understand inittab file generation process.

1. The skeleton package gets installed. It copies system/skeleton/* to output/target/.

2. The busybox package gets installed. It copies package/busybox/inittab to output/target/etc/inittab.

3. The skeleton package has registered a "target finalize hook" called SKELETON_SYSTEM_GETTY that gets triggered at the very end of the build (after all packages have been built and installed, but before the root filesystem image is generated). This hook, implemented in package/skeleton/skeleton.mk, will tune the inittab by uncommenting the getty line and adjusting the serial port / terminal according to your configuration. This only happens if BR2_TARGET_GENERIC_GETTY=y.

See http://git.buildroot.net/buildroot/tree/package/skeleton/skeleton.mk#n139

Note that the logic in the older Buildroot you're using is different, since at the time, we didn't had a 'skeleton' package.

Quoted 7 lines
Quoted 4 lines

4. Maybe this question doesn't belong here,
what option or parameter do I need to setup if I want to login without
typing login name and password after booting?
Currently I have to type "root" and hit enter. (no password setup for root)

Just add a post-build script that tunes your inittab by adding a line that starts a shell.

Adding '-n -l /bin/sh' to the command should take you straight to a shell instead of invoking login.

Quoted 12 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot