buildroot inittab getty

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

buildroot inittab getty

logos
This post was updated on .
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

Also, I have no post build script nor post image script.

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.

Reply | Threaded
Open this post in threaded view
|

Re: buildroot inittab getty

Thomas Petazzoni-2
Hello,

On Mon, 19 Oct 2015 15:45:41 -0700 (PDT), logos wrote:

> 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.

> 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@skate:~/projets/buildroot (master)$ grep GETTY .config
# BR2_TARGET_GENERIC_GETTY is not set
thomas@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

> 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.

> 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.

> 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
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
[hidden email]
http://lists.busybox.net/mailman/listinfo/buildroot
Reply | Threaded
Open this post in threaded view
|

Re: buildroot inittab getty

Chris Packham
On Tue, Oct 20, 2015 at 9:01 PM, Thomas Petazzoni
<[hidden email]> wrote:

> Hello,
>
> On Mon, 19 Oct 2015 15:45:41 -0700 (PDT), logos wrote:
>
>> 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.
>
>> 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@skate:~/projets/buildroot (master)$ grep GETTY .config
> # BR2_TARGET_GENERIC_GETTY is not set
> thomas@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
>
>> 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.
>
>> 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.
>
>> 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.

>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux, Kernel and Android engineering
> http://free-electrons.com
> _______________________________________________
> buildroot mailing list
> [hidden email]
> http://lists.busybox.net/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[hidden email]
http://lists.busybox.net/mailman/listinfo/buildroot