Buildroot Package Makefile:如何从 git 获取最新的提交?

发布于 2025-01-20 12:28:10 字数 1080 浏览 4 评论 0原文

我正在努力使用 $BR2_External 将我自己的模块添加到 buildroot 的构建中。我的包的 make 文件如下,

##############################################################
#
# GPIO
#
##############################################################

GPIO_VERSION = '2851a05c9b613c1736f79faa185a11118b229852'

GPIO_SITE = '<URL of git repo>'
GPIO_SITE_METHOD = git
GPIO_GIT_SUBMODULES = YES

GPIO_MODULE_SUBDIRS = GPIO_driver/
# GPIO_MODULE_SUBDIRS += GPIO_driver/

# define LDD_BUILD_CMDS
#   $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)/misc-modules
#   $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)/scull
# endef
#
# # TODO add your writer, finder and finder-test utilities/scripts to the installation steps below

define GPIO_INSTALL_TARGET_CMDS

    #module
    # $(INSTALL) -m 0755 $(@D)/01_simple_LKM/*  $(TARGET_DIR)/usr/bin
    $(INSTALL) -m 0755 $(@D)/GPIO_driver/*  $(TARGET_DIR)/usr/bin

endef

$(eval $(kernel-module))
$(eval $(generic-package))

该 make 文件始终仅从 gitHub 提取特定提交(在 GPIO_VERSION 变量中提到)。这有点令人沮丧,因为每次我将新代码推送到 git 时,我都必须使用新的提交号更新 make 文件。那么,有没有什么方法可以编写 make 文件,以便拉取最近的提交。

I am working on adding my own module to the build of buildroot using $BR2_External. The make file of my package is as follows,

##############################################################
#
# GPIO
#
##############################################################

GPIO_VERSION = '2851a05c9b613c1736f79faa185a11118b229852'

GPIO_SITE = '<URL of git repo>'
GPIO_SITE_METHOD = git
GPIO_GIT_SUBMODULES = YES

GPIO_MODULE_SUBDIRS = GPIO_driver/
# GPIO_MODULE_SUBDIRS += GPIO_driver/

# define LDD_BUILD_CMDS
#   $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)/misc-modules
#   $(MAKE) $(TARGET_CONFIGURE_OPTS) -C $(@D)/scull
# endef
#
# # TODO add your writer, finder and finder-test utilities/scripts to the installation steps below

define GPIO_INSTALL_TARGET_CMDS

    #module
    # $(INSTALL) -m 0755 $(@D)/01_simple_LKM/*  $(TARGET_DIR)/usr/bin
    $(INSTALL) -m 0755 $(@D)/GPIO_driver/*  $(TARGET_DIR)/usr/bin

endef

$(eval $(kernel-module))
$(eval $(generic-package))

This make file always pulls only a specific commit (mentioned in GPIO_VERSION variable) from gitHub. This is getting a little frustrating as, everytime I push new code to git I have to update the make file with the new commit number as well. So, is there any way to write the make file such that the most recent commit is pulled.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无敌元气妹 2025-01-27 12:28:10

只需将版本更改为类似的分支名称(本地或远程):

GPIO_VERSION = origin/master # This will use HEAD of origin/master.

但是,您现在必须强迫Buildroot进行最新更改(每次将新提交给GPIO Repo)。

$ make gpio-dirclean  # Remove all GPIO build output
$ rm -fr dl/gpio      # Remove the downloaded GPIO source code (git project)
$ make gpio           # Build the GPIO project (will download from the HEAD of your branch)

Just change the version to a branch name (local or remote) like this:

GPIO_VERSION = origin/master # This will use HEAD of origin/master.

However, you will now have to force Buildroot to pull the latest changes (each time you push new commits to the GPIO repo).

$ make gpio-dirclean  # Remove all GPIO build output
$ rm -fr dl/gpio      # Remove the downloaded GPIO source code (git project)
$ make gpio           # Build the GPIO project (will download from the HEAD of your branch)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文