Running a user program at startup
- This topic has 2 replies, 2 voices, and was last updated 12 years ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Home › Forums › MultiConnect OCG › Running a user program at startup
I’d like to install a program on the system to run automatically when the system is powered on. Can anyone give me some advice on what’s the best way to do that? I see from inittab that the default runlevel is 5. Do I have to create some kind of a script in rc5.d to accomplish this, or can I just add a line like ‘/usr/bin/myprogram &’ directly to the end of the /etc/init.d/rc script?
Hi Greg,
Your bitbake recipe can inherit from the “update-rc.d” class, which takes care of this for you. Simply inherit from the class, define a couple of additional parameters in your recipe, and include the script in your fakeroot_do_install target. The update-rc.d class takes care of the rest.
Here’s a link to OpenEmbedded documentation for the update-rc.d class:
A good example of how this class is used is our mts-io driver. Check out `path-to-corecdp/multitech/recipes/multitech/mts-io.inc for an example. Specifically take a look at the following lines for the inheritance and declaration of variables that the class needs:
inherit update-rc.d
INITSCRIPT_NAME = "mts-io"
INITSCRIPT_PARAMS = "start 39 S ."
These lines install the init script in the /etc/init.d/ directory:
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/mts-io.init ${D}${sysconfdir}/init.d/mts-io
Let us know if you have more questions!
Cheers,
Mike
Sorry, my link didn’t work!
http://docs.openembedded.org/usermanual/usermanual.html#update-rc-d_class