简体   繁体   中英

How to include files in Cstom recipe for yocto build

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 ^^

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM