Hi,

Thank you all for your contribution to this thread.
Following this, here's what I have tried so far that HAS NOT worked.
1. The initial code of this post as a separate recipe.
2. The initial code of this post as a .bbappend.
3. The example shown here:
http://embeddedguruji.blogspot.com/2019/02/yocto-recipe-to-copy-single-file-on.html
4. The format of the recipe as shown here:
https://stackoverflow.com/questions/62635557/add-files-to-system-image-in-yocto
5. Other similar scripts around StackOverflow

Basically, none of them showed usage of adding the S=${WORKDIR} line.

Upon using it, the files transferred to the rootfs build successfully.

First thing I tried was the following recipe with an absolute path:

```
SUMMARY = "filesystem"
DESCRIPTION = "Copy gui and relevant scripts"
LICENSE = "CLOSED"

inherit allarch

MY_FILES =
/home/<user>/oe-core/layers/meta-custom-gui/recipes-gui/gui/files"

do_install() {

install -d {D}/etc

install -m 0755 ${MY_FILES}/fb.modes ${D}/etc

# Same thing for other files

}

FILES_${PN} += " \

/etc \

# Same thing for other files

"

Then in build/local.conf: CORE_IMAGE_EXTRA_INSTALL += " filesystem "
```

And this recipe worked.
So I figured it probably has to do with the pathing, so rewrote my initial
code by adding S=${WORKDIR} like you all suggested, here is my final
working recipe.

```
SUMMARY = "filesystem"
DESCRIPTION = "Copy gui and relevant scripts"
LICENSE = "CLOSED"

SRC_URI += " \

file://qt_app \

file://startup.sh \

file://fb.modes \

"

S = "${WORKDIR}"

do_install() {

install -d 0644 ${D}/home/root

install -m 0755 ${WORKDIR}/qt_app ${D}/home/root

install -d 0644 ${D}/etc/init.d

install -m 0755 ${WORKDIR}/startup.sh ${D}/etc/init.d


install -m 0755 ${WORKDIR}/fb.modes ${D}/etc

}

FILES_${PN} += " \

/home/root/qt_app \

/etc/init.d/startup.sh \

/etc/fb.modes \

"

Then in build/local.conf: CORE_IMAGE_EXTRA_APPEND += " filesystem "
```

So a few observations and follow-up questions on this:
1. Adding S=${WORKDIR} did the trick. Why is that? I don't use S anywhere
in my do_install().
2. In order to copy a bash script, I had to add RDEPENDS_${PN} += " bash "
to this secondary recipe.
3. In order to copy my Qt app, I also had to add its Qt dependencies as in
(2). Why do I need everything's dependencies even if I only wish to do a
copy in the rootfs?
4. Some of you have been suggesting adding the recipe to
CORE_IMAGE_EXTRA_INSTALL or CORE_IMAGE_EXTRA_APPEND. Both give me the same
result. Is there a fundamental difference?
4. To setup Yocto, I used Toradex's manifest for the Dunfell version, which
uses Yocto v3.1 LTS since I'm working on an Apalis iMX6 board:
https://developer.toradex.com/linux-bsp/os-development/build-yocto/build-a-reference-image-with-yocto-projectopenembedded

Thank you all again and I hope this helps others.
Anthony

On Wed, May 3, 2023 at 4:33 AM Josef Holzmayr <jes...@theyoctojester.info>
wrote:

> My guess is that you are on a recent release, which as changed syntax. To
> add files to packages, you need:
>
> FILES:${PN} += ...
>
> But I agree with the other responders, please be as precise as possible.
> Name your used versions please, for one thing.
> The other part is that things will not be added to an image automatically
> just because you wrote a recipe. You have to add them explicitly. Its a bit
> dated by now, but I think most of this is explained in the various
> livecoding sessions:
> https://www.youtube.com/playlist?list=PLD4M5FoHz-TxMfBFrDKfIS_GLY25Qsfyj
>
> Greetz
>
>
> On Wed, May 3, 2023 at 10:12 AM MOHAMMED HASSAN <hassanchatta...@gmail.com>
> wrote:
>
>> On Tue, May 2, 2023 at 03:17 PM, Anthony Abboud wrote:
>>
>> HI Yocto Community,
>>
>> I am currently working on build a custom Boot2Qt image to learn about
>> How-To's since it's my first time playing with Yocto. I am successfully
>> able to build an image for my system; manually inserting and launching my
>> Qt application works great.
>>
>> Now I want to include this app and some files into the rootfs of the
>> image. I modified the recipe by adding the following lines at the end to
>> attempt this:
>>
>> ```
>>
>> Ignore my previous posts Ive made some mistakes there.
>> 1) Create a custom recipe file.
>>
>>
>> SRC_URI += " \
>> file://qtApp_qml \
>> file://startup.sh \
>> file://fb.modes \
>> "
>>
>>
>> Add line S="${WORKDIR}"
>>
>>
>> do_install() {
>>   install -d ${D}/home/root
>>   install -m 755 ${WORKDIR}/qtApp_qml ${D}/home/root/
>>
>>   install -d ${D}/etc/init.d
>>   install -m 755 ${WORKDIR}/startup.sh ${D}/etc/init.d/
>>
>>   install -d ${D}/etc
>>   install -m 755 ${WORKDIR}/fb.modes ${D}/etc/
>> }
>>
>> FILES_${PN} += " \
>>         /home/root/qtApp_qml \
>>         /etc/init.d/startup.sh \
>>         /etc/fb.modes \
>> "
>> ```
>>
>>
>> Run bitbake recipename
>> If it runs successfully,  then add the below in your local.conf folder.
>> CORE_IMAGE_EXTRA_INSTALL_append += " recipename "
>> Next bitbake target
>>
>>
>> But I'm simply unable to get those three files to show up at all in the
>> final build (both the folders and files!).
>>
>> I've tried a few variations I saw around but still nothing. Any idea
>> what's missing?
>>
>> Would it be possible for you to share what changes you have tried. To be
>> honest I am a beginner too and want too learn more, so I got curious.
>> Also the above will most probably work, but in case you solve it with any
>> other method, then please post here for other's reference.
>>
>>
>>
>> Thanks!
>> Anthony
>>
>>
>> Best Regards,
>> Hassan
>>
>>
>>
>>
>>
>>
>>
> 
>
>

-- 
*Anthony Abboud*
*B Eng., CEP, LSSGB*
Senior Software Engineering, R&D - Boston Scientific Corporation

*+1 (514) 224-4477*
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#59855): https://lists.yoctoproject.org/g/yocto/message/59855
Mute This Topic: https://lists.yoctoproject.org/mt/98649960/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to