- 论坛徽章:
- 0
|
本帖最后由 jounehou 于 2011-03-08 01:16 编辑
今天晚上终于把这个问题解决了。
http://blogold.chinaunix.net/u1/57901/showart_2019107.html
发现遇到这种情况的不只我一人。
感谢该博主的分享,现转载于此:
问题情况:
=================================================================================================================
现在手上有一块Mini6410的版主 从内核内核官网上下载了2.6.36的内核 想移植到板子上 现在板子上只加了nandflash的驱动 但是不知道添加好没有。(如果我想启动文件系统有一个nandflash驱动是否就可以了)
下面是kernel 的启动信息 部分 !求高手帮忙分析一下 。
loop: module loaded
S3C NAND Driver, (c) 2008 Samsung Electronics--pink
S3C NAND Driver is using software ECC.
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit) 《===============这里是否意味驱动已好?
Creating 3 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000080000 : "Bootloader"
0x000000080000-0x000000580000 : "Kernel"
0x000000580000-0x000010000000 : "File System"
=====================================================
dm9000 Ethernet Driver, V1.31
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
s3c-sdhci s3c-sdhci.0: clock source 0: hsmmc (133000000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 1: hsmmc (133000000 Hz)
s3c-sdhci s3c-sdhci.0: clock source 2: mmc_bus (24000000 Hz)
mmc0: SDHCI controller on samsung-hsmmc [s3c-sdhci.0] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
s3c6400_setup_sdhci_cfg_card: CTRL 2=c0004120, 3=80808080
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
uncorrectable error :
uncorrectable error :
end_request: I/O error, dev mtdblock2, sector 2
EXT3-fs (mtdblock2): error: unable to read superblock
end_request: I/O error, dev mtdblock2, sector 0
VFS: Cannot open root device "mtdblock2" or unknown-block(31,2)《====================这里为什么是unknown-block
Please append a correct "root=" boot option; here are the available partitions:
1f00 512 mtdblock0 (driver?) 《==============================这里代表什么意思阿 ,driver 为什么是问好 ?驱动没好?
1f01 5120 mtdblock1 (driver?)
1f02 256512 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2)
[<c002a5d4>] (unwind_backtrace+0x0/0xec) from [<c0252ef0>] (panic+0x54/0x174)
[<c0252ef0>] (panic+0x54/0x174) from [<c0008f20>] (mount_block_root+0x1c8/0x20
[<c0008f20>] (mount_block_root+0x1c8/0x20 from [<c0009180>] (prepare_namespace+0x12c/0x184)
[<c0009180>] (prepare_namespace+0x12c/0x184) from [<c00085ec>] (kernel_init+0x10c/0x14c)
[<c00085ec>] (kernel_init+0x10c/0x14c) from [<c0025e0c>] (kernel_thread_exit+0x0/0x
bootargs :bootargs=root=/dev/mtdblock2 console=ttySAC0,115200
=================================================================================================================
现在一点头绪都没有。内核版本 :2.6.36 板子是友善的mini6410 现在刚把nandflash驱动移植上去 。文件系统 是yaffs2.内核已打yaffs2最新补丁并且已配置对yafffs2的支持。
从打印信息上看 驱动应该移植上去了 分区表也好了 可是为什么挂载不上去 ?
郁闷阿 !
这篇学习笔记以失败为基础向前推进~ 重点在于如何发现问题和解决问题的方法
下面开始和大家分享我的失败过程~:
解压缩内核压缩文件后进入到目录中,然后修改Makefile,找到
ARCH ?=
CROSS_COMPILE ?=
这两项,不修改这两项的话将会默认使用x86的配置,这里修改为
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
arm-linux- 是交叉编译器~ 这里我使用的交叉编译器为友善送的arm-linux-gcc-4.3.2.tgz,带EABI
然后执行make menuconfig,然后进入System Type中看看是否为ARM体系~
第一行为ARM system type 说明没错~ 然后在ARM system type中选择SamSung “S3C2410...”
随后在下面出现的S3C2440 Machines中选择SMDK2440
退出保存~ 执行make zImage
出现ERROR
drivers/video/console/vgacon.c:510:error “PCIMEM_BASE undeclared”
是在vgacon_startup中,vgacon是啥?~ 不认识~ 应该是不必要的东西~ 去掉它~
vim drivers/video/console/Makefile
在里面看见了这句
obj-$(CONFIG_VGA_CONSOLE) += vgacon.o
然后执行 find ./ -name “Kconfig” | xargs grep “VGA_CONSOLE”
看见config VGA_CONSOLE 在driver/video/console/Kconfig中
也就是说在驱动->视频->终端中,执行make menuconfig
在Device Drivers->Graphics Support->Console display driver support中发现了VGA text console
去掉它,保存设置后再编译
编译完成后将在arch/arm/boot中得到zImage文件
使用SuperVivi的USB加载功能启动这个内核文件~ 得到下列输出
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux........................................................................................................ done, booting the kernel.
失败
信息不够丰富~ 根据kasim大大的指点,在配置中进入Kernel hacking
打开Kernel debugging和Kernel low-level debugging functions 还有 Kernel low-level debugging messages via S3C UART
保存后再编译
运行zImage后得下列输出
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux........................................................................................................ done, booting the kernel.
Error: unrecognized/unsupported machine ID (r1 = 0x000007cf).
Available machine support:
ID (hex) NAME
0000016a SMDK2440
Please check your kernel config and/or bootloader.
失败
原来是machine的ID和Supervivi传递进来的ID不匹配~
关于machine ID,可以参考一下这篇文章
<2.6.18-2内核中对S3C2440的引导启动分析>
虽然版本老了点,但是核心思想还是没有变
vim arch/arm/mach-s3c2440/mach-smdk2440.c
在最后一段有这句 MACHINE_START(S3C2440 , ”SMDK2440”)
这里S3C2440就是machine ID的代号~ 呢具体值是多少呢?~
在arch/arm/tools/mach-types中
s3c2440 ARCH_S3C2440 S3C2440 362
原来我们的machine ID是362~
呢bootloader传递进来的值是多少呢?~
Error: unrecognized/unsupported machine ID (r1 = 0x000007cf).
注意到没有?~ 0x7CF转换成10进制也就是1999
修改mach-types中的对应项
s3c2440 ARCH_S3C2440 S3C2440 1999
虽然这样就和下面MINI2440的1999冲突了,但是只要不加入MINI2440的配置就没事
修改后编译,再执行zImage后得下列输出
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux........................................................................................................ done, booting the kernel.
失败
咦?~ 啥都没有?~ 最起码也应该有个乱码吧 这时候我的第一反应是会不会没有跳入到start_kernel中
所以马上编辑init/main.c,在start_kernel的前部加上printk(KERN_INFO “in start_kernel \n”);
但是这个时候内核还没有初始化,所以printk是没有作用的~
继续得到kasim大大的指点,编辑kernel/printk.c中的printk函数
{
va_list args;
int r;
#ifdef CONFIG_DEBUG_LL
extern void printascii(const char *);
char buff[256];
#endif
va_start(args, fmt);
r = vprintk(fmt, args);
#ifdef CONFIG_DEBUG_LL
vsprintf(buff, fmt, args);
#endif
va_end(args);
#ifdef CONFIG_DEBUG_LL
printascii(buff);
#endif
return r;
}
编译后执行zImage,得下列输出
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux........................................................................................................ done, booting the kernel.
<6>in start_kernel
<6>Initializing cgroup subsys cpuset
<6>Initializing cgroup subsys cpu
<5>Linux version 2.6.30.3 (wolf@ubuntu) (gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72) ) #4 Wed Aug 5 16:54:49 CST 2009
.........................
.........................
失败
虽然正常输出了~ 有进入start_kernel~ 但是为什么之前每输出呢?~ 会不会是没有找到输出设备
在输出中看到这行
<5>Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0
console=ttySAC0 会不会是没有ttySAC0这个设备呢~ 在内核中搜索ttySAC 在driver/serial/samsung.c中得到对应项目
这时候我猜想会不会没有加载samsung.c , 经过一轮Makefile和Kconfig的查询 , 发现对应选项在Device Drivers->Character devices->Serial drivers中
一看,原来根本就没有加载Samsung SoC serial support , 选成静态编译之后又出现了Support for console on Samsung SoC serial port ,就是它了,选上, 退出的时候顺便把Kernel low-level debugging functions给取消了
否则我们设置的printk会自行输出,就不知道ttySAC有没有加载成功了
编译后执行,得下列输出
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySAC0"
MACH_TYPE = 1999
NOW, Booting Linux......
Uncompressing Linux......................................................................................................... done, booting the kernel.
w# |
评分
-
查看全部评分
|