douduan6731 2018-11-30 11:30 采纳率: 0%
浏览 554
已采纳

如何在yocto构建的自定义配方中包括文件

Hi all I'm new to Yocto and trying to build my first recipe, I have a custom layer which shows up and installs correctly on my system "colibri-imx6ull" but I cannot see any results of my recipes work. Bitbake seems to build them but maybe I've misunderstood something in the build process. I have a longtime goal of installing Golang and a few custom scripts but currently, I'm not even able to copy a simple text file.

Version available is Toradex (2.8) v2017.12 rocko (2.4)

I have added my layer to oe-core/build/conf/bblayers.conf

${TOPDIR}/../layers/meta-hydroware \

I have a layer configuration file avalible at

/layers/meta-hydroware/recipes-golang/conf/layer.conf

Containing the following

BBPATH := "${BBPATH}:${LAYERDIR}"
BBFILES := "${BBFILES} ${LAYERDIR}/recipes-*/*/*.bb \ 
       ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "golang"
BBFILE_PATTERN_golang := "^${LAYERDIR}/" 
BBFILE_PRIORITY_golang := "105"

It's included in the list of layers when building so hopefully it works. Firstly I'm just trying to get anything to copy anywhere into my build and I've tried to use this recipe to copy a simple text file but it does not show up.

My recipe file "golang.bb" is located in

/layers/meta-hydroware/recipes-golang/golang/golang.bb

and the text file is located in

/layers/meta-hydroware/recipes-golang/golang/files

This is the content of my golang.bb

SUMMARY = "Provides GO"
DESCRIPTION = "Tools for runnings and compiling GO"

SRC_URI =   "file://readme.txt"

LICENSE = "CLOSED"

S = "${WORKDIR}"
FILES_${PN} = ""
ALLOW_EMPTY_${PN} = "1"

do_install() {
    install -m 0755 -d ${D}${bindir} ${D}${bindir}/go
    mkdir ~/usr/bin/go
    cp -a --no-preserve=ownership ${WORKDIR}/* ${D}${bindir}/go/
}

My goal is to install golang which is available in the same folder as the textfile

 /layers/meta-hydroware/recipes-golang/golang/files/go1.11.2.linux-armv6l.tar.gz

My first goal is to be able to find the text file somewhere on my installed machine, the second goal is to install go. Is there anything wrong with my recipe which prevents it from placing the file?

Are there any additional things I need to do in order to handle to install a .tar.gz file? or do do_install() understand what to do?

Thanks for your answers //Confused newbie who spend too many days on this already ^^

  • 写回答

1条回答 默认 最新

  • doukaizha5417 2018-11-30 17:05
    关注

    There are multiple improvements to the recipe,

    SUMMARY = "Provides GO"
    DESCRIPTION = "Tools for runnings and compiling GO"
    
    SRC_URI =   "file://readme.txt"
    
    LICENSE = "CLOSED"
    S = "${WORKDIR}"
    
    do_install() {
        install -d ${D}${bindir}/go
        install -Dm 0755 ${WORKDIR}/readme.txt ${D}${bindir}/go
    }
    
    FILES_${PN} = "${bindir}/*"
    

    The above recipe should work if its included directly into image using IMAGE_INSTALL_append in local.conf or image recipe or some other package RDEPENDS on this package.

    Corrections done:

    1. You don't need to allow the empty package
    2. FILES_${PN} should carry the list files you want to install
    3. install -d creates the directory and install -Dm to copy it. You don't need to use cp or mkdir inside the recipe.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面