当前位置:网站首页>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);
}
边栏推荐
猜你喜欢
MySql 怎么查出符合条件的最新的数据行?
边缘辅助无人机网络的分层联邦学习
Oracle 密码策略详解
Convolutional Nerual Nertwork(CNN)
关于梯度下降法的一些优化方法
【DC-5靶场渗透】
自监督论文阅读笔记 Ship Detection in Sentinel 2 Multi-Spectral Images with Self-Supervised Learning
Ansible installation and deployment detailed process, basic operation of configuration inventory
自监督论文阅读笔记SELF-SUPERVISED SPECTRAL MATCHING NETWORK FOR HYPERSPECTRAL TARGET DETECTION
滚动条 scrollbar 和scrollbar-thumb 样式
随机推荐
进程间通信IPC - 信号量
时间盲注脚本
MySQL 下载和安装详解
BeanFactory和FactoryBean的区别
梯度下降、反向传播
c#,.net 下载文件 设置断点
【DC-5靶场渗透】
代码没写完,哪里有脸睡觉!17 张程序员壁纸推荐
嵌入式实验三(代码几乎都要改才能运行)
Qlik Sense 赋值详解(Set、Let)
softmax和最大熵
Leetcode刷题——128. 最长连续序列
中国生产力促进中心”十四五”规划与发展规模分析报告2022~2028年
Oracle 日历表详解(含节假日)
中国水环境治理行业投融资分析及“十四五”规划建议报告2022~2028年
Makefile
深度学习理论课程第四、五章总结
漫谈Map Reduce 参数优化
【DC-2靶场渗透】
中国生物降解塑料行业市场运营态势及发展趋势研究报告2022~2028年