当前位置:网站首页>cmdline -[command line,__fdt_pointer,initial_boot_params] boot_command_line 获取
cmdline -[command line,__fdt_pointer,initial_boot_params] boot_command_line 获取
2022-08-03 05:23:00 【SEVENTHD7】
[boot_command_line,cmdline,commandline,devicetree地址]
head.S->start_kernel(), head.S 中主要是获取dt的地址:
str_l x21, __fdt_pointer, x5 // Save FDT pointer
>>start_kernel() -- main.c
>>setup_arch() --setup.c
>>setup_machine_fdt()
>>early_init_dt_scan() --fdt.c
>>early_init_dt_verify() --fdt.c ;check __fdt_pointer后,赋给initial_boot_params
>>early_init_dt_scan_nodes() --fdt.c ;最终获取devicetree参数
>>early_init_dt_scan_chosen --fdt.c; 获取command line 参数
setup_arch(&command_line);
command_line 是对 全局变量boot_command_line的一个引用
setup_machine_fdt()
__fdt_pointer 经过fixmap_remap_fdt(dt_phys) 映射后,往下传参
early_init_dt_scan_nodes
获取 command_line参数,给boot_command_line 赋值
获取memory参数
int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
int depth, void *data)
{
int l;
const char *p;pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
if (depth != 1 || !data ||
(strcmp(uname, "chosen") != 0 && strcmp(uname, "[email protected]") != 0))
return 0;early_init_dt_check_for_initrd(node);
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); //拷贝到 boot_command_line/*
* CONFIG_CMDLINE is meant to be a default in case nothing else
* managed to set the command line, unless CONFIG_CMDLINE_FORCE
* is set in which case we override whatever was found earlier.
*/
#ifdef CONFIG_CMDLINE
#if defined(CONFIG_CMDLINE_EXTEND)
strlcat(data, " ", COMMAND_LINE_SIZE);
strlcat(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#elif defined(CONFIG_CMDLINE_FORCE)
strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#else
/* No arguments from boot loader, use kernel's cmdl*/
if (!((char *)data)[0])
strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
#endif
#endif /* CONFIG_CMDLINE */pr_debug("Command line is: %s\n", (char*)data);
/* break now */
return 1;
}
void __init early_init_dt_scan_nodes(void)
{
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);/* Setup memory, calling early_init_dt_add_memory_arch */
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
}
边栏推荐
猜你喜欢
随机推荐
卷积神经网络入门
enum和enum class的区别
【DC-2 Range Penetration】
自监督论文阅读笔记Index Your Position: A Novel Self-Supervised Learning Method for Remote Sensing Images Sema
opencv透视变化
自监督论文阅读笔记 Self-supervised Label Augmentation via Input Transformations
二阶段提问总结
解析各种文本的年月日
自监督论文阅读笔记 SimCLRV2 Big Self-Supervised Models are Strong Semi-Supervised Learners
Qlik Sense 聚合函数及范围详解(Sum、Count、All、ToTaL、{1})
IPC 通信 - IPC
理论上的嵌入式跑马灯
Oracle 密码策略详解
中国水环境治理行业投融资分析及“十四五”规划建议报告2022~2028年
MySQL 安装报错的解决方法
自监督论文阅读笔记 Self-supervised Learning in Remote Sensing: A Review
MySQL 排序
new / malloc / delete / free之间的区别
ASP.NET MVC3的伪静态实现
中国磷化铟晶圆行业发展前景与投资规划分析报告2022~2028年