1. 程式人生 > >自己寫bootloader筆記6---boot.c分析(u-boot向核心傳遞引數及跳轉到核心)

自己寫bootloader筆記6---boot.c分析(u-boot向核心傳遞引數及跳轉到核心)

#include "setup.h"


extern void uart0_init(void);
extern void nand_read(unsigned int addr, unsigned char *buf, unsigned int len);
extern void puts(char *str);
extern void puthex(unsigned int val);



//定義tag結構體
static struct tag *params;

//開始標誌函式
void setup_start_tag(void)
{
params = (struct tag *)0x30000100;


params->hdr.tag = ATAG_CORE;
params->hdr.size = tag_size (tag_core);


params->u.core.flags = 0;
params->u.core.pagesize = 0;
params->u.core.rootdev = 0;


params = tag_next (params);
}

//記憶體相關標誌函式

void setup_memory_tags(void)
{
params->hdr.tag = ATAG_MEM;
params->hdr.size = tag_size (tag_mem32);

params->u.mem.start = 0x30000000;
params->u.mem.size  = 64*1024*1024;

params = tag_next (params);
}

//獲取字串大小函式
int strlen(char *str)
{