编译linux的设备树

使用make dtbs命令时

在arch/arm 的目录Makefile文件中有

boot := arch/arm/boot

prepare 和scripts是空的

在文件scripts/Kbuild.include中

变量build := -f $(srctree)/scripts/Makefile.build obj

在顶层Makefile中

$(srctree):=.

展开后-f ./scripts/Makefile.build obj:=arch/arm/boot/dts

通过下面的命令包含传入的$(obj)目录下的Makefile,即arch/arm/boot/dts/Makefile

The filename Kbuild has precedence over Makefile

kbuild-dir := (if (filter /%,(src)),(src),(srctree)/(src))

kbuild-file := (if (wildcard (kbuild-dir)/Kbuild),(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)

include $(kbuild-file)

-f 的作用是使用make 命令编译由-f 指定的Makefile文件(scripts/Makefile.build)

在该文件中使用默认目标__build,

展开后使用

__build: (builtin-target) (lib-target) (extra-y)) (subdir-ym) $(always)

@:

其中 $(always)在arch/arm/boot/dts/Makefile中

always := $(dtb-y)

$(dtb-y)就是我们要编译的目标.dtb。

至此,流程为

Make dtbs ->

make -f ./scripts/Makefile.build obj:=arch/arm/boot/dts

->__build: (builtin-target) (lib-target) (extra-y)) (subdir-ym) $(always)

->include $(kbuild-file)

->always := $(dtb-y)

dtbs 依赖$(dtb-y)

相关推荐
云计算老刘4 分钟前
10. Linux 系统启动原理
linux·运维·服务器
CS_浮鱼12 分钟前
【Linux编程】线程同步与互斥
linux·网络·c++
正在走向自律25 分钟前
豆包编程模型Doubao-Seed-Code深度体验,从零开始构建全栈项目的完整指南
java·服务器·数据库·doubao·claude code·火山方舟
任聪聪1 小时前
Centos平替系统RockyLinux详细安装教程
linux·运维·centos
HealthScience1 小时前
vscode怎么连接远程服务器/无密码(使用秘钥)登录
服务器·ide·vscode
zjj5872 小时前
ubuntu虚拟内存
linux·运维·ubuntu
终端行者2 小时前
Nginx 配置Websocket代理 Nginx 代理 Websocket
运维·websocket·nginx
*翊墨*2 小时前
达梦数据库Linux安装
linux·数据库·excel
瑶总迷弟3 小时前
在centos上基于kubeadm部署单master的k8s集群
linux·kubernetes·centos
优质&青年3 小时前
【Operator prometheus监控系列三---业务监控】
运维·云原生·kubernetes·自动化·prometheus