主题 : 编译2.6.18 内核下载后为什么不能启动? 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 172
精华: 1
发帖: 48
金钱: 500 两
威望: 68 点
贡献值: 10 点
综合积分: 116 分
注册时间: 2008-02-27
最后登录: 2017-09-13
10楼  发表于: 2008-04-01 22:32
可是还没看到,我移植的2.6.18就是done, booting the kernel.这里停了。
可能再head.s中 bl decompress_kernel 和mov pc ,r4 中间出现问题,在汇编中用什么指令可以输出一些信息来看是那条指令跑飞了。先感谢了
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
11楼  发表于: 2008-04-01 23:19
The best advice is if you're using your own debugging code, remove it.
Use the debugging printascii() stuff for your platform in
arch/arm/kernel/debug-armv.S (enabled by CONFIG_DEBUG_LL) and drop it
into printk() (kernel/printk.c) just after the vsprintf() call, and
monitor the relevant serial port.
"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: 44
精华: 0
发帖: 39
金钱: 390 两
威望: 48 点
贡献值: 0 点
综合积分: 78 分
注册时间: 2008-01-28
最后登录: 2009-04-30
12楼  发表于: 2008-04-02 13:24

 按照上面你说的改后Re:编译2.6.18 内核下载后为什么不能启动?

按照上面你说的改后
Enter your selection: b
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySA
C0"
MACH_TYPE = 782
NOW, Booting Linux......
Uncompressing Linux.............................................................
......................... done, booting the kernel.

Error: unrecognized/unsupported machine ID (r1 = 0x0000030e).

Available machine support:

ID (hex)        NAME
0000016a        SMDK2440

Please check your kernel config and/or bootloader.

这是vivi里的mach_type 和 内核里设置的不一样
修改任何一个地方都可以了
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
13楼  发表于: 2008-04-02 14:12
引用第10楼alexchen于2008-04-01 22:32发表的  :
可是还没看到,我移植的2.6.18就是done, booting the kernel.这里停了。
可能再head.s中 bl decompress_kernel 和mov pc ,r4 中间出现问题,在汇编中用什么指令可以输出一些信息来看是那条指令跑飞了。先感谢了

如果你修改过Machine ID还是出现这样的错,一般来说是挂在板级的初始化阶段,这部分代码是用C写,你可以通过参照上面的回贴修改printk()来让串口在这个阶段就输出debug消息。
"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: 172
精华: 1
发帖: 48
金钱: 500 两
威望: 68 点
贡献值: 10 点
综合积分: 116 分
注册时间: 2008-02-27
最后登录: 2017-09-13
14楼  发表于: 2008-04-02 17:24
我在init/main.c的start_kernel 中加入printascii("hello world\n");编译错误,好像是什么没有定义,要加那些头文件。版主能不能发一个QQ2440 2.6.13以上的zImage 给我参考下。邮箱是alexchenq@163.com,先谢了。
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
15楼  发表于: 2008-04-02 22:55
引用第14楼alexchen于2008-04-02 17:24发表的  :
我在init/main.c的start_kernel 中加入printascii("hello worldn");编译错误,好像是什么没有定义,要加那些头文件。版主能不能发一个QQ2440 2.6.13以上的zImage 给我参考下。邮箱是alexchenq@163.com,先谢了。


Patch the 2.6.18 kernel with the following patch to make printk() output via serial port before uart driver is inited

cd linux-2.6.18 &&  patch  -p1  < /path/to/early_printk.patch

early_printk.patch:

---
kernel/printk.c |  12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

Index: linux-2.6.18/kernel/printk.c
===================================================================
--- linux-2.6.18.orig/kernel/printk.c    2008-04-02 21:46:59.000000000 +0800
+++ linux-2.6.18/kernel/printk.c    2008-04-02 21:55:18.000000000 +0800
@@ -492,11 +492,19 @@
{
    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;
}
附件: early_printk.patch.zip (1 K) 下载次数:20
"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: 172
精华: 1
发帖: 48
金钱: 500 两
威望: 68 点
贡献值: 10 点
综合积分: 116 分
注册时间: 2008-02-27
最后登录: 2017-09-13
16楼  发表于: 2008-04-03 00:37
版主回复好快,赞一个,明天在虚拟机里试试。
级别: 侠客
UID: 172
精华: 1
发帖: 48
金钱: 500 两
威望: 68 点
贡献值: 10 点
综合积分: 116 分
注册时间: 2008-02-27
最后登录: 2017-09-13
17楼  发表于: 2008-04-03 00:40
版主回复好快,赞一个,明天在虚拟机里试试。
级别: 侠客
UID: 172
精华: 1
发帖: 48
金钱: 500 两
威望: 68 点
贡献值: 10 点
综合积分: 116 分
注册时间: 2008-02-27
最后登录: 2017-09-13
18楼  发表于: 2008-04-03 12:33
我打了补丁,下载启动后出现以下错误,请版主再分析分析。。

Enter your selection: b
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
Setup linux parameters at 0x30000100
linux command line is: "noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySA
C0"
MACH_TYPE = 362
NOW, Booting Linux......
Uncompressing Linux.............................................................
......................... done, booting the kernel.
<5>Linux version 2.6.18 (root@localhost.localdomain) (gcc version 3.4.1) #5 Thu                                                                             
Apr 3 11:56:15 CST 2008                     
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177                                                       
Machine: SMDK2440               
<7>Converting old-style param struct to taglist                                             
<4>ATAG_INITRD is deprecated; please update your bootloader.                                                           
Memory policy: ECC disabled, Data cache writeback                                               
<7>On node 0 totalpages: 16384                             
<7>  DMA zone: 16384 pages, LIFO batch:3                                       
CPU S3C2440A (id 0x32440001)                           
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz                                                                   
<6>S3C24XX Clocks, (c) 2004 Simtec Electronics                                             
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on                                                   
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                                                                 
Built 1 zonelists.  Total pages: 16384                                     
<5>Kernel command line: noinitrd root=/dev/mtdblock2 init=/linuxrc console=ttySA                                                                               
C0 
irq: clearing pending ext status 00000200                                       
irq: clearing subpending status 00000003                                       
irq: clearing subpending status 00000002                                       
PID hash table entries: 512 (order: 9, 2048 bytes)                                                 
timer tcon=00000000, tcnt a4ca, tcfg 00000200,00000000, usec 00001e57
<1>Unable to handle kernel paging request at virtual address 000b8022
<1>pgd = c0004000
<1>[000b8022] *pgd=00000000
Internal error: Oops: 5 [#1]
Modules linked in:
CPU: 0
PC is at vgacon_startup+0x25c/0x3f4
LR is at 0xb8000
pc : [<c011356c>]    lr : [<000b8000>]    Not tainted
sp : c0243f74  ip : 000b8022  fp : c0243f98
r10: c02c7864  r9 : 41129200  r8 : c0247250
r7 : ffffaa55  r6 : c021e970  r5 : 000055aa  r4 : 00000000
r3 : c02c7854  r2 : 000c0022  r1 : c02c7850  r0 : 00000000
Flags: nzCv  IRQs on  FIQs off  Mode SVC_32  Segment kernel
Control: C000717F  Table: 30004000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc0242250)
Stack: (0xc0243f74 to 0xc0244000)
3f60:                                              c02ca57c c001e2c8 00000000
3f80: 00000000 3001dcac 3001dc78 c0243fbc c0243f9c c00191e0 c0113320 c01224ac
3fa0: c001e2c0 c001e2c8 c02471a4 c02e7b60 c0243fd4 c0243fc0 c0018aec c00191bc
3fc0: c0007175 c029f444 c0243ff4 c0243fd8 c0008930 c0018acc c0008464 c029f4c8
3fe0: c0007175 c029f444 00000000 c0243ff8 30008030 c0008800 00000000 00000000
Backtrace:
[<c0113310>] (vgacon_startup+0x0/0x3f4) from [<c00191e0>] (con_init+0x34/0x2b0)
[<c00191ac>] (con_init+0x0/0x2b0) from [<c0018aec>] (console_init+0x30/0x48)
r7 = C02E7B60  r6 = C02471A4  r5 = C001E2C8  r4 = C001E2C0
[<c0018abc>] (console_init+0x0/0x48) from [<c0008930>] (start_kernel+0x140/0x26c
)
r5 = C029F444  r4 = C0007175
[<c00087f0>] (start_kernel+0x0/0x26c) from [<30008030>] (0x30008030)
r5 = C029F444  r4 = C0007175
Code: e59f7178 e59f5178 e5832000 e581c000 (e1de22b2)
<0>Kernel panic - not syncing: Attempted to kill the idle task!
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
19楼  发表于: 2008-04-03 13:28
引用第18楼alexchen于2008-04-03 12:33发表的  :
我打了补丁,下载启动后出现以下错误,请版主再分析分析。。

Enter your selection: b
Copy linux kernel from 0x00050000 to 0x30008000, size = 0x00200000 ... done
zImage magic = 0x016f2818
.......


仔细看kernel crash的信息:

<1>Unable to handle kernel paging request at virtual address 000b8022
<1>pgd = c0004000
<1>[000b8022] *pgd=00000000
Internal error: Oops: 5 [#1]
Modules linked in:
CPU: 0
PC is at vgacon_startup+0x25c/0x3f4
LR is at 0xb8000

pc : [<c011356c>]    lr : [<000b8000>]    Not tainted
sp : c0243f74  ip : 000b8022  fp : c0243f98
r10: c02c7864  r9 : 41129200  r8 : c0247250
r7 : ffffaa55  r6 : c021e970  r5 : 000055aa  r4 : 00000000
r3 : c02c7854  r2 : 000c0022  r1 : c02c7850  r0 : 00000000
Flags: nzCv  IRQs on  FIQs off  Mode SVC_32  Segment kernel
Control: C000717F  Table: 30004000  DAC: 00000017
Process swapper (pid: 0, stack limit = 0xc0242250)
Stack: (0xc0243f74 to 0xc0244000)
3f60:                                              c02ca57c c001e2c8 00000000
3f80: 00000000 3001dcac 3001dc78 c0243fbc c0243f9c c00191e0 c0113320 c01224ac
3fa0: c001e2c0 c001e2c8 c02471a4 c02e7b60 c0243fd4 c0243fc0 c0018aec c00191bc
3fc0: c0007175 c029f444 c0243ff4 c0243fd8 c0008930 c0018acc c0008464 c029f4c8
3fe0: c0007175 c029f444 00000000 c0243ff8 30008030 c0008800 00000000 00000000
Backtrace:
[<c0113310>] (vgacon_startup+0x0/0x3f4) from [<c00191e0>] (con_init+0x34/0x2b0)
[<c00191ac>] (con_init+0x0/0x2b0) from [<c0018aec>] (console_init+0x30/0x48)
r7 = C02E7B60  r6 = C02471A4  r5 = C001E2C8  r4 = C001E2C0
[<c0018abc>] (console_init+0x0/0x48) from [<c0008930>] (start_kernel+0x140/0x26c
)
r5 = C029F444  r4 = C0007175
[<c00087f0>] (start_kernel+0x0/0x26c) from [<30008030>] (0x30008030)
r5 = C029F444  r4 = C0007175
Code: e59f7178 e59f5178 e5832000 e581c000 (e1de22b2)
<0>Kernel panic - not syncing: Attempted to kill the idle task!

如果你想学ARM汇编,你可以试试反汇编kernel,然后找出crash的位置;
如果你和我一样懒,就多加几个printk()吧
[ 此贴被kasim在2008-04-03 13:34重新编辑 ]
"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."