devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch)
@ 2015-03-11 10:08 Geert Uytterhoeven
  2015-03-11 10:35 ` Wolfram Sang
  2015-03-11 13:05 ` Peter Hurley
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-03-11 10:08 UTC (permalink / raw)
  To: Laurent Pinchart, Grant Likely, Mark Rutland, Rob Herring
  Cc: Cao Minh Hiep, Nobuhiro Iwamatsu, Linux-SH, Kuninori Morimoto,
	Magnus Damm, Simon Horman, Sakato Ryusuke, Yoshihiro Shimoda,
	devicetree@vger.kernel.org

TL;DR

After removing the "console=" parameter from chosen/bootargs, and relying
solely on chosen/stdout-path, Hiep-san's Linaro userland cannot find the
console device anymore.

On Wed, Mar 11, 2015 at 7:45 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Tuesday 10 March 2015 12:32:59 Geert Uytterhoeven wrote:
>> On Tue, Mar 10, 2015 at 10:03 AM, Cao Minh Hiep <cm-hiep@jinso.co.jp> wrote:
>> > On 2015年03月10日 17:05, Nobuhiro Iwamatsu wrote:
>> >> This is user land issue.
>> >> Hiep, if you have not changed ttySCX in inittab, you will need to change.
>> >> Could you check your inittab?
>> >>
>> >> --- a/inittab    2015-03-10 15:01:58.986609389 +0900
>> >> +++ b/inittab    2015-03-10 15:00:32.132094877 +0900
>> >> @@ -28,7 +28,7 @@
>> >>
>> >>   l6:6:wait:/etc/init.d/rc 6
>> >>   # Normally not reached, but fallthrough in case of emergency.
>> >>   z6:6:respawn:/sbin/sulogin
>> >>
>> >> -SC6:12345:respawn:/sbin/getty -L 38400 ttySC6
>> >> +SC0:12345:respawn:/sbin/getty -L 38400 ttySC0
>> >>
>> >>   # /sbin/getty invocations for the runlevels.
>> >>   #
>> >>   # The "id" field MUST be the same as the last
>> >
>> > There is no inittab file in Linaro userland that I am using.
>>
>> I'm not familiar with the Linaro userland.
>>
>> Is there any other configuration file that contains the string "ttySC6"?
>> Or does the Linaro userland derive it from the kernel command line?
>> If yes, perhaps there's a newer version that does look at stdout-path
>> instead?
>>
>> The goal of the stdout-path support was to have a better description in DT
>> and automate things. So I don't think reverting the change is the proper way
>> forward.
>>
>> If you can't get it to work, I think we should bring it up with the DT
>> people first, some of which work for Linaro.
>
> I quite agree with that, but how should userspace know which device node in
> /dev corresponds to the console specified in stdout-path ?

root@koelsch:~# hd /sys/firmware/devicetree/base/chosen/stdout-path
00000000  2f 73 65 72 69 61 6c 40  65 36 65 36 30 30 30 30  |/serial@e6e60000|
00000010  00                                                |.|
00000011
root@koelsch:~# ls -l /sys/devices/platform/e6e60000.serial/tty
total 0
drwxr-xr-x 3 root root 0 Mar 11 10:50 ttySC0
root@koelsch:~# cat /sys/devices/platform/e6e60000.serial/tty/ttySC0/dev
204:8
root@koelsch:~# ls -l /dev/ttySC0
crw------- 1 root tty 204, 8 Mar 11 10:46 /dev/ttySC0

Hence all pieces of the puzzle are available to userspace...
Is there another way?

BTW, we also had the "/dev/console" abstraction for quite a while.
I've just replaced "ttySC0" by "console" in my /etc/inittab, and everything
still works fine. That's Debian (without systemd) though, so it doesn't help
for the Linaro userland.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch)
  2015-03-11 10:08 chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch) Geert Uytterhoeven
@ 2015-03-11 10:35 ` Wolfram Sang
  2015-03-11 13:05 ` Peter Hurley
  1 sibling, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2015-03-11 10:35 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, Grant Likely, Mark Rutland, Rob Herring,
	Cao Minh Hiep, Nobuhiro Iwamatsu, Linux-SH, Kuninori Morimoto,
	Magnus Damm, Simon Horman, Sakato Ryusuke, Yoshihiro Shimoda,
	devicetree@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]


> Hence all pieces of the puzzle are available to userspace...
> Is there another way?

My hackish way is to parse dmesg, adapt inittab at runtime and make init reload
it. Not exactly production quality, though:

+       l=$(dmesg | sed -n '/console.*enabled/ s/.*\[\(tty[A-Z]\+[0-9]\+\)\].*/\1/; T; p; q')
+       sed -i s/ttyS0/$l/g /etc/inittab
+       kill -s SIGHUP 1


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch)
  2015-03-11 10:08 chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch) Geert Uytterhoeven
  2015-03-11 10:35 ` Wolfram Sang
@ 2015-03-11 13:05 ` Peter Hurley
       [not found]   ` <55003D82.1080601-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Hurley @ 2015-03-11 13:05 UTC (permalink / raw)
  To: Geert Uytterhoeven, Laurent Pinchart, Grant Likely, Mark Rutland,
	Rob Herring
  Cc: Cao Minh Hiep, Nobuhiro Iwamatsu, Linux-SH, Kuninori Morimoto,
	Magnus Damm, Simon Horman, Sakato Ryusuke, Yoshihiro Shimoda,
	devicetree@vger.kernel.org

On 03/11/2015 06:08 AM, Geert Uytterhoeven wrote:
> TL;DR
> 
> After removing the "console=" parameter from chosen/bootargs, and relying
> solely on chosen/stdout-path, Hiep-san's Linaro userland cannot find the
> console device anymore.
> 
> On Wed, Mar 11, 2015 at 7:45 AM, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> wrote:
>> On Tuesday 10 March 2015 12:32:59 Geert Uytterhoeven wrote:
>>> On Tue, Mar 10, 2015 at 10:03 AM, Cao Minh Hiep <cm-hiep@jinso.co.jp> wrote:
>>>> On 2015年03月10日 17:05, Nobuhiro Iwamatsu wrote:
>>>>> This is user land issue.
>>>>> Hiep, if you have not changed ttySCX in inittab, you will need to change.
>>>>> Could you check your inittab?
>>>>>
>>>>> --- a/inittab    2015-03-10 15:01:58.986609389 +0900
>>>>> +++ b/inittab    2015-03-10 15:00:32.132094877 +0900
>>>>> @@ -28,7 +28,7 @@
>>>>>
>>>>>   l6:6:wait:/etc/init.d/rc 6
>>>>>   # Normally not reached, but fallthrough in case of emergency.
>>>>>   z6:6:respawn:/sbin/sulogin
>>>>>
>>>>> -SC6:12345:respawn:/sbin/getty -L 38400 ttySC6
>>>>> +SC0:12345:respawn:/sbin/getty -L 38400 ttySC0
>>>>>
>>>>>   # /sbin/getty invocations for the runlevels.
>>>>>   #
>>>>>   # The "id" field MUST be the same as the last
>>>>
>>>> There is no inittab file in Linaro userland that I am using.
>>>
>>> I'm not familiar with the Linaro userland.
>>>
>>> Is there any other configuration file that contains the string "ttySC6"?
>>> Or does the Linaro userland derive it from the kernel command line?
>>> If yes, perhaps there's a newer version that does look at stdout-path
>>> instead?
>>>
>>> The goal of the stdout-path support was to have a better description in DT
>>> and automate things. So I don't think reverting the change is the proper way
>>> forward.
>>>
>>> If you can't get it to work, I think we should bring it up with the DT
>>> people first, some of which work for Linaro.
>>
>> I quite agree with that, but how should userspace know which device node in
>> /dev corresponds to the console specified in stdout-path ?
> 
> root@koelsch:~# hd /sys/firmware/devicetree/base/chosen/stdout-path
> 00000000  2f 73 65 72 69 61 6c 40  65 36 65 36 30 30 30 30  |/serial@e6e60000|
> 00000010  00                                                |.|
> 00000011
> root@koelsch:~# ls -l /sys/devices/platform/e6e60000.serial/tty
> total 0
> drwxr-xr-x 3 root root 0 Mar 11 10:50 ttySC0
> root@koelsch:~# cat /sys/devices/platform/e6e60000.serial/tty/ttySC0/dev
> 204:8
> root@koelsch:~# ls -l /dev/ttySC0
> crw------- 1 root tty 204, 8 Mar 11 10:46 /dev/ttySC0
> 
> Hence all pieces of the puzzle are available to userspace...
> Is there another way?
> 
> BTW, we also had the "/dev/console" abstraction for quite a while.
> I've just replaced "ttySC0" by "console" in my /etc/inittab, and everything
> still works fine. That's Debian (without systemd) though, so it doesn't help
> for the Linaro userland.

The tty subsystem emits the list of consoles as a space-delimited, single text
line in /sys/class/tty/console/active (alias: /sys/devices/virtual/tty/console/active).

The first console listed is the primary console.
tty0 is not resolved to its underlying tty device name.

That said, is the original reporter of this problem even interested in
upgrading their userspace, even if this is fixed in Linaro eventually?
What about other Linaro users?

I think the only reasonable course here is to continue to support
"console=" in /chosen/bootargs.

Regards,
Peter Hurley



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

* Re: chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch)
       [not found]   ` <55003D82.1080601-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
@ 2015-03-11 13:23     ` Geert Uytterhoeven
  2015-03-11 13:42       ` Peter Hurley
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2015-03-11 13:23 UTC (permalink / raw)
  To: Peter Hurley
  Cc: Laurent Pinchart, Grant Likely, Mark Rutland, Rob Herring,
	Cao Minh Hiep, Nobuhiro Iwamatsu, Linux-SH, Kuninori Morimoto,
	Magnus Damm, Simon Horman, Sakato Ryusuke, Yoshihiro Shimoda,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Hi Peter,

On Wed, Mar 11, 2015 at 2:05 PM, Peter Hurley <peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org> wrote:
> On 03/11/2015 06:08 AM, Geert Uytterhoeven wrote:
>> TL;DR
>>
>> After removing the "console=" parameter from chosen/bootargs, and relying
>> solely on chosen/stdout-path, Hiep-san's Linaro userland cannot find the
>> console device anymore.

> The tty subsystem emits the list of consoles as a space-delimited, single text
> line in /sys/class/tty/console/active (alias: /sys/devices/virtual/tty/console/active).

Thanks! I didn't know about that virtual file.

> The first console listed is the primary console.
> tty0 is not resolved to its underlying tty device name.

Are you sure about that? Isn't the last one the primary console?

root@koelsch:~# cat  /sys/class/tty/console/active
tty0 ttySC0

If tty0 would be the primary console, getty on /dev/console wouldn't work for
my serial console, as only input on the primary console can be read through
/dev/console if my memory serves me well (or perhaps this has changed?).

Ah, Documentation/ABI/testing/sysfs-tty agrees with me:

What:           /sys/class/tty/console/active
Date:           Nov 2010
Contact:        Kay Sievers <kay.sievers-tD+1rO4QERM@public.gmane.org>
Description:
                 Shows the list of currently configured
                 console devices, like 'tty1 ttyS0'.
                 The last entry in the file is the active
                 device connected to /dev/console.

> That said, is the original reporter of this problem even interested in
> upgrading their userspace, even if this is fixed in Linaro eventually?
> What about other Linaro users?

We'll see...

> I think the only reasonable course here is to continue to support
> "console=" in /chosen/bootargs.

Hmm...
If you really need it, you can always add it to the U-Boot bootargs variable.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch)
  2015-03-11 13:23     ` Geert Uytterhoeven
@ 2015-03-11 13:42       ` Peter Hurley
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Hurley @ 2015-03-11 13:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, Grant Likely, Mark Rutland, Rob Herring,
	Cao Minh Hiep, Nobuhiro Iwamatsu, Linux-SH, Kuninori Morimoto,
	Magnus Damm, Simon Horman, Sakato Ryusuke, Yoshihiro Shimoda,
	devicetree@vger.kernel.org

Hi Geert,

On 03/11/2015 09:23 AM, Geert Uytterhoeven wrote:
> Hi Peter,
> 
> On Wed, Mar 11, 2015 at 2:05 PM, Peter Hurley <peter@hurleysoftware.com> wrote:
>> The first console listed is the primary console.
>> tty0 is not resolved to its underlying tty device name.
> 
> Are you sure about that? Isn't the last one the primary console?
> 
> root@koelsch:~# cat  /sys/class/tty/console/active
> tty0 ttySC0
> 
> If tty0 would be the primary console, getty on /dev/console wouldn't work for
> my serial console, as only input on the primary console can be read through
> /dev/console if my memory serves me well (or perhaps this has changed?).
> 
> Ah, Documentation/ABI/testing/sysfs-tty agrees with me:
> 
> What:           /sys/class/tty/console/active
> Date:           Nov 2010
> Contact:        Kay Sievers <kay.sievers@vrfy.org>
> Description:
>                  Shows the list of currently configured
>                  console devices, like 'tty1 ttyS0'.
>                  The last entry in the file is the active
>                  device connected to /dev/console.

Did I write 'first'?  <blushes>
Yeah, it is 'last', as the documentation states.

>> That said, is the original reporter of this problem even interested in
>> upgrading their userspace, even if this is fixed in Linaro eventually?
>> What about other Linaro users?
> 
> We'll see...
> 
>> I think the only reasonable course here is to continue to support
>> "console=" in /chosen/bootargs.
> 
> Hmm...
> If you really need it, you can always add it to the U-Boot bootargs variable.

Is u-boot a given?

Regards,
Peter Hurley

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

end of thread, other threads:[~2015-03-11 13:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11 10:08 chosen/stdout-path and userland (Re: Can't boot kernel v4.0-rc2 on Koelsch) Geert Uytterhoeven
2015-03-11 10:35 ` Wolfram Sang
2015-03-11 13:05 ` Peter Hurley
     [not found]   ` <55003D82.1080601-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2015-03-11 13:23     ` Geert Uytterhoeven
2015-03-11 13:42       ` Peter Hurley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).