How printf output messages to kernel with uclibc lib

loody miloody at gmail.com
Fri Jan 30 08:38:41 UTC 2009


Dear all:
   I am porting kernel on my arm platform and I wrote a userspace
program, hello world.
   But I cannot see the "hello world".

   my environment is:
   1. uclinux.dist 2008
   2. and I put my source code under user and compile it.
   3. I use arm-linux-2006 to compile kernel
   4. I use arm-linux-2007 to compile my hello world.

   what I have done:
   1. rewrite the 8250 uart driver such that I can see
      <6>console [ttyS0] enabled
   2. At the end of register_console, I can see the log content shown
on my uart when calling release_console_sem, which ask
call_console_drivers to show everything in logbuffer.
   3. My dev looks like below:
   crw------- 1 root root 5,  1 2009-01-30 14:14 console
   lrwxrwxrwx 1 root root    13 2009-01-30 14:14 fd -> /proc/self/fd
   brw-r--r-- 1 root root 1,  0 2009-01-30 14:17 ram0
   lrwxrwxrwx 1 root root     4 2009-01-30 14:16 stderr -> fd/2
   lrwxrwxrwx 1 root root     4 2009-01-30 14:15 stdin -> fd/0
   lrwxrwxrwx 1 root root     4 2009-01-30 14:15 stdout -> fd/1
   crw-r--r-- 1 root root 5,  0 2009-01-30 14:14 tty
   crw------- 1 root root 4,  0 2009-01-30 14:14 tty0
   crw------- 1 root root 4,  1 2009-01-30 14:14 tty1
   crw------- 1 root root 4, 64 2009-01-30 14:14 ttyS0

   4. After opening DBG_FLT in binfmt_flat.c, I can see message below.
   p=83d6fffc
   start_thread(regs=0x83c15ef8, entry=0x83d60044, start_stack=0x83d6ffb0)

   my questions are:
   a. from 1 2 above, can I boldly say my console driver for output is ready?
      (My uart read function is not finished yet, since my irq# has
some problem, but I don't think this affect the printf to output
message on the console)
   b. Do I miss any necessary nodes in dev from 3.
   c. From 4, can I say my hello has been executed?
   d. in uclibc, _stdio.c, there are 3 _stdio_streams[] receiving the
printf messages.
      But how do they direct to the kernel, such that kernel can put
them on the console?
   e. How do people usually debug flat file which running in userspace?
   f.  Where is the entry of kernel that receive the message passed by printf?
      If I know where it is, may be I can check whether printf did
pass the message to kernel.

   thanks for your help,
   miloody


More information about the uClibc mailing list