当前位置:网站首页>buildroot override 机制
buildroot override 机制
2022-07-01 06:33:00 【Li-Yongjun】
前言
buildroot 编译的通常流程是:下载 tar 包、解压、配置、编译、安装。tar 包下载到 dl 目录中,编译时解压到 output/build/package-,这是一个临时目录,每当使用 make clean 时,该目录会被完全删除。
所以,当开发一个组件时,直接在 output/build/package- 目录中修改不是一个合适的解决方案。
override
为此,buildroot 提供了一种特定的机制:_OVERRIDE_SRCDIR。buildroot 读取 override 文件(默认是 $(CONFIG_DIR)/local.mk),文件内容示例如下:
<pkg1>_OVERRIDE_SRCDIR = /path/to/pkg1/sources
<pkg2>_OVERRIDE_SRCDIR = /path/to/pkg2/sources
这样,在执行 make _rebuild 的时候,buildroot 就会将指定目录的源码拷贝到 output/build/package-custom,然后编译、安装。
优化
编译时可能会报如下错误
comm: /xxx/buildroot-xxx/xxx/build/xxx-custom/.files-list-images.before: No such file or directory
添加一行命令做个优化即可
vim package/pkg-generic.mk
# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
# used.
$(BUILD_DIR)/%/.stamp_rsynced:
@$(call step_start,rsync)
@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
@mkdir -p $(@D)
$(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
rsync -au --chmod=u=rwX,go=rX $($(PKG)_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS) $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
# 添加的命令
touch $(@D)/.files-list.before; touch $(@D)/.files-list-staging.before; touch $(@D)/.files-list-host.before;
$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
@$(call step_end,rsync)
$(Q)touch [email protected]
边栏推荐
猜你喜欢

Esp32 monitors the battery voltage with ULP when the battery is powered

(上)苹果有开源,但又怎样呢?

Some pits designed by NOC
![[wechat applet] how to build a building block development?](/img/69/edb02c88b52b474a797307b96de369.jpg)
[wechat applet] how to build a building block development?

mysql学习

Mongodb: I. what is mongodb? Advantages and disadvantages of mongodb

关于变量是否线程安全的问题

Software engineering review

Promise

SQL statement
随机推荐
在支付宝上买基金安全吗?哪里可以买基金
解决The code generator has deoptimised the styling of xxxx.js as it exceeds the max of 500kb
Is the account opening of Huafu securities safe and reliable? How to open Huafu securities account
Common shortcut keys
H5 web page determines whether an app is installed. If it is installed, it will jump to the summary of the scheme to download if it is not installed
Docker 安装部署Redis
[unity shader custom material panel part II]
存储过程学习笔记
C language course set up library information management system (big homework)
C语言课设销售管理系统设计(大作业)
了解ESP32睡眠模式及其功耗
[network security tool] what is the use of USB control software
VS2019如何永久配置本地OpenCV4.5.5使用
嵌入式系统
C language course set up salary management system (big homework)
H5网页判断是否安装了某个APP,安装则跳转未安装则下载的方案总结
Router 6/ 以及和Router5 的区别
Gson的@JsonAdater注解的几种方式
关于变量是否线程安全的问题
The code generator has eliminated the styling of xxxx js as it exceeds the max of 500kb