Bitbake Fails Customizing LinuxPTP

I am running a custom kirkstone build on an Apalis iMX6Q IT module

root@acu3:~# uname -r
6.0.5-rt14-6.1.0-devel+git.040e3123e9d9

So I have successfully added linuxptp to the build. I noticed that the package does not install any type of service file to be able to run this through systemd, so I created them and added them to my custom layer in the same manner that I did for gpsd, chrony, etc…

However, now the build fails saying that directories do not exist even though I know they do as the custom .bbappends for other packages install things there.

NOTE: Executing Tasks
ERROR: linuxptp-3.1.1-r0 do_install: ExecutionError('/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/temp/run.do_install.262184', 1, None, None)
ERROR: Logfile of failure stored in: /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/temp/log.do_install.262184
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-core/glibc/glibc_2.35.bb:do_populate_sysroot', '/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-cross_11.3.bb:do_populate_sysroot', '/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/gcc/gcc-runtime_11.3.bb:do_populate_sysroot', '/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/quilt/quilt-native_0.67.bb:do_populate_sysroot', 'virtual:native:/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/patch/patch_2.7.6.bb:do_populate_sysroot', 'virtual:native:/home/mmorgan/oe-core/build/../layers/openembedded-core/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['glibc', 'gcc-cross-arm', 'gcc-runtime', 'quilt-native', 'patch-native', 'pseudo-native', 'attr-native', 'libtool-native', 'linux-libc-headers', 'mpfr-native', 'gnu-config-native', 'xz-native', 'binutils-cross-arm', 'flex-native', 'libmpc-native', 'texinfo-dummy-native', 'gmp-native', 'zstd-native', 'zlib-native', 'libgcc', 'gettext-minimal-native', 'm4-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing shell function do_install
| NOTE: make -j 12 ARCH=arm EXTRA_CFLAGS= -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0=/usr/src/debug/linuxptp/3.1.1-r0                      -fdebug-prefix-map=/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0=/usr/src/debug/linuxptp/3.1.1-r0                      -fdebug-prefix-map=/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/recipe-sysroot=                      -fdebug-prefix-map=/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/recipe-sysroot-native=  mandir=/usr/share/man install DESTDIR=/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image prefix=/usr
| install -p -m 755 -d /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image/usr/sbin /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image/usr/share/man/man8
| install ptp4l hwstamp_ctl nsm phc2sys phc_ctl pmc timemaster ts2phc /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image/usr/sbin
| for x in ptp4l.8 hwstamp_ctl.8 nsm.8 phc2sys.8 phc_ctl.8 pmc.8 timemaster.8 ts2phc.8; do \
| 	[ -f $x ] && install -p -m 644 -t /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image/usr/share/man/man8 $x ; \
| done
| install: target '/home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/image/etc/' is not a directory: No such file or directory
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/mmorgan/oe-core/build/../layers/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb:do_install) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5778 tasks of which 5777 didn't need to be rerun and 1 failed.

Folder Structure

oe-core
>layers
>  meta-custom
>    recipes-connectivity
>      linuxptp
>        linuxptp
>          ptp4l.conf
>          ptp4l.service
>          phc2sys.service
>        linuxptp_%.bbappend

linuxptp_%.bbappend

SUMMARY = "LinuxPTP Configuration Files"

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

SRC_URI += " \
	file://ptp4l.conf \
	file://ptp4l.service \
	file://phc2sys.service \
"

do_install:append() {
        install -m 0755 ${WORKDIR}/ptp4l.conf ${D}/etc/
    	install -m 0644 ${WORKDIR}/ptp4l.service ${D}/lib/systemd/system/
    	install -m 0644 ${WORKDIR}/phc2sys.service ${D}/lib/systemd/system/
}

Again, this is same way that I have added files in other recipes, any thoughts as to why this particular package is giving me issues?

Hi @morgan1361,

Probably the folder that you’re trying to install wasn’t created by Yocto yet. You can check that by running the following command.

$ bitbake linuxptp -c devshell

I believe you won’t find the etc and systemd folders.

Instead, try that:

SUMMARY = "LinuxPTP Configuration Files"

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

SRC_URI += " \
    file://ptp4l.conf \
    file://ptp4l.service \
    file://phc2sys.service \
"

inherit systemd

do_install:append() {
    install -d ${D}/etc/
    install -d ${D}${systemd_system_unitdir}
    
    install -m 0755 ${WORKDIR}/ptp4l.conf ${D}/etc/
    install -m 0644 ${WORKDIR}/ptp4l.service ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/phc2sys.service ${D}${systemd_system_unitdir}
}

This should create the correct folders and move your files to these folders.

Can you try and check if that works?

Best Regards,
Hiago.

@hfranco.tx

Trying what you suggested resulted in the following

Initialising tasks: 100% |######################################################################################################| Time: 0:00:04
Sstate summary: Wanted 280 Local 271 Mirrors 0 Missed 9 Current 2121 (96% match, 99% complete)
NOTE: Executing Tasks
ERROR: linuxptp-3.1.1-r0 do_package: QA Issue: linuxptp: Files/directories were installed but not shipped in any package:
  /lib
  /lib/systemd
  /lib/systemd/system
  /lib/systemd/system/phc2sys.service
  /lib/systemd/system/ptp4l.service
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
linuxptp: 5 installed and not shipped files. [installed-vs-shipped]
ERROR: linuxptp-3.1.1-r0 do_package: Fatal QA errors were found, failing task.
ERROR: Logfile of failure stored in: /home/mmorgan/oe-core/build/tmp/work/armv7at2hf-neon-tdx-linux-gnueabi/linuxptp/3.1.1-r0/temp/log.do_package.4313
ERROR: Task (/home/mmorgan/oe-core/build/../layers/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb:do_package) failed with exit code '1'
NOTE: Tasks Summary: Attempted 5780 tasks of which 5774 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 4 seconds

Summary: 1 task failed:
  /home/mmorgan/oe-core/build/../layers/meta-openembedded/meta-oe/recipes-connectivity/linuxptp/linuxptp_3.1.1.bb:do_package
Summary: There was 1 WARNING message.
Summary: There were 2 ERROR messages, returning a non-zero exit code.

Hi @morgan1361,

I can see the following error:

You also need to see the FILES variable to make sure all files are packed together.

Please, try the following code:

SUMMARY = "LinuxPTP Configuration Files"

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

SRC_URI += " \
    file://ptp4l.conf \
    file://ptp4l.service \
    file://phc2sys.service \
"

inherit systemd

FILES:${PN} += "${base_libdir}/*"
FILES:${PN}-dev = "${base_libdir}/* ${includedir}"

do_install:append() {
    install -d ${D}/etc/
    install -d ${D}${systemd_system_unitdir}
    
    install -m 0755 ${WORKDIR}/ptp4l.conf ${D}/etc/
    install -m 0644 ${WORKDIR}/ptp4l.service ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/phc2sys.service ${D}${systemd_system_unitdir}
}

This should fix your problem. Let me know if this still continues so we can try a different solution.

Best Regards,
Hiago.