Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page:

Table of Contents
maxLevel5

Scope

Objective is to create containerized application based on OCI standard and managing the application using Dobby tool in Rpi for RDK-B build.

**NOTE : Current support is available for Rpi3, For Rpi4 work is in progress

Things to do:

  • Include DAC SDK in Rpi RDK-B dunfell build

  • Enable Dobby support in Rpi RDK-B build
  • Create an OCI image for a sample application using meta-dac-sdk
  • Create platform specific lib json to generate container configuration for respective platform
  • Install Bundlegen in a VM or any host machine
  • Generate OCI bundle from the OCI image using Bundlegen tool
  • Start/Stop OCI bundle using Dobby


Include DAC SDK in Rpi RDK-B dunfell build

Refer to build app using meta-dac-sdk toolchain - Quickstart: Building, Installing and Running DAC apps


Enable Dobby support in Rpi RDK-B build

Add Dobby package in RDK-B build -  meta-cmf-raspberrypi/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend 

Code Block
+++ b/recipes-core/packagegroups/packagegroup-rdk-ccsp-broadband.bbappend
@@ -6,6 +6,9 @@ RDEPENDS_packagegroup-rdk-ccsp-broadband_append = "\
     libseshat \
     notify-comp \
     start-parodus \
+    dobby \
+    crun \
     \
 "


Create an OCI image for a sample application using meta-dac-sdk

View file
namehelloworld-test.tgz
height250

Add below files inside meta-dac-sdk for building sample "helloworld-test" application

      classes/dac-image-helloworld.bbclass
      recipes-example/example/helloworld-test.bb
      recipes-example/example/helloworld-test/
      recipes-example/example/helloworld-test/main.cpp
      recipes-example/example/helloworld-test/LICENSE
      recipes-example/images/dac-image-helloworld-test.bb
      recipes-example/images/metadatas/helloworld-test-appmetadata.json


To create OCI Image for the sample application, run the respective recipe

Code Block
MACHINE=raspberrypi-rdk-broadband source meta-cmf-raspberrypi/setup-environment
bitbake dac-image-helloworld-test

Image path :  build-raspberrypi-rdk-broadband/tmp/deploy/images/raspberrypi-rdk-broadband

Image name : dac-image-*.oci-image.tar

Example -  build/tmp/deploy/images/raspberrypi3/dac-image-helloworld-test-raspberrypi3-20230325195708.rootfs-oci-latest-arm-linux.oci-image.tar


Create platform specific lib json to generate container configuration for respective platform


Refer - https://github.com/rdkcentral/BundleGen/blob/master/docs/TemplateLibs.md

**Note : Already available for Rpi3, support for Rpi4 is in progress



Install Bundlegen in a VM or any host machine


Reference : Containerization feature integration in Raspberry-Pi RDK Video stack  [ Currently the page is restricted to RDKM ]

Requirement : Ubuntu 22

Reference for Bundlegen : https://github.com/rdkcentral/BundleGen

# Install dependencies

$ sudo apt update

$ sudo apt upgrade

$ sudo apt install -y make git go-md2man

# Install Go 1.13

$ wget https://dl.google.com/go/go1.13.12.linux-amd64.tar.gz

$ tar -xvf go1.13.12.linux-amd64.tar.gz

$ sudo mv go /usr/local

$ mkdir -p $HOME/go

$ echo 'export GOPATH=$HOME/go' >> $HOME/.bashrc

$ echo 'export GOROOT=/usr/local/go' >> $HOME/.bashrc

$ echo 'export PATH=$GOPATH/bin:$GOROOT/bin:$PATH' >> $HOME/.bashrc

$ source $HOME/.bashrc

# Build/install umoci

$ go get -d github.com/opencontainers/umoci

$ cd $GOPATH/src/github.com/opencontainers/umoci/

$ make

$ sudo make install

# Install skopeo

$ . /etc/os-release

$ sudo sh -c "echo 'deb

$ sudo apt update && sudo apt install skopeo


Install Bundlegen

git clone https://github.com/rdkcentral/BundleGen.git

cd BundleGen

$ python3 setup.py build

$ python3 setup.py install


Generate OCI bundle from the OCI image using Bundlegen tool

  • Copy the oci image (dac-image-*.oci-image.tar) to local VM where Bundlegen is installed.
  • Run ./test/build_and_test_on_rpi.sh <VM_IP>  dac-image-*.oci-image.tar
  • Above step will generate an oci bundle image ( .gz),  example : rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image.tar.gz  


Start/Stop OCI bundle using Dobby

To run the OCI bundle using dobby, copy the above generated bundle to Rpi board

Code Block
cd /
mkdir dac
copy bundle image to /dac
tar -xvzf rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image.tar.gz
chmod -R 744 rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image
DobbyTool start helloworld-test rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image/
DobbyTool list
Code Block
root@RaspberryPi-Gateway:/# cd dac/
root@RaspberryPi-Gateway:/dac# ls
rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image
root@RaspberryPi-Gateway:/dac# chmod -R 777 rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image/
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac# DobbyTool -v start helloworld-test rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image/
0000000260.953013 NFO: < M:Main.cpp F:main L:1264 > starting dbus service
0000000260.953307 NFO: < M:Main.cpp F:main L:1265 >   bus address 'unix:path=/var/run/dbus/system_bus_socket'
0000000260.953533 NFO: < M:Main.cpp F:main L:1266 >   service name 'org.rdk.dobby.test.pid14388'
0000000260.958383 NFO: < M:SDBusIpcService.cpp F:eventLoopThread L:1287 > started sd-bus event loop thread
0000000260.958559 NFO: < M:DobbyProxy.cpp F:containerStateChangeThread L:1165 > entered container state change thread
0000000260.959260 NFO: < M:SDBusIpcService.cpp F:eventLoopThread L:1318 > starting sd-bus event loop
started 'helloworld-test' container, descriptor is 734
0000000261.416063 NFO: < M:DobbyProxy.cpp F:containerStateChangeThread L:1224 > exiting container state change thread
0000000261.417027 NFO: < M:SDBusIpcService.cpp F:eventLoopThread L:1323 > stopping sd-bus event loop
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac# DobbyTool list
descriptor | id                               | state
------------|----------------------------------|-------------
        734 | helloworld-test                  | running
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac# cat rpi3_reference-dac-image-helloworld-test-raspberrypi-rdk-broadband-20230325195708.rootfs-oci-latest-arm-linux.oci-image/rootfs/my_file.txt
********************Hello World ********************

root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac#
root@RaspberryPi-Gateway:/dac# journalctl -fu dobby
-- Logs begin at Tue 2023-03-21 04:26:19 UTC. --
Mar 24 15:22:01 RaspberryPi-Gateway helloworld-test[14410]: Loaded plugin 'thunder' from '/usr/lib/plugins/dobby/libThunderPlugin.so.1'
Mar 24 15:22:01 RaspberryPi-Gateway helloworld-test[14410]: Plugin logging has nothing to do at postStart
Mar 24 15:22:01 RaspberryPi-Gateway helloworld-test[14410]: Plugin networking has nothing to do at postStart
Mar 24 15:22:01 RaspberryPi-Gateway helloworld-test[14410]: Hook poststart completed
Mar 24 15:22:01 RaspberryPi-Gateway DobbyDaemon[234]: NFO: No file size limit size for container log - setting to unlimited
Mar 24 15:22:01 RaspberryPi-Gateway DobbyDaemon[234]: NFO: Configuring logging for container 'helloworld-test' (pid: 14395)
Mar 24 15:22:01 RaspberryPi-Gateway DobbyDaemon[234]: NFO: container 'helloworld-test' started, controller process pid 14395
Mar 24 15:22:01 RaspberryPi-Gateway DobbyDaemon[234]: MIL: container 'helloworld-test'(734) started
Mar 24 15:22:30 RaspberryPi-Gateway DobbyDaemon[234]: NFO: List()
Mar 24 15:22:30 RaspberryPi-Gateway DobbyDaemon[234]: NFO: GetState('734')