uboot 传递参数给 kernel 内核
uboot通过环境变量 bootargs 传递参数给 kernel 内核,bootargs存储在设备树的 chosen 节点中,则 kernel 是通过读取设备树的 chosen 节点中的 bootargs 属性获取 uboot 传递过来的参数。
U_BOOT_CMD(
bootz, CONFIG_SYS_MAXARGS, 1, do_bootz,
"boot Linux zImage image from memory", bootz_help_text
);
bootz ${loadaddr} - ${fdt_addr}
do_bootz()---> do_bootm_states() ---> bootm_os_get_boot_func()(得到函数do_bootm_linux())boot_fn()(实际就是函数do_bootm_linux()) ---> boot_prep_linux() ---> image_setup_linux() ---> image_setup_libfdt() ---> fdt_chosen()
在函数 fdt_chosen() 函数中,读取环境变量 bootargs 的值,并设置到设备树的 chosen 节点下
bootargs 内容包括:
1、设置控制台 console 用哪个
2、设置根文件系统在哪个存储设备的哪个分区

浙公网安备 33010602011771号