Discussion:
[yocto] adding own shell script
Zolee K
2018-10-29 09:50:33 UTC
Permalink
Hi all,

I'd like to install my own test.sh script into the image, I created this
recipe file, however I dont know how to have bitbake put the my test.sh
into /etc folder

SUMMARY = "test.sh"
LICENSE = "Z"

SRC_URI = "\
file://test.sh \
"

do_configure(){
:
}

do_compile() {
:
}


do_install() {
install -d ${D}${sysconfdir}
install -m 0770 ${WORKDIR}/test.sh ${D}${sysconfdir}/test.sh
}
Uwe Geuder
2018-10-29 12:26:32 UTC
Permalink
Post by Zolee K
I'd like to install my own test.sh script into the image, I created this
recipe file, however I dont know how to have bitbake put the my test.sh
into /etc folder
SUMMARY = "test.sh"
LICENSE = "Z"
SRC_URI = "\
file://test.sh \
"
do_configure(){
}
do_compile() {
}
do_install() {
install -d ${D}${sysconfdir}
install -m 0770 ${WORKDIR}/test.sh ${D}${sysconfdir}/test.sh
}
At least at the first glimpse this recipe looks to me like it might
work. (Executable code does not belong under /etc, but that is a
different issue)

However, bitbake will execute the tasks in the recipe only if they
are pulled in, i. e. some part of your image depends on the package
created. There are always many recipes in the layers of a Yocto based
project, but only those tasks which are really needed will be executed.

There are 2 ways to create the dependency

a.) directly into the image

https://www.yoctoproject.org/docs/2.5.1/mega-manual/mega-manual.html#var-IMAGE_INSTALL
https://www.yoctoproject.org/docs/2.5.1/mega-manual/mega-manual.html#var-PACKAGE_INSTALL

b.) indirectly by making some package already in your image runtime-depend on
your new package

https://www.yoctoproject.org/docs/2.5.1/mega-manual/mega-manual.html#var-RDEPENDS


Regards,

Uwe Geuder
Neuro Event Labs Oy
Tampere, Finland
uwe.gexder at neuroeventlabs.com (Bot check: fix one obvious typo)
--

Loading...