Release

Version added 2018-03-07 20:32:00| Modified 12-Apr-2018

Now you are ready to package the native service in the webOS image.

 

Add Service to Build Recipe

Add the service to the package recipe file.

  • Update the file : packagegroup-webos-extended.bb

  • Directory : build-webos/meta-webosose/meta-webos/recipes-core/packagegroups

  • Updates to be made: Add the service name to RDEPENDS _ $ {PN} =

...
RDEPENDS_${PN} = " \
    activitymanager \
    audiod \
    ...
    com.example.service.native \
    ${VIRTUAL-RUNTIME_appinstalld} \
    ...

For more details, please see Yocto project reference manual.

 

Modify Systemd Execution List on webos-initscripts

Modify the webos-initscripts component which is responsible for systemd configuration in webOS. Through this process, you can learn how to modify a built-in component in webOS.

  1. Download the webos-initscripts component source from GitHub (https://github.com/webosose/webos-initscripts.git) to your local system.

    In this document, we download the webos-initscripts component to ~/project/webOS/webos-initscripts.

    ~/project/webOS$ git clone https://github.com/webosose/webos-initscripts.git
    
  2. Specify the order of execution of the newly created native service.

    In this example, adding the service to the last line ensures that it is executed last.

    • Update the file : webos-bd.target

    • Directory : ~/project/webOS/webos-initscripts/files/systemd/targets

    • Updates : Add the service name (com.example.service.native.service) to the last line.

      [Unit]
      Description="%n"
      Wants=nyx-utils.service \
      	      second-screen-gateway.service \
      	      com.example.service.native.service
      
  3. Specify the path of the webos-initscripts local source directory in the build.

    • Update the file : webos-local.conf

    • Directory : build-webos

      INHERIT += "externalsrc"
      EXTERNALSRC_pn-com.example.service.native = "/home/username/project/webOS/com.example.service.native/"
      EXTERNALSRC_BUILD_pn-com.example.service.native = "/home/username/project/webOS/com.example.service.native/build/"
      PR_append_pn-com.example.service.native =".local0"
      EXTERNALSRC_pn-webos-initscripts = "/home/username/project/webOS/webos-initscripts/"
      EXTERNALSRC_BUILD_pn-webos-initscripts = "/home/username/project/webOS/webos-initscripts/build"
      PR_append_pn-webos-initscripts =".local0"
  4. Build webos-initscripts on build-webos.

    We can check webos-initscripts on local directory if built successfully.

    build-webos$ source oe-init-build-env
    build-webos$ bitbake webos-initscripts

 

Build the webOS and Flash it on Target

  1. Build the webos-image.

    build-webos$ source oe-init-build-env
    build-webos$ bitbake webos-image
    
  2. Flash the generated webos-image to SD card.

    build-webos/BUILD/deploy/images/raspberrypi3$ sudo dd bs=4M if=webos-image-raspberrypi3-master-yyyymmddhhmmss.rpi-sdimg of=/dev/sdc
    
  3. After booting, connect to target with SSH.

    If you look at the service list with ls-monitor, you can see com.example.service.native is executed as static type.

    $ ssh root@192.168.0.12
    root@raspberrypi3:~# ls-monitor -l | grep example
    542           com.example.service.native        /usr/sbin/com.example.service.native    static                  4dTPKKQI
Except as noted, this content is licensed under Creative Commons Attribution 4.0 and sample code is licensed under Apache License 2.0.