[yocto] THISDIR variable in another meta-layer
Richard Purdie
richard.purdie at linuxfoundation.org
Sat Dec 15 03:30:01 PST 2018
On Fri, 2018-12-14 at 10:26 +0100, Tomasz Michalski wrote:
> Hi
> I have structure of files:
>
> meta-layer-A
> recipes-X
> componentB
> default
> script.sh
> componentB.bb
> meta-layer-B
> recipes-X
> componentB
> files
> script.sh
> componentB.bbappend
>
> In componentB.bb I have function do_install:
> do_install () {
> install -m 0755 -d ${D}/usr/share
> cmake_do_install
> install -m 0755 ${THISDIR}/default/script.sh ${D}/usr/share
> }
>
> In componentB.bbapend I overwrite function in order to install other
> script instead:
> do_install () {
> install -m 0755 -d ${D}/usr/share
> cmake_do_install
> install -m 0755 ${THISDIR}/files/script.sh ${D}/usr/share
> }
>
>
> The problem is that ${THISDIR} indicates IN BOTH CASES to path meta-
> layer-A/recipes-X/componentB.
> So how to tell bitbake in componentB.bbappend to install my script
> from path meta-layer-B/recipes-X/componentB/files? It is really
> frustrating that variable THISDIR doesn't indicates to path meta-
> layer-B/recipes-X/componentB when I used it in componentB.bbapend.
THISDIR isn't meant to be used from do_install, its something which
works at parsing time using immediate expansion.
You need to reference the file you're using from SRC_URI and use the
functionality in SRC_URI to override files from other layers. It should
copy the right thing to WORKDIR which you can then install in
do_install.
To make it see the files in the extra layer, this is why you see
recipes which do things like:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
so your bbappend might have:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
for your case above.
Cheers,
Richard
More information about the yocto
mailing list