Adding random files into root directoy of yocto image?

0

Issue

How can we add random files e.g. jpeg, mp3, .py files into some directory e.g. /data/myfiles in yocto?
The step what i have done so far is i have created a my own layer with bitbake-layers and i am also able to add already available recipes into my layer and then it is added into my image .

I do bitbake core-minimal-image, it get built and then i am able touse the packages which i have added through local.conf or .bbappend file.
i have found this recipe file ..

SUMMARY = "Copy mksd.sh script to image deployment area"
SECTION = "devel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = \
"file://${WORKDIR}/mksd.sh;beginline=4;endline=7;md5=d8d50b7d91345eb72f51bbced7fc791b"
SRC_URI = "file://mksd.sh"

#This package doesn't have any files for the rootfs in it, option needed to create an empty 
# package so when the rootfs image is made it finds the mksd_xxx.deb package and doesn't complain
FILES_${PN} = ""
ALLOW_EMPTY_${PN} = "1"


# Copy script to the deploy area with u-boot, uImage, and rootfs
do_deploy () {
   install -d ${DEPLOY_DIR_IMAGE}
   install -m 0755 ${WORKDIR}/mksd.sh ${DEPLOY_DIR_IMAGE}
}
addtask deploy after do_install

But now i am a bit confused about e.g. i have an .jpeg file and i want it to copy into /data/my files directory into my target system. That means i want to create a directory first named /data/myfiles and then i want to copy an image there all through recipe.
So when i burn my image into my device it should show in my device?
How can i do that?

Solution

Can’t you just create a simple recipe to do this? That way you could manage dependencies or change whether they are installed or not by just adding/removing the recipe. This is how Yocto should work.

DESCRIPTION = "File Installer"
LICENSE = "CLOSED"

SRC_URI = " \
    file://filea \
    file://fileb \
    file://filec \
    file://filed \
"

S = "${WORKDIR}"

do_install() {
    install -d ${D}/path
    install ${S}/filea ${D}/path
    install ${S}/fileb ${D}/path
    install ${S}/filec ${D}/path
    install ${S}/filed ${D}/path
}

FILES_${PN} += "/path"

Answered By – Peter Buelow

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More