Skip to contentSkip to conversation

How to start application/script at startup

DISCUSSION [email protected] 2 participants 3 messages Sep 7, 2023 – Sep 8, 2023 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi all,
I am using *"Mickledore 4.2.3"* for *"Raspberry-Pi2"* and for init I am using the default " *SysVinit".* I want to start my Script/Application immediately after starting and disable all logs. Please tell me how I can implement this in YOCTO. * *

Thanks
Shrikant Vaishnav

#1 lore raw
Quoted 2 lines · shrikantvaishnav via lists.yoctoproject.org

Hi all,
I am using "Mickledore 4.2.3" for "Raspberry-Pi2" and for init I am using the default "SysVinit".I want to start my Script/Application immediately after starting and disable all logs. Please tell me how I can implement this in YOCTO.

First, write an init script as usual with any sysv-using Linux system (for example, https://unix.stackexchange.com/a/20361). In your recipe install it to /etc/init.d and then use the update-rcd class to register it (https://docs.yoctoproject.org/ref-manual/classes.html#update-rc-d).

Searching poky for the update-rc.d class will give you many examples.

Ross

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Copying the list, I don’t do private support.

Quoted 5 lines · On 7 Sep 2023, at 17:29, [email protected] wrote:

Thanks Ross sir,
i have some doubts regarding your answer thanks in advance.

(1)cant i directly modify inside "poky/meta/recipes-core/sysvinit" folder and write whatever i want is this approach ok ? i tried with inittab and then with rc but my echo "shri" script/command not displayed after startup.

Editing inittab is a bad idea.

Quoted 3 lines

(2)Also i confuse with these two line:

• In your recipe install it to /etc/init.d :where is the location inside Poky directory???

That’s an on-target location. Something like:

SRC_URI = “file://myinitscript <file://myinitscript/>”

do_install() {
	mkdir —parents ${sysconfdir}/init.d
	install ${WORKDIR}/myinitscript ${sysconfdir}/init.d
}
Quoted 1 line

• use the update-rcd class to register it:why i need this steps

Write the init script and install it in the recipe for your application, or write a new recipe if there isn’t a single obvious recipe.

The update-rcd class is needed to construct the symlinks for sysv to work. If you don’t know what I’m talking about then read up on how SysV init scripts work: this isn’t Yocto-specific but a Unix standard since 1983.

Ross