u-boot makefile要点

1、ARCH  CROSS_COMPILE设置为默认值

# set default to nothing for native builds
ifeq ($(HOSTARCH),$(ARCH))
CROSS_COMPILE ?=
endif

添加直接修改为使用的编译器:

ARCH = arm

CROSS_COMPILE = arm-nuvoton-linux-uclibcgnueabi-

 

2、CROSS_COMPILE版本限制

 

*** Your GCC is older than 6.0 and is not supported
arch/arm/config.mk:73: recipe for target 'checkgcc6' failed
make: *** [checkgcc6] Error 1

改错方法:直接去掉版本检查

checkgcc6: 
@if test "$(call cc-name)" = "gcc" -a \
"$(call cc-version)" -lt "0600"; then \
echo '*** Your GCC is older than 6.0 and is not supported'; \
# false; \
fi

在函数checkgcc6:中屏蔽错误检查的推出false。

 

 

3、种编译方法(原地编译和单独输出文件夹编译)

具体用法:默认的就是原地编译。如果需要指定具体的输出目录编译则有2种方式来指定输出目录。(具体参考Makefile 56-76行注释内容)

第一种:make O=输出目录

第二种:export BUILD_DIR=输出目录 然后再make

如果两个都指定了(既有BUILD_DIR环境变量存在,又有O=xx),则O=xx具有更高优先级,听他的。

ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
else
KBUILD_OUTPUT := output
endif

 

 

参考:

https://blog.csdn.net/weixin_45309916/article/details/109218569

posted @ 2022-03-31 20:45  liujunhuasd  阅读(253)  评论(0编辑  收藏  举报