2017-08-09 78 views
0

我正在使用BBB來了解yocto項目。我不確定補丁是如何工作的。這是我的項目目錄修補程序如何在yocto中工作

├── meta-testlayer 
├── poky 

元測試層包含HelloWorld示例

├── conf 
│   └── layer.conf 
├── COPYING.MIT 
├── README 
└── recipes-hello 
    └── helloworld 
     ├── helloworld-0.1 
     │   ├── helloworld.c 
     │   ├── helloworld.patch 
     │   └── newhelloworld.c 
     └── helloworld_0.1.bb 

helloworld.c和newhelloworld.c只有一個printf語句不同。這裏是helloworld.c

#include <stdio.h> 

int main(int argc, char **argv) 
{ 

    printf("Hi, this is my first custom recipe. Have a good day\n"); 
    return 0; 
} 

newhelloworld.c 的#include

int main(int argc, char **argv) 
{ 

    printf("Let see if patch works\n"); 
    printf("Hi, this patch is from the test-layer\n"); 
    return 0; 
} 

下面的內容是我用diff helloworld.c newhelloworld.c > helloworld.patch命令創建的補丁。

6c6,7 
<  printf("Hi, this is my first custom recipe. Have a good day\n"); 
--- 
>  printf("Let see if patch works\n"); 
>  printf("Hi, this patch is from the test-layer\n"); 

這是helloworld_0.1.bb文件的內容

SUMMARY = "Simple helloworld application" 
SECTION = "examples" 
LICENSE = "MIT" 
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 

#here we specify the source we want to build 
SRC_URI = "file://helloworld.c" 
SRC_URI += "file://helloworld.patch" 

#here we specify the source directory, where we can do all the building and expect sources to be placed 
S = "${WORKDIR}" 

#bitbake task 
do_compile() { 
     ${CC} ${LDFLAGS} helloworld.c -o helloworld 
} 

#bitbake task 
do_install() { 
     install -d ${D}${bindir} 
     install -m 0755 helloworld ${D}${bindir} 
} 

這是錯誤消息當我運行bitbake -c patch helloworld

NOTE: Executing SetScene Tasks 
NOTE: Executing RunQueue Tasks 
ERROR: helloworld-0.1-r0 do_patch: Command Error: 'quilt --quiltrc /home/guest/yocto_practice/poky/build-beaglebone/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/helloworld/0.1-r0/recipe-sysroot-native/etc/quiltrc push' exited with 0 Output: 
Applying patch helloworld.patch 
patch: **** Only garbage was found in the patch input. 
Patch helloworld.patch does not apply (enforce with -f) 
ERROR: helloworld-0.1-r0 do_patch: Function failed: patch_do_patch 
ERROR: Logfile of failure stored in: /home/guest/yocto_practice/poky/build-beaglebone/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/helloworld/0.1-r0/temp/log.do_patch.22267 
ERROR: Task (/home/guest/yocto_practice/meta-testlayer/recipes-hello/helloworld/helloworld_0.1.bb:do_patch) failed with exit code '1' 
NOTE: Tasks Summary: Attempted 11 tasks of which 8 didn't need to be rerun and 1 failed. 

Summary: 1 task failed: 
    /home/guest/yocto_practice/meta-testlayer/recipes-hello/helloworld/helloworld_0.1.bb:do_patch 
Summary: There were 2 ERROR messages shown, returning a non-zero exit code. 
+0

這裏有沒有足夠的信息來告訴你爲什麼無法應用補丁 - 但也許它與元測試中的其他補丁有衝突嗎?如果你把你的補丁放在meta-testlayer中,那麼你完全不需要bbappend:你可以修改helloworld_0.1.bb。 – jku

+0

我應該在這裏粘貼日誌截圖嗎?另外如何從同一層應用補丁? – user7345878

回答

2

兩種方法應用補丁:

  • Pu t將其加入您的測試層,添加一行在你的.bb文件: SRC_URI += " file://example.patch "

  • 把它放在另一層,但如果它不是你的層(元光電,元FSL它只是需要,元QT ...)

對於這種情況,在你.bbappend文件中使用:

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" 
SRC_URI += " file://helloworld.patch " 
+0

我遵循了兩種方法,但可能是我在修補程序文件中做了錯誤的事情。正如在調試消息中,我可以看到'只有垃圾被發現在補丁輸入中' – user7345878

+0

你的補丁壞了,你是怎麼做到的? – PierreOlivier

+0

我在問題中添加了我的example.patch文件內容。 如果我做'bitabke helloworld'或'bitbake -c patch helloworld',我會遇到錯誤。 還有一件事我必須先應用補丁,然後烘烤配方? 或者我可以直接烘烤helloworld食譜。 – user7345878

相關問題