[yocto] Using devtool for adding a systemd service

Fabien Lahoudere fabien.lahoudere at collabora.co.uk
Fri Nov 10 07:19:01 PST 2017


Hi

I don't think that devtool will help you in this case.
IIUC, what you need is to check if your file is populated in the package?

You can verify this by checking package content after the build.
For example :
	dpkg-deb -c <package-path>
will show you all files installed by the package.

I think rpm and opkg provide similar mechanism to extract packages contents.

You can also mount your rootfs partition using loop devices.

On Fri, 2017-11-10 at 11:07 +0100, Alan Martinovic wrote:
> Hi,
> I need to add a systemd service that needs no additional sources
> compiled, but just needs an available command executed at boot. 
> 
> I've created a basis for the recipe in my layer:
> 
> nrf52-usb-systemd/
> |-- files
> |   `-- btattach-nrf-acm.service
> `-- nrf52-usb-systemd.bb
> 
> 
> together with a recipe template (nrf52-usb-systemd.bb)
> for which I don't know if works yet.
> 
>   SUMMARY = "Writes patterns to the fb device"
>   LICENSE = "MIT"
>   LIC_FILES_CHKSUM = "file://COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
> 
>   inherit systemd
> 
>   REQUIRED_DISTRO_FEATURES= "systemd"
> 
>   SRC_URI = "file://btattach-nrf-acm.service"
> 
>   do_install () {
> 
>       install -m 0644 ${WORKDIR}/btattach-nrf-acm.service ${D}${sysconfdir}/systemd/system
>    }
> 
>   NATIVE_SYSTEMD_SUPPORT = "1"
>   SYSTEMD_PACKAGES = "${PN}"
>   SYSTEMD_SERVICE_${PN} = "fb-draw.service"
> 
> 
> I'm not sure I got the install command right and
> if the service file is making it way to the proper location.
> 
> Instead of building the whole image, flashing and checking 
> it out, I would like to test how devtool could help here.
> 
> I execute:
> 
> devtool build nrf52-usb-systemd
> 
> this results in a creation of a workspace with the sources files.
> What I am not seeing is a creation of a device sysroot which would
> show me that the do_install was correctly written.
> 
> Given that the device sysroot directory on the host would be called
> "sysroot" was hoping to be able do confirm that the following took 
> place
> 
> ${D}${sysconfdir}/systemd/system -> .sysroot/etc/ssytemd/system
> 
> and confirming there is a 
> 
> .sysroot/etc/ssytemd/system/btattach-nrf-acm.service
> 
> 
> Is this possible with devtool, or am I misinterpreting 
> what it's purpose is?
> 
-- 
Fabien



More information about the yocto mailing list