qboot 启动采用了双核启动方式,当第一个内核 uImage 的校验不通过时,将加载
第二块内核地址空间,启动第二个内核。
qboot 的主函数的代码如下:
int main()
{
int i;
unsigned int magic=0;
unsigned int magic_clac=0, magic_datacrc=0, image_size=0;
struct image_info image;
unsigned int *vram;
sysclk_init();
init_sernuc(0);
ser_putstr(0,"\n\rstart linux...\n\r");
hw_init();
board_nand_hwinit();
memset(&image, 0, sizeof(image));
image.dest = (unsigned char *)SDRAM_FRAMEBUFFER_ADDR;
image.offset = FLASH_**_BASE;
image.length = FLASH_**_LEN;
load_nandflash(&image);//load ** bmp
lcd_ctrl_init(image.dest);
image.dest = (unsigned char *)SDRAM_LINUX_BASE;
uimage_head = (struct linux_uimage_header *)image.dest;
image.offset = FLASH_LINUX_BASE;
image.length = FLASH_LINUX_LEN;
for (i=0;i<1;i++) {
load_nandflash(&image); //load image into sdram
theKernel=(void(*)(int, int, unsigned int))(SDRAM_LINUX_BASE+64);
theKernel(0, 4576,SDRAM_LINUX_PARAMETER);
magic = swap_uint32n(uimage_head->magic);
if ( magic == LINUX_UIMAGE_MAGIC) {
image_size = swap_uint32n(uimage_head->size);
magic_datacrc = swap_uint32n(uimage_head->data_crc);
batt_gpio_high();
magic_clac = crc32(0, image.dest + 64, image_size);
if (magic_clac == magic_datacrc)
{
theKernel=(void(*)(int,int,unsigned int))(SDRAM_LINUX_BASE+64);
}else{
dbg_info("\n\r kernel[%d] crc32 failed!!",i);
}
}
else{
image.offset += FLASH_LINUX_LEN;
}
}
return 0;
}
|