当前位置:网站首页>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);
}
边栏推荐
- 动态规划笔记
- 中国柔性制造系统(FMS)市场发展动态及未来趋势预测报告2022~2028年
- 当奈飞的NFT忘记了web2的业务安全
- 进程间通讯 (IPC 技术) - 信号
- 自监督论文阅读笔记 Self-supervised Label Augmentation via Input Transformations
- 经典论文-ResNet
- 滚动条 scrollbar 和scrollbar-thumb 样式
- 联邦学习摘录
- Oracle 分区索引详解(local、global)
- 自监督论文阅读笔记SELF-SUPERVISED SPECTRAL MATCHING NETWORK FOR HYPERSPECTRAL TARGET DETECTION
猜你喜欢
随机推荐
用iPhone前摄3D人像建模,Meta:我看行
中国生产力促进中心”十四五”规划与发展规模分析报告2022~2028年
Apache2-XXE漏洞渗透
BeanFactory和FactoryBean的区别
SAP HANA 新增一列时报错详解
block底层探索
docker mysql 容器中执行mysql脚本文件并解决乱码
自监督论文阅读笔记DisCo: Remedy Self-supervised Learning on Lightweight Models with Distilled Contrastive
动漫:海贼王女
Oracle null 有哪些注意事项【面试题】
观看华为AI技术领域课程--深度学习前三章总结
中国柔性制造系统(FMS)市场发展动态及未来趋势预测报告2022~2028年
HANA 常用数据类型详解
opencv
编程软件配备
mysql 客户端SSL错误2026 (HY000)
A-B数对问题|UPC-Count Interval|洛谷-P1102A-B数对
微信小程序 自定义tabBar
理论上的嵌入式跑马灯
IO 复用









