嵌入式linux内核不能正常启动 问题跟踪记录
(2014-08-16 21:10:01)
标签:
内核坏块u-bootnandreadboot_zimage天祥电子 |
分类: 嵌入式 |
Copy linux kernel from 0x00120000 to 0x30008000, size =
0x00400000 ... Copy Kernel to SDRAM done,NOW, Booting
Linux......
data abort
pc : [<3000b0ac>]
sp : 301ff6f4
r10: 40000000
r7 : 0000270f
r3 : 0000270f
Flags: nzCv
Resetting CPU ...
注意到一个细节:uboot在烧录内核的时候跳过了一个坏块。会不会是copy内核到SDRAM的时候没跳过坏块而导致启动数据错误了呢?
u-boot引导内核用的是自己添加的命令:boot_zImage,实现函数在arch/arm/lib下的boot_zImage.c中,其中拷贝内核的函数为
static inline int copy_kernel_img(ulong dst, const char *src,
size_t size)
{
}
用到了函数nand_read_ll();而此函数定义在nand_read,c中
int nand_read_ll(unsigned char *buf, unsigned long start_addr,
int size)
{
nand_select();
nand_clear_RnB();
;
*nid = nand_id;
}
if (nand_id == 0xec76 ||
nand_id == 0xad76 ) {
nand.page_size = 512; nand.block_size = 16 * 1024;
nand.bad_block_offset = 5;
// nand.size = 0x4000000;
nand.page_size = 2048;
nand.bad_block_offset = nand.page_size;
// nand.size = 0x8000000;
return -1; // hang
}
#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
if (is_bad_block(&nand, i) ||
i += nand.block_size;
size += nand.block_size;
continue;
}
}
#endif
i += j;
buf += j;
}
nand_deselect();
return 0;
}
其中跳坏块的部分用到了条件编译
#ifdef CONFIG_S3C2410_NAND_SKIP_BAD
if (is_bad_block(&nand, i) ||
i += nand.block_size;
size += nand.block_size;
continue;
}
}
#endif