[Yocto] Run scripts on startup boot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[Yocto] Run scripts on startup boot

524 Views
petertseng
Contributor IV

Hi

I'm currently using i.MX Linux Yocto BSP (mickledore-6.1.22-2.0.0)

I added initscripts_%.bbappend file:

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

DEPENDS = "update-rc.d-native"
RDEPENDS:${PN} = "update-rc.d"

SRC_URI += " \
	file://backlightset.sh \
"

# Without this it is not possible to patch checkroot
S = "${WORKDIR}"

do_install:append () {
	install -m 0755 ${WORKDIR}/backlightset.sh	${D}${sysconfdir}/init.d

	update-rc.d -r ${D} backlightset.sh start 20 S .
}

MASKED_SCRIPTS += " \
	backlightset \
"

and added the script: backlightset.sh

#!/bin/sh
#
# SPDX-License-Identifier: GPL-2.0-only
#

### BEGIN INIT INFO
# Provides:			backlightset
# Required-Start:	mountvirtfs
# Required-Stop:	
# Default-Start:	S
# Default-Stop:		
# Short-Description: Setup backlight
### END INIT INFO

echo 60 > /sys/class/backlight/lvds_backlight/brightness

 

After booting I check the following files:

/etc/init.d/backlightset.sh

/etc/rcS.d/S20backlightset.sh -> ../init.d/backlightset.sh

/etc/systemd/system/backlightset.service -> /dev/null

 

But the script does not seem to be executed.

$ cat /sys/class/backlight/lvds_backlight/brightness
80

 

How can I solve this problem?

Thank you in advance!

Best Regards
Peter 

 

0 Kudos
Reply
0 Replies