You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

On this Page: 


Scope

Dobby is a container management tool, to make it easy for other applications to start/stop/monitor containers. It can be thought of as a "Docker for the embedded world". 

This page demonstrates building a sample Java application in RDK framework and running in a container using Dobby in a RDK-B reference board ( Rpi ).

Major Dobby Components in RDK-B

  • DobbyDaemon

    • This is the main Dobby process, which is launched at bootup by systemd. When started, DobbyDaemon registers itself on dbus. It then idles and waits for commands over dbus to start, stop or inspect containers.

  • DobbyTool

    • CLI to interact with Dobby for developers, and issue commands such as start, stop or info

Build Dobby in RDK-B

  1. Getting the RDK-B dunfel Code 

    mkdir < workspace_dir>
    cd  <workspace_dir>
    repo init -u https://code.rdkcentral.com/r/manifests -b dunfell -m rdkb-extsrc.xml
    repo sync -j4 --no-clone-bundle



  2. Add dobby,readline, and crun packages to the package recipe file to consider it during the build

Path: ./meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend


  1. Add readline dependencies in the dobby recipe file

    Path: ./meta-rdk/recipes-containers/dobby/dobby-thunderplugin.bb


  2. Add the below kernel options to support containerization

    Path: ./meta-raspberrypi/recipes-kernel/linux/linux-raspberrypi.inc



Build Java Application in RDK-B

  1. Download the meta-java layer for Java support in RDKB image for Raspberry Pi

    cd  <workspace_dir>
    git clone git://git.yoctoproject.org/meta-java
    cd meta-java
    git checkout remotes/origin/dunfell
  2. Add a new java application 

           1. Create a new recipe under meta-rdk-ext/

           2. New recipe should have the java application, corresponding .bb and license files

                Example: sample application (HelloWorld.java) under meta-rdk-ext/recipes-java/

           3. Add the new recipe to the package group to consider it during the build

               Example : java-helloworld added in meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend

               

           

     3. Creating Runtime spec to Containerize the java application

           1.  Create a configuration file that is config.json for the java application and place it under meta-rdk-ext/recipes-java/<application_folder>

                 

         2.  Install the config.json through the Application recipe file 

               

             

Running Dobby Container in Rpi

This provides details on running containerized java applications using dobby in RDK-B Platform (Raspberry Pi)

Steps:

  1. Build the source code

    $ source meta-cmf-raspberrypi/setup-environment (Select option raspberrypi-rdk-broadband.conf)
    $ bitbake rdk-generic-broadband-image
  2. Flash the image to RPI and copy the container folder to /tmp

    cp -r /etc/java_container/ /tmp/
    chmod +x /tmp/java_container/
    chmod -R 744 /tmp/java_container/

  3. Start the container using DobbyTool command

    /usr/bin/DobbyTool start java_container /tmp/java_container


Validation:

  •  Once the container starts, it will launch the java application. this can be verified through a log    

             Log path: /tmp/container.log 

             

    

  •   Container lists can be verified by the command : DobbyTool list

                    


  • Container access :  Run the below command to enter the container console

    crun --root /run/rdk/crun exec --tty java_container /bin/bash

    The HelloWorld java application can be also be run manually using java command .

Sample Code

Attaching the config,json and Helloworld Java Application recipe file.

recipes-java.zip

  • No labels