我目前正在尝试集成来自 github 的一个包,它在用户空间中实现了一个 MTP 响应器。
我使用的是 buildroot 2017.08。
我已经创建了包含以下内容的 Config.in
和 umtprd.mk
文件。
我还修补了源代码,以便将某些字段的值替换到随包提供的配置文件中。
Config.in
$ cat Config.in
config BR2_PACKAGE_UMTPRD
bool "umtprd"
help
umtprd is a deamon, checking USB connection and start MTP communication.
https://github.com/viveris/uMTP-Responder
if BR2_PACKAGE_UMTPRD
config BR2_PACKAGE_UMTPRD_TAG
string "git version of umtprd package"
default "master"
help
Must be the name of the branch/tag :
https://github.com/viveris/uMTP-Responder
endif #BR2_PACKAGE_UMTPRD
umtprd.mk
$ cat umtprd.mk
UMTPRD_VERSION = $(BR2_PACKAGE_UMTPRD_TAG)
UMTPRD_SITE_METHOD = git
UMTPRD_SITE = https://github.com/viveris/uMTP-Responder
define UMTPRD_BUILD_CMDS
$(MAKE) CFLAGS="-DUSE_SYSLOG" CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D)
endef
define UMTPRD_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/umtprd $(TARGET_DIR)/usr/bin
$(INSTALL) -D -m 0755 $(@D)/conf/umtprd*.sh $(TARGET_DIR)/usr/bin
$(INSTALL) -D -m 0755 $(@D)/conf/S98uMTPrd $(TARGET_DIR)/etc/init.d
mkdir -p $(TARGET_DIR)/etc/umtprd
$(INSTALL) -D -m 0644 $(@D)/conf/umtprd.conf $(TARGET_DIR)/etc/umtprd/
endef
$(eval $(generic-package))
补丁
$ cat 0001-configuration.patch
diff -Naur a/conf/umtprd.conf b/conf/umtprd.conf
--- a/conf/umtprd.conf 2018-12-22 14:58:25.000000000 +0100
+++ b/conf/umtprd.conf 2019-01-10 10:31:06.069769073 +0100
@@ -11,8 +11,7 @@
#storage command : Create add a storage entry point. Up to 16 entry points supported
#Syntax : storage "PATH" "NAME"
-storage "/" "root folder"
-storage "/home" "home folder"
+storage "<path>" "<name>"
# Set the USB manufacturer string
@@ -20,11 +19,11 @@
# Set the USB Product string
-product "The Viveris Product !"
+product "<product_string>"
# Set the USB Serial number string
-serial "01234567"
+serial "<serial>"
# Set the USB interface string. Should be always "MTP"
首次构建
当我第一次执行 make
时,包已成功下载、提取、修补、构建和安装。
$ make
>>> umtprd umtprd-0.9.7 Downloading
[...]
warning: refname 'umtprd-0.9.7' is ambiguous.
WARNING: no hash file for umtprd-umtprd-0.9.7.tar.gz
>>> umtprd umtprd-0.9.7 Extracting
[...]
>>> umtprd umtprd-0.9.7 Patching
Applying 0001-configuration.patch using patch:
patching file conf/umtprd.conf
>>> umtprd umtprd-0.9.7 Configuring
>>> umtprd umtprd-0.9.7 Building
[...]
>>> umtprd umtprd-0.9.7 Installing to target
[...]
>>> Finalizing target directory
[...]
>>> Sanitizing RPATH in target tree
[...]
>>> Copying overlay <path_to_overlay>
>>> Executing post-build script <post_build_script>
>>> Generating root filesystem image rootfs.tar
[...]
>>> Executing post-image script <post_image_script>
后期构建
但是,如果我在不删除文件夹 output/build/umtprd-umtprd-0.9.7
的情况下再次运行 make,buildroot 会尝试再次提取和修补源代码。
在这种情况下补丁显然失败了,因此编译过程停止并且不生成图像。
$ make
WARNING: no hash file for umtprd-umtprd-0.9.7.tar.gz
>>> umtprd umtprd-0.9.7 Extracting
[...]
>>> umtprd umtprd-0.9.7 Patching
Applying 0001-configuration.patch using patch:
Error: duplicate filename '0001-configuration.patch'
Conflicting files are:
already applied: <path_to_patch>/0001-configuration.patch
to be applied : <path_to_patch>/0001-configuration.patch
package/pkg-generic.mk:191 : la recette pour la cible « <path_to_buildroot>/output/build/umtprd-"umtprd-0.9.7"/.stamp_patched » a échouée
make: *** [<path_to_buildroot>/output/build/umtprd-"umtprd-0.9.7"/.stamp_patched] Erreur 1
我检查了构建目录,所有 .stamp 文件似乎都在那里,所以我不明白为什么 buildroot 重新提取、重新修补和重新构建包,因为配置和源没有改变。
$ ls -la output/build/umtprd-umtprd-0.9.7/.stamp_*
-rw-r--r-- 1 <user> <user> 0 janv. 10 14:58 output/build/umtprd-umtprd-0.9.7/.stamp_built
-rw-r--r-- 1 <user> <user> 0 janv. 10 14:58 output/build/umtprd-umtprd-0.9.7/.stamp_configured
-rw-r--r-- 1 <user> <user> 0 janv. 10 15:05 output/build/umtprd-umtprd-0.9.7/.stamp_downloaded
-rw-r--r-- 1 <user> <user> 0 janv. 10 15:05 output/build/umtprd-umtprd-0.9.7/.stamp_extracted
-rw-r--r-- 1 <user> <user> 0 janv. 10 14:58 output/build/umtprd-umtprd-0.9.7/.stamp_patched
-rw-r--r-- 1 <user> <user> 0 janv. 10 14:58 output/build/umtprd-umtprd-0.9.7/.stamp_target_installed
问题可以通过删除构建文件夹 output/build/umtprd-umtprd-0.9.7
来解决,但我不应该这样做,因此我想了解为什么 buildroot 是重新提取和重新修补源。
我做错了什么?
最佳答案
你似乎没有做错任何事,但实际上,Buildroot 不应该重新提取和重新修补这个包。因此,在您的两次“make”调用之间一定发生了什么导致这种情况发生。
您能否提供以下命令序列的完整日志(未修改):
make
ls -la output/build/umtprd-umtprd-0.9.7/.stamp_*
make
谢谢。
关于linux - Buildroot - 在每次构建时重新提取 Github 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54131103/