Pre-requisite
- Access to Raspberry Pi terminal.
- Access to Xconf server from browser https://xconf.rdkcentral.com:9093/admin/
- For Admin mode(read and writ permission) -> username : admin, password: RdkXcadm$2120
- For User mode(only read mode) -> username: user ,password: RdkXcusr@2210
...
- Parameters: give a parameter that will match the one of the formulas that you have created.
- estbMacAddress < MAC Address> or
- estbIP <IP Address>
- model <Model Name>
Log Upload: Client End Verification (In RPI)
- Remove already existing DCM Settings config files under /tmp
rm -rf /tmp/DCM* - Restart the log upload service in Raspberry Pi using the command
systemctl restart CcspTelemetry.service
root@RaspberryPi-Gateway:~# systemctl restart CcspTelemetry.service - Verify through CURL command
curl -i 'https://xconf.rdkcentral.com:9092/loguploader/getSettings?estbIP=<IP ADDRESS>'
or
curl -i 'https://xconf.rdkcentral.com:9092/loguploader/getSettings?estbMacAddress=<MAC-Address>'
...
Firmware Upgradation for RPI using Xconf Server
- Introduction
The Firmware upgrade will upgrade higher or lower version of the current image in RPI target with the help of Xconf server and TFTP/HTTP protocol.
- TFTP Server Setup
STEP 1:
Install xinetd and tftpd-hpa application in your local PC to setup tftp server by using below command
sudo apt-get install xinetd
sudo apt-get install tftpd-hpa
STEP 2:
Create new folder ,for example "tfphome" in your PC home directory to maintain checksum file and upgrading image file.
Image Added
STEP 3:
Check tftp file is there or not in /etc/xinetd.d/ directory. if it is not there then create tftp file under this /etc/xinetd.d/ direcotry and add below content.
vi /etc/xinetd.d/tftp
service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in.tftpd server_args = -c -v -s /home/xyz/tftphome ( Give upgrading file and checksum file maintained directory ) disable = no } |
---|
File : /etc/xinetd.d/tftp
Image Added
Verify /etc/default/tftpd-hpa file content
vi /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa TFTP_USERNAME="tftp" TFTP_DIRECTORY="/home/xyz/tftphome" ( Give upgrading file and checksum file maintained directory ) TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure" |
---|
File: /etc/default/tftpd-hpa
Image Added
STEP 5: Start tftp server and xinetd server using below commands.
sudo service tftpd-hpa restart
sudo /etc/init.d/xinetd restart
- Procedure for image flashing
- Have 2 different broadband images and copy to the linux machine
- Flash a image to the SD card(SD card Minimum size should be 8GB)
→ for Morty version
sudo dd if=<image> of=/dev/sdb bs=4M
Example : $ sudo dd if=rdkb-generic-broadband-image_default_20190808132609.rootfs.rpi-sdimg of=/dev/sdb bs=1M
→ For dunfell version
bzip2 -d <image>
sudo -E bmaptool copy --nobmap <image> /dev/sdb
Example:
$ bzip2 -d rdk-generic-broadband-image-raspberrypi-rdk-broadband.wic.bz2
$ sudo -E bmaptool copy --nobmap rdk-generic-broadband-image-raspberrypi-rdk-broadband.wic /dev/sd
Image Added
- With another image
- Create checksum using the below command
md5sum "<imagefile_name>" > imagefile_name.txt
- Copy both (image as well as the checksum) to tftp server
for Ex:
md5sum "rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic" >rdkb-generic-broadband-image_rdk-next_20211118174413.txt
cp -r rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic rdkb-generic-broadband-image_rdk-next_20211118174413.txt /home/xyz/tftphome
Image Added
Xconf Server UI Configurations
- Create Model
Flow: Xconf-Server ->Common ->Models
Give ID and Description to setup Model for your device and save that details in xconf server.
Image Added
- Create MAC List
Flow: Xconf-Server->Common->MAC Lists
After entered MAC Lists page press create button to add your device MAC detail and save the details.
Image Added
- Create Firmware config
Flow: Xconf-Server->Firmware->Firmware Configs
After entered Firmware Configs page press create button to add your device firmware configuration detail.
Give Description, File name, Version and select your model name and save the details in xconf server.
Description: <unique Identifier>
File Name :<Upgrading image name>
Version: <Upgrading image name without .rootfs.rpi.sdimg or .bz2.wic>
Model: <Model name configured under Common Tab>
Image Added
- Create Firmware Rule
Flow: Xconf-Server->Firmware->Firmware Rules
After entered Firmware Rule page press create button to add your device firmware Rule detail.
Please Select a Template : <MAC_RULE>
Name : <Name difined during firmware configs creation>
Type : <MAC_RULE>
Build Conditions:eStbMac IN_LIST <List-Id> AND model is <Model_Name>
Firmware Config:<select the same name defined during configs creation>
Image Added
Image Added
- Edit Download Location Round Robin Filter
Flow: Xconf-server -> Firmware -> Download Location Filter -> Edit
After entered Download Location Filter page press Edit button to add your Download Location detail.
Location (FQDN) : <xconf.rdkcentral.com>
Location (full HTTP Location) : <https://xconf.rdkcentral.com/xconf/upload/>
TFTP :< Tftp server IPv4 and IPv6 Address>
Image Added
- Add TFTP location
An HTTP location will be returned by default to all devices. To enable tftp(If you have the download location of the firmware as tftp, then only you need to setup this)as download location for a particular set of devices, we need to override it from firmware rules.
Flow : Xconf-server -> Firmware ->Firmware Rules -> Define Properties -> Create
Image Added
- A page will be displayed with options to select the template. Select ‘DOWNLOAD_LOCATION_FILTER’ from the list.
Image Added
- In this 'firmware rule’ page with type 'DOWNLOAD_LOCATION_FILTER', we need to specify the ‘Build Conditions’ and ‘Action’ , The build condition should be same as that we used to set rule actions(which will set rules for our intended devices). In ‘Properties’ option under ‘Action’, add ‘firmwareDownloadProtocol’ as ‘tftp’, ‘firmwareLocation’ as ‘your tftp location IPV4 address’. This property will override the default value set from ‘Download Round Robin location filter’.
Image Added
- Note: Setting up IPV4 locations via ‘Download Location Round Robin Filter’ is not supported. This can be set only by the property 'firmwareLocation' from the 'Define Properties' firmware rule page.
Just like we added tftp location and protocol here, we can also override the default value with http as well. For firmwareDownloadProtocol, add 'http' and for the 'firmwareLocation', add http location. - Response example for https://{xconf-ip}:{port}/xconf/swu/stb?eStbMac={mac}. Here the 'firmwareLocation' and 'firmwareDownloadProtocol' are overrided at 'Define Properties' firmware rule.
- The 'ipv6' addresses will be one of the addresses mentioned in the 'Download Filter' page . If you don't want "ipv6FirmwareLocation", then don't setup it in 'Define Properties' or in the 'Download location filter' pages and you will get only "firmwareLocation" in the response.
Image Added
- Verification of Firmware test page
Flow : Xconf-server -> Firmware -> Test Page
Parameters : eStbMac <MAC-Address>
Image Added
- Client end Configurations and verification (in RPI)
Change the CLOUDURL URL in /etc/include.properties File
CLOUDURL=https://xconf.rdkcentral.com:9092/xconf/swu/stb?eStbMac=
Image Added
Image Added
- Change the TFTP address in /etc/device.properties
Image Added
- Check the image version using “cat /version.txt”
Image Added
- Restart the service using below command
root@RaspberryPi-Gateway:~# systemctl restart swupdate.service
else reboot the board.
Note: For the 1st time board go for automatic reboot when we give restart of swupdate service and creates 2 more partitions in sd card. - Check the response, xconf_curl_httpcode and swupdate log files under /rdklogs/logs/
- This log file contains the below details
service status, http code , MAC address , JSONSTR, cloud prototype (TFTP), cloud version , RPI version , Checksum ,Number of partitions Device type, Active and Passive bank partitions ,Upgrade successful message.
Image Added
- Sample Log
root@RaspberryPi-Gateway:/rdklogs/logs# root@RaspberryPi-Gateway:/rdklogs/logs# cat swupdate.log Started executing swupdate_utility.sh and device type is :broadband Main app & Triggering deviceInitiatedFWDnld.sh URL_CMD: curl -w %{http_code} 'https://xconf.rdkcentral.com:9092/xconf/swu/stb?eStbMac=B8:27:EB:22:16:36' -o /tmp/cloudurl.txt >> /tmp/cloudhttpresp.txt No error in curl command and curl http code is:200 cloud version is rdkb-generic-broadband-image_rdk-next_20211118174413 RPI version is rdkb-generic-broadband-image_rdk-next_20211118184509 Active bank is:2 rpiimageModel in dev is :rdkb cloudimageModel is :rdkb no of parts is :4 active bank is 0 so fetch info from passive and partition is:2 rpipassivebankimageModel: passivebankVersion: since bank1 p3 is broadband and pass bank is rdkv cloud is broadband check broadband version and upgrade if mismatches check broadband versions and upgrade if mismatches !! Device type is broadband !! Image Upgrade During Bootup ..! Main APP of devinitFWDNLD--- 2021-11-22 07:15:14 version = rdkb-generic-broadband-image_rdk-next_20211118184509 2021-11-19 07:15:14 buildtype = dev Mac in jsonstr:B8:27:EB:22:16:36&model=RPI&capabilities=RCDL&capabilities=supportsFullHttpUrl 2021-11-22 07:15:14 JSONSTR: B8:27:EB:22:16:36&model=RPI&capabilities=RCDL&capabilities=supportsFullHttpUrl Trying to communicate with XCONF server URL_CMD: curl -w %{http_code} 'https://xconf.rdkcentral.com:9092/xconf/swu/stb?eStbMac=B8:27:EB:22:16:36&model=RPI&capabilities=RCDL&capabilities=supportsFullHttpUrl' -o /rdklogs/logs/response.txt >> /rdklogs/logs/xconf_curl_httpcode CKP: got no error in curl command!!!!!!!!!!!!!200 Curl return code : 0 ret = 0, http_code: 200 for XCONF communication 2021-11-22 07:15:15 HTTP request success. Processing response.. OUTPUT1 : 2021-11-22 07:15:16 cloudFWFile: rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic 2021-11-22 07:15:16 cloudFWLocation: 192.168.1.4 2021-11-22 07:15:16 cloudFWVersion: rdkb-generic-broadband-image_rdk-next_20211118174413 2021-11-22 07:15:16 cloudProto: tftp 2021-11-22 07:15:16 cloudImmediateRebootFlag: false 2021-11-22 07:15:16 myFWVersion = rdkb-generic-broadband-image_rdk-next_20211118184509 2021-11-22 07:15:16 myFWFile = 2021-11-22 07:15:16 lastDnldFile: 2021-11-22 07:15:16 cloudFWVersion: rdkb-generic-broadband-image_rdk-next_20211118174413 2021-11-22 07:15:16 cloudFWFile: rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic Xconf image Check Firmware versions are different myFWVersion : rdkb-generic-broadband-image_rdk-next_20211118184509 cloudFWVersion : rdkb-generic-broadband-image_rdk-next_20211118174413 cloudFWLocation192.168.1.4 cloudfile :rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic protocol1 2021-11-22 07:15:16 Starting Image Flashing ... 2021-11-22 07:15:16 Upgrade Server = 192.168.1.4 2021-11-22 07:15:16 Upgrade File = rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic 2021-11-22 07:15:16 Reboot Flag = 0 2021-11-22 07:15:16 Upgrade protocol = 1 2021-11-22 07:15:16 PDRI Upgrade = CKP !!!!!!!!! calling rpi_sw_install Checking available partition for bank switch and image upgrade... Creating additional partition for storage area and box will go for reboot... storage partition mmcblk0p4 is available file system type check count partition p3 is 0 Creating ext4 file system for partition mmc0blkp3... Discarding device blocks: done Creating filesystem with 524288 4k blocks and 131072 inodes Filesystem UUID: 2fbcfc3a-6b84-48b0-a171-86dd13cbf82b Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 Allocating group tables: done Writing inode tables: done Creating journal (16384 blocks): done Writing superblocks and filesystem accounting information: done file system type check count partition p4 is 0 Creating ext4 file system for partition mmc0blkp4... Discarding device blocks: done Creating filesystem with 524288 4k blocks and 131072 inodes Filesystem UUID: 1c2075c1-9de9-4fb0-b9ab-f9ca277f54d7 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912 cloud proto is :1 set IPtable rules for tftp !! cloudfile is:rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic cloudlocation is:192.168.1.4 Downloading already deployed checksum file from server rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic tftp download checksum file checksum file to download is rdkb-generic-broadband-image_rdk-next_20211118174413.txt Downloading rdkb-generic-broadband-image_rdk-next_20211118174413.rootfs.wic ... |
---|
- Verify the tftp download is happening by noticing the change of file size using below command:
ls /extblock/tftpimage/imagedwnldls -sh (use this command frequently to verify the file size change)
Image Added
- Once image download completed, the RPI board will auto reboot and come up with downloaded image.
- Once the board comes up, check the image loaded in the box using “cat /version.txt” command .It will be upgraded with the image from xconf-server.
Image Added
NOTE : Every time need to flash the different images . Because, here they are using the bank switching approach (https://wiki.rdkcentral.com/display/RDK/RDKB+RPI+Firmware+Upgrade+-+Design+-+2019+M7) where the images will be stored in the cloud.
So for the next time, when you try to flash the same image to SD card , the firmware upgrade will not happen . The reason is, it will check in the bank (cloud – active and passive banks). If the image is already available in any one of the bank, then it will not go for image upgrade.
Sample Log: After retries...No error in curl command and curl http code is:200 cloud version is rdkb-generic-broadband-image_rdk-next_20211118174413 RPI version is rdkb-generic-broadband-image_rdk-next_20211118174413 Active bank is:2 rpiimageModel in dev is :rdkb cloudimageModel is :rdkb no of parts is :4 active bank is 0 so fetch info from passive and partition is:2 rpipassivebankimageModel:rdkb passivebankVersion:rdkb-generic-broadband-image_rdk-next_20211118174413 since both banks has broadband alone and cloud also has broadband-compare versions with cloud atleast one bank matches broadband root@RaspberryPi-Gateway:/rdklogs/logs# tail -f swupdate.log RPI version is rdkb-generic-broadband-image_rdk-next_20211118174413 Active bank is:2 rpiimageModel in dev is :rdkb cloudimageModel is :rdkb no of parts is :4 active bank is 0 so fetch info from passive and partition is:2 rpipassivebankimageModel:rdkb passivebankVersion:rdkb-generic-broadband-image_rdk-next_20211118174413 since both banks has broadband alone and cloud also has broadband-compare versions with cloud atleast one bank matches broadband |
---|