OpenWrt Forum Archive

Topic: kernel panic - custom kernel

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello, Î'm trying to create my custom kernel... some attempts were successfully but now I'm stuck:

Flash device: 0x800000 at 0x1fc00000
bootloader size: 262144
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x007f0000 : "linux"
0x000f8000-0x007f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x00400000-0x007f0000 : "rootfs_data"
0x007f0000-0x00800000 : "nvram"
nf_conntrack version 0.5.0 (256 buckets, 2048 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 120k freed
Warning: unable to open an initial console.
Failed to execute /etc/preinit.  Attempting defaults...
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

I guess this is because of an missing dependency, any hints about this?

thanks in advance
cheers michu

have u got in rootfs the file /etc/preinit and/or /sbin/init, that is usually a link to busybox ?

Well as I couln't boot, I recreated my Image... I re-added this package (compiled into the kernel)

[*] libgcc............................................... GCC support library

now the error went away.. pretty strange...

when I reboot there is still a warning: Warning: unable to open an initial console.

...
bootloader size: 262144
Creating 4 MTD partitions on "Physically mapped flash":
0x00000000-0x00040000 : "cfe"
0x00040000-0x007f0000 : "linux"
0x000f8000-0x007f0000 : "rootfs"
mtd: partition "rootfs" doesn't start on an erase block boundary -- force read-only
0x00450000-0x007f0000 : "rootfs_data"
0x007f0000-0x00800000 : "nvram"
nf_conntrack version 0.5.0 (256 buckets, 2048 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP vegas registered
NET: Registered protocol family 1
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 120k freed
Warning: unable to open an initial console.
Algorithmics/MIPS FPU Emulator v1.5
- preinit -
...

? ? <*> iptables............................... IPv4 firewall administration tool  --->                                                                 ? ?
  ? ? <*> libgcc............................................... GCC support library                                                                       ? ?
  ? ? --- libpthread.......................................... POSIX thread library                                                                       ? ?
  ? ? < > libssp............................................... GCC support library                                                                       ? ?
  ? ? < > libstdcpp.................................... GNU Standard C++ Library v3                                                                       ? ?
  ? ? < > mksh................................................................ mksh                                                                       ? ?
  ? ? <*> mtd............................... Update utility for trx firmware images                                                                       ? ?
  ? ? < > qos-scripts.................................................. QoS scripts                                                                       ? ?
  ? ? <*> uclibc........................................ C library embedded systems                                                                       ? ?
  ? ? < > wireless-tools.......... Tools for manipulating Linux Wireless Extensions                                                                       ? ?


what is the "general" recommendation for libgcc/libssp/libstdcpp/uclibc?

should the be enabled?

back to you question:

root@OpenWrt:/# ls -al /etc/preinit
-rwxr-xr-x    1 root     root         1401 Jul  7  2007 /etc/preinit

root@OpenWrt:/# ls -al /sbin/init
lrwxrwxrwx    1 root     root           14 Jul 11  2007 /sbin/init -> ../bin/busybox


another question about mount:

root@OpenWrt:/# mount --h
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /tmp type tmpfs (rw,nosuid,nodev)
tmpfs on /dev type tmpfs (rw)
none on /dev/pts type devpts (rw)
/dev/mtdblock3 on /jffs type jffs2 (rw)
/jffs on / type mini_fo (rw)
root@OpenWrt:/# mount --help
BusyBox v1.4.2 (2007-07-07 07:21:50 CEST) multi-call binary

Usage: mount [-l] [-p PORT] [IPADDR PORTNUM]

Open a pipe to IP:port

Options:
        -l      Listen mode, for inbound connects
        -p PORT Local port number

I guess the help for mount is pretty strange...

(Last edited by michu on 7 Jul 2007, 17:11)

michu wrote:

what is the "general" recommendation for libgcc/libssp/libstdcpp/uclibc?

should the be enabled?

I think you have not to include them if you are not using packages which require them.

About your problem, for what device are you building the firmware?

michu wrote:

Well as I couln't boot, I recreated my Image... I re-added this package (compiled into the kernel)

[*] libgcc............................................... GCC support library

now the error went away.. pretty strange...

Thanks for the info, you just saved my day smile

when I reboot there is still a warning: Warning: unable to open an initial console.

This is normal. The new preinit stuff doesn't need initial device files under /dev. Instead preinit creates them on the fly. The shell, which is started to created the devices, complains about this at first

what is the "general" recommendation for libgcc/libssp/libstdcpp/uclibc?

should the be enabled?

I run all my boxen with uclibc and uclibcxx and didn't need libstdcpp up to now. I *thought* that I didn't need libgcc, but now I know better smile
I guess applications that depend on libssp should include it through Makefile dependency, but maybe that isn't possible...

root@OpenWrt:/# mount --help
BusyBox v1.4.2 (2007-07-07 07:21:50 CEST) multi-call binary

Usage: mount [-l] [-p PORT] [IPADDR PORTNUM]

Open a pipe to IP:port

Options:
        -l      Listen mode, for inbound connects
        -p PORT Local port number

I guess the help for mount is pretty strange...[

Pretty bizarre smile

Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

You are using Wrong loader or wrong firmware with wrong flash size.

So get a a correct firmware which must be same with ur board one.

michu wrote:

Well as I couln't boot, I recreated my Image... I re-added this package (compiled into the kernel)
[*] libgcc............................................... GCC support library
now the error went away.. pretty strange...

I think I've found a reason for that, if not an explanation:

root@router-casa-andrea:/# ldd /bin/busybox
        libcrypt.so.0 => /lib/libcrypt.so.0 (0x2aabe000)
        libm.so.0 => /lib/libm.so.0 (0x2aae3000)
        libc.so.0 => /lib/libc.so.0 (0x2ab00000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)

Naturally, this begs the question as to why busybox is requiring libc instead of being happy with uClibc and, also, why that specific busybox option requiring it isn't toggling the selection of libc. I'll open a ticket pointing to this thread, maybe it's nothing, maybe it isn't.

(Edit: ticket is at https://dev.openwrt.org/ticket/4908)

(Last edited by aboaboit on 10 Apr 2009, 07:26)

The discussion might have continued from here.