Cannot copy files to root path of rootf (/)

Hello,
Using merge recipe, I can copy files and folder to /home/root/etc/* but no to /etc directly which is what I want.

This is what I have done so far.

I Added the directories and files structure I wanted to transfer to rootfs in this path:
~/fsl-community-bsp/sources/meta-freescale/recipes-extended/merge-files/merge-files/merge

merge
    ├── etc
    │   ├── esp8266
    │   │   ├── esp_configure
    │   │   ├── esp_getInfo
    │   │   ├── EspPinsInit.sh
    │   │   ├── esp_reset.sh
    │   │   ├── flash
    │   │   │   ├── 0x00000.bin
    │   │   │   ├── 0x10000.bin
    │   │   │   ├── EspFlash.sh
    │   │   │   └── esptool.py
    │   │   ├── GpioPinInit.sh
    │   │   ├── README
    │   │   ├── setEnv
    │   │   ├── wirelessConnect.sh
    │   │   ├── wirelessGetDns.sh
    │   │   └── wirelessInit.sh
    │   └── yum.repos.d
    │       └── mybuild.repo
    └── README

I wrote proper dependencies into the recipe & select proper path ~/fsl-community-bsp/sources/meta-freescale/recipes-extended/merge-files/merge-files_1.0.bb

RDEPENDS_${PN} += "bash expect


Add package in local.conf
IMAGE_INSTALL_append += " merge-files \

Then, when I check the tar.gz:

tar tvf core-image-minimal-colibri-imx6ull.tar.xz |grep esp8266

drwxr-xr-x 0/0               0 2019-08-21 15:26 ./home/root/etc/esp8266/
-rwxr-xr-x 0/0             892 2019-08-21 14:37 ./home/root/etc/esp8266/wirelessGetDns.sh

`

If I change MERGED_DST within the recipe, no files are copied. If I erase it, same thing happens.
Here is the recipe:

    DESCRIPTION = "Merge prebuilt/extra files into rootfs"
    LICENSE = "MIT"
    LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
    
    inherit allarch
    
    SRC_URI = "file://merge"
    S = "${WORKDIR}"
    
    MERGED_DST ?= "${ROOT_HOME}"
    do_install () {
        install -d ${D}/${MERGED_DST}
        find ${WORKDIR}/merge/ -maxdepth 1 -mindepth 1 -not -name README \
        -exec cp -fr '{}' ${D}/${MERGED_DST}/ \;
        find ${WORKDIR}/merge/ -maxdepth 1 -mindepth 1 -exec rm -fr '{}' \;
    }
    do_configure[noexec] = "1"
    do_compile[noexec] = "1"
    
    FILES_${PN} = "/*"
    ALLOW_EMPTY_${PN} = "1"
    INSANE_SKIP_${PN} = "debug-files dev-so"
    RDEPENDS_${PN} += "bash expect"

Hi

I guess that your conclusion is wrong that it only works if you install into /home/root. I guess that the recipe works the first time it is built, but if you then change the destination directory it will not work again.

The do deploy task deletes the files after it did copy them. If you then change MERGED_DST and rerun the build the buildsystem will not run the do_fetch task, as no input variables for that task have changed. Then do_install does not have any input files and you end up with an empty package.

If you delete line 15 of the recipe, run bitbake -c cleansstate merge-files to force do_fetch to be executed and then the recipe works as expected the above assumption would be correct.

Max

Hello,

Thanks! It works, now I’d like to understand why.

If you delete line 15 of the recipe, run bitbake -c cleansstate merge-files to force do_fetch to be executed and then the recipe works as expected the above assumption would be correct.

I tried both erasing and not erasing line 15 and it works either way as long as I change the MERGED_DST variable I perform bitbake -c cleansstate merge-files before bitbake <image_target>.

  1. Where is do_fetch in the recipe?
  2. What does it do if it not declared?
  3. How can I automate the cleansstate part within the recipe so I can avoid doing it manually?

Thanks!

Hi

Great that it works

  1. Most tasks have are predefined in openembedded-core. Only some of them are overridden/amended in the individual recipes. I suggest doing some reading, e.g. the Yocto documentation is a good starting point. We also mention some books here.
  2. It falls back to its default implementation
  3. You can’t. IMHO it’s a bug to delete the fetched items in the recipe. The solution is to delete that line from do_install.

Max