Search code examples
embedded-linuxyoctobitbakeswupdate

Yocto do_install action not performed


here is my bbappend file.

LICENSE = "MIT"
IMAGE_LINGUAS = " "

# User preferences 
inherit extrausers

# Change root password (note the capital -P)
EXTRA_USERS_PARAMS = "\
  usermod -P toor  root; \
  useradd -P michael -G sudo  michael; \
  useradd -P nfi -G sudo  nfi; \
  "

# uncomment the line %sudo ALL=(ALL) ALL in /etc/sudoers
modify_sudoers() {
   sed 's/# %sudo/%sudo/' < ${IMAGE_ROOTFS}${sysconfdir}/sudoers > ${IMAGE_ROOTFS}${sysconfdir}/sudoers.tmp
   mv ${IMAGE_ROOTFS}${sysconfdir}/sudoers.tmp ${IMAGE_ROOTFS}${sysconfdir}/ROOTFS
}
sudoers_POSTPROCESS_COMMAND_append = " modify_sudoers;"

IMAGE_INSTALL = "base-files \
        base-passwd \
        busybox \
        mtd-utils \
        mtd-utils-ubifs \
        libconfig \
        swupdate \
        swupdate-www \
                ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts systemd', d)} \
        util-linux-sfdisk \
        mmc-utils \
        e2fsprogs-resize2fs \
        lua \
        debugconfigs \
         "

IMAGE_FSTYPES = "ext4.gz.u-boot ext4 cpio.gz.u-boot"

PACKAGE_EXCLUDE += " jailhouse kernel-module-jailhouse libncursesw5 libpanelw5 libpython3 python3*  perl* apt dpkg "

SRC_URI += "file://set-ttymxc0-permissions.sh"

do_install() {
    install -d ${D}${sysconfdir}/init.d
    install -m 0755 ${WORKDIR}/set-ttymxc0-permissions.sh ${D}${sysconfdir}/init.d/
}

addtask install after do_build

I am using SWUpdate. I can build their kernel and run it on my device. However I cannot login as root or any user I have created. It seems this could be related to user permissions in the getty serial terminal ttymxc0. So I am attempting to add a script to init.d. The script contains

#!/bin/sh

# Set permissions on ttymxc0
chmod 660 /dev/ttymxc0
chown root:tty /dev/ttymxc0

The bitbake file I am appending to is swupdate-image.bb. This file does not do much. It does not have a do_install section. So I am attempting to add one. However it is never run. Can anyone speculate as to why?


Solution

  • You actually noticed that the file swupdate-image.bb require an other file swupdate-image.inc.

    You should pay attention to this line:

    ${@bb.utils.contains('SWUPDATE_INIT', 'tiny', 'virtual/initscripts-swupdate', 'initscripts systemd', d)} \
    

    ${@bb.utils.contains() is a (Python) function. Basically it will check the SWUPDATE_INIT variable, if there is a match with tiny then it will return virtual/initscripts-swupdate to IMAGE_INSTALL. Else, it will return initscripts systemd to IMAGE_INSTALL.

    So you should only set your variable SWUPDATE_INIT= "tiny" in a .bbappend file.

    Adding this should install rcS.swupdate in your final image according to initscripts-swupdate recipe:

    https://github.com/sbabic/meta-swupdate/blob/master/recipes-core/initscripts-swupdate/initscripts-swupdate-usb.bb

    N.B: I have noticed that you added resize2fs. If you want to add this binary make sure that the right kernel flag is set ! You will more likely need to create a .bbappend file and add the following :

    EXTRA_OECONF_append_class-target = " --enable-resizer"