栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

kbuild 札记

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

kbuild 札记

最近才明白,Makefile 是一个事物,kbuild 是另外一个事物。
之前一直不知道。
Linux 和 uboot 确实是基于 Makefile 进行编译的,但是单单看 Makefile 的语法,是很难把它两个的编译流程理清楚的。
kbuild 是基于 Makefile 的一套编译框架,用于编译 Linux kernel 和 uboot.

前面的流程调用

此处省去一万字,后面再补。

笔记

$(strip string)
8.2 Functions for String Substitution and Analysis
Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, ‘$(strip a b c )’ results in ‘a b c’.

# scripts/Makefile.build/line: 298
$(builtin-target): $(obj-y) FORCE
	$(call if_changed,link_o_target)
# 这是一个普通规则,依赖众多的 obj-y
# scripts/Kbuild.include/line: 171
# printing commands
cmd = @$(echo-cmd) $(cmd_$(1))
# 至于 echo-cmd 不是特别重要,暂时先不分析了
# 就是相当于调用了 $(cmd_$(1)) 这个命令
echo  @set -e; 	 echo '    -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  hello/hello.c ;';   -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  hello/hello.c ;  echo '  cc -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  -c -o hello/hello.o hello/hello.c'; cc -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  -c -o hello/hello.o hello/hello.c;    scripts/basic/fixdep hello/.hello.o.d hello/hello.o 'cc -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  -c -o hello/hello.o hello/hello.c' > hello/.hello.o.tmp; rm -f hello/.hello.o.d; mv -f hello/.hello.o.tmp hello/.hello.o.cmd
@set -e
    -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  hello/hello.c ;
/bin/sh: 1: -Wp,-MD,hello/.hello.o.d: not found
  cc -Wp,-MD,hello/.hello.o.d      -D"KBUILD_STR(s)=#s" -D"KBUILD_baseNAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  -c -o hello/hello.o hello/hello.c
/bin/sh: 1: scripts/basic/fixdep: not found
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/740603.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号