当前位置:网站首页>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);
}
边栏推荐
猜你喜欢
随机推荐
用iPhone前摄3D人像建模,Meta:我看行
C# Base64加密
动漫:海贼王女
MySql 怎么查出符合条件的最新的数据行?
Sentinel初次使用Demo测试
代码没写完,哪里有脸睡觉!17 张程序员壁纸推荐
自监督论文阅读笔记 Self-Supervised Visual Representation Learning with Semantic Grouping
HoloLens联合发明人:打造理想的全天AR需要解决这些问题
ASP.NET MVC:自定义 Route
中国水产养殖行业市场投资分析及未来风险预测报告2022~2028年
【源码解读】你买的NFT到底是什么?
ASP.NET MVC3的伪静态实现
Qlik Sense 临时处理表数据详解(Resident)
php连接数据库脚本
MySQL 慢查询
解析各种文本的年月日
Oracle 日历表详解(含节假日)
Sqli-labs-master靶场1-23关通关详细教程(基础篇)
[XSS, file upload, file inclusion]
中国石油行业并购重组趋势与投资战略规划建议报告2022~2028年









