linux-mips
[Top] [All Lists]

RE: no kernel prompt

To: Marc Karasek <marc_karasek@ivivity.com>
Subject: RE: no kernel prompt
From: Justin Carlson <justincarlson@cmu.edu>
Date: 11 Dec 2001 10:39:02 -0500
Cc: linux-mips@oss.sgi.com
In-reply-to: <25369470B6F0D41194820002B328BDD2195AD9@ATLOPS>
References: <25369470B6F0D41194820002B328BDD2195AD9@ATLOPS>
Sender: owner-linux-mips@oss.sgi.com
On Mon, 2001-12-10 at 23:36, Marc Karasek wrote:
> I ran across something like this before.  Whatever you are using for
> yourinit is it dynamically linked?  If so try to statically link it.  I was
> seeing something similar happen and it was because of a problem in the
> dynamic linking.  It was failing to find the proper lib to continue, but
> could not dump any output to the terminal to tell me.  It was a bear to find
> ... :-) 
> 
> -----Original Message-----
> From: balaji.ramalingam@philips.com
> To: linux-mips@oss.sgi.com
> Sent: 12/10/01 10:59 PM
> Subject: no kernel prompt
> 
> 
> 
> Hello guys,
> 
> I was able to sort out the console issue and know I think the kernel is
> able to open /dev/console and I 'm not getting that error message from
> the kernel saying
> unable to open console blau blau..
> 
> I also inserted some printk's in the init/main.c before and after the
> kernel executing /sbin/init.
> So I thing the kernel can execute the sbin/init. I replace the init fiel
> with a simple
> shell script which echo the "hello world" message.
> 

I'm I reading this right, in that you've got something like this:

...
   printk("Going to exec init\n");
   execve("/sbin/init");
   printk("After exec\n");
...

And you're seeing both printk's come out?  Or are you seeing just the 
first one?  If you're seeing both, then the exec is failing.  But 
you should see another message about failing to exec init if that was
the case.

Also, something I've been bitten by; if you replace /sbin/init with
something that outputs and exits, the kernel will panic when init
exits, and so your output can be lost, depending on the driver 
used for the output.  

Try something like this:

#include <stdio.h>
#include <stdlib.h>

int main()
{
        char msg[] = "Hello, world!\n";
        write(1, msg, sizeof(msg));
        while(1) {}
}

this avoids having to load all of a shell interpreter just to do some 
output.  Link the binary statically (with -static in gcc) and use
it as /sbin/init.  

If you still don't see output, you'll have to start tracing your way
into the exec path to see where things are failing.  Look at
do_execve() in fs/exec.c, and fs/binfmt_elf.c (assuming your 
init is in elf format).


> Is there a simple test which I can do to confirm that I dont have any
> issue with
> the console or with my ramdisk image?

The fact that you are successfully mounting a root filesystem seems to
indicate that your ramdisk is OK (at least, it's a valid filesystem). 
There's nothing that's come out of the console yet, though.

-Justin

Attachment: pgp1T5qEl9zPq.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>