[yocto] Very strange append issue

Gary Thomas gary at mlbassoc.com
Sun Dec 1 06:01:36 PST 2013


I'm having a very strange behaviour in one of my recipes.  I have two
recipes which are tightly coupled.  In one, the 'disk-installer', I'd
like to reuse a source file from another 'installer' so that I only need
to make changes in a single place (good practice).  To this end, I have
a structure like this (the 'installer' recipe is in another layer):

meta-mytarget/packages/misc/
├── disk-installer_0.0.bb
├── installer
│   └── mytarget
│       ├── 6x_bootscript.txt -> ../../../../recipes-bsp/u-boot/u-boot-script-boundary/6x_bootscript.txt
│       ├── do_install.defaults
│       ├── do_install.post
├── installer_0.0.bbappend

In the 'disk-installer' recipe, I have:
   FILESEXTRAPATHS_prepend := "${THISDIR}/installer:"
so that 'disk-installer' can pick up (share) 'do_install.defaults'
That part works fine.  The problem is that there is a 'do_install_append()'
fragment in 'installer_0.0.bbappend' that is being attached to the
'do_install()' of 'disk-installer_0.0.bb'!

Here's what I mean - from 'disk-installer_0.0.bb':
do_install() {
     # Copy images for fully recoverable image
     MAC_ADDR=ignored . ${WORKDIR}/do_install.defaults
     for f in ${KERNEL} ${ROOTFS} ${UBOOT}; do
       if [ -e ${DEPLOY_DIR_IMAGE}/`basename $f` ]; then
         install -d ${D}/`dirname $f`
         cp -L ${DEPLOY_DIR_IMAGE}/`basename $f` ${D}/`dirname $f`
       fi
     done
}

and from 'installer_0.0.bbappend':
do_install_append() {
     # Additional installation steps
     install -m 0755 ${WORKDIR}/do_install.post ${D}/etc/do_install.post
     mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "U-Boot script" -d ${WORKDIR}/6x_bootscript.txt ${D}/etc/6x_bootscript
}

The 'installer' bit makes no sense for the 'disk-installer' recipe
and yet when this package is built, I get this in 'run.do_install':
do_install() {
     # Copy images for fully recoverable image
     MAC_ADDR=ignored . /local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/do_install.defaults
     for f in ${KERNEL} ${ROOTFS} ${UBOOT}; do
       if [ -e /local/p8301_new/tmp/deploy/images/mytarget/`basename $f` ]; then
         install -d /local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/image/`dirname $f`
         cp -L /local/p8301_new/tmp/deploy/images/mytarget/`basename $f` /local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/image/`dirname $f`
       fi
     done
     # Additional installation steps
     install -m 0755 /local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/do_install.post 
/local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/image/etc/do_install.post
     mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "U-Boot script" -d /local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/6x_bootscript.txt 
/local/p8301_new/tmp/work/mytarget-amltd-linux-gnueabi/disk-installer/0.0-r0/image/etc/6x_bootscript

}

I can see by the copied comment (#) lines that this fragment
is coming exactly from 'installer_0.0.bbappend'

This looks totally wrong to me.  Am I missing something (and
it should work this way)??

The complete recipes and fragments are attached in case my explanation
is a bit confusing.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------
-------------- next part --------------
DESCRIPTION = "Additional setup for self-contained disk based installer"
SECTION = "base"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 "
FILESEXTRAPATHS_prepend := "${THISDIR}/installer:"

# These files get dragged in by this process
DEPENDS += "amltd-console-image linux-boundary u-boot-fslc"

# Pick up defaults used by network installer
SRC_URI += " \
            file://do_install.defaults \
"

S = "${WORKDIR}"

PACKAGE_ARCH = "${MACHINE_ARCH}"

do_install() {
    # Copy images for fully recoverable image
    MAC_ADDR=ignored . ${WORKDIR}/do_install.defaults
    for f in ${KERNEL} ${ROOTFS} ${UBOOT}; do
      if [ -e ${DEPLOY_DIR_IMAGE}/`basename $f` ]; then
        install -d ${D}/`dirname $f`
        cp -L ${DEPLOY_DIR_IMAGE}/`basename $f` ${D}/`dirname $f`
      fi
    done
}

FILES_${PN} += "/local"
-------------- next part --------------
#
# Just tell BitBake where to find my component files
#
FILESEXTRAPATHS_prepend := "${THISDIR}/installer:"

SRC_URI += " \
            file://do_install.post \
	    file://6x_bootscript.txt \
"

COMPATIBLE_MACHINE = "${MACHINE}"

do_install_append() {
    # Additional installation steps
    install -m 0755 ${WORKDIR}/do_install.post ${D}/etc/do_install.post            
    mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "U-Boot script" -d ${WORKDIR}/6x_bootscript.txt ${D}/etc/6x_bootscript
}



More information about the yocto mailing list