Yocto recipe to install shared libraries dependency issues - yocto

I have a Yocto recipe that compiles dynamically linked shared libraries that should be added to the rootfs. Compiling and adding them to rootfs works fine, but QA packaging warnings are resulted.
S = "${WORKDIR}/git"
do_compile () {
make
}
do_install () {
install -m 0755 -d ${D}${libdir}
oe_libinstall -so libA ${D}${libdir}
oe_libinstall -so libB ${D}${libdir}
oe_libinstall -so libC ${D}${libdir}
}
INSANE_SKIP_${PN} = "ldflags"
# RDEPENDS_${PN} = "libB${SOLIBS}"
# RPROVIDES_${PN} = "libB${SOLIBS}"
# FILES_${PN} = "${libdir}/lib*${SOLIBS}"
# INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
# INHIBIT_PACKAGE_STRIP = "1"
The warning is the following:
WARNING: package do_package_qa: QA Issue: /usr/lib/libC.so.1.0.0 contained in package package requires libB.so, but no providers found in RDEPENDS_package? [file-rdeps]
The commented RDEPENDS_${PN} = "libB${SOLIBS}" doesn't do anything in any way I tried so far.
How can I solve this problem? I don't want to add INSANE_SKIP_${PN} += "file-rdeps", I want to resolve the dependency problem.

Just guessing but isn't your recipe installing lib{A,B,C}.so.1.0.0 and they actually need libX.so (objdump -x /usr/lib/libC.so.1.0.0, what's in NEEDED)? In which case, they probably should depend on libX.so.1.0.0 instead, so fix your Makefile/CMakeLists.
I've never seen nor used oe_libinstall before, could you just use install relative/path/to/libA.so.1.0.0 ${D}${libdir} instead? Maybe that's oe_libinstall doing this weird trick?
Also, you probably don't need your manually crafted do_compile, it's already what the basic do_compile does for you (calling make if there's a Makefile available).

Related

How can I install a file to /boot in yocto?

I need to add a file to the /boot directory produced by a yocto build. I've created a recipe that is trying to do this:
SRCREV = "48cabcbc64484ca6c201746e526a11b4b43eb359"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-uEnv.patch file://0002-disable-boot-interrupt.patch file://uEnv.txt"
FILES_${PN} += "/boot/uEnv.txt"
do_install_append() {
install -m 0744 ${WORKDIR}/uEnv.txt ${D}/${base_prefex}/boot
}
This recipe does some patching of u-boot too, but for now I'm just interested in the parts that are trying to add uEnv.txt to the boot directory. I know this recipe is being processed. If I rename the uEnv.txt file, for example, it throws an error. So I know it's trying to install it. But when I examine the rootfs created by yocto, the file is missing.
Does anyone know what I'm doing wrong? Maybe the problem is with ${D}/${base_prefex}/boot and I'm just not putting it in the right place? I've tried putting it in other places, though, like ${D}${sysconfdir}/ without success.
Here are some idea that you can try:
u-boot already have a variable to work with Env files (Check poky/meta/recipes-bsp/u-boot/u-boot.inc)
It checks for UBOOT_ENV variable if it is present and it copies it to /boot:
do_install() {
...
if [ -n "${UBOOT_ENV}" ]
then
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
fi
...
}
do_deploy() {
...
if [ -n "${UBOOT_ENV}" ]
then
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
rm -f ${DEPLOYDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
fi
...
}
I assume that your recipe is a bbappend for uboot because it has a patch.
So you can try the following:
SRCREV = "48cabcbc64484ca6c201746e526a11b4b43eb359"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://0001-uEnv.patch file://0002-disable-boot-interrupt.patch file://uEnv.txt"
UBOOT_ENV = "uEnv"
UBOOT_ENV_SUFFIX = "txt"
More more note to be considered, if your Uboot is trying to fetch the uEnv.txt file from rootfs/boot then it is okay, but if it trying to get it from the boot partition (if you have one) then you should add it to that partition with (In your machine conf or local conf):
BOOT_FILES_append = " uEnv.txt"

Yocto bitbake .bbappend not installing file

I am trying to add a json to /etc on a device.
Have read many SO answers and not found a solution.
The new json is called audio_config.json, it is under files/ in the same directory as the .bbappend. Am using append because this file is needed only on one device model while the main recipe is on many models.
Doing this:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://audio_config.json"
do_install_append() {
install -d ${D}${sysconfdir}
install -m 644 ${B}/audio_config.json ${D}${sysconfdir}
}
Gets an error saying that the json is not in the work directory.
The same thing happens if I use ${WORKDIR} instead of ${B}.
Other recipes in this tree follow this same model, not sure what the problem is.
If I use ${THISDIR} then it says that the json is not located in the base recipe directory - which it's not supposed to be.
From SO posts I have tried
FILES_${PN}-audio_config.json = "${sysconfdir}/audio_config.json"
But that seems to have no effect.
TIA!
In do_unpack() the file is copied to ${WORKDIR}, not ${B} (build dir) and not ${S} (sources dir). This recipe works for me with Yocto Dunfell:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://audio_config.json"
do_install_append() {
install -d ${D}${sysconfdir}
install -m 644 ${WORKDIR}/audio_config.json ${D}${sysconfdir}
}
Note the different source path argument in the second call to install.
I'm guessing that there was a yocto/bitbake bug that affected you.
According to users and documentation, what I had above should have worked. But it didn't.
What did work was this:
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
AUDIO_CONFIG_FILES := "${THISDIR}/files"
do_install_append() {
install -d ${D}${sysconfdir}
install -m 644 ${AUDIO_CONFIG_FILES}/audio_config.json ${D}${sysconfdir}
}
Using a variable for immediate expansion of $THISDIR set the local path correctly and the install occurs.
You were right to add the FILES_${PN} to add the file to the image. But do not add any suffix to it, just append your file to the variable:
FILES_${PN} += "${sysconfdir}/audio_config.json"
Also, you should use the ${WORKDIR} in your install.
install -m 644 ${WORKDIR}/audio_config.json ${D}${sysconfdir}
Also check the work directory of your package to get some logs and see the files actually retrieved for an easier debugging.

Yocto: BUILD_LDFLAGS set to build system libraries, not target

I've got a makefile recipe that builds a shared library (an alsa plugin). If I build the library outside if yocto everything works correctly and alsa will link to the library.
However if I build it with yocto, even though the log is error free, when I try and run alsa, I get an error "Cannot open shared library". The library is installed in location referenced by the error message and it's permissions are correct.
From within the recipe if I print out what BUILD_LDFLAGS is set to I notice the it's pointing to the x86_64-linux (build system) libraries instead of the 'MACHINE' libraries (example: -L//.build-yocto/tmp/sysroots/x86_64-linux/lib"
My questions are:
Is the BUILD_LDFLAGS the source of my problem?
If so how do I remedy it?
If not BUILD_LDFLAGS, any idea what is the problem.
Here is a copy of my recipe bb file:
SUMMARY = "..."
LICENSE = "CLOSED"
#Package release number
PR = "r0"
###################################################################
#The following lines tell yocto where to get the source code from
# This section is for git. Comment out ALL this section if
# you DO NOT want to pull from a git repo (local or remote).
# If pulling from git uncomment and modify paths.
###################################################################
#Uncomment following line to pull from REMOTE git repo
#SRC_URI = "git://gitpath;protocol=ssh;branch=master"
#Uncomment following line and modify path to pull from LOCAL git repo clone
##SRC_URI = "git:///localgitpath;protocol=file;branch=master"
#Change hash to match the commit you want yocto to use
##SRCREV="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
##S = "${WORKDIR}/git/"
# End of git section
###################################################################
#The following lines tell yocto where to use a local file system
# for the source. Uncomment all lines and modify paths
###################################################################
SRC_URI = ""
inherit externalsrc
EXTERNALSRC = "/home/<my_path>"
EXTERNALSRC_BUILD = "/home/<my_path>"
# End of local file system section
##################################################################
#END of where to get source code
##################################################################
#Ignore vendor ldflags checking and use ours
INSANE_SKIP_${PN} = "ldflags"
#Don't strip debug symbols
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
SOLIBS = ".so"
#Tell yocto that the .so files are real and not sym-links.
FILES_SOLIBSDEV = ""
#/usr/lib/alsa-lib
FILES_${PN} += "${libdir}/alsa-lib"
#/usr/<PATH>
FILES_${PN} += "${prefix}/<PATH>"
DEPENDS += "alsa-lib"
EXTRA_OEMAKE += "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}/include' 'BUILDDIR=${S}' 'DESTDIR=${D}'"
TARGET_CFLAGS += "-DPIC -fPIC -Wall -Wextra -O2 -g -I./include -I<path> -I-I<path2> -I<path3> -lasound"
TARGET_LDFLAGS += "-shared -lasound"
do_configure() {
oe_runmake -f Makefile.yocto clean
}
do_compile() {
# unset LDFLAGS TARGET_LDFLAGS BUILD_LDFLAGS
echo " Werkdir ${WORKDIR}"
echo " Compiler ${CC}"
echo " BUILD_LDFLAGS ${BUILD_LDFLAGS}"
echo " LDFLAGS ${LDFLAGS}"
echo " TARGET_LDFLAGS ${TARGET_LDFLAGS}"
oe_runmake -f Makefile.yocto all 'CC=${CC}'
}
do_install() {
install -d ${D}${libdir}
install -d ${D}${libdir}/alsa-lib
install -d ${D}${bindir}
install -d ${D}${prefix}
install -d ${D}${prefix}/<PATH>
install -m 0644 <path_n>lib1.so ${D}${libdir}
install -m 0644 <path_n>lib2.so.so ${D}${libdir}
install -m 0644 <path_n>lib3.so.so ${D}${libdir}
install -m 0644 <path_n>lib4.so.so ${D}${libdir}
install -m 0644 <path_n>lib1pcm_plugin.so ${D}${libdir}/alsa-lib
install -m 0755 <path_n>app1 ${D}${bindir}
install -m 0755 <path_n>app2 ${D}${bindir}
install -m 0755 <path_n>app3 ${D}${bindir}
install -m 0755 <path_n>app4 ${D}${bindir}
install -m 0755 <path_n>app5 ${D}${bindir}
install -m 0755 <path_n>app6 ${D}${bindir}
install -m 0755 <path_n>app7 ${D}${bindir}
install -m 0755 <path_n>app8 ${D}${bindir}
}
Makefile:
# Makefile template for shared library
#Yocto will pass in the CC flag so this is commented out. Otherwise the correct compiler won't be used
#CC = gcc # C compiler
#These are here to allow a build outside of Yocto (testing the build). Yocto's CFLAGS
#and LDFLAGS will override these.
CFLAGS += -fPIC -Wall -Wextra -O2 -g -I<path1> -I<path2> -I<path2> # C flags
LDFLAGS = -shared # linking flags
RM = rm -f # rm command
TARGET_LIB = libasoundplugin.so # target lib
LIB1=lib1
PATH1=<path1>
LIB2=lib2
PATH2=<path2>
INCLUDE_FLAGS = -L$(PATH1) -l$(LIB1I) \
-L$(PATH2) -l$(LIB2) \
-lasound
SRCS = source.c
OBJS = $(SRCS:.c=.o)
.PHONY: all
all: ${TARGET_LIB}
$(TARGET_LIB): $(OBJS)
$(CC) ${LDFLAGS} ${INCLUDE_FLAGS} -o $# $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$#
include $(SRCS:.c=.d)
.PHONY: clean
clean:
-${RM} ${TARGET_LIB} ${OBJS} $(SRCS:.c=.d)
Thanks!
Is the BUILD_LDFLAGS the source of my problem?
No. BUILD_LDFLAGS is used to build native packages, while you build a target package. In your case TARGET_LDFLAGS variable will be used as LDFLAGS source.
Here is a copy of my recipe bb file
Where does it come from? Did you write it from a template?
As I can see there is a recipe for alsa plugins, maybe you can add your plugin to this recipe?
You can also take as example the recipe for a2jmidid, it is close to what you are trying to do as I understand. It does nothing special, except for setting dependencies, getting sources, adding certain ld flags and passing resulting files to the package.
Regarding the Makefile (I suppose it is also your recipe):
First of all there is no need to have a separate Makefile for yocto.
#Yocto will pass in the CC flag so this is commented out. Otherwise the correct compiler won't be used
#CC = gcc # C compiler
You are passing CC from your .bb recipe (even twice: via EXTRA_OEMAKE and in do_compile). There is no need to comment out CC variable, as definitions inside Makefile have lower priority compared to definitions passed as command line arguments.
Why do you need INCLUDE_FLAGS variable? I don't understand what does it do (except for passing to gcc some flags for the third time).
Ultimately, you can go to the workdir, open file temp/log.do_compile and you will see which commands were executed to compile your plugin. Compare it to the settings you use to compile it manually, and you will see what is the difference between successful and unsuccessful builds.

Yocto/OpenEmbedded Recipe Including library paths from host

I have the luxury of dealing with the endless error and warning paradise that is OpenEmbedded. Good news is that I am finally getting somewhere with my recipe, but I am hitting an issue where my recipe is including include and library paths from my host machine. This as I am aware is unsafe for cross-compilation. Would any of you fine people take like quick look at my recipe and tell me if I'm doing anything dumb? I'd really appreciate it, as this is making me feel like I'm a complete moron.
Here's my OpenEmbedded Recipe:
#TODO fixup license type
#Built by Rob.
DESCRIPTION = "librem"
HOMEPAGE = ""
SECTION = "meta-miku"
DEPENDS = "zlib re"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# This tells bitbake where to find the files we're providing on the local filesystem
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
S = "${WORKDIR}/rem-0.5.2"
INSANE_SKIP_${PN}-dev += "dev-elf"
#INSANE_SKIP_${PN} += "installed-vs-shipped"
SRC_URI = "https://github.com/creytiv/rem/archive/v0.5.2.tar.gz"
SRC_URI[md5sum] = "4d63ab174fb7957b6805fd0de6991fd2"
SRC_URI[sha256sum] = "cef1b29631a35926982502f0eecc0950d40d2585241d0598ff18e70e2dfcfcb6"
do_compile() {
oe_runmake ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
}
do_install () {
oe_runmake install ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}" DESTDIR=${D}${libdir}
install -d ${D}${libdir}/
install -m 0644 ${S}/librem.a ${D}${libdir}/librem.a
install -m 0644 ${S}/librem.so ${D}${libdir}/librem.so
install -d ${D}${libdir}/pkgconfig
install -m 0644 ${S}/librem.pc ${D}${libdir}/pkgconfig/librem.pc
}
And here are my warnings:
WARNING: rem-1.0-r0 do_package: QA Issue: rem: Files/directories were installed but not shipped in any package:
/usr/lib64/usr/include
/usr/lib64/usr/include/rem
/usr/lib64/usr/include/rem/rem_auconv.h
/usr/lib64/usr/include/rem/rem_fir.h
/usr/lib64/usr/include/rem/rem_aumix.h
/usr/lib64/usr/include/rem/rem_video.h
/usr/lib64/usr/include/rem/rem_audio.h
/usr/lib64/usr/include/rem/rem_vidconv.h
/usr/lib64/usr/include/rem/rem_dtmf.h
/usr/lib64/usr/include/rem/rem_aubuf.h
/usr/lib64/usr/include/rem/rem_au.h
/usr/lib64/usr/include/rem/rem_dsp.h
/usr/lib64/usr/include/rem/rem_vidmix.h
/usr/lib64/usr/include/rem/rem_vid.h
/usr/lib64/usr/include/rem/rem_goertzel.h
/usr/lib64/usr/include/rem/rem_auresamp.h
/usr/lib64/usr/include/rem/rem_autone.h
/usr/lib64/usr/include/rem/rem_g711.h
/usr/lib64/usr/include/rem/rem_aufile.h
/usr/lib64/usr/include/rem/rem.h
/usr/lib64/usr/lib/librem.a
/usr/lib64/usr/lib/librem.so
/usr/lib64/usr/lib/pkgconfig
/usr/lib64/usr/lib/pkgconfig/librem.pc
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
rem: 24 installed and not shipped files. [installed-vs-shipped]
WARNING: rem-1.0-r0 do_package_qa: QA Issue: rem: The compile log indicates that host include and/or library paths were used.
Please check the log '/media/rob/a72581e8-3ca3-4dc1-b3b8-6db5464de098/qc_openEmbedded/apps_proc/build/tmp-glibc/work/aarch64-linaro-linux/rem/1.0-r0/temp/log.do_compile' for more information. [compile-host-path]
WARNING: rem-1.0-r0 do_package_qa: QA Issue: No GNU_HASH in the elf binary: '/media/rob/a72581e8-3ca3-4dc1-b3b8-6db5464de098/qc_openEmbedded/apps_proc/build/tmp-glibc/work/aarch64-linaro-linux/rem/1.0-r0/packages-split/rem-dev/usr/lib64/librem.so' [ldflags]
NOTE: Tasks Summary: Attempted 420 tasks of which 407 didn't need to be rerun and all succeeded.
NOTE: Writing buildhistory
Summary: There were 4 WARNING messages shown.
It is exactly what the warning is telling you in your bitbake output warning. The files are processed and installed however there is no reference to them in the output hence why they are not shipped.
Please set FILES such that these items are packaged. Alternatively if
they are unneeded, avoid installing them or delete them within
do_install. rem: 24 installed and not shipped files.
[installed-vs-shipped]
Include the files in your Yocto recipe:
#TODO fixup license type
#Built by Rob.
DESCRIPTION = "librem"
HOMEPAGE = ""
SECTION = "meta-miku"
DEPENDS = "zlib re"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
# This tells bitbake where to find the files we're providing on the local filesystem
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
S = "${WORKDIR}/rem-0.5.2"
INSANE_SKIP_${PN}-dev += "dev-elf"
#INSANE_SKIP_${PN} += "installed-vs-shipped"
SRC_URI = "https://github.com/creytiv/rem/archive/v0.5.2.tar.gz"
SRC_URI[md5sum] = "4d63ab174fb7957b6805fd0de6991fd2"
SRC_URI[sha256sum] = "cef1b29631a35926982502f0eecc0950d40d2585241d0598ff18e70e2dfcfcb6"
do_compile() {
oe_runmake ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
}
do_install () {
oe_runmake install ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}" DESTDIR=${D}${libdir}
install -d ${D}${libdir}/
install -m 0644 ${S}/librem.a ${D}${libdir}/librem.a
install -m 0644 ${S}/librem.so ${D}${libdir}/librem.so
install -d ${D}${libdir}/pkgconfig
install -m 0644 ${S}/librem.pc ${D}${libdir}/pkgconfig/librem.pc
}
FILES_${PN} += "\
/usr/lib64/usr/include \
/usr/lib64/usr/include/rem \
/usr/lib64/usr/include/rem/rem_auconv.h \
/usr/lib64/usr/include/rem/rem_fir.h \
/usr/lib64/usr/include/rem/rem_aumix.h \
/usr/lib64/usr/include/rem/rem_video.h \
/usr/lib64/usr/include/rem/rem_audio.h \
/usr/lib64/usr/include/rem/rem_vidconv.h \
/usr/lib64/usr/include/rem/rem_dtmf.h \
/usr/lib64/usr/include/rem/rem_aubuf.h \
/usr/lib64/usr/include/rem/rem_au.h \
/usr/lib64/usr/include/rem/rem_dsp.h \
/usr/lib64/usr/include/rem/rem_vidmix.h \
/usr/lib64/usr/include/rem/rem_vid.h \
/usr/lib64/usr/include/rem/rem_goertzel.h \
/usr/lib64/usr/include/rem/rem_auresamp.h \
/usr/lib64/usr/include/rem/rem_autone.h \
/usr/lib64/usr/include/rem/rem_g711.h \
/usr/lib64/usr/include/rem/rem_aufile.h \
/usr/lib64/usr/include/rem/rem.h \
/usr/lib64/usr/lib/librem.a \
/usr/lib64/usr/lib/librem.so \
/usr/lib64/usr/lib/pkgconfig \
/usr/lib64/usr/lib/pkgconfig/librem.pc \
"
or alternatively the easier way would just be to use a wildcard which catches everything
FILES_${PN} += "/usr/lib64/usr/*"

Bitbake does not install my files in my rootfs

My aim is to create Bitbake recipe, that will install config file in /etc directory, and script, that will apply this config into /ect/init.d directory (and invoke update-rc-d).
I already saw another similar question (Bitbake not installing my file in the rootfs image). I did almost exactly what this guy did, but unfortunately it didn't work.
The problem is that Bitbake does not complain on anything, but just not adds these files to rootfs.
Here is my current recipe. I also put my script and config files to two directories: files, and alsa-config, which resides inside recipe directory.
SUMMARY = "Alsa Config"
DESCRIPTION = "Adds alsa configuration file, and startup script that applies it."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI += " \
file://my-alsa-config \
file://asound.state \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
INITSCRIPT_NAME = "my-alsa-config"
INITSCRIPT_PARAMS = "defaults 99 01"
inherit autotools update-rc.d
do_install() {
install -m 0644 ${WORKDIR}/asound.state ${D}${sysconfdir}
}
FILES_${PN} += "${sysconfdir}/asound.state"
In my local.conf I added line:
CORE_IMAGE_EXTRA_INSTALL += "alsa-config "
Please, can anybody help?
Fortunately, I was able to solve the problem. Here is the solution:
SUMMARY = "Alsa Config"
DESCRIPTION = "Adds alsa configuration file, and startup script that applies it."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
SRC_URI += " \
file://my-alsa-config \
file://asound.state \
"
PACKAGE_ARCH = "${MACHINE_ARCH}"
S = "${WORKDIR}"
INITSCRIPT_NAME = "my-alsa-config"
INITSCRIPT_PARAMS = "defaults 99 01"
inherit autotools update-rc.d
do_install() {
install -d ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/my-alsa-config ${D}${sysconfdir}/init.d/
install -m 0644 ${WORKDIR}/asound.state ${D}${sysconfdir}/
}
FILES_${PN} += "${sysconfdir}/asound.state \
${sysconfdir}/my-alsa-config"
A little bit of comments:
PACKAGE_ARCH has to be set properly. In my case, when I didn't have it, execute permissions for script file were not set for some reason.
do_install() has to create every directory, that is needed. Even if I know, that in my rootfs there will be /etc directory, I have to create it. And I'm not sure if it is necessary, but it's better to have slash at the end of install directory, just in case.
Init scripts that are to be installed to launch at startup has to be installed too;)
Scripts must have proper permissions set.