[yocto] adding own shell script

Uwe Geuder jrswdnan22 at snkmail.com
Mon Oct 29 05:26:32 PDT 2018


On Mon, Oct 29, 2018 at 11:51 AM Zolee K zoleelikesdebian-at-gmail.com wrote:
> 
> 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)


More information about the yocto mailing list