Hi,

By default, Yocto uncompress files with an extension use for compression 
(include it tgz), so any file that you add to the SRC_URI, Yocto will do the 
uncompress in the do_unpack task. Because do_install depends on do_unpack, when 
you want to use that task, you will already have the uncompress data available, 
and you only need to copy into the right folder.

You can see the whole list of tasks that your recipe has with the command:

bitbake <name_recipe> -c do_listtasks

After that you can use the do_install task to send the files that you need to 
the destination rootfs using the ${WORKDIR}, ${S} and ${D} variables of 
bitbake. You can see the openemebedded-core layer for some inspiration. If you 
want to see what exactly is in the WORKDIR directory, you will get the whole 
path with the following command:

bitbake -e <name_recipe> | grep ^WORKDIR= | sed -n -e 's/^.*WORKDIR="//p' | sed 
-n -e 's/".*$//p'

PS: Please take into consideration that you should never use absolute paths in 
Yocto and use the predetermine variables for that (${WORKDIR}, ${S}, ${D}, etc)

Sincerely,


Jairo R. Mejia Aponte | Embedded Software Linux Junior Engineer

Netmodule | Hirschmann Automation & Control GmbH

Location Eschborn | Frankfurter Str. 10-14 | 65760 Eschborn | Germany

jairo.mejiaapo...@belden.com<mailto:jairo.mejiaapo...@belden.com> | 
www.netmodule.com<http://www.netmodule.com/> | 
www.belden.com<http://www.belden.com/>

________________________________
From: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org> on behalf of 
umes...@gmail.com <umes...@gmail.com>
Sent: 21 October 2024 5:54 PM
To: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org>
Subject: [EXTERNAL] [yocto] reading tgz file and uncompress in rootfs


External Message:Use caution before opening links or attachments

Hi, I have requirement where recipe file reads set of .tgz files and it should 
store in a location in rootfs and untar them(on freescale board). Can you 
please show some pointers.

SUMMARY = " Tools"
LICENSE = "CLOSED"

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

SRCREV = "${AUTOREV}"

SRC_URI = "file://tool1.tgz
file://tool2.tgz<file://tool2.tgz/>
file://tool3.tgz<file://tool3.tgz/>
file://tool4.tgz<file://tool4.tgz/>"

do_install () {
install -d ${IMAGE_ROOTFS}/usr/share/sigma-tools

for file in ${WORKDIR}/.tgz;do

tar -xvzf $file -C ${IMAGE_ROOTFS}/usr/share/<folder>

done

Alternatively instead of for loop tried below

tar -xvzf file://tool1.tgz -C ${IMAGE_ROOTFS}/usr/share/<folder>
tar -xvzf file://tool2.tgz -C ${IMAGE_ROOTFS}/usr/share/<folder>
tar -xvzf file://tool3.tgz -C ${IMAGE_ROOTFS}/usr/share/<folder>
tar -xvzf file://tool4.tgz -C ${IMAGE_ROOTFS}/usr/share/<folder>

But when I build following is the error

DEBUG: Python function extend_recipe_sysroot finished

DEBUG: Executing shell function do_install
tar (child): Cannot connect to file: resolve failed
gzip: stdin: unexpected end of file
tar: Child returned status 128
tar: Error is not recoverable: exiting now

Can you please suggest to resolve errors and provide solutions

Thanks

**********************************************************************
DISCLAIMER:
Privileged and/or Confidential information may be contained in this message. If 
you are not the addressee of this message, you may not copy, use or deliver 
this message to anyone. In such event, you should destroy the message and 
kindly notify the sender by reply e-mail. It is understood that opinions or 
conclusions that do not relate to the official business of the company are 
neither given nor endorsed by the company. Thank You.
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#64083): https://lists.yoctoproject.org/g/yocto/message/64083
Mute This Topic: https://lists.yoctoproject.org/mt/109136100/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to