Running a user program at startup

Home Forums MultiConnect OCG Running a user program at startup

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5117
    Greg Ludewig
    Participant

    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?

    #5118
    Mike Fiore
    Blocked

    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

    #5119
    Mike Fiore
    Blocked
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.