Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3433090
  • 博文数量: 754
  • 博客积分: 10132
  • 博客等级: 上将
  • 技术积分: 7780
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-14 23:36
文章分类

全部博文(754)

文章存档

2012年(3)

2011年(39)

2010年(66)

2009年(167)

2008年(479)

我的朋友

分类: LINUX

2009-02-12 11:08:22

在一塊s3c2440a的平台上,跑linux-2.6.12.1, 在root分區中直接用genromfs建立了一個romfs.img,寫入root分區, 打印的信息如下,又跟蹤了一下發現在
create_dev("/dev/root", ROOT_DEV, root_device_name);就出錯了返回值 -2,
請高人指點一二。




Uncompressing Linux.......................................................... done, booting the kernel.
consoleLinux version 2.6.12.1 (xxxx@xxxx) (gcc version 3.4.3) #49 Fri Jul 1 14:30:16 2005
CPU: ARM920Tid(wb) [41129200] revision 0 (ARMv4T)
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Machine: SMDK2440
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440aaa)
S3C2440: core 196.608 MHz, memory 98.304 MHz, peripheral 49.152 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
Built 1 zonelists
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc console=ttySAC1,115200n8
irq: clearing pending ext status 00000100
irq: clearing subpending status 00000010
PID hash table entries: 256 (order: 8, 4096 bytes)
timer tcon=00000000, tcnt 9fff, tcfg 000002_0,00000000, usec 00001f40
Console: colour dummy device 80x30
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: 30464KB available (1473K code, 303K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C2440: Clock Support, UPLL 208.896 MHz
S3C2410 DMA Driver, (c) 2003-2004 Simtec Electronics
DMA channel 0 at c2800000, irq 33
DMA channel 1 at c2800040, irq 34
DMA channel 2 at c2800080, irq 35
DMA channel 3 at c28000c0, irq 36
NetWinder Floating Point Emulator V0.97 (double precision)
devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)
devfs: boot_options: 0x1
JFS: nTxBlock = 238, nTxLock = 1908
S3C2410 RTC, (c) 2004 Simtec Electronics
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
S3C2410 NAND Driver, (c) 2004 Simtec Electronics
s3c2410-nand: mapped registers at c2a00000
s3c2410-nand: timing: Tacls 9ns, Twrph0 39ns, Twrph1 9ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x36 (Samsung NAND 64MiB 1,8V 8-bit)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Creating 5 MTD partitions on "NAND 64MiB 1,8V 8-bit":
0x00000000-0x00020000 : "loader"
mtd: Giving out device 0 to loader
0x00020000-0x00030000 : "param"
mtd: Giving out device 1 to param
0x00030000-0x00200000 : "kernel"
mtd: Giving out device 2 to kernel
0x00200000-0x00400000 : "root"
mtd: Giving out device 3 to root
0x00400000-0x03ef8000 : "user"
mtd: Giving out device 4 to user
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 384 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
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 2048)
NET: Registered protocol family 1
VFS: Cannot open root device "mtdblock3" or unknown-block(31,3)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)


不知道2.6上怎麼樣,你把內核參數root=/dev/mtdblock3改為root=/dev/mtdblock/3試試,或者去掉devfs支持試試。


跟蹤create_dev("/dev/root", ROOT_DEV, root_device_name)發現在 __link_path_walk( /dev/root )= -2
好像是找不到目錄項 /dev ,
就在前面加上
sys_mkdir( "/dev", 0700 );
sys_mkdir( "/root", 0700 );
這樣居然可以正確加載rootfs了。不知道是啥原因,希望哪位大俠幫分協一下。

但後面又出錯了
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
這個應該和我使用的busybox有關,回去再仔細研究一下。


應該按樓上的方法把root=/dev/mtdblock3改為root=/dev/mtdblock/3,因為你啟用了devfs文件系統;
可以考慮在/dev下:ln -s /dev/mtdbock3 root
試試!


root=/dev/mtdblock3 沒錯,可能是內核還不支持ROMFS文件系統,選上
應該沒事了

謝謝各位的幫助,

在函數
void __init prepare_namespace(void)
中調用 mount_devfs(); 和mount_root中需要用到兩個目錄/dev 和 /root
可是我在前面的代碼中沒有找到建立這兩個目錄的地方,


我現在在mount_devfs(); 前加上這兩句系統就可以正常運行了,但我認為這是前面某個地方有錯誤引起的。
另外root=/dev/mtdblock3, 和/dev/mtdblock/3的,都可以啟動。我想他們都被sysfs解釋成/sys/block/mtdblock3/dev來處理了.


在2.4的代碼中有直接的sys_mkdir(/dev)和sys_mkdir( /root )調用.在2.6.12.1沒有,不知道2.6是如何處理的,望哪位大俠能指點一下。



頂一把,我的也是這個問題!

加入了devfs後就不行了。
以前用 root=/dev/mtdblock3可以的
現在啟動後
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
VFS: Cannot open root device "mtdblock3" or unknown-block(31,3)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
就這樣

改成
root=/dev/mtdblock/3
啟動後
TCP reno registered
TCP bic registered
NET: Registered protocol family 1
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device "mtdblock/3" or unknown-block(2,0)
Please append a correct "root=" boot option
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

不知道怎麼辦,我的是2.6.16的內核!


 

 

阅读(2105) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~