mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] console_name for systemd based systems
@ 2012-03-28  9:09 Alexander Dahl
  2012-03-28  9:26 ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Dahl @ 2012-03-28  9:09 UTC (permalink / raw)
  To: PTXdist Developer Mailinglist

Hei hei, 

moving along with systemd integration I came across an issue where I'm
not sure how to integrate this nicely into ptxdist. Let me explain how
this works for busysbox init at the moment:

There's PTXCONF_CONSOLE_NAME in platformconfig. For our project it has
the value /dev/ttyS0 because the target has no graphics system but just
a serial console. For busybox this is put to /etc/inittab around line 41
of rules/initmethod-bbinit.make:

 40     @$(call install_replace, initmethod-bbinit, /etc/inittab, \
 41         @CONSOLE@, $(PTXCONF_CONSOLE_NAME))

The resulting line in /etc/inittab:

 console::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100

Now systemd has no inittab anymore. There are two services for getty:

 # ls /lib/systemd/system/*tty*
 /lib/systemd/system/getty@.service  
 /lib/systemd/system/serial-getty@.service

The first one is used for /dev/tty*, the second for /dev/ttyS* or any
other serial console (/dev/ttyUSB0 would be possible as well). These are
activated by setting a symlink at the appropriate place, a quick 'n
dirty solution ignoring PTXCONF_CONSOLE_NAME looks like this:

 255     # FIXME there's $(PTXCONF_CONSOLE_NAME) in platformconfig.
Would be
 256     #       nice to get this by some magic
 257     @$(call install_link, myrootfs, \
 258         /lib/systemd/system/serial-getty@.service, \
 259        
/etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service)

For integrating this into ptxdist, especially in
rules/initmethod-systemd.*, there would be some magic needed guessing
which service to pick based on which device is configured in
PTXCONF_CONSOLE_NAME. Any ideas on this?

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28  9:09 [ptxdist] console_name for systemd based systems Alexander Dahl
@ 2012-03-28  9:26 ` Michael Olbrich
  2012-03-28 10:25   ` Alexander Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2012-03-28  9:26 UTC (permalink / raw)
  To: ptxdist

Hi,

On Wed, Mar 28, 2012 at 11:09:55AM +0200, Alexander Dahl wrote:
> moving along with systemd integration I came across an issue where I'm
> not sure how to integrate this nicely into ptxdist. Let me explain how
> this works for busysbox init at the moment:
> 
> There's PTXCONF_CONSOLE_NAME in platformconfig. For our project it has
> the value /dev/ttyS0 because the target has no graphics system but just
> a serial console. For busybox this is put to /etc/inittab around line 41
> of rules/initmethod-bbinit.make:
> 
>  40     @$(call install_replace, initmethod-bbinit, /etc/inittab, \
>  41         @CONSOLE@, $(PTXCONF_CONSOLE_NAME))
> 
> The resulting line in /etc/inittab:
> 
>  console::respawn:/sbin/getty -L 115200 /dev/ttyS0 vt100
> 
> Now systemd has no inittab anymore. There are two services for getty:
> 
>  # ls /lib/systemd/system/*tty*
>  /lib/systemd/system/getty@.service  
>  /lib/systemd/system/serial-getty@.service
> 
> The first one is used for /dev/tty*, the second for /dev/ttyS* or any
> other serial console (/dev/ttyUSB0 would be possible as well). These are
> activated by setting a symlink at the appropriate place, a quick 'n
> dirty solution ignoring PTXCONF_CONSOLE_NAME looks like this:
> 
>  255     # FIXME there's $(PTXCONF_CONSOLE_NAME) in platformconfig.
> Would be
>  256     #       nice to get this by some magic
>  257     @$(call install_link, myrootfs, \
>  258         /lib/systemd/system/serial-getty@.service, \
>  259        
> /etc/systemd/system/getty.target.wants/serial-getty@ttyS0.service)
> 
> For integrating this into ptxdist, especially in
> rules/initmethod-systemd.*, there would be some magic needed guessing
> which service to pick based on which device is configured in
> PTXCONF_CONSOLE_NAME. Any ideas on this?

I've never needed that with systemd. By default systemd will add such a
dependency for the tty the kernel uses for it's output. So if you boot with
"console=/dev/ttyS0" in the kernel commandline you should get a getty on
ttyS0.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28  9:26 ` Michael Olbrich
@ 2012-03-28 10:25   ` Alexander Dahl
  2012-03-28 10:44     ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Dahl @ 2012-03-28 10:25 UTC (permalink / raw)
  To: ptxdist

Hei Michael, 

Am 2012-03-28 11:26, schrieb Michael Olbrich:
> I've never needed that with systemd. By default systemd will add such a
> dependency for the tty the kernel uses for it's output. So if you boot with
> "console=/dev/ttyS0" in the kernel commandline you should get a getty on
> ttyS0.

I didn't get a serial getty without the symlink mentioned. The cmdline
is (shortened):

 $ cat /proc/cmdline
 console=ttyS0,115200

The kernel does output to the serial console, I see all boot messages,
but I do not have a getty then. So maybe systemd does not recognize this
parameter format. I will play a little with the bootloader later to see
if that's the case.

On the other hand I have still problems with systemd-logind, maybe this
prevents correct loading. Do you have special settings for this one?

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28 10:25   ` Alexander Dahl
@ 2012-03-28 10:44     ` Michael Olbrich
  2012-03-28 11:02       ` Alexander Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2012-03-28 10:44 UTC (permalink / raw)
  To: ptxdist

Hi,

On Wed, Mar 28, 2012 at 12:25:40PM +0200, Alexander Dahl wrote:
> Am 2012-03-28 11:26, schrieb Michael Olbrich:
> > I've never needed that with systemd. By default systemd will add such a
> > dependency for the tty the kernel uses for it's output. So if you boot with
> > "console=/dev/ttyS0" in the kernel commandline you should get a getty on
> > ttyS0.
> 
> I didn't get a serial getty without the symlink mentioned. The cmdline
> is (shortened):
> 
>  $ cat /proc/cmdline
>  console=ttyS0,115200
> 
> The kernel does output to the serial console, I see all boot messages,
> but I do not have a getty then. So maybe systemd does not recognize this
> parameter format. I will play a little with the bootloader later to see
> if that's the case.

Which kernel version? systemd uses /sys/class/tty/console/active to
determine where to start a getty.

Is "agetty" installed?

> On the other hand I have still problems with systemd-logind, maybe this
> prevents correct loading. Do you have special settings for this one?

No, but it's possible that you're missing some necessary kernel config
options.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28 10:44     ` Michael Olbrich
@ 2012-03-28 11:02       ` Alexander Dahl
  2012-03-28 11:10         ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Dahl @ 2012-03-28 11:02 UTC (permalink / raw)
  To: ptxdist

Am 2012-03-28 12:44, schrieb Michael Olbrich:
> Which kernel version? systemd uses /sys/class/tty/console/active to
> determine where to start a getty.

 $ uname -r
 2.6.36.4

(It's planned to upgrade to 3.0.x but we have to port the kernel module
code for our own hardware first.)

 $ ls /sys/class/tty/console/
 dev        power      subsystem  uevent

> Is "agetty" installed?

Yes: PTXCONF_UTIL_LINUX_NG_AGETTY=y

 $ which agetty
 /sbin/agetty

>> On the other hand I have still problems with systemd-logind, maybe this
>> prevents correct loading. Do you have special settings for this one?
> 
> No, but it's possible that you're missing some necessary kernel config
> options.

Maybe, at least /sys/class/tty/console/active is missing. I already had
to activate some kernel stuff for udev before. The kernel config was not
made by me and I didn't have time to have a close look on it yet. Which
config options do you refer to?

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28 11:02       ` Alexander Dahl
@ 2012-03-28 11:10         ` Michael Olbrich
  2012-03-28 11:27           ` Alexander Dahl
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Olbrich @ 2012-03-28 11:10 UTC (permalink / raw)
  To: ptxdist

On Wed, Mar 28, 2012 at 01:02:23PM +0200, Alexander Dahl wrote:
> Am 2012-03-28 12:44, schrieb Michael Olbrich:
> > Which kernel version? systemd uses /sys/class/tty/console/active to
> > determine where to start a getty.
> 
>  $ uname -r
>  2.6.36.4
> 
> (It's planned to upgrade to 3.0.x but we have to port the kernel module
> code for our own hardware first.)

that's the problem. systemd needs at least 2.6.39 to work properly.

>  $ ls /sys/class/tty/console/
>  dev        power      subsystem  uevent

/sys/class/tty/console/active was introduced in a later kernel version.

> > Is "agetty" installed?
> 
> Yes: PTXCONF_UTIL_LINUX_NG_AGETTY=y
> 
>  $ which agetty
>  /sbin/agetty
> 
> >> On the other hand I have still problems with systemd-logind, maybe this
> >> prevents correct loading. Do you have special settings for this one?
> > 
> > No, but it's possible that you're missing some necessary kernel config
> > options.
> 
> Maybe, at least /sys/class/tty/console/active is missing. I already had
> to activate some kernel stuff for udev before. The kernel config was not
> made by me and I didn't have time to have a close look on it yet. Which
> config options do you refer to?

In this case the kernel is too old. The README in the systemd source tells
you what else is needed.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] console_name for systemd based systems
  2012-03-28 11:10         ` Michael Olbrich
@ 2012-03-28 11:27           ` Alexander Dahl
  0 siblings, 0 replies; 7+ messages in thread
From: Alexander Dahl @ 2012-03-28 11:27 UTC (permalink / raw)
  To: ptxdist

Hello Michael, 

Am 2012-03-28 13:10, schrieb Michael Olbrich:
>>  $ uname -r
>>  2.6.36.4
>>
>> (It's planned to upgrade to 3.0.x but we have to port the kernel module
>> code for our own hardware first.)
> 
> that's the problem. systemd needs at least 2.6.39 to work properly.

> In this case the kernel is too old. The README in the systemd source tells
> you what else is needed.

Okay thank you, this means there's some kernel module hacking due,
before proceeding with systemd integration …

Greets
Alex

-- 
»With the first link, the chain is forged. The first speech censured,
the first thought forbidden, the first freedom denied, chains us all
irrevocably.« (Jean-Luc Picard, quoting Judge Aaron Satie)
*** GnuPG-FP: 02C8 A590 7FE5 CA5F 3601  D1D5 8FBA 7744 CC87 10D0 ***

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-03-28 11:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28  9:09 [ptxdist] console_name for systemd based systems Alexander Dahl
2012-03-28  9:26 ` Michael Olbrich
2012-03-28 10:25   ` Alexander Dahl
2012-03-28 10:44     ` Michael Olbrich
2012-03-28 11:02       ` Alexander Dahl
2012-03-28 11:10         ` Michael Olbrich
2012-03-28 11:27           ` Alexander Dahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox