板子有个串口,做控制台,大家都知道
我弄的系统在内核启动后开始运行到init进程了.
运行到最后一段 :
free_initmem(); unlock_kernel(); system_state = SYSTEM_RUNNING; numa_default_policy(); if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) printk(KERN_ERR "Warning: unable to open an initial console.\n"); (void) sys_dup(0); (void) sys_dup(0); /* * We try each of these until one succeeds. * * The Bourne shell can be used instead of init if we are * trying to recover a really broken machine. */ printk(KERN_ERR"execute command\n"); if (execute_command) run_init_process(execute_command); //if (sys_open((const char __user *)"/sbin/init",O_RDWR,0)<0){printk(KERN_ERR"connot open /sbin/init\n");}else {printk(KERN_E RR"/sbin/init opened\n");} printk(KERN_ERR"run_init_process ok\n"); run_init_process("/sbin/init"); printk(KERN_ERR"sbin,init\n"); run_init_process("/etc/init"); run_init_process("/bin/init"); run_init_process("/bin/sh"); panic("No init found. Try passing init= option to kernel."); } |
发布评论
评论(9)
初步断定是busybox的问题,请问大家有没有在busyboy配置不对的情况下出现过这情况?
直接 init=/bin/sh 就可以。
谢谢回复,你的意思是直接/bin/sh,当0进程,但是还有个问题,就是在嵌入板子上这些命令其实都是指向busybox的连接,即使执行/bin/sh也还是运行busybox,不同的是当init运行的时候会以inittab为参数文件运行里面的初始化脚本和getty.
建议你找个能确定肯定没问题的busybox盘验证一下
还有,请把你的启动信息给出来,给个内核函数啥用,大家都知道这个函数
你可以在busybox的init_main()函数开始使用一下printf()函数,你能用printk()说明不了你的问题,你的问题中printk()早就能用了,看能不能在用户空间使用printf()函数
嵌入式系统(开发板)的busybox盘?不明白.我这边的busybox是编译好就在文件系统里面然后写在flash上,然后内核启动mount 的,busybox作为init进程肯定是运行了.不知道init_main能不能显示printf的内容,应该是不行吧.
busybox初始话脚本设为/etc/inittab
其内容是
::sysinit:/etc/rc.d/rcS
::respawn:/sbin/getty ttyS1 115200 # 这行试过ttyS0和ttyS1都不行,而且这2设备是可以被打开的.
::shutdown:/bin/umount -a
/etc/rc.d/rcS的内容是动态加载一些模块和设置设备参数
头一部分是
#!/bin/sh
# This script runs when init it run during the boot process.
# Mounts everything in the fstab
echo "rdS start"
mount -a
#turn on user space unaligned access handling in the kernel (for simple config)
echo 2 > /proc/cpu/alignment
# loads the NPE ethernet modules into the kernel.
insmod /lib/modules/2.6.13.2/intel/ixp400.ko
# Firmware code for NPE Engine.
cat /etc/IxNpeMicrocode.dat > /dev/ixNpe
insmod /lib/modules/2.6.13.2/intel/ixp400_eth.ko npe_learning=0 netdev_max_backlog=6000
echo "Reconfiguring NPE-B(ixp0-LAN) with `flash_mac -i ixp0` MAC address"
echo "Reconfiguring NPE-C(ixp1-WAN) with `flash_mac -i ixp1` MAC address"
后面省略.
第一行rdS start都显示不出来.但是一些信息估计是加载模块里面的printk出来的.
你不是怀疑busybox编译时配置的不对吗?所以我指的busybox盘就是指用busybox编译出来的文件系统
先请你把你启动信息详细贴出来
先不用关注inittab,rc$脚本,文件系统中没有这些东东,照样启动,如果能run_init_process("/sbin/init")成功,系统就进去了,关键看你的init程序有没有执行,执行到哪一步了,我的建议是你找到你的busybox中init的源代码,在各个部分添加打印信息(如开始部分,打开控制口前,执行inittab前等等),重新编译busybox制作文件系统,加载执行,再贴出详细信息
run_init_process("/sbin/init")已经成功启动了,在板子上"/sbin/init"是busybox的一个连接,他确实启动了,而且我认为是它解析的inittab,inittab里的初试化脚本也启动了,(所以我断定是run_init_process("/sbin/init")已经成功启动,并且想你说的就是“系统进去了”)但是busybox里的printf()开始是显示不出来的,我看了原代码,在busybox的init_main他关掉了0,1,2文件描述符,又重新打开,注意这个时候是没控制台提示符的,打印不出任何信息,我不知道inittab里的getty ttyS1是不是成功运行了。反正在内核init的main里可以打开/dev/ttyS1。
系统进去了,运行了,但是没有提示符,也不能printf(输出)。我没有成功的这个板子上成功运行过的busybox盘。
打印输出现在也没法贴,明天贴,请帮我看看。
大概是到了VFS:mount root (后面的记不得)
free init memary:315K
如果不启动脚本后面就什么也没有(没有提示符,也不能输入什么象挡机一样),如果初始脚本里有加载模块,模块里printk可以显示
还有2个串口我也都试过,getty ttyS0,getty ttyS1都不行(问题可能就在这里,ttyS0,1在内核中确实可以被打开),也许是 getty要加路径?明天试一下
实在想不出什么好办法,连调试的办法都没有了
[ 本帖最后由 smalloc 于 2007-6-14 20:49 编辑 ]
控制台信息如下,请帮忙分析一下,或提点建议谢谢
Using base address 0x00029800 and length 0x00111c38
Uncompressing Linux............................................................................ done, booting the kernel.
Linux version 2.6.13.2 (root@localhost.localdomain) (gcc version 3.4.3) #136 Thu Jun 14 14:57:23 CST 2007
CPU: XScale-IXP42x Family [690541f1] revision 1 (ARMv5TE)
Machine: Intel IXDP425 Development Platform
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT undefined 5 cache
CPU0: I cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
CPU0: D cache: 32768 bytes, associativity 32, 32 byte lines, 32 sets
Built 1 zonelists
Kernel command line: console=ttyS1,115200 root=/dev/mtdblock2 noinitrd rootfstype=jffs2 mem=32M@0x00000000 init=/sbin/init
PID hash table entries: 256 (order: 8, 4096 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 32MB = 32MB total
Memory: 29952KB available (1678K code, 401K data, 316K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
PCI: IXP4xx is host
PCI: IXP4xx Using direct access for memory space
PCI: bus0: Fast back to back transfers enabled
dmabounce: registered device 0000:00:08.0 on pci bus
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (C) 2001-2003 Red Hat, Inc.
Initializing Cryptographic API
IXP4xx Watchdog Timer: heartbeat 60 sec
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled
ttyS0 at MMIO 0xc8000000 (irq = 15) is a XScale
ttyS1 at MMIO 0xc8001000 (irq = 15) is a XScale
io scheduler noop registered
io scheduler cfq registered
Intel(R) PRO/1000 Network Driver - version 6.0.60-k2-NAPI
Copyright (c) 1999-2005 Intel Corporation.
ixp_flash_probe
STARAT ADDR IS :50000000
end addr is :50ffffff
windows size is 1000000,windows addr is c2880000<3>LAT NAME IS cfi_probe
mtd_do_chip_probe
Search for id9f f0) interleave(1) type(1)
Search for id9f f0) interleave(1) type(1)
Search for id9f f0) interleave(1) type(1)
Search for idb0 00) interleave(1) type(1)
Search for idb0 00) interleave(1) type(1)
Search for idb0 e3) interleave(1) type(2)
jedec match ok!
Found: winbond w28j320bt90l
cfi setup ok
IXP4XX-Flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
setcmd 0001
cfi_fixup jedec_fixup_table
using fwh lock/unlock method
cfi_intelext_chipdrv
number of CFI chips: 1
cfi interleave is 1
devsize is 4194304
cfi->devsize is 22
mtd size is 400000
FLASH PROBE PASS!
type is 3
FLAGS IS 5
size is 400000
erasesize is 10000
numeraseregions is 1
PARSE_MTD_Partitions
redboot test start!
offset is 3e0000 ,master size is 400000 is ,erasersize is 10000 is<3>Searching for RedBoot partition table in IXP4XX-Flash.0 at offset 0x3e0000
5 RedBoot partitions found on MTD device IXP4XX-Flash.0
parse_mtd_partitions end
ERR IS 5<3>add_mtd_pa start
Creating 5 MTD partitions on "IXP4XX-Flash.0":
0x00000000-0x00050000 : "RedBoot"
ADD_MTD_DEVICE OK!!!OHYE!!
0x00050000-0x00170000 : "zImage"
ADD_MTD_DEVICE OK!!!OHYE!!
0x00170000-0x003e0000 : "filesystem"
ADD_MTD_DEVICE OK!!!OHYE!!
0x003e0000-0x003ef000 : "FIS directory"
mtd: partition "FIS directory" doesn't end on an erase block -- force read-only
ADD_MTD_DEVICE OK!!!OHYE!!
0x003ef000-0x003f0000 : "RedBoot config"
mtd: partition "RedBoot config" doesn't start on an erase block boundary -- force read-only
ADD_MTD_DEVICE OK!!!OHYE!!
ADD PARTITIONS OK
NET: Registered protocol family 2
IP route cache hash table entries: 512 (order: -1, 2048 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 204
TCP reno registered
TCP bic 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>
sector_size is 10000,blocks is27,flash size is270000
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 316K
execute command
run_init_process ok
这里说的有你的加载模块的printk信息也贴出来
系统停住后,能够敲入字符回显吗?敲入回车行能够到下一行吗?换句话说,控制台能响应你的请求吗,还是完全死了