移植Linux内核到s3c6410(kernel 打印:Uncompressing Lin(2)

加了定位信息后:


Starting kernel ...

Uncompressing Linux... done, booting the kernel.

kernel boot step 0x00000000

000009d8

7f005000

c0008358

50025288

500252c0

000009d8

kernel boot step 0x00000001

kernel boot step 0x00000002

kernel boot step 0x00000003

kernel boot step 0x00000004

确认了:

machine ID确实是对的。

异常不是在汇编阶段而是出在start_kernel函数之后。

继续在start_kernel里加打印,终于确定是在 setup_arch(&command_line);之后就出现异常了。但是还是无法精确定位,由于在 console_init();初始化之前printk是打印在__log_buf里,而且在软复位或者按键复位后,内存的值还能保留,所以尝试按键复位后,在uboot里使用md命令查看__log_buf里的值来确认内核初始化的打印。


__log_buf=503c9598


MINI6410 # md 0x503c9598

503c9598: 4c3e353c 78756e69 72657620 6e6f6973    <5>Linux version

503c95a8: 362e3220 2038332e 6f6f7228 6f6c4074     2.6.38 (root@lo

503c95b8: 686c6163 2e74736f 61636f6c 6d6f646c    calhost.localdom

503c95c8: 296e6961 63672820 65762063 6f697372    ain) (gcc versio

503c95d8: 2e34206e 20332e34 6e746328 2e312d67    n 4.4.3 (ctng-1.

503c95e8: 29312e36 23202920 53203432 4a206e75    6.1) ) #24 Sun J

503c95f8: 32206c75 32322034 3a35343a 43203333    ul 24 22:45:33 C

503c9608: 32205453 0a313130 433e343c 203a5550    ST 2011.<4>CPU:

503c9618: 764d5241 6f632d36 7461706d 656c6269    ARMv6-compatible

503c9628: 6f727020 73736563 5b20726f 66303134     processor [410f

503c9638: 36363762 6572205d 69736976 36206e6f    b766] revision 6

503c9648: 52412820 2937764d 7263202c 6330303d     (ARMv7), cr=00c

503c9658: 37383335 343c0a66 5550433e 4956203a    5387f.<4>CPU: VI

503c9668: 6e205450 6c616e6f 69736169 6420676e    PT nonaliasing d

503c9678: 20617461 68636163 56202c65 20545049    ata cache, VIPT

503c9688: 616e6f6e 7361696c 20676e69 74736e69    nonaliasing inst

MINI6410 #

503c9698: 74637572 206e6f69 68636163 00000a65    ruction cache...

503c96a8: 00000000 00000000 00000000 00000000    ................

503c96b8: 00000000 00000000 79726f6d 6c6f7020    ........mory pol

503c96c8: 3a796369 43434520 73696420 656c6261    icy: ECC disable

503c96d8: 44202c64 20617461 68636163 72772065    d, Data cache wr

503c96e8: 62657469 0a6b6361 4b3e303c 656e7265    iteback.<0>Kerne

503c96f8: 6170206c 2063696e 6f6e202d 79732074    l panic - not sy

503c9708: 6e69636e 45203a67 524f5252 6146203a    ncing: ERROR: Fa

503c9718: 64656c69 206f7420 6f6c6c61 65746163    iled to allocate

503c9728: 31783020 20303030 65747962 65622073     0x1000 bytes be

503c9738: 20776f6c 2e307830 3e303c0a 3e343c0a    low 0x0..<0>.<4>

503c9748: 6b636142 63617274 0a203a65 5b3e343c    Backtrace: .<4>[

503c9758: 3030633c 37363133 205d3e63 6d756428    <c003167c>] (dum

503c9768: 61625f70 72746b63 2b656361 2f307830    p_backtrace+0x0/

503c9778: 31317830 66202934 206d6f72 30633c5b    0x114) from [<c0

503c9788: 61306332 5d3e3436 75642820 735f706d    2c0a64>] (dump_s

MINI6410 # md 0x503c9598             

503c9798: 6b636174 3178302b 78302f38 0a296331    tack+0x18/0x1c).

503c97a8: 00000000 00000000 00000000 00000000    ................

503c97b8: 00000000 00000000 00346163 00000000    ........ca4.....

503c97c8: 00000000 00000000 00000000 00000000    ................

503c97d8: 00000000 00000000 6d756428 74735f70    ........(dump_st

503c97e8: 2b6b6361 2f307830 63317830 72662029    ack+0x0/0x1c) fr

503c97f8: 5b206d6f 3230633c 63613063 205d3e63    om [<c02c0acc>]

503c9808: 6e617028 302b6369 2f343678 38317830    (panic+0x64/0x18

503c9818: 000a2930 00000000 63323063 38366130    0)......c02c0a68

503c9828: 28205d3e 696e6170 78302b63 78302f30    >] (panic+0x0/0x

503c9838: 29303831 6f726620 3c5b206d 31303063    180) from [<c001

503c9848: 38653936 28205d3e 626d656d 6b636f6c    69e8>] (memblock

503c9858: 6c6c615f 625f636f 2b657361 63337830    _alloc_base+0x3c

503c9868: 3478302f 000a2930 00000000 00000000    /0x40)..........

503c9878: 00000000 00000000 30303a32 30303030    ........2:000000

503c9888: 00003030 00000000 00000000 00000000    00..............

MINI6410 #

503c9898: 00000000 00000000 00006232 00000000    ........2b......

503c98a8: 00000000 00000000 00000000 00000000    ................

503c98b8: 00000000 00000000 625f636f 2b657361    ........oc_base+

503c98c8: 2f307830 30347830 72662029 5b206d6f    0x0/0x40) from [

503c98d8: 3030633c 33613631 205d3e34 6d656d28    <c0016a34>] (mem

503c98e8: 636f6c62 6c615f6b 2b636f6c 34317830    block_alloc+0x14

503c98f8: 3178302f 000a2938 72203e34 30633a35    /0x18)..4> r5:c0

503c9908: 31353134 00006338 00000000 00000000    41518c..........

503c9918: 00000000 00000000 31303063 30326136    ........c0016a20

503c9928: 28205d3e 626d656d 6b636f6c 6c6c615f    >] (memblock_all

503c9938: 302b636f 302f3078 29383178 6f726620    oc+0x0/0x18) fro

503c9948: 3c5b206d 30303063 63306464 28205d3e    m [<c000dd0c>] (

503c9958: 39332e54 78302b31 302f3831 29303378    T.391+0x18/0x30)

503c9968: 0000000a 00000000 00000000 00000000    ................

503c9978: 00000000 00000000 2f307830 30337830    ........0x0/0x30

503c9988: 72662029 5b206d6f 3030633c 32376530    ) from [<c000e72

发现一条异常打印:

Kerne  panic - not syncing: ERROR: Failed to allocate 0x1000 bytes be low 0x0..

搜索代码中的打印,确认是这个函数里打印的:

start_kernel-->setup_arch-->paging_init-->bootmem_init-->arm_bootmem_init-->memblock_alloc_base

phys_addr_t __init memblock_alloc_base(phys_addr_t size, phys_addr_t align, phys_addr_t max_addr)
{
 phys_addr_t alloc;

alloc = __memblock_alloc_base(size, align, max_addr);

if (alloc == 0)
  panic("ERROR: Failed to allocate 0x%llx bytes below 0x%llx.\n",
        (unsigned long long) size, (unsigned long long) max_addr);

return alloc;
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwjwjw.html