0
votes

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?

1
You should install the init script as well (in do_install()).Jussi Kukkonen
Thanks for the hint! It made me do a few things, that solved the problem:)Staszek

1 Answers

0
votes

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:

  1. 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.
  2. 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.
  3. Init scripts that are to be installed to launch at startup has to be installed too;)
  4. Scripts must have proper permissions set.