[yocto] Adding custom scripts to home directory and /etc/init.d/*

Giordon Stark kratsg at gmail.com
Tue Mar 6 08:19:35 PST 2018


Thanks Anuj,

This is where I ended up for now (let me know if this looks about right):

# see https://stackoverflow.com/a/40768781
DESCRIPTION = "Clock Configuration via I2C"
SRC_URI = "file://init-clock"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${WORKDIR}/init-clock;beginline=2;endline=19;md5=846eef20187f1d9f7f2af0d254faa171"

# these 3 lines will have the script run on boot
inherit update-rc.d
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME = "init-clock"

# install it in the correct location for update-rc.d
do_install() {
  install -d ${D}${INIT_D_DIR}
  install -m 0755 ${WORKDIR}/init-clock ${D}${INIT_D_DIR}/init-clock
}

*# package it as it is not installed in a standard location*
*FILES_${PN} = "${INIT_D_DIR}/init-clock"*

The one thing I'm not 100% sure I understand is the last line that I
bolded, but it seems to be needed.

Thanks,

Giordon

On Mon, Mar 5, 2018 at 6:36 PM Anuj Mittal <anuj.mittal at intel.com> wrote:

> On 03/06/2018 05:18 AM, Giordon Stark wrote:
> > Hi all,
> >
> > I am wondering if there's a nice pattern or workflow within Yocto where
> > I can add a custom shell script to /etc/init.d for the purposes of
> > running it on OS boot (which also requires running update.rc I believe)
>
> You can inherit update-rc.d class and define INITSCRIPT_NAME/PARAMS in
> your recipe.
>
>
> https://www.yoctoproject.org/docs/latest/ref-manual/ref-manual.html#ref-classes-update-rc.d
>
> > as well as prepopulating the home directory with some files of my
> choosing.
> >
> > If someone could point me in the right direction, that would be great!
> >
> > Giordon
> > --
> > Giordon Stark
> >
> >
>
> --
Giordon Stark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20180306/afce0323/attachment.html>


More information about the yocto mailing list