* printf internals
@ 2007-12-14 0:07 Siva Prasad
2007-12-14 1:55 ` David Newall
0 siblings, 1 reply; 8+ messages in thread
From: Siva Prasad @ 2007-12-14 0:07 UTC (permalink / raw)
To: linux-kernel
Hi,
I am looking at how exactly does the printf in user programs succeeds in
displaying characters to the serial console.
printf uses /dev/console to write the data. Once written to
/dev/console, what happens to the string written?
Is there any way, I can get access to those prints/string inside the
kernel?
Thanks
Siva
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: printf internals
2007-12-14 0:07 printf internals Siva Prasad
@ 2007-12-14 1:55 ` David Newall
2007-12-14 16:15 ` Clemens Koller
0 siblings, 1 reply; 8+ messages in thread
From: David Newall @ 2007-12-14 1:55 UTC (permalink / raw)
To: Siva Prasad; +Cc: linux-kernel
Siva Prasad wrote:
> I am looking at how exactly does the printf in user programs succeeds in
> displaying characters to the serial console.
Is it a student assignment? This is so not the right mailing list.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: printf internals
2007-12-14 1:55 ` David Newall
@ 2007-12-14 16:15 ` Clemens Koller
2007-12-19 22:33 ` Siva Prasad
0 siblings, 1 reply; 8+ messages in thread
From: Clemens Koller @ 2007-12-14 16:15 UTC (permalink / raw)
To: David Newall; +Cc: Siva Prasad, linux-kernel
David Newall schrieb:
> Siva Prasad wrote:
>> I am looking at how exactly does the printf in user programs succeeds in
>> displaying characters to the serial console.
>
> Is it a student assignment? This is so not the right mailing list.
Come on, are we playing hide and seek here?
You can use strace to follow a typical hello world example and
see what device it opens to feed the hello out.
I.e. it can be to the current /dev/ttyX and not to /dev/console
or if you are logged in via SSH to a machine, the device
is again different... or if you use screen, ...
Work your way from there and then use a Linux Source code
Cross Reference (lxr, ask Google for one) and follow the code.
Regards,
--
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: printf internals
2007-12-14 16:15 ` Clemens Koller
@ 2007-12-19 22:33 ` Siva Prasad
2007-12-19 23:31 ` Scott Russell
2007-12-22 3:42 ` Richard D
0 siblings, 2 replies; 8+ messages in thread
From: Siva Prasad @ 2007-12-19 22:33 UTC (permalink / raw)
To: Clemens Koller, David Newall; +Cc: linux-kernel
Thank you very much for your response Clemens.
I tried strace on a regular system. It does not show which tty, etc., as it uses the stdout (fd = 1) and write(1, ...) to it.
This is not a student project. I am trying to build my own kernel and ramdisk. Kernel boots fine to a point where it starts accessing ramdisk and executes init scripts. From there on nothing gets printed. I did some debugging and found that prints of user land programs are not coming to the serial console, while kernel prints are working fine. I found all the programs getting executed, by placing a printk in execve routine and printing the arguments.
So, I wanted to trace down the path from user program to the kernel and see why it is not printing messages from user program. I placed a printk in drivers/char/tty_io.c:tty_write() and it is not getting called from my file system. I tried the same thing on my good system (say regular PC) and it works as expected.
Any clues that can help debug this issue is highly appreciated.
How can I get access to the same printf string inside kernel.
Thanks
Siva
-----Original Message-----
From: Clemens Koller [mailto:clemens.koller@anagramm.de]
Sent: Friday, December 14, 2007 8:16 AM
To: David Newall
Cc: Siva Prasad; linux-kernel@vger.kernel.org
Subject: Re: printf internals
David Newall schrieb:
> Siva Prasad wrote:
>> I am looking at how exactly does the printf in user programs succeeds in
>> displaying characters to the serial console.
>
> Is it a student assignment? This is so not the right mailing list.
Come on, are we playing hide and seek here?
You can use strace to follow a typical hello world example and
see what device it opens to feed the hello out.
I.e. it can be to the current /dev/ttyX and not to /dev/console
or if you are logged in via SSH to a machine, the device
is again different... or if you use screen, ...
Work your way from there and then use a Linux Source code
Cross Reference (lxr, ask Google for one) and follow the code.
Regards,
--
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: printf internals
2007-12-19 23:31 ` Scott Russell
@ 2007-12-19 23:31 ` Siva Prasad
2007-12-20 0:04 ` Masoud Sharbiani "مسعود شربیانی"
0 siblings, 1 reply; 8+ messages in thread
From: Siva Prasad @ 2007-12-19 23:31 UTC (permalink / raw)
To: Scott Russell; +Cc: Clemens Koller, David Newall, linux-kernel
Yes!... this is a embedded system, and will not have monitor. So, serial
is the default console.
I pass cmdline as "root=/dev/ram rw console=ttyS0,115200"
Thanks
Siva
-----Original Message-----
From: Scott Russell [mailto:catfather@donpoo.net]
Sent: Wednesday, December 19, 2007 3:31 PM
To: Siva Prasad
Cc: Clemens Koller; David Newall; linux-kernel@vger.kernel.org
Subject: RE: printf internals
On Wed, 2007-12-19 at 14:33 -0800, Siva Prasad wrote:
> Thank you very much for your response Clemens.
>
> I tried strace on a regular system. It does not show which tty, etc.,
as it uses the stdout (fd = 1) and write(1, ...) to it.
>
> This is not a student project. I am trying to build my own kernel and
ramdisk. Kernel boots fine to a point where it starts accessing ramdisk
and executes init scripts. From there on nothing gets printed. I did
some debugging and found that prints of user land programs are not
coming to the serial console, while kernel prints are working fine. I
found all the programs getting executed, by placing a printk in execve
routine and printing the arguments.
>
> So, I wanted to trace down the path from user program to the kernel
and see why it is not printing messages from user program. I placed a
printk in drivers/char/tty_io.c:tty_write() and it is not getting called
from my file system. I tried the same thing on my good system (say
regular PC) and it works as expected.
>
> Any clues that can help debug this issue is highly appreciated.
> How can I get access to the same printf string inside kernel.
This sounds like you're printing out the serial console instead.
--
Scott <catfather@donpoo.net>
AIM: BlueCame1
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: printf internals
2007-12-19 22:33 ` Siva Prasad
@ 2007-12-19 23:31 ` Scott Russell
2007-12-19 23:31 ` Siva Prasad
2007-12-22 3:42 ` Richard D
1 sibling, 1 reply; 8+ messages in thread
From: Scott Russell @ 2007-12-19 23:31 UTC (permalink / raw)
To: Siva Prasad; +Cc: Clemens Koller, David Newall, linux-kernel
On Wed, 2007-12-19 at 14:33 -0800, Siva Prasad wrote:
> Thank you very much for your response Clemens.
>
> I tried strace on a regular system. It does not show which tty, etc., as it uses the stdout (fd = 1) and write(1, ...) to it.
>
> This is not a student project. I am trying to build my own kernel and ramdisk. Kernel boots fine to a point where it starts accessing ramdisk and executes init scripts. From there on nothing gets printed. I did some debugging and found that prints of user land programs are not coming to the serial console, while kernel prints are working fine. I found all the programs getting executed, by placing a printk in execve routine and printing the arguments.
>
> So, I wanted to trace down the path from user program to the kernel and see why it is not printing messages from user program. I placed a printk in drivers/char/tty_io.c:tty_write() and it is not getting called from my file system. I tried the same thing on my good system (say regular PC) and it works as expected.
>
> Any clues that can help debug this issue is highly appreciated.
> How can I get access to the same printf string inside kernel.
This sounds like you're printing out the serial console instead.
--
Scott <catfather@donpoo.net>
AIM: BlueCame1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: printf internals
2007-12-19 23:31 ` Siva Prasad
@ 2007-12-20 0:04 ` Masoud Sharbiani "مسعود شربیانی"
0 siblings, 0 replies; 8+ messages in thread
From: Masoud Sharbiani "مسعود شربیانی" @ 2007-12-20 0:04 UTC (permalink / raw)
To: Siva Prasad; +Cc: Scott Russell, Clemens Koller, David Newall, linux-kernel
On 12/19/07, Siva Prasad <sprasad@bivio.net> wrote:
>
> Yes!... this is a embedded system, and will not have monitor. So, serial
> is the default console.
>
> I pass cmdline as "root=/dev/ram rw console=ttyS0,115200"
Adding a CONSOLE=/dev/ttyS0 works for me on both Debian and Redhat;
You also want a inittab entry for console on serial device. (use
google and find it yourself).
cheers,
Masoud
> Thanks
> Siva
>
>
> -----Original Message-----
> From: Scott Russell [mailto:catfather@donpoo.net]
> Sent: Wednesday, December 19, 2007 3:31 PM
> To: Siva Prasad
> Cc: Clemens Koller; David Newall; linux-kernel@vger.kernel.org
> Subject: RE: printf internals
>
>
> On Wed, 2007-12-19 at 14:33 -0800, Siva Prasad wrote:
> > Thank you very much for your response Clemens.
> >
> > I tried strace on a regular system. It does not show which tty, etc.,
> as it uses the stdout (fd = 1) and write(1, ...) to it.
> >
> > This is not a student project. I am trying to build my own kernel and
> ramdisk. Kernel boots fine to a point where it starts accessing ramdisk
> and executes init scripts. From there on nothing gets printed. I did
> some debugging and found that prints of user land programs are not
> coming to the serial console, while kernel prints are working fine. I
> found all the programs getting executed, by placing a printk in execve
> routine and printing the arguments.
> >
> > So, I wanted to trace down the path from user program to the kernel
> and see why it is not printing messages from user program. I placed a
> printk in drivers/char/tty_io.c:tty_write() and it is not getting called
> from my file system. I tried the same thing on my good system (say
> regular PC) and it works as expected.
> >
> > Any clues that can help debug this issue is highly appreciated.
> > How can I get access to the same printf string inside kernel.
>
> This sounds like you're printing out the serial console instead.
>
> --
> Scott <catfather@donpoo.net>
> AIM: BlueCame1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: printf internals
2007-12-19 22:33 ` Siva Prasad
2007-12-19 23:31 ` Scott Russell
@ 2007-12-22 3:42 ` Richard D
1 sibling, 0 replies; 8+ messages in thread
From: Richard D @ 2007-12-22 3:42 UTC (permalink / raw)
To: 'Siva Prasad', 'Clemens Koller',
'David Newall'
Cc: linux-kernel
Most likely your device nodes are missing in /dev.
-----Original Message-----
From: linux-kernel-owner@vger.kernel.org
[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Siva Prasad
Sent: Thursday, December 20, 2007 4:03 AM
To: Clemens Koller; David Newall
Cc: linux-kernel@vger.kernel.org
Subject: RE: printf internals
Thank you very much for your response Clemens.
I tried strace on a regular system. It does not show which tty, etc., as it
uses the stdout (fd = 1) and write(1, ...) to it.
This is not a student project. I am trying to build my own kernel and
ramdisk. Kernel boots fine to a point where it starts accessing ramdisk and
executes init scripts. From there on nothing gets printed. I did some
debugging and found that prints of user land programs are not coming to the
serial console, while kernel prints are working fine. I found all the
programs getting executed, by placing a printk in execve routine and
printing the arguments.
So, I wanted to trace down the path from user program to the kernel and see
why it is not printing messages from user program. I placed a printk in
drivers/char/tty_io.c:tty_write() and it is not getting called from my file
system. I tried the same thing on my good system (say regular PC) and it
works as expected.
Any clues that can help debug this issue is highly appreciated.
How can I get access to the same printf string inside kernel.
Thanks
Siva
-----Original Message-----
From: Clemens Koller [mailto:clemens.koller@anagramm.de]
Sent: Friday, December 14, 2007 8:16 AM
To: David Newall
Cc: Siva Prasad; linux-kernel@vger.kernel.org
Subject: Re: printf internals
David Newall schrieb:
> Siva Prasad wrote:
>> I am looking at how exactly does the printf in user programs succeeds in
>> displaying characters to the serial console.
>
> Is it a student assignment? This is so not the right mailing list.
Come on, are we playing hide and seek here?
You can use strace to follow a typical hello world example and
see what device it opens to feed the hello out.
I.e. it can be to the current /dev/ttyX and not to /dev/console
or if you are logged in via SSH to a machine, the device
is again different... or if you use screen, ...
Work your way from there and then use a Linux Source code
Cross Reference (lxr, ask Google for one) and follow the code.
Regards,
--
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-12-22 3:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 0:07 printf internals Siva Prasad
2007-12-14 1:55 ` David Newall
2007-12-14 16:15 ` Clemens Koller
2007-12-19 22:33 ` Siva Prasad
2007-12-19 23:31 ` Scott Russell
2007-12-19 23:31 ` Siva Prasad
2007-12-20 0:04 ` Masoud Sharbiani "مسعود شربیانی"
2007-12-22 3:42 ` Richard D
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox