Linux MIPS Architecture development
 help / color / mirror / Atom feed
* printk problems
@ 2003-04-08 11:57 Avinash S.
  2003-04-08 15:37 ` Justin Carlson
  2003-04-08 17:07 ` Jun Sun
  0 siblings, 2 replies; 4+ messages in thread
From: Avinash S. @ 2003-04-08 11:57 UTC (permalink / raw)
  To: linux

Hello,
I am trying to port linux to a custom built IDT MIPS board. I have 
managed to get the UART working. My bootup code loads and prints some 
debugging messages initially and then actual kernel bootup occurs. 
However it hangs when it reaches the first printk function. i have tried 
to debug this with some difficulty but with no effect. Could some one 
tell me or atleast point me to where i can get some info on how printk 
works or atleast how to debug my printk to see where the actual problem 
lies?

Thanks in advance.


Avinash

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

* Re: printk problems
  2003-04-08 11:57 printk problems Avinash S.
@ 2003-04-08 15:37 ` Justin Carlson
  2003-04-08 18:24   ` Michael Pruznick
  2003-04-08 17:07 ` Jun Sun
  1 sibling, 1 reply; 4+ messages in thread
From: Justin Carlson @ 2003-04-08 15:37 UTC (permalink / raw)
  To: Avinash S.; +Cc: linux

On Tue, 2003-04-08 at 07:57, Avinash S. wrote:
> Hello,
> I am trying to port linux to a custom built IDT MIPS board. I have 
> managed to get the UART working. My bootup code loads and prints some 
> debugging messages initially and then actual kernel bootup occurs. 
> However it hangs when it reaches the first printk function. i have tried 
> to debug this with some difficulty but with no effect. Could some one 
> tell me or atleast point me to where i can get some info on how printk 
> works or atleast how to debug my printk to see where the actual problem 
> lies?
> 

Couple quick questions:

1)  I assume you want to do console over serial port.  You have
SERIAL_CONSOLE enabled in your .config, right?

2) Is the UART standard, for which a driver is extant?  If not, you'll
need to write one.  

3) Are you sure it's hanging, or is it just not reporting anything
else?  Do you have other status indicators (i.e. LED's of some sort?)


Here's the 30 second summary of what happens at bootup on a serial
console.  This is mostly from memory a year old or so, so don't take
this as gospel:

Pretty early in the boot sequence (in init/main.c) console_init() is
called (in drivers/char/tty_io.c).  If your serial driver is compiled in
with console support, the serial port is initialized here, and added to
a list of available consoles.  The first(?) extant console is chosen for
console output, where your printk()s will end up.

Until this point, printk() calls are buffered in memory.  If you have
printk()s not showing up, odds are pretty good you're failing to
initialize the serial console in some way.

Hope that helps...

-Justin

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

* Re: printk problems
  2003-04-08 11:57 printk problems Avinash S.
  2003-04-08 15:37 ` Justin Carlson
@ 2003-04-08 17:07 ` Jun Sun
  1 sibling, 0 replies; 4+ messages in thread
From: Jun Sun @ 2003-04-08 17:07 UTC (permalink / raw)
  To: Avinash S.; +Cc: linux, jsun

On Tue, Apr 08, 2003 at 05:27:23PM +0530, Avinash S. wrote:
> Hello,
> I am trying to port linux to a custom built IDT MIPS board. I have 
> managed to get the UART working. My bootup code loads and prints some 
> debugging messages initially and then actual kernel bootup occurs. 
> However it hangs when it reaches the first printk function. i have tried 
> to debug this with some difficulty but with no effect. Could some one 
> tell me or atleast point me to where i can get some info on how printk 
> works or atleast how to debug my printk to see where the actual problem 
> lies?
>

You might want to try the early printk approach.  See

http://linux.junsun.net/porting-howto/

Jun

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

* Re: printk problems
  2003-04-08 15:37 ` Justin Carlson
@ 2003-04-08 18:24   ` Michael Pruznick
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Pruznick @ 2003-04-08 18:24 UTC (permalink / raw)
  To: Justin Carlson; +Cc: Avinash S., linux


> Until this point, printk() calls are buffered in memory. 

This is what I like to use to bypass the buffering for
non-standard serial hardware.  

The raw_output() function needs to be specific to
your serial driver.  The one below is just an example
from a board I'm currently working on (that is not in
the linux-mips tree yet).  Basically, raw_output() needs
to put the char in the serial hardware output register
and then wait for the serial hardware to indicate that
it put the char on the wire to prevent over-run.


Changes to kernel/printk.c
#define RAW_OUTPUT
static void emit_log_char(char c)
{
#ifdef RAW_OUTPUT
        void raw_output(char c);
        raw_output(c);
#else
        LOG_BUF(log_end) = c;
        log_end++;
        if (log_end - log_start > LOG_BUF_LEN)
                log_start = log_end - LOG_BUF_LEN;
        if (log_end - con_start > LOG_BUF_LEN)
                con_start = log_end - LOG_BUF_LEN;
        if (logged_chars < LOG_BUF_LEN)
                logged_chars++;
#endif
}


What I added to my serial driver.  You will need to
do the similar for your specific serial hardware.
#ifdef RAW_OUTPUT
void raw_output(char c)
{
        struct rs_port *port = &rs_ports[0];
        if ( c == '\n' )
        {
          sio_out(port, TXX9_SITFIFO, '\r');
          wait_for_xmitr(port);
        }
        sio_out(port, TXX9_SITFIFO, c);
        wait_for_xmitr(port);
        return;
}
#endif


-- 
Michael Pruznick, michael_pruznick@mvista.com, www.mvista.com
MontaVista Software, 1237 East Arques Ave, Sunnyvale, CA 94085

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

end of thread, other threads:[~2003-04-08 18:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-08 11:57 printk problems Avinash S.
2003-04-08 15:37 ` Justin Carlson
2003-04-08 18:24   ` Michael Pruznick
2003-04-08 17:07 ` Jun Sun

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