init does not run on 405GP system
Hi,
I'm currently porting u-boot and Linux to an IBM 405GP based board. The problem is now that init seems not to be running and does not give any output. Up to that point where init should make some noise the kernel boots smoothly (serial console), I see all output and NFS-Root is mounted via an Intel 82559 network chip. The kernel threads are also running, I see kupdated & friends being put into the run queue from time to time.
I have replaced /sbin/init by a statically linked "hello world" (which also does not give any output). My impression is that the binary code of the init ELF binary is never run. When I switch on the SHOW_SYSCALLs macro in arch/ppc/kernel/entry.S I see the system calls for open(), dup(), dup() and execve() which come from init/main.c. Opening the console works, execve() to /sbin/init as well. When I follow the path of execution up to load_elf_binary() in fs/binfmt_elf.c I can even see the correct code being load and pointed to by elf_entry in that file. But there is never any output from init, nor does something happen when I replace init by a piece of code which should immediately make a zero pointer exception.
Nevertheless, the kernel runs smoothly. I can ping the machine, I can even floodping it with 0% packet loss. Only that there is no userspace running.
Has anybody seen something like this before?
- Kernel is 2.4.21-rc2 with bitkeeper from 20030515 plus board port
- userland was tested with Debian bootdisks, Denx 4xx boot image and others
- toolchain is the Debian powerpc-linux cross toolchain.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 4 lines · In message <[email protected]> you wrote:
I'm currently porting u-boot and Linux to an IBM 405GP based board. The problem is now that init seems not to be running and does not give any output. Up to that point where init should make some noise the kernel
...
Quoted 3 lines
Nevertheless, the kernel runs smoothly. I can ping the machine, I can even floodping it with 0% packet loss. Only that there is no userspace running.
Do user space program like init really don;t run, or is there any chance that you just might see no output?
You can do a couple of things:
* Check your adaptions of the kernel source and your kernel configu- ration is you really have a working serial console port.
* If booting over NFS realy works, you can try to start a (statically linked small test program) that does something else but a printf to the console. For example, open a file in /tmp for output and frpintf to that file.
* Or start your test program with a known system call (like gettimeofday() or maybe even getuid() etc.) and set a breakpoint at the system call handler code inthe kernel.
You wrote "opening the console works" - set a breakpoint, and verify that your console driver is really initialized and used.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] In general, if you think something isn't in Perl, try it out, because it usually is :-) - Larry Wall in <[email protected]>
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 2 lines · Wolfgang Denk
Do user space program like init really don;t run, or is there any chance that you just might see no output?
I'm not sure...
Quoted 2 lines
* Check your adaptions of the kernel source and your kernel configu- ration is you really have a working serial console port.
I suppose yes - printk() works just fine and I see the complete kernel output on the serial line.
Quoted 4 lines
* If booting over NFS realy works, you can try to start a (statically linked small test program) that does something else but a printf to the console. For example, open a file in /tmp for output and frpintf to that file.
Tried - does not work. Even when I end the init program with return 0; I would expect the kernel panic which does not come. the fprintf() should also trigger sys_write() being called which does not happen. This all lets me assume that the code of the init process is not really run.
The strange thing is that there is also no error message. I would normally expect that when some mapping is broken the kernel would just blow up with all kinds of uggly noise. When I output which task is currently being scheduled init runs more or less all the time, only interrupted by the kernel daemons. I see no idle task.
Quoted 2 lines
You wrote "opening the console works" - set a breakpoint, and verify that your console driver is really initialized and used.
Well, as I can use printk() from kernel space, shouldn't the driver work? But nevertheless, I've hooked a printk() into drivers/char/serial.c:rs_open() and I get the output.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 9 lines · Robert Schwebel
I'm currently porting u-boot and Linux to an IBM 405GP based board. The problem is now that init seems not to be running and does not give any output. Up to that point where init should make some noise the kernel boots smoothly (serial console), I see all output and NFS-Root is mounted via an Intel 82559 network chip. The kernel threads are also running, I see kupdated & friends being put into the run queue from time
to time.
That's where I've seen output stop when I've forgotten to put a getty on /dev/ttyS0 in /etc/inittab...
--
Hollis Blanchard
IBM Linux Technology Center
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 2 lines · Hollis Blanchard
That's where I've seen output stop when I've forgotten to put a getty on
/dev/ttyS0in/etc/inittab...
But that cannot be the reason why a hello_world does not work and why I do not see the sys_write() syscall being called at all. Btw, init on my other rootfs is busybox init. I suppose I should always see someting useful when init is starting.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 2 lines · In message <[email protected]> you wrote:
But that cannot be the reason why a
hello_worlddoes not work and why I
Show us your "hello_world" code. Does it actually open "/dev/console" ?
Quoted 3 lines
do not see the
sys_write()syscall being called at all. Btw, init on my other rootfs is busybox init. I suppose I should always see someting useful when init is starting.
Why do you assume that?
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: [email protected] "Though a program be but three lines long,
someday it will have to be maintained."
- The Tao of Programming
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Quoted 1 line · Wolfgang Denk
Show us your "
hello_world" code. Does it actually open "/dev/console" ?
Attached - source + compiled binary (this one is dynamically linked). Could you verify that this hello world works with your hardware when copied to /sbin/init? I would assume it prints out the text and then the kernel panics because of the return.
Quoted 5 lines
Quoted 3 lines
do not see the
sys_write()syscall being called at all. Btw, init on my other rootfs is busybox init. I suppose I should always see someting useful when init is starting.Why do you assume that?
Normally init makes some output, something like
message(MAYBE_CONSOLE | LOG, "init started: %s", bb_msg_full_version);
from busybox-init.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
#include <stdio.h>
int main(void) {
FILE *f;
f = fopen("/dev/console","w");
fprintf(f,"hello penguin world\n");
fclose(f);
return 0;}
Quoted 3 lines · Robert Schwebel
I'm currently porting u-boot and Linux to an IBM 405GP based board. The problem is now that init seems not to be running and does not give any output.
We have some new information about what happens on that machine, and the more I know the stranger it is :-(
When you look at fs/exec.c:setup_arg_pages() there is a call to put_dirty_pages(). After that call the argv and env data should be found on the stack, at 0x7fffffda, which can also be looked at when you generate a kernel mapping with kmap(page) plus an offset of 0xfba. These both addresses should point to the same piece of physical RAM. I have printed out the content of the TLBs and they look correct:
...
TLB 7, v = 1, sz = 1, flags = 0x0110, EPN 0x7ffff000, RPN 0x0014a000
...
TLB 63, v = 1, sz = 7, flags = 0x0300, EPN 0xc1000000, RPN 0x01000000
...
Nevertheless, when I set a breakpoint to the location after the put_dirty_pages() call I see different memory. The kernel mapping contains correct content:
"init",0,"HOME=/",0,"TERM=linux",0,"/sbin/init"
But the user mapping (0x7fffffda) shows crap. It is a writable piece of memory, I can place something in it by writing after the put_dirty_pages(). When I write a "unique" pattern to that place, stop the processor with the BDI and read out a complete memory dump I don't find the pattern any more - this looks like a caching problem, but I'm not entirely sure. I've tried an invalidate_dcache_range() to the user space mapping addresses without success.
-+-+-
What could happen here? Is the cache handling code bullet proof? I'm running out of ideas.
Kernel is still 2.4.21-rc2-ppc20030515 plus port to the board in question.
Robert
Signature · 5 lines
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4Quoted 5 lines · Robert Schwebel
Nevertheless, the kernel runs smoothly. I can ping the machine, I can even floodping it with 0% packet loss. Only that there is no userspace running.
Has anybody seen something like this before?
It is solved. The On Chip Memory was mapped to an address below 0x8000'0000 - what we didn't know was that this is a _virtual_ address, because the OCM is not simply located "behind" the MMU. After changing the mapping it works smoothly now.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/