Failing to adding files to rotfs

Hi all,
I am trying to add a folder to /home/root/ of an Apalis IMX6 with BSP 2.8 on Yocto, so I created a layer and configured It as described on this topic, all the compilation goes without any problem, but I can’t see my folder on Toradex side. Could you please help me with It?

My Layer folder:

/meta-time-zone$ tree
.
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipe
    ├── time-zone_1.0.0.bb
    └── tzupdate-2.1.0.tar.gz

2 directories, 5 files

.bb file from my new layer

SUMMARY = "Auto Detect Time Zone"
LICENSE = "CLOSED"

# Prevent Yocto from decompressing the file
SRC_URI = "file://tzupdate-2.1.0.tar.gz"

do_install(){
    # Create the time-zone folder into the final image
    install -d ${D}/home/root/time-zone/
    # Copy file there;
    install -m 0755 ${WORKDIR}/tzupdate-2.1.0.tar.gz ${D}/home/root/time-zone/
}

# Specify what was installed in (do_install)
FILES_${PN} = "/home/root/time-zone/*"

Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

Your recipe is a bit unusual to me. Are you expecting to copy the compacted file into your final image?

In general, your recipe looks correct. There is only one point that I’d like you to double-check. Could you please take a look at the file conf/layer.conf and verify the configuration of the BBFILES variable? Typically it’s set up like this:

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

As you can see in the example above, the standard practice is to search for .bb files in the directories matching the pattern recipes-*/*/, which differs slightly from your setup.

Best regards,
Daniel Morais

Hi @daniel_m.tx,

I pretend to copy the extracted file into the final image.
I checked the BBFILES into conf/layer.conf and is like you described.
The folder recipe name was changed and a new image was generated, but the same problem was noted.

Directory tree:

/meta-time-zone$ tree
.
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-tz
    ├── time-zone_1.0.0.bb
    └── tzupdate-2.1.0.tar.gz

layer.conf file:

# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "../../../layers/meta-time-zone"
BBFILE_PATTERN_../../../layers/meta-time-zone = "^${LAYERDIR}/"
BBFILE_PRIORITY_../../../layers/meta-time-zone = "6"

Thanks in advance and Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

Please try changing from:

└── recipes-tz
    ├── time-zone_1.0.0.bb
    └── tzupdate-2.1.0.tar.gz

to:

└── recipes-tz
    └── tz
        ├── files
        │      └── tzupdate-2.1.0.tar.gz
        └── time-zone_1.0.0.bb

Also, please change your recipe to the following:

SUMMARY = "Auto Detect Time Zone"
LICENSE = "CLOSED"

FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

# Prevent Yocto from decompressing the file
SRC_URI = "file://tzupdate-2.1.0.tar.gz"

do_install(){
    # Create the time-zone folder into the final image
    install -d ${D}/home/root/time-zone/
    # Copy file there;
    install -m 0755 ${WORKDIR}/tzupdate-2.1.0.tar.gz ${D}/home/root/time-zone/
}

# Specify what was installed in (do_install)
FILES_${PN} = "/home/root/time-zone/*"

Can you please check if this solves the issue?

By default, Yocto may decompress the file. To verify this, you can check the build directories. To find out the location of the WORKDIR directory, you can execute the following command:

bitbake time-zone -e | grep ^WORKDIR=

I recommend checking the directory mentioned above after running the command bitbake time-zone -c unpack, which forces the execution of the unpack task. For more information on this, please refer to this article.

Best regards,
Daniel Morais

Hi @daniel_m.tx ,

I changed the directory structure as mentioned and pasted the recipe content on my recipe, but I needed to change the FILESEXTRAPATHS:prepend to FILESEXTRAPATHS_prepend because bitbake wasn’t recognizing the command, returning the below error:
ERROR: ParseError at .../meta-time-zone/recipes-tz/tz/time-zone_1.0.0.bb:4: unparsed line: 'FILESEXTRAPATHS:prepend := "${THISDIR}/files:"'

When checking the WORKDIR directory, it seems to be ok.

#bitbake time-zone -e | grep ^WORKDIR=
WORKDIR=".../build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/time-zone/1.0.0-r0"

#ls ...build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/time-zone/1.0.0-r0
recipe-sysroot  recipe-sysroot-native  temp  time-zone-1.0.0  tzupdate-2.1.0

Recipe directory with suggested changes:

.
└── tz
    ├── files
    │   └── tzupdate-2.1.0.tar.gz
    └── time-zone_1.0.0.bb

Even with these changes, we had the same behavior.

Thanks and Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

Apologies for the typo. The FILESEXTRAPATHS:prepend is now used on the Kirkstone branch. In your case, you should use FILESEXTRAPATHS_prepend.

As you can see on your log, the folder tzupdate-2.1.0 exists because the file is being decompressed by default. Since you want to keep the file compressed, you should add the parameter unpack=0 to the SRC_URI line. Please test the example below:

SRC_URI = "file://tzupdate-2.1.0.tar.gz;unpack=0"

For more information about the above solution, please refer to this article.

Best regards,
Daniel Morais

HI @daniel_m.tx,
I tested the solution with the unpack=0" parameter and unfortunately, It still did not appear on the Linux side. I read the article you suggested I did not find any misconception.

Thanks and Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

Can you please share again the output of the below command after running the command bitbake time-zone -c unpack?

ls ...build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/time-zone/1.0.0-r0

Also, if possible please share the actual status of your recipe.

Best regards,
Daniel Morais

Hi @daniel_m.tx ,
Below are the command output and current recipe state.

Ls output after run bitbake time-zone -c unpack:

$ ls ...build/tmp-glibc/work/armv7at2hf-neon-angstrom-linux-gnueabi/time-zone/1.0.0-r0
bitbake-cookerdaemon.log  recipe-sysroot  recipe-sysroot-native  temp  time-zone-1.0.0  tzupdate-2.1.0.tar.gz

Current recipe state:

SUMMARY = "Auto Detect Time Zone"
LICENSE = "CLOSED"

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

# Prevent Yocto from decompressing the file
SRC_URI = "file://tzupdate-2.1.0.tar.gz;unpack=0"

do_install(){
    # Create the time-zone folder into the final image
    install -d ${D}/home/root/time-zone/
    # Copy file there;
    install -m 0755 ${WORKDIR}/tzupdate-2.1.0.tar.gz ${D}/home/root/time-zone/
}

# Specify what was installed in (do_install)
FILES_${PN} = "/home/root/time-zone/*"

Thanks and Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

As you can see in your logs, the tzupdate-2.1.0.tar.gz file already exists in the WORKDIR directory. Therefore, the installation you’ve performed in the task do_install in your recipe should be sufficient to achieve your desired outcome.

I conducted a brief test and found that this approach worked perfectly on my side. The only possible issue might be forgetting to add the new recipe to your image. Have you added this recipe to your image somewhere? The simplest way to do this is by adding the following parameter to your conf/local.conf file:

IMAGE_INSTALL_append += " time-zone"

Can you please verify this?

Best regards,
Daniel Morais

Hi @daniel_m.tx,
The IMAGE_INSTALL_append += " time-zone" wasn’t added to local.conf, but when I added it, it generated a compilation error.

NOTE: Resolving any missing task queue dependencies
ERROR: Nothing RPROVIDES 'time-zone' (but ...build/../layers/meta-toradex-demos/recipes-images/images/console-tdx-image.bb RDEPENDS on or otherwise requires it)
NOTE: Runtime target 'time-zone' is unbuildable, removing...
Missing or unbuildable dependency chain was: ['time-zone']
ERROR: Required build target 'console-tdx-image' has no buildable providers.
Missing or unbuildable dependency chain was: ['console-tdx-image', 'time-zone']

Summary: There were 4 WARNING messages shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

I have the same error of “Nothing RPROVIDES” if I try to execute just bitbake time-zone.

Thanks and Best Regards,
Adriano Munin

Hi @adrianomunin.eld ,

Can you please share the entire log for the command bitbake time-zone? If you still get the Nothing RPROVIDES error, can you confirm that the layer you added to the recipe time-zone.bb exists on the file conf/bblayers.conf?

Best regards,
Daniel Morais

Hi @daniel_m.tx,
sorry for the delay. I rechecked the conf/bblayers.conf and really was missing the recipe. So, now the tar.gz file is appearing in the home folder with the recipe added.
Now I am trying to send this unpacked, but I can’t. I have tried to remove the unpack=0 parameter and also tried to set It to 1 on the recipe, but in no case it works.

Thanks and best regards,
Adriao Munin

Hi @adrianomunin.eld ,

Thanks for the information!

As mentioned, the Yocto automatically unpacks the compressed file available on the SRC_URI variable.

I recommend you always verify the content of the WORKDIR directory after running the command bitbake time-zone -c unpack, so you can see which files are available in order to use in the following Yocto tasks.

As checked before, you already faced two possible scenarios, the first one below you can see that you had the tzupdate-2.1.0 folder inside the WORKDIR directory, this is the unpacked file and you can use it inside the install task.

The second scenario is the below, where you can find the tzupdate-2.1.0.tar.gz still packed, and then you can also work with this inside the install task.

The difference between the two scenarios above is the addition of the unpack parameter inside the SRC_URI variable, if you want to keep the file packed you should use SRC_URI = "file://tzupdate-2.1.0.tar.gz", if you want the file unpacked you should use SRC_URI = "file://tzupdate-2.1.0.tar.gz;unpack=0".

Please let me know if you have any doubts.

Best regards,
Daniel Morais

Hi @daniel_m.tx ,
I tried to copy the uncompressed files to the home folder with install -d, but it didn’t work. So I used the cp -r ${WORKDIR}/tzupdate-2.1.0 ${D}/home/root/ command line to copy the unpacked folder to the home directory, and now is all working.

Thanks for the help.
Best regards,
Adriano Munin

Hi @adrianomunin.eld ,

Glad to hear that you were able to solve the issue.

We remain at your disposal if you have any questions.

Best regards,
Daniel Morais