这段时间一直在玩友善之臂的Tiny6410,自己写了点驱动打算写点软件放入文件系统中执行的,但是发现用友善提供的rootfs_qtopia_qt4-20110112.tgz解压后的文件制作的yaffs2文件系统刷到nand中后无法正常启动,提示错误如下:
s3c-rtc s3c64xx-rtc: hctosys: invalid date/time
Freeing init memory: 1404K
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
/init: line 102: can't open /r/dev/console: no such file
Kernel panic - not syncing: Attempted to kill init!
[<c016d464>] (unwind_backtrace+0x0/0xe4) from [<c04fc7ec>] (panic+0x58/0x174)
[<c04fc7ec>] (panic+0x58/0x174) from [<c0187848>] (do_exit+0x68/0x5cc)
[<c0187848>] (do_exit+0x68/0x5cc) from [<c0188070>] (do_group_exit+0x90/0xc4)
[<c0188070>] (do_group_exit+0x90/0xc4) from [<c01880b4>] (sys_exit_group+0x10/0x18)
[<c01880b4>] (sys_exit_group+0x10/0x18) from [<c0167e20>] (ret_fast_syscall+0x0/0x30)
one_wire_status: 2
为了调试这个问题,首先把根目录挂载到了nfs上,uboot命令如下:
setenv bootargs root=/dev/nfs console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.2:/nfsboot/qt ip=192.168.1.80:192.168.1.2:192.168.1.1:255.255.255.0:name:eth0:on fbcon=rotate:1
192.168.1.80是设置的调试板的IP,192.168.1.2是nfs主机地址,192.168.1.1是网关,/nfsboot/qt 是nfs目录
把yaffs2文件系统中的所有目录、文件拷贝到/nfsboot/qt 下,首先查看/dev下为空,难怪会提示can't open /r/dev/console: no such file
/dev下的文件都是驱动节点,不知道console的节点号就无法创建这个节点,于是随便创建一个试试。相关命令如下:
sudo mknod console c 100 0 ;自己写了个驱动,控制GPIO的,主节设备是100,先用这个试试了
sudo chmod 777 console ;记得把读写权限全开放
然后启动linux,这次的提示有所变化了:
Freeing init memory: 1404K
Unable to handle kernel paging request at virtual address 726f2064
pgd = c4d98000
[726f2064] *pgd=00000000
Internal error: Oops: 80000005 [#1] PREEMPT
last sysfs file:
Modules linked in:
CPU: 0 Not tainted (2.6.36-FriendlyARM #4)
PC is at 0x726f2064
LR is at 0x6f746365
pc : [<726f2064>] lr : [<6f746365>] psr: 60000033
sp : c5429f60 ip : 000000f0 fp : 6c696620
r10: 68637573 r9 : 206f4e20 r8 : 3a74696e
r7 : 692f2074 r6 : 696e6920 r5 : 64616220 r4 : 3a746f6f
r3 : f4500808 r2 : 00000004 r1 : 00000008 r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA Thumb Segment user
Control: 00c5387d Table: 54d98008 DAC: 00000015
Process switch_root (pid: 1, stack limit = 0xc5428268)
Stack: (0xc5429f60 to 0xc542a000)
9f60: 72696420 6f746365 c50a7972 00181090 00000037 00000004 00000000 c01daecc
9f80: 00000000 00000000 00000037 00000000 0014fbe4 00000037 00181090 c0167fc8
9fa0: c5428000 c0167e20 0014fbe4 00000037 00000002 00181090 00000037 00000001
9fc0: 0014fbe4 00000037 00181090 00000004 00000019 00000001 0000000b 0000000e
9fe0: 00000002 be941b58 0001cb58 00008ebc 60000010 00000002 ffffffff fff7fffd
Code: bad PC value
---[ end trace 95e0e7e97b3c480a ]---
Kernel panic - not syncing: Attempted to kill init!
[<c016d4f0>] (unwind_backtrace+0x0/0xf0) from [<c05057e4>] (panic+0x60/0x178)
[<c05057e4>] (panic+0x60/0x178) from [<c018887c>] (do_exit+0x68/0x5cc)
one_wire_status: 4
[<c018887c>] (do_exit+0x68/0x5cc) from [<c016ba50>] (die+0x194/0x1c4)
[<c016ba50>] (die+0x194/0x1c4) from [<c016e320>] (__do_kernel_fault+0x64/0x84)
[<c016e320>] (__do_kernel_fault+0x64/0x84) from [<c016e514>] (do_page_fault+0x1d4/0x1f0)
one_wire_status: 4
[<c016e514>] (do_page_fault+0x1d4/0x1f0) from [<c016721c>] (do_PrefetchAbort+0x34/0x94)
[<c016721c>] (do_PrefetchAbort+0x34/0x94) from [<c0167b70>] (__pabt_svc+0x50/0xa0)
one_wire_status: 4
Exception stack(0xc5429f18 to 0xc5429f60)
9f00: 00000000 00000008
9f20: 00000004 f4500808 3a746f6f 64616220 696e6920 692f2074 3a74696e 206f4e20
one_wire_status: 4
说明刚才的无法打开的问题已经解决了,只是驱动控制的位置不对导致了其他错误,于是接下来的问题是找到console对应驱动的主次节点号。想到烧录光盘提供的img文件启动开发板是正常的,于是烧录这个正常的img文件,进入系统命令行界面,运行命令ls -all /dev
crw-rw---- 1 root root 10, 59 Jan 1 1970 adc
lrwxrwxrwx 1 root root 11 Jan 1 1970 audio -> sound/audio
crw-rw---- 1 root root 10, 63 Jan 1 1970 backlight
crw-rw---- 1 root root 10, 57 Jan 1 1970 backlight-1wire
crw-rw---- 1 root root 10, 61 Jan 1 1970 buttons
crw-rw---- 1 root root 5, 1 Nov 30 00:01 console
crw-rw---- 1 root root 10, 56 Jan 1 1970 cpu_dma_latency
......
......
这里看到console对应设备的主设备号为5,次设备号为1。
下面知道该怎么做了吧,对了,在文件系统/dev下建立console节点,命令为sudo mknod console c 5 1,然后重新挂载到nfs启动,一切顺利,哈哈。
关于设备号5 1的由来需要查询linux内核源代码,关于为什么要在启动的时候打开console应该要研究linux启动过程了,暂时还没有去深入研究, 现在只是把解决这个问题的方法放出来而已,以后有什么新的进展会继续更新。