Skip to contentSkip to conversation

Need help getting Linux past init

U-Boot Graeme Russ 4 participants 5 messages Mar 26, 2010 – Mar 27, 2010

lore
Share & tools
lore
#0 lore raw

Hi All,

I know this post is off topic - I you can point me to a better target audience (except LKML - they are somewhat reserved about requests for help ;) please let me know. That said, here goes...

I now have U-Boot (x86 port) fully capable of booting a Linux kernel (2.6.33). I downloaded Buildroot and built a JFFS2 image and after a lot of mucking around, finally got U-Boot to ls it and the Linux Kernel to mount it.

My Linux kernel command line is:

console=ttyS0,115200 noinitrd rw root=/dev/mtdblock0 rootfstype=jffs2 init=/bin/sh

I've added a few debug lines in Linux. The last lines of the boot process are as follows:

[    1.340905] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.343423] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    1.345935] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    1.396891] brd: module loaded
[    1.422898] loop: module loaded
[    1.426898] Serck eNET flash device: 0x1000000 at 0x11000000
[    1.436921] Serck eNET Flash Bank #0: Found 1 x16 devices at 0x0 in
16-bit bank
[    1.438291]  Intel/Sharp Extended Query Table at 0x0031
[    1.439291]  Intel/Sharp Extended Query Table at 0x0031
[    1.440557] Using buffer write method
[    1.441575] cfi_cmdset_0001: Erase suspend on write enabled
[    1.449905] 8139too Fast Ethernet driver 0.9.28
[    1.460851] eth0: RealTek RTL8139 at 0x2000, 00:40:f4:6e:67:ac, IRQ 10
[    1.472862] eth1: RealTek RTL8139 at 0x2100, 00:40:f4:6e:67:ac, IRQ 9
[    1.475904] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[    1.479905] rtc-test rtc-test.0: rtc core: registered test as rtc0
[    1.482905] rtc-test rtc-test.1: rtc core: registered test as rtc1
[    1.498879] TCP cubic registered
[    1.505900] rtc-test rtc-test.0: setting system clock to 2010-03-24
02:12:31 UTC (1269396751)
[    1.584915] VFS: Mounted root (jffs2 filesystem) on device 31:0.
[    1.587000] Freeing unused kernel memory: 168k freed
[    1.591853] Call mark_rodata_ro()
[    1.595840] Write protecting the kernel text: 2660k
[    1.598100] Write protecting the kernel read-only data: 772k
[    1.598880] Set system_state = SYSTEM_RUNNING
[    1.600505] Call numa_default_policy()
[    1.601504] Opening /dev/console
[    1.612898] Set current->signal->flags |= SIGNAL_UNKILLABLE
[    1.614104] run_init_process(/bin/sh)
[    1.615189] sys_execve()
[    1.616189] do_execve()
[    1.816894] execve succeeded

So it looks like the kernel has no problem locating /bin/sh in the JFFS2 partition but then the lights go out. I've also tried /bin/init - same result.

I even tried changing /dev/console to be a symlink to /dev/ttyS0 but that didn't change a thing.

I am _SO_ close to getting this going, and after all the work I have put into U-Boot to get this far, it is really frustrating.

Any ideas?

TIA

Graeme

#1 lore raw

Try without 'init=/bin/sh'. Do you really have /bin/sh file or /sbin/init file on your rootfs?

26.03.10, 23:33, "Graeme Russ" <[email protected]>:

Quoted 73 lines

Hi All,

I know this post is off topic - I you can point me to a better target audience (except LKML - they are somewhat reserved about requests for help ;) please let me know. That said, here goes...

I now have U-Boot (x86 port) fully capable of booting a Linux kernel (2.6.33). I downloaded Buildroot and built a JFFS2 image and after a lot of mucking around, finally got U-Boot to ls it and the Linux Kernel to mount it.

My Linux kernel command line is:

console=ttyS0,115200 noinitrd rw root=/dev/mtdblock0 rootfstype=jffs2 init=/bin/sh

I've added a few debug lines in Linux. The last lines of the boot process are as follows:

 [    1.340905] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
 [    1.343423] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
 [    1.345935] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
 [    1.396891] brd: module loaded
 [    1.422898] loop: module loaded
 [    1.426898] Serck eNET flash device: 0x1000000 at 0x11000000
 [    1.436921] Serck eNET Flash Bank #0: Found 1 x16 devices at 0x0 in
 16-bit bank
 [    1.438291]  Intel/Sharp Extended Query Table at 0x0031
 [    1.439291]  Intel/Sharp Extended Query Table at 0x0031
 [    1.440557] Using buffer write method
 [    1.441575] cfi_cmdset_0001: Erase suspend on write enabled
 [    1.449905] 8139too Fast Ethernet driver 0.9.28
 [    1.460851] eth0: RealTek RTL8139 at 0x2000, 00:40:f4:6e:67:ac, IRQ 10
 [    1.472862] eth1: RealTek RTL8139 at 0x2100, 00:40:f4:6e:67:ac, IRQ 9
 [    1.475904] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
 [    1.479905] rtc-test rtc-test.0: rtc core: registered test as rtc0
 [    1.482905] rtc-test rtc-test.1: rtc core: registered test as rtc1
 [    1.498879] TCP cubic registered
 [    1.505900] rtc-test rtc-test.0: setting system clock to 2010-03-24
 02:12:31 UTC (1269396751)
 [    1.584915] VFS: Mounted root (jffs2 filesystem) on device 31:0.
 [    1.587000] Freeing unused kernel memory: 168k freed
 [    1.591853] Call mark_rodata_ro()
 [    1.595840] Write protecting the kernel text: 2660k
 [    1.598100] Write protecting the kernel read-only data: 772k
 [    1.598880] Set system_state = SYSTEM_RUNNING
 [    1.600505] Call numa_default_policy()
 [    1.601504] Opening /dev/console
 [    1.612898] Set current->signal->flags |= SIGNAL_UNKILLABLE
 [    1.614104] run_init_process(/bin/sh)
 [    1.615189] sys_execve()
 [    1.616189] do_execve()
 [    1.816894] execve succeeded

So it looks like the kernel has no problem locating /bin/sh in the JFFS2 partition but then the lights go out. I've also tried /bin/init - same result.

I even tried changing /dev/console to be a symlink to /dev/ttyS0 but that didn't change a thing.

I am _SO_ close to getting this going, and after all the work I have put into U-Boot to get this far, it is really frustrating.

Any ideas?

TIA

Graeme
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw
In reply to Graeme Russ

Hi Graeme,

Quoted 9 lines

Hi All,

I know this post is off topic - I you can point me to a better target audience (except LKML - they are somewhat reserved about requests for help ;) please let me know. That said, here goes...

I now have U-Boot (x86 port) fully capable of booting a Linux kernel (2.6.33). I downloaded Buildroot and built a JFFS2 image and after a lot of mucking around, finally got U-Boot to ls it and the Linux Kernel to mount it.

Congratulations!

Quoted 43 lines

My Linux kernel command line is:

console=ttyS0,115200 noinitrd rw root=/dev/mtdblock0 rootfstype=jffs2 init=/bin/sh

I've added a few debug lines in Linux. The last lines of the boot process are as follows:

[    1.340905] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.343423] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[    1.345935] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[    1.396891] brd: module loaded
[    1.422898] loop: module loaded
[    1.426898] Serck eNET flash device: 0x1000000 at 0x11000000
[    1.436921] Serck eNET Flash Bank #0: Found 1 x16 devices at 0x0 in
16-bit bank
[    1.438291]  Intel/Sharp Extended Query Table at 0x0031
[    1.439291]  Intel/Sharp Extended Query Table at 0x0031
[    1.440557] Using buffer write method
[    1.441575] cfi_cmdset_0001: Erase suspend on write enabled
[    1.449905] 8139too Fast Ethernet driver 0.9.28
[    1.460851] eth0: RealTek RTL8139 at 0x2000, 00:40:f4:6e:67:ac, IRQ 10
[    1.472862] eth1: RealTek RTL8139 at 0x2100, 00:40:f4:6e:67:ac, IRQ 9
[    1.475904] rtc_cmos rtc_cmos: rtc core: registered rtc_cmos as rtc0
[    1.479905] rtc-test rtc-test.0: rtc core: registered test as rtc0
[    1.482905] rtc-test rtc-test.1: rtc core: registered test as rtc1
[    1.498879] TCP cubic registered
[    1.505900] rtc-test rtc-test.0: setting system clock to 2010-03-24
02:12:31 UTC (1269396751)
[    1.584915] VFS: Mounted root (jffs2 filesystem) on device 31:0.
[    1.587000] Freeing unused kernel memory: 168k freed
[    1.591853] Call mark_rodata_ro()
[    1.595840] Write protecting the kernel text: 2660k
[    1.598100] Write protecting the kernel read-only data: 772k
[    1.598880] Set system_state = SYSTEM_RUNNING
[    1.600505] Call numa_default_policy()
[    1.601504] Opening /dev/console
[    1.612898] Set current->signal->flags |= SIGNAL_UNKILLABLE
[    1.614104] run_init_process(/bin/sh)
[    1.615189] sys_execve()
[    1.616189] do_execve()
[    1.816894] execve succeeded
Quoted 2 lines

So it looks like the kernel has no problem locating /bin/sh in the JFFS2 partition but then the lights go out. I've also tried /bin/init - same result.

Hm. Can you try the filesystem on another x86 platform with a working kernel? If I have problems like this, I usually try to boot into a working filesystem, mount the filesystem in questino and try a chroot into it. Unfortunately this is not applicable for you.

You may try to link /bin/sh statically. Maybe the dynamic linker has a problem?

Quoted 5 lines

I even tried changing /dev/console to be a symlink to /dev/ttyS0 but that didn't change a thing.

I am _SO_ close to getting this going, and after all the work I have put into U-Boot to get this far, it is really frustrating.

As you have come this far, I don't see how you can be stopped ;)

Cheers
Detlev

Signature · 5 lines
Old mathematicians never die; they just lose some of their functions.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#3 lore raw
In reply to Graeme Russ
Quoted 11 lines

So it looks like the kernel has no problem locating /bin/sh in the JFFS2 partition but then the lights go out. I've also tried /bin/init - same result.

I even tried changing /dev/console to be a symlink to /dev/ttyS0 but that didn't change a thing.

I am _SO_ close to getting this going, and after all the work I have put into U-Boot to get this far, it is really frustrating.

Any ideas?

What if you make an init app or script that just creates a file on the JFFS2 fs? Then you could verify it was created by rebooting the board and inspecting the filesystem from U-Boot. That would tell you that the code is executing as expected at least. You could dump debug output to this file for later use too. If that works, it'd be interesting to know if a statically linked hello world app printed anything out. If not, you could narrow the problem down to a serial/console issue.

A JTAG/XDP debugger could help too. Maybe dumping the printk buffer in Linux would show some kernel messages that never made it to your serial port.

Peter

#4 lore raw
Quoted 7 lines · Peter Tyser
Quoted 3 lines

So it looks like the kernel has no problem locating /bin/sh in the JFFS2 partition but then the lights go out. I've also tried /bin/init - same result.

What if you make an init app or script that just creates a file on the JFFS2 fs? Then you could verify it was created by rebooting the board and inspecting the filesystem from U-Boot. That would tell you that the

Brilliant idea!

After trying to figure out why networking stopped (note to self - don't accidentally disable PCI Interrupts) I got NFS Root working as well and created /bin/test_init as:

#!/bin/sh
/bin/echo hello > /tmp/test_hello

and set the kernel command line init=/bin/test_init and lo and behold it created /tmp/test_hello exactly as expected (well, the kernel then crashed 'cause init died - lol)

I then created a jffs2 image from the NFS Root and got the same result

Very happy :)

Quoted 4 lines

code is executing as expected at least. You could dump debug output to this file for later use too. If that works, it'd be interesting to know if a statically linked hello world app printed anything out. If not, you could narrow the problem down to a serial/console issue.

I think this is where I am at. I think everything really is working except for the serial console after control is passed to init

Quoted 4 lines

A JTAG/XDP debugger could help too. Maybe dumping the printk buffer in Linux would show some kernel messages that never made it to your serial port.

I think I can debug it using NFS Root

Graeme