Welcome 微信登录

首页 / 操作系统 / Linux / 移植Linux内核到s3c6410(kernel 打印:Uncompressing Linux ... done , booting the kernel.后无响应问题的解决。)

U-boot网口问题解决后,uImage和ramdisk终于可以上传到单板上去验证了。脚本为:
MINI6410 # setenv serverip 192.168.1.200MINI6410 # setenv bootargs root=/dev/ram rootfstype=ext2 init=/linuxrc console=ttySAC0,115200 mem=256MINI6410 # tftp 0x51800000 ramdisk.binMINI6410 # tftp 0x50800000 uImageMINI6410 # bootm 0x50800000 0x51800000—————————————————————执行bootm命令后打印:
## Booting image at 50800000 ...   Image Name:   Linux-2.6.38   Image Type:   ARM Linux Kernel Image (uncompressed)   Data Size:    1902992 Bytes =  1.8 MB   Load Address: 50008000   Entry Point:  50008000   Verifying Checksum ... OKOK## Loading Ramdisk Image at 51800000 ...   Image Name:   ramdisk1.0   Image Type:   ARM Linux RAMDisk Image (gzip compressed)   Data Size:    1040870 Bytes = 1016.5 kB   Load Address: 00000000   Entry Point:  00000000   Verifying Checksum ... OK Starting kernel ... Uncompressing Linux... done, booting the kernel. 就无任何反应了!!!!网上查资料主要怀疑方向有:1、machine ID uboot与内核定义不一致。2、内核参数console传递的不对。 问题确认:1、machine ID uboot与内核定义不一致。uboot传递的machine ID参数:boardsamsungmini6410Mini6410.c gd->bd->bi_arch_number = MACH_TYPE;include/configs/Mini6410.h#define MACH_TYPE  2520内核的machine ID参数:include/generated/mach-types.h#define MACH_TYPE_MINI6410             2520
所以不是这个问题。
 2、内核参数console传递的不对。console=ttySAC0,115200 这个也确认是没有问题。所以也不是这个问题。———————————————————没办法,只能自己动手调试了。1、首先尝试low-level debug调试方法Kernel hacking-->Kernel low-level debugging functionsKernel hacking-->S3C UART to use for low-level debug 为UART 0。可是问题依旧,还是无任何打印。2、直接使用printascii/printhex8 打印kernel启动过程。printascii其实就是1个字符1个字符往串口里写,addruart_current 就是返回当前uart的寄存器基地址,这个与我们前面的S3C UART to use for low-level debug 配置有关。       ENTRY(printascii)
  addruart_current r3, r1, r2
  b 2f
1:  waituart r2, r3
  senduart r1, r3
  busyuart r2, r3
  teq r1, #" "
  moveq r1, #" "
  beq 1b
2:  teq r0, #0
  ldrneb r1, [r0], #1
  teqne r1, #0
  bne 1b
  mov pc, lr
ENDPROC(printascii)printhex8 其实就是将16进制数,每4个bit为1个字符,填写到buffer里,即转为 ASCII字符串,然后调用printascii打印出来。我写的定位函数,r0为入参,打印具体到了哪一步:__right_p:
    adr r13,spbuf1
    STMIA r13, {R1-R4,R7}
    mov r7,lr
    mov r4, r0
    adr r0, str_p3
    bl     printascii
    mov r0 ,r4
    bl printhex8
    adr r0,str_p4
    bl printascii
    mov lr,r7
    ldmia r13,{R1-R4,R7}    mov pc,lr
    str_p3: .asciz " kernel boot step 0x"
    str_p4:      .asciz     " "
 .align
ENDPROC(__right_p)spbuf1:  .space 20例如:/*step 0*/
      mov r0,#0
      bl __right_p写汇编函数要注意几点:A、破坏的寄存器一定要保存B、多层调用(a-->b-->c)一定要记得保存/恢复lr寄存器,因为b调用c是会破坏a的返回地址。