设为首页 加入收藏

TOP

UBOOT编译--- include/config.h、 include/autoconf.mk、include/autoconf.mk.dep、u-boot.cfg(三)(一)
2023-07-23 13:30:24 】 浏览:110
Tags:UBOOT 编译 --- include/config.h include/autoconf.mk include/autoconf.mk.dep u-boot.cfg

1. 前言

 UBOOT版本:uboot2018.03,开发板myimx8mmek240。

2. 概述

本节主要接上一节解析 :include/config.h、 include/autoconf.mk、include/autoconf.mk.dep、spl/include/autoconf.mk、u-boot.cfg、spl/u-boot.cfg。

3 语句 $ (Q) $(MAKE) -f $(srctree)/scripts/Makefile.autoconf

由于未指定目标,采用默认目标__all

#note:scripts/Makefile.autoconf
__all: include/autoconf.mk include/autoconf.mk.dep

ifeq ($(shell grep -q '^CONFIG_SPL=y' include/config/auto.conf 2>/dev/null && echo y),y) //本人单板该条件成立
__all: spl/include/autoconf.mk

endif


include/autoconf.mk.dep: include/config.h FORCE
	$(call cmd,autoconf_dep)
	
spl/include/autoconf.mk: spl/u-boot.cfg
	$(Q)mkdir -p $(dir $@)
	$(call cmd,autoconf)
	
	
u-boot.cfg: include/config.h FORCE
	$(call cmd,u_boot_cfg)

spl/u-boot.cfg: include/config.h FORCE
	$(Q)mkdir -p $(dir $@)
	$(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD)
	
	
include/config.h: scripts/Makefile.autoconf create_symlink FORCE
	$(call filechk,config_h)

3.1 依赖include/autoconf.mk

include/autoconf.mk: u-boot.cfg
	$(call cmd,autoconf)
u-boot.cfg: include/config.h FORCE
	$(call cmd,u_boot_cfg)

3.1.1 include/config.h的规则

include/config.h: scripts/Makefile.autoconf create_symlink FORCE
	$(call filechk,config_h)
3.1.1.1 FORCE

参见UBOOT编译--- make xxx_deconfig过程详解(一)4.3小节。

为mach相关的头文件在arch/arm/include/asm/arch创建软连接。

#note:scripts/Makefile.autoconf
# symbolic links
# If arch/$(ARCH)/mach-$(SOC)/include/mach exists,
# make a symbolic link to that directory.
# Otherwise, create a symbolic link to arch/$(ARCH)/include/asm/arch-$(SOC).
PHONY += create_symlink
create_symlink:
ifdef CONFIG_CREATE_ARCH_SYMLINK
ifneq ($(KBUILD_SRC),)
	$(Q)mkdir -p include/asm
	$(Q)if [ -d $(KBUILD_SRC)/arch/$(ARCH)/mach-$(SOC)/include/mach ]; then	\
		dest=arch/$(ARCH)/mach-$(SOC)/include/mach;			\
	else									\
		dest=arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU));	\
	fi;									\
	ln -fsn $(KBUILD_SRC)/$$dest include/asm/arch
else
	$(Q)if [ -d arch/$(ARCH)/mach-$(SOC)/include/mach ]; then	\
		dest=../../mach-$(SOC)/include/mach;			\
	else								\
		dest=arch-$(if $(SOC),$(SOC),$(CPU));			\
	fi;								\
	ln -fsn $$dest arch/$(ARCH)/include/asm/arch
endif
endif

如果采用直接在源目录编译的方式时KBUILD_SRC为空,走else分支。对于我调试的单板ARCH=arm,SOC=imx8m,因此执行else语句展开为:

if [ -d arch/arm/mach-imx8m/include/mach ]; then        \
        dest=../../mach-imx8m/include/mach;                     \
else                                                            \
        dest=arch-imx8m;                        \
fi;                                                             \
ln -fsn $dest arch/arm/include/asm/arch

由于我使用的单板设备商提供的源码中没有arch/arm/mach-imx8m/include/mach 和arch-imx8m目录(而是直接在arch/arm/include/asm/arch目录下提供必要的头文件,当然一般不建议这么做)。执行该句相当于未执行。

3.1.1.3 scripts/Makefile.autoconf

指定的依赖文件。

3.1.1.4 规则 $(call filechk,config_h)
#note:scripts/Kbuild.include
###
# filechk is used to check if the content of a generated file is updated.
# Sample usage:
# define filechk_sample
#	echo $KERNELRELEASE
# endef
# version.h : Makefile
#	$(call filechk,sample)
# The rule defined shall write to stdout the content of the new file.
# The existing file will be compared with the new one.
# - If no file exist it is created
# - If the content differ the new file is used
# - If they are equal no change, and no timestamp update
# - stdin is piped in from the first prerequisite ($<) so one has
#   to specify a valid file as first prerequisite (of
首页 上一页 1 2 3 4 5 下一页 尾页 1/5/5
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇UBOOT编译--- UBOOT的顶层config... 下一篇PHY驱动调试之 ---PHY设备驱动(三)

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目