设为首页 加入收藏

TOP

UBOOT编译--- UBOOT的顶层config.mk(五)(一)
2023-07-23 13:30:25 】 浏览:83
Tags:UBOOT 编译 --- config.mk

1. 前言

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

2. 概述

此文件包含在 ./Makefile 和 spl/Makefile 中。 清理状态以避免添加两次相同的标志。有些平台需要不同的 SPL 标志,这就是为什么这个文件也必须包含在 spl/Makefile 中的原因。如果我们没有SPL,构建系统会简单得多。我使用的平台有使用SPL。

3. 顶层config.mk解析

由于内容较少,直接在源代码中批注:

#
# (C) Copyright 2000-2013
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# SPDX-License-Identifier:	GPL-2.0+
#
#########################################################################

# This file is included from ./Makefile and spl/Makefile.
# Clean the state to avoid the same flags added twice.
#
# (Tegra needs different flags for SPL.
#  That's the reason why this file must be included from spl/Makefile too.
#  If we did not have Tegra SoCs, build system would be much simpler...)
PLATFORM_RELFLAGS :=
PLATFORM_CPPFLAGS :=
PLATFORM_LDFLAGS :=
LDFLAGS :=
LDFLAGS_FINAL :=
OBJCOPYFLAGS :=
# clear VENDOR for tcsh
VENDOR :=
#########################################################################

ARCH := $(CONFIG_SYS_ARCH:"%"=%) //架构 arm
CPU := $(CONFIG_SYS_CPU:"%"=%)   //CPU armv8
ifdef CONFIG_SPL_BUILD           //我使用的平台有定义 -DCONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif
BOARD := $(CONFIG_SYS_BOARD:"%"=%) //板 myimx8mm
ifneq ($(CONFIG_SYS_VENDOR),)
VENDOR := $(CONFIG_SYS_VENDOR:"%"=%) //厂商 myzr
endif
ifneq ($(CONFIG_SYS_SOC),)
SOC := $(CONFIG_SYS_SOC:"%"=%)     //SOC imx8m
endif

# Some architecture config.mk files need to know what CPUDIR is set to,
# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
# CPU-specific code.
CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),) //  arch/arm/cpu/armv8

sinclude $(srctree)/arch/$(ARCH)/config.mk	# include architecture dependend rules // arch/arm/config.mk
sinclude $(srctree)/$(CPUDIR)/config.mk		# include  CPU	specific rules //arch/arm/cpu/armv8/config.mk

ifdef	SOC
sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk	# include  SoC	specific rules //arch/arm/cpu/armv8/imx8m/config.mk
endif
ifneq ($(BOARD),)
ifdef	VENDOR
BOARDDIR = $(VENDOR)/$(BOARD) // myzr/myimx8mm
else
BOARDDIR = $(BOARD)
endif
endif
ifdef	BOARD
sinclude $(srctree)/board/$(BOARDDIR)/config.mk	# include board specific rules //board/myzr/myimx8mm/config.mk
endif

ifdef FTRACE
PLATFORM_CPPFLAGS += -finstrument-functions -DFTRACE  //进行函数跟踪,一般不开,调试时可以打开
endif

# Allow use of stdint.h if available
//如果您的工具链可以使用 stdint.h,您可以定义它启用它的选项。 您可以在以下情况下提供选项“USE_STDINT=1”构建 U-Boot 来实现这一点。
ifneq ($(USE_STDINT),)
PLATFORM_CPPFLAGS += -DCONFIG_USE_STDINT
endif

#########################################################################

RELFLAGS := $(PLATFORM_RELFLAGS)

PLATFORM_CPPFLAGS += $(RELFLAGS)
PLATFORM_CPPFLAGS += -pipe  //使用管道代替临时文件。

LDFLAGS += $(PLATFORM_LDFLAGS)
LDFLAGS_FINAL += -Bstatic

export PLATFORM_CPPFLAGS
export RELFLAGS
export LDFLAGS_FINAL
export CONFIG_STANDALONE_LOAD_ADDR

3.1 架构(ARCH)特定规则

# arch/arm/config.mk
# (C) Copyright 2000-2002
# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
#
# SPDX-License-Identifier:	GPL-2.0+
#

ifndef CONFIG_STANDALONE_LOAD_ADDR
ifneq ($(CONFIG_ARCH_OMAP2PLUS),) //未定义
CONFIG_STANDALONE_LOAD_ADDR = 0x80300000
else
CONFIG_STANDALONE_LOAD_ADDR = 0xc100000
e
首页 上一页 1 2 3 4 下一页 尾页 1/4/4
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇ARMv8之memory model和Observabil.. 下一篇UBOOT编译--- include/config.h、..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目