主题 : mini2440 关于UBIFS根文件系统移植  内核Linux2.6.29,内核启动出错: 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 66854
精华: 0
发帖: 6
金钱: 30 两
威望: 6 点
贡献值: 0 点
综合积分: 12 分
注册时间: 2012-04-04
最后登录: 2012-05-05
楼主  发表于: 2012-04-13 16:39

 mini2440 关于UBIFS根文件系统移植  内核Linux2.6.29,内核启动出错:

描述:我的MTD分区图
图片:
 
搜索了很多资料都找不到答案,而且我发现友善技术交流去也缺少关于UBIfs移植的相关问题和解决方案,故决定发帖,祈求版主好心能帮解决一下下!!!


我在移植完UBIFS后,关掉电源,从NAND FLASH启动时,出现以下启动不成功的打印信息,(红色部分为特别关注)
## Booting kernel from Legacy Image at 31000000 ...
Image Name: Linux-2.6.29.4-FriendlyARM
Created: 2012-04-12 9:24:54 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1771160 Bytes = 1.7 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux.............................................................
................................................. done, booting the kernel.
Linux version 2.6.29.4-FriendlyARM (root@12.34.217.125.in-addr.arpa) (gcc versio
n 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #12 Thu Apr 12 17:24:50 CST 2012
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: ubi.mtd=3,2048 root=ubi0:rootfs rootfstype=ubifs console=tt
ySAC0 init=/linuxrc rw
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61268KB available (3172K code, 334K data, 92K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 296 bytes
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Using static regulatory domain info
cfg80211: Regulatory domain: US
(start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
(2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm)
(5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm)
(5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm)
cfg80211: Calling CRDA for country: US
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 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 2048)
TCP reno registered
NET: Registered protocol family 1
fuse init (API version 7.11)
msgmni has been set to 119
alg: No test for stdrng (krng)
io scheduler noop registered (default)
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
dm9000 Ethernet Driver, V1.31
Now use the default MAC address: 08:90:90:90:90:90
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c4862000,c4866004 IRQ 51 MAC: 08:90:90:90:90:90 (friendly-arm)
usbcore: registered new interface driver rt73usb
Linux video capture interface: v2.00
usbcore: registered new interface driver ov511
ov511: v1.64 for Linux 2.5:ov511 USB Camera Driver
Driver 'sd' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bi
t)
NAND_ECC_NONE selected by board driver. This is not recommended !!
Scanning device for bad blocks
Bad eraseblock 44 at 0x000000580000
Bad eraseblock 55 at 0x0000006e0000
Bad eraseblock 56 at 0x000000700000
Bad eraseblock 57 at 0x000000720000
Bad eraseblock 58 at 0x000000740000
Bad eraseblock 59 at 0x000000760000
Bad eraseblock 60 at 0x000000780000
Bad eraseblock 61 at 0x0000007a0000
Bad eraseblock 62 at 0x0000007c0000
Bad eraseblock 63 at 0x0000007e0000
Bad eraseblock 64 at 0x000000800000
Bad eraseblock 65 at 0x000000820000
Bad eraseblock 66 at 0x000000840000
Bad eraseblock 67 at 0x000000860000
Bad eraseblock 69 at 0x0000008a0000
Bad eraseblock 273 at 0x000002220000
Bad eraseblock 685 at 0x0000055a0000
Bad eraseblock 863 at 0x000006be0000
Bad eraseblock 1994 at 0x00000f940000
Bad eraseblock 2009 at 0x00000fb20000
Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000060000 : "supervivi"
0x000000060000-0x000000260000 : "Kernel"
0x000000260000-0x000040260000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 256MiB 3,3V 8-bit"
-- size truncated to 0xfda0000
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "NAND 256MiB 3,3V 8-bit"
-- size truncated to 0x10000000
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 126976 bytes
UBI: smallest flash I/O unit: 2048
UBI: VID header offset: 2048 (aligned 2048)
UBI: data offset: 4096
UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 556
UBI error: ubi_init: cannot attach mtd3
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22

ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: S3C24XX OHCI
usb usb1: Manufacturer: Linux 2.6.29.4-FriendlyARM ohci_hcd
usb usb1: SerialNumber: s3c24xx
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver usbserial
usbserial: USB Serial Driver core
USB Serial support registered for pl2303
usbcore: registered new interface driver pl2303
pl2303: Prolific PL2303 USB to serial adaptor driver
mice: PS/2 mouse device common for all mice
TCP cubic registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
lib80211: common routines for IEEE802.11 drivers
UBIFS error (pid 1): ubifs_get_sb: cannot open "ubi0:rootfs", error -19
VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00 384 mtdblock0 (driver?)
1f01 2048 mtdblock1 (driver?)
1f02 259712 mtdblock2 (driver?)
1f03 262144 mtdblock3 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
U-Boot 2009.11 ( 9鏈?10 2011 - 03:51:10)


我的内核MTD分区为:
如果:粘贴的图看不到,我把它上传到附件中了;
我用pri打印了启动参数:(特别是红色部分)
启动参数:
[u-boot@GQ2440]# pri
baudrate=115200
ethaddr=0a:1b:3c:4d:5e:6f
ethact=dm9000
bootdelay=1
bootcmd=nand read 31000000 80000 352800 ; bootm
31000000filesize=1B06D8
fileaddr=31000000
gatewayip=192.168.1.1
netmask=255.255.255.0
ipaddr=192.168.1.230
serverip=192.168.1.26
mtdids=nand0=nandflash0
mtdparts=mtdparts=nandflash0:384k(bootloader),128k(params),5m(kernel),64m(root),
-(app)
partition=nand0,0
mtddevnum=0
mtddevname=bootloader
bootargs=ubi.mtd=3,2048 root=ubi0:rootfs rootfstype=ubifs console=ttySAC0 init=/
linuxrc rw

stdin=serial
stdout=serial
stderr=serial
Environment size: 1236/131068 bytes
[ 此帖被liangyinxuan在2012-04-13 22:56重新编辑 ]
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2012-04-16 12:50

 Re:mini2440 关于UBIFS根文件系统移植 内核Linux2.6.29,内核启动出错:

Creating 4 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000060000 : "supervivi"
0x000000060000-0x000000260000 : "Kernel"
0x000000260000-0x000040260000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 256MiB 3,3V 8-bit"
-- size truncated to 0xfda0000
0x000000000000-0x000040000000 : "nand"
mtd: partition "nand" extends beyond the end of device "NAND 256MiB 3,3V 8-bit"
-- size truncated to 0x10000000

看起来内核使用的NAND Flash分区表和你源代码中定义的以及u-boot中使用的并不一样。建议你把u-boot中定义的mtdparts变量加到bootargs里,确保内核和u-boot使用一样的分区表。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 66854
精华: 0
发帖: 6
金钱: 30 两
威望: 6 点
贡献值: 0 点
综合积分: 12 分
注册时间: 2012-04-04
最后登录: 2012-05-05
2楼  发表于: 2012-04-17 16:43

 回 1楼(kasim) 的帖子

还是很感谢版主能及时的回答我的问题!后来我自己也发现了这个问题了,我以这个为题为突破点发现:我的内核的NAND FLASH 的MTD分区的文件是2.6.29内核下的arch/arm/plat-s3c24xx/目录下的common-friendly-arm.c  而不是arch/arm/mach-s3c2440/ 目录下的mach-anubis.c文件 ,后来及时的改正了!打印信息的分区跟我贴图的分区一样了,但是发现还有UBI error: validate_ec_hdr: bad VID header offset 512, expected 2048
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 556
UBI error: ubi_init: cannot attach mtd3
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
的错误信息,但还是找到了相近的解决方案:http://blog.chinaunix.net/space.php?uid=20632682&do=blog&id=82414  按照这篇帖子最终内核成功的启动了

这两天有空我会写篇博文,对ubifs制作过程和遇到的问题有所总结
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2012-04-17 19:42

 回 2楼(liangyinxuan) 的帖子

恭喜楼主问题解决。总结问题比解决问题本身更重要。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
级别: 新手上路
UID: 66854
精华: 0
发帖: 6
金钱: 30 两
威望: 6 点
贡献值: 0 点
综合积分: 12 分
注册时间: 2012-04-04
最后登录: 2012-05-05
4楼  发表于: 2012-04-21 11:18

 Re:mini2440 关于UBIFS根文件系统移植 内核Linux2.6.29,内核启动出错:

对ubifs制作过程和遇到的问题有所总结 我已经在CSDN中写成博客了!分别分成三部分:如果哪位也遇到相同的问题可以去参考详细的过程!
下面给出链接:
之一“uboot中添加对UBIFS文件系统的支持”
http://blog.csdn.net/yx_l128125/article/details/7474704
之二“Linux内核中添加对UBIFS文件系统的支持”
http://blog.csdn.net/yx_l128125/article/details/7475437
之三“UBIFS镜像的制作&&烧写”
http://blog.csdn.net/yx_l128125/article/details/7478042