RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
This document explains about how to build RDKB containerization image and use it. In addition it also has some useful commands which can be used to handle the containers
The code is developed and changes made in necessary files for containerization.
Go to the <workspace>
cd <workspace>
execute the following command:
source meta-cmf-raspberrypi/setup-environment
A list is obtained, select the following option from among the list:
12) meta-cmf-raspberrypi/conf/machine/raspberrypi-rdk-broadband-lxc.conf
The path is automatically directed to:
<workspace>/build-raspberrypi-rdk-broadband-lxc/
Use the following command to compile the complete code:
bitbake rdk-generic-broadband-lxc-image
To compile a specific component container use the below command:
bitbake <component> -c compile -f
Ex:
bitbake ccsp-dmcli -c compile -f
The above command will compile the dmcli component container.
Once the code generation for containerization is compiled, the image for the same is found under the path:
cd <workspace>/build-raspberrypi-rdk-broadband-lxc/tmp/deploy/images/raspberrypi-rdk-broadband-lxc/
The image to be considered:
<ImageName.rootfs.rpi-sdimg>
Ex:
Path:
cd container-work/build-raspberrypi-rdk-broadband-lxc/tmp/deploy/images/
Image:
raspberrypi-rdk-broadband-lxcrdk-generic-broadband-lxc-image_default_20190327101556.rootfs.rpi-sdimg
The image has to be copied to the local PC using scp command:
scp -i ~/dvm_rdkb -P 8093 <username@ip_address>:<path to the existing file> <path to destination in local PC>
It has to be flashed to an SD card using this command in local PC:
sudo dd if=<path to ImageName.rootfs.rpi-sdimg> of=<path to SD card space> bs=4M
Ex:
sudo dd if=rdkb-generic-broadband-image_default_20181026100202.rootfs.rpi-sdimg of=/dev/sdd bs=4M
The SD card is inserted to the Raspberry Pi board and booted to check for containers created.
The Raspberry Pi board is connected to the PC via a USB to serial converter and the logs can be checked in console or can be connected via HDMI cable to a TV and logs will be shown in the terminal
1.Check for the container generated in the following path:
/container/<container_name>/
Three folders will be generated under <container_name>:
i. conf -- This folder contains the lxc.conf file.
ii. launcher -- This folder contains the script to execute the container.
iii. rootfs – This folder contains all the root files which includes bin, sbin, usr, lib, etc.
The above folders will be created automatically based on the xml files written in the workspace.
Path :
<workspace>/meta-cmf-raspberrypi/recipes-containers/lxc-container-generator/files/xml/<container.xml>
Ex:
container-work/meta-cmf-raspberrypi/recipes-containers/lxc-container-generator/files/xml/lxc_conf_CcspPandMSsp.xml
The above xml file is written for “P and M” container and will be responsible for the generation of the 3 folders mentioned above.
2.Check all the processes running in regard to lxc.
ps -Af | grep lxc
The Pi terminal should show logs similar to the following:
5530 | root | 0.00 | /usr/bin/lxc-execute -n PSMSSP -f /container/PSMSSP/conf/lxc.conf -- /usr/bin/PsmSsp -subsys eRT . |
5534 | psm | 0.00 | /init.lxc.static –gid 705 –uid 705 -- /usr/bin/PsmSsp -subsys eRT . |
6433 | root | 0.00 | /usr/bin/lxc-execute -n CCSPPANDM -f /container/CCSPPANDM/conf/lxc.conf -- /usr/bin/gw_prov_utopia |
6435 | pandm | 0.00 | /init.lxc.static –gid 706 –uid 706 -- /usr/bin/gw_prov_utopia |
6520 | root | 0.00 | /usr/bin/lxc-execute -n DBUS -f /container/DBUS/conf/lxc.conf -- /usr/bin/dbus-daemon –system –nofork –nopidfile –systemd-activation |
6532 | dbus | 0.00 | /init.lxc.static –gid 703 –uid 703 -- /usr/bin/dbus-daemon –system –nofork –nopidfile –systemd-activation |
6574 | root | 0.00 | /usr/bin/lxc-execute -n CCSPCR -f /container/CCSPCR/conf/lxc.conf -- /usr/bin/CcspCrSsp -subsys eRT . |
6577 | ccspcr | 0.00 | /init.lxc.static –gid 704 –uid 704 -- /usr/bin/CcspCrSsp -subsys eRT . |
6737 | root | 0.00 | grep lxc |
1. Run respective container scripts to execute individual container when container fails in boot up process:
sh /container/<Container Name>/launcher/<container.sh> start
Ex:
sh /container/PSMSSP/launcher/PsmSsp.sh start
The above command can be executed to run PSM container and see its logs in Console.
2. Run command/commands inside the container specified by the Name when the container is already running:
lxc-attach -n CCSPWIFI -f /container/CCSPWIFI/conf/lxc.conf
Ex:
lxc-attach -n CCSPWIFI -f /container/CCSPWIFI/conf/lxc.conf
The above command can be executed to run the commands specified by lxc.conf file.
i. Service file used:
/lib/systemd/system/dbus.service
ii. Directory name:
/container/DBUS/
iii. Conf file used for it:
/container/DBUS/conf/lxc.conf
iv. Service handled by this file:
DBUS acts as a message bus. DBUS container contains commands which initialize the message bus and connects all the components to each other for communication. Dbus path differs for each component.
i. Service file used:
/lib/systemd/system/PsmSsp.service
ii. Directory name:
/container/PSMSSP/
iii. Conf file used for it:
/container/PSMSSP/conf/lxc.conf
iv. Service handled by this file:
Persistent Storage Manager container stores current/default system configurations and retrieves them from backup files when required on behalf of other component containers.
i. Service file used:
/lib/systemd/system/CcspPandMSsp.service
ii. Directory name:
/container/CCSPPANDM/
iii. Conf file used for it:
/container/CCSPPANDM/conf/lxc.conf
iv. Service handled by this file:
Provisioning and Management container acts an an interface and responds to any query or setting of variables. It keeps a track of changes in attributes and notifies to other component containers.
This container also handles Gateway provisioning for provisioning LAN and DOCSIS which includes IP addressing, routing and other gateway initialisation. It initiates registration of all servies on boot up.
i. Service file used:
/lib/systemd/system/ccspwifiagent.service
ii. Directory name:
/container/CCSPWIFI/
iii. Conf file used for it:
/container/CCSPWIFI/conf/lxc.conf
iv. Service handled by this file:
WiFi Agent container provides each component container, the access to data model APIs and driver specific APIs to manage WiFi specific parameters through a component specific Abstraction layer. It helps to manage and configure the gateway’s wifi access point interface.
i. Service file used:
/lib/systemd/system/CcspCrSsp.service
ii. Directory name:
/container/CCSPCR/
iii. Conf file used for it:
/container/CCSPCR/conf/lxc.conf
iv. Service handled by this file:
Component registrar acts as a centralized container for registration of all the component containers with their respective name, version, dbus path and namespace.
This command is used to quickly launch a container in an isolated environment. It mainly runs the specified command into the container via intermediate process lxc-init (forwards the received signal to starting command). Lxc-execute uses the configurations specified by the lxc-create process.
Ex:
lxc-execute -n DBUS -f /container/DBUS/conf/lxc.conf
lxc-execute -n PSMSSP -f /container/PSMSSP/conf/lxc.conf
lxc-execute -n CCSPPANDM -f /container/CCSPPANDM/conf/lxc.conf
lxc-execute -n CCSPWIFI -f /container/CCSPWIFI/conf/lxc.conf
lxc-execute -n CCSPCR -f /container/CCSPCR/conf/lxc.conf
This command attaches to the container namespace and run a specified command inside, the already executing container.
Ex:
lxc-attach -n DBUS -f /container/DBUS/conf/lxc.conf
lxc-attach -n PSMSSP -f /container/PSMSSP/conf/lxc.conf
lxc-attach -n CCSPPANDM -f /container/CCSPPANDM/conf/lxc.conf
lxc-attach -n CCSPWIFI -f /container/CCSPWIFI/conf/lxc.conf
lxc-attach -n CCSPCR -f /container/CCSPCR/conf/lxc.conf
hostapd is software daemon used for turning the normal network interface to access point.
Ex:
hostapd -B /nvram/hostapd0.conf\
Host PC has to be connected with the Raspberry Pi board via USB to Ethernet adaptor or by WiFi
WiFi client should be connected to the WiFi Access point RPi using the SSID(Default: RPI3-RDKB-AP0) and password(Default: rdk@1234) given.
Host based management can be done via WebUI by opening http://10.0.0.1/ in connected client device