1
votes

I have a recipe that should be copying a runlevel script into /etc/init.d and creating a symbolic link to it from /etc/rc5 However the do_install function does not appear to be being called.

Below the structure of my layer. The problem bb file is init-wifi.bb at the bottom of the tree. The other recipes with bbappends work fine.

.
├── conf
│   └── layer.conf
├── recipes-connectivity
│   ├── alsa
│   │   ├── alsa-lib
│   │   └── alsa-lib_1.0.29.bbappend
│   └── wpa-supplicant
│       ├── wpa-supplicant
│       │   ├── wpa_supplicant.conf
│       │   └── wpa_supplicant.conf-sane
│       └── wpa-supplicant_2.4.bbappend
├── recipes-core
│   ├── base-files
│   │   ├── base-files
│   │   │   └── profile
│   │   └── base-files_%.bbappend
│   └── init-ifupdown
│       ├── init-ifupdown-1.0
│       │   └── interfaces
│       └── init-ifupdown_1.0.bbappend
└── recipes-my
    └── init-wifi
        ├── files
        │   └── wifi_start.sh
        └── init-wifi.bb

Below is the init-wifi.bb recipe:

SUMMARY = "x"
LICENSE = "CLOSED"
#PR = "r0"
SRC_URI += "file://wifi_start.sh"

#INITSCRIPT_NAME = "wifi_start.sh"
#INITSCRIPT_PARAMS = "defaults 90"

do_install() {
    install -d ${D}${sysconfdir}/init.d
    install -d ${D}${sysconfdir}/rcS.d
    install -d ${D}${sysconfdir}/rc1.d
    install -d ${D}${sysconfdir}/rc2.d
    install -d ${D}${sysconfdir}/rc3.d
    install -d ${D}${sysconfdir}/rc4.d
    install -d ${D}${sysconfdir}/rc5.d


    install -m 0755 ${WORKDIR}/wifi_start.sh  ${D}${sysconfdir}/init.d/

    ln -sf ${D}${syscondir}/init.d/wifi_start.sh {D}${sysconfdir}/rc5.d/S90wifi_start.sh

}

If I introduce errors to the bb file outside the do_install function I get errors wen invoking bitbake, so I know my recipe file is being found and parsed. However If i introduce errors inside the do_install function it is not being called. Additionally I don't see the script being installed into the work or image directories (after removing intentional debugging errors).

If I force bitbake to run the recipe with 'bitbake -c install init-wifi', it will install the files "work/image" directories:

tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/initwifi/0.0-r0/image/etc/init.d/wifi_start.sh

tmp/work/cortexa7hf-vfp-neon-poky-linux-gnueabi/initwifi/0.0-r0/wifi_start.sh

However when my image is built and installed on my module, the script and links are not there.

Been struggling with this for a couple of days and searches haven't produced much help either.

Any ideas?

Thanks!

2

2 Answers

2
votes

You didn't add your new recipe to your image recipe.

IMAGE_INSTALL_append = " init-wifi " 

EDIT

I used to do the same and it works well. Differences I can see is:

SRC_URI += "file://wifi_start.sh"

should be

SRC_URI = "file://wifi_start.sh"

Beacuse you are creating SRC_URI, not adding to an existing one.

I used to add md5 checksum for each file I use.

You should add

FILES_${PN} += "${sysconfdir}/profile.d"
FILES_${PN} += "${sysconfdir}/rcS.d"
FILES_${PN} += "${sysconfdir}/rc1.d"
FILES_${PN} += "${sysconfdir}/rc2.d"
FILES_${PN} += "${sysconfdir}/rc3.d"
FILES_${PN} += "${sysconfdir}/rc4.d"
FILES_${PN} += "${sysconfdir}/rc5.d"

From the Yocto man

FILES

The list of directories or files that are placed in packages.

To use the FILES variable, provide a package name override that identifies the resulting package. Then, provide a space-separated list of files or paths that identify the files you want included as part of the resulting package. Here is an example:

FILES_${PN} += "${bindir}/mydir1/ ${bindir}/mydir2/myfile"
2
votes

LPS,

Thanks for the help and suggestions. With them I was able to get it to install the file and create the link.

I made the suggested changes to my init-wifi.bb file:

SUMMARY = "x"
LICENSE = "CLOSED"
#PR = "r0"
SRC_URI = "file://wifi_start.sh"


FILES_${PN} += "${sysconfdir}/init.d"
FILES_${PN} += "${sysconfdir}/rcS.d"
FILES_${PN} += "${sysconfdir}/rc1.d"
FILES_${PN} += "${sysconfdir}/rc2.d"
FILES_${PN} += "${sysconfdir}/rc3.d"
FILES_${PN} += "${sysconfdir}/rc4.d"
FILES_${PN} += "${sysconfdir}/rc5.d"


do_install() {

install -d ${D}${sysconfdir}/init.d
install -d ${D}${sysconfdir}/rcS.d
install -d ${D}${sysconfdir}/rc1.d
install -d ${D}${sysconfdir}/rc2.d
install -d ${D}${sysconfdir}/rc3.d
install -d ${D}${sysconfdir}/rc4.d
install -d ${D}${sysconfdir}/rc5.d   

install -m 0755 ${WORKDIR}/wifi_start.sh  ${D}${sysconfdir}/init.d/   

ln -sf ${D}${syscondir}/init.d/wifi_start.sh      ${D}${sysconfdir}/rc5.d/S90wifi_start.sh

}

Additionally I had to add the suggested line below to meta-mylayer/conf/layer.conf

IMAGE_INSTALL_append = " init-wifi "

I am getting a warning:

WARNING: QA Issue: Symlink /etc/rc5.d/S90wifi_start.sh in init-wifi points to TMPDIR [symlink-to-sysroot]

So I think I'll revisit how I'm doing the links, but I am 'off top dead-center' and moving forward again.

Thanks!

-Steve