如何实现uboot和linux之间的参数传递
参考http://cgxcn.blog.163.com/blog/static/132312422009101133251202/
参考:http://blog.chinaunix.net/uid-14833587-id-76499.html
参考:http://lixuefeng26.blog.sohu.com/204383842.html
原理就是:uboot将要传递的参数,保存到一个指定的物理位置;然后linux从该物理位置获取数据即可
1.先看一下uboot自带的参数传递过程:
A. 首先说明两个结构体:
boot/u-boot/include/asm-mips
typedef struct global_data {
bd_t *bd;
unsigned long flags;
unsigned long baudrate;
unsigned long have_console; /* serial_init() was called */
unsigned long ram_size; /* RAM size */
unsigned long reloc_off; /* Relocation Offset */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
void **jt; /* jump table */
} gd_t
和
boot/u-boot/include/asm-mips
typedef struct bd_info {
int bi_baudrate; /* serial console baudrate */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* Ethernet adress */
unsigned long bi_arch_number; /* unique id for this board */
unsigned long bi_boot_params; /* where this board expects params */
unsigned long bi_memstart; /* start of DRAM memory */
unsigned long bi_memsize; /* size of DRAM memory in bytes */
unsigned long bi_flashstart; /* start of FLASH memory */
unsigned long bi_flashsize; /* size of FLASH memory */
unsigned long bi_flashoffset; /* reserved area for startup monitor */
} bd_t;
B. 在do_bootm_linux(boot/u-boot/lib_mips/mips_linux.c)中,有如下处理:
字节的空间,来存放要传递的参数。
[xxx5]即uboot中,将linux内核释放到的内存地址
[xxx6]存储bootpara参数的地址
[xxx7]获取存储的bootpara参数内容