Versions Compared

Key

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

The RDK firmware upgrader, the RDK agent at the CPE device side with the goal to provide an efficient and safe way to upgrade Firmware on the Field boxes. The module has the capability to

  • Ping cloud server to get new Firmware images
  • Download the images to secure location
  • Verify the signature of the downloaded firmware
  • Flash the image onto the box using manufacture library APIs

The module supports the upgrade of multiple Firmware types to RDK unit (RDK Video and stream boxes.)

  • PCI
  • PDRI
  • Remote Firmware
  • Additional supports to deploy and updates security certificate bundles 

draw.io Diagram
bordertrue
diagramNameFirmware manager
simpleViewerfalse
width600
linksauto
tbstyletop
lboxtrue
diagramWidth726
height568
revision1

...

Broadcast Event For Maintenance Manager:

EVENT NAMEVALUE
MAINT_FWDOWNLOAD_COMPLETE8
MAINT_FWDOWNLOAD_ERROR9
MAINT_FWDOWNLOAD_ABORTED10
MAINT_CRITICAL_UPDATE11
MAINT_REBOOT_REQUIRED12
MAINT_FWDOWNLOAD_INPROGRESS15
MAINT_FWDOWNLOAD_FG17
MAINT_FWDOWNLOAD_BG18

Broadcast Event For System Service

EVENT NAMEVALUE
FW_STATE_UNINITIALIZED0
FW_STATE_REQUESTING1
FW_STATE_DOWNLOADING2
FW_STATE_FAILED3
FW_STATE_DOWNLOAD_COMPLETE4
FW_STATE_VALIDATION_COMPLETE5
FW_STATE_PREPARING_TO_REBOOT6
FW_STATE_ONHOLD_FOR_OPTOUT7
FW_STATE_CRITICAL_REBOOT8
FW_STATE_NO_UPGRADE_REQUIRED9
IMAGE_FWDNLD_UNINITIALIZED0
IMAGE_FWDNLD_DOWNLOAD_INPROGRESS1
IMAGE_FWDNLD_DOWNLOAD_COMPLETE2
IMAGE_FWDNLD_DOWNLOAD_FAILED3
IMAGE_FWDNLD_FLASH_INPROGRESS4
IMAGE_FWDNLD_FLASH_COMPLETE5
IMAGE_FWDNLD_FLASH_FAILED6

jsonprocess

This component is responsible for processing the xconf response and parse the json file. Then create a data structure to use further.

The firmware upgrader queries Xconf to check whether any upgrade is available for this device. The API is used to communicate with the Xconf and below are its typical parameters. The device details are fetched using the APIs as part of the deviceutils component.


Function Name

Parameter

Description

MakeXconfComms

pResponse

server_type
http_code

Pointer to structure to receive output data

Xconf

Http status

createJsonString

Char * pPostFieldOut,

Size_t szPostFieldOut

The json string is looks like  createJsonString: totlen = 503eStbMac=38:A6:CE:FF:FA:47&firmwareVersion=SKXI11ADS_VBN_23Q4_sprint_20231030231228sdy_NG&additionalFwVerInfo=SKXI11ADS_PDRI_PROD_20220704085103_11.0.0.0.bin&env=vbn&model=SKXI11ADS&partnerId=sky-uk&activationInProgress=false&targetProposition=Not Available&accountId=1010958709201877139&experience=X1&serial=IP01SK12035000A54&localtime=Tue Oct 31 08:36:04 UTC 2023&dlCertBundle=&rdmCatalogueVersion=&timezone=Europe/London&capabilities=rebootDecoupled&capabilities=RCDL&capabilities=supportsFullHttpUrl



upgradeRequest

int upgrade_type,int server_type,constchar* artifactLocationUrl,constvoid* dwlloc,char*pPostFields,int*pHttp_code

Use For requesting upgrade pci, pdri and xconf.

Param-1: Upgrade type pci, pdri, xconf

Param-2: Type of server. HTTP_XCONF_DIRECT, HTTP_XCONF_CODEBIG, HTTP_SSR_DIRECT, HTTP_SSR_CODEBIG

Param-3: Download server url

Param-4: To store download data

Param-5: http code

getXconfRespData

XCONFRES *pResponse,char*pJsonStr

The response looks like below

{"firmwareDownloadProtocol":"http","firmwareFilename":"tbd","firmwareLocation":"tbd","firmwareVersion":"tbd","rebootImmediately":false}



The response from Xconf is processed as part of the jsonparser Component. This is a typical response from the Xconf. 

{
"firmwareDownloadProtocol":"http",
"firmwareFilename":"tbd",
"firmwareLocation":"tbd",
"firmwareVersion":"tbd",
"rebootImmediately":false
}

 

  1. firmwareDownloadProtocol : This field represents the protocol. Rdkvfwupgrader support only http protocol.
  2. firmwareFilename: This filed use for PCI image details.
  3. firmwareLocation: This field provides URL endpoint to download image.
  4. firmwareVersion: This field provides the firmware version with out adding signed or unsigned details.
  5. rebootImmediatly: This field is used for critical updates. If this is true then the device will reboot immediately after PCI flash happens to flash memory. If this is false then reboot will happen during reboot window time.
  6.  additionalFwVerInfo: This field is used for PDRI image details.
  7.  remCtrl: This field is used for peripheral firmware details.
  8. cloudDelayDownload: This field is use for make the download start with some delay.
  9. dlCertBundle: This filed is used for to get certificate bundle details.

...

This component is responsible for reading the rfc value and writing the rfc value. Below are the rfc used in this module.

RFC nameDescriptionDefault Value
Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.EnableUse for throttle featureFALSE

Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed

Use for set throttle speed

1MB => 1 *1024 * 1024

Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.IncrementalCDL.Enable

Use For Incremental Download

TRUE

Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLDirect.Enable

Use For Direct CDN Download

FALSE

  1. RFC_THROTTLE: This is used to enable the throttle download feature. Using this feature we can control the download speed. RFC_TOPSPEED value is used to decide the speed of the download. This feature is used for a better experience for the user while watching videos.
  2. RFC_INCR_CDL: This is used to enable the incremental/chunk download. Using this feature we can resume the download if the download is failed due to slow internet(curl error code 18) and max time out (curl error code 28). Using this feature we can save the network usage data and quick firmware upgrade.
  3. RFC_DIRECT_CDN: This is use for enable direct cdn feature. If this feature is enable image download happen using signing url provided by xconf server.

...

  1. Communicate with XCONF server and get the response.
  2. Processing of XCONF response and extract the firmware image details.
  3. Download and flash PCI image from the SSR server to device flash memory.
  4. Download and flash PDRI image from the SSR server to device flash memory.
  5. Download and flash peripheral image from the SSR server to device flash memory.
  6. retry download if download fail other than image not found on server error.
  7. Trigger RDM Application.
  8. Download cert bundle.
  9. Support state red recovery download if the download is fail due to invalid certificate.
  10. Support incremental download. This feature needs to be enable using "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.IncrementalCDL.Enable" RFC
  11. Support Throttle download based on download speed mentioned. This feature needs to be enable using "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable" RFC
  12. Support codebig download. This is use if the device is not in comcast network.

...

  1. In case of X1 device this module is trigger by system service called swupdate.service and in case of TV this module is trigger by Maintenance Manager. And the trigger time is during boot up and maintenance window time and App trigger.
  2. In case of non-RDKE swupdate.service or maintenance manager is calling "swupdate_utils.sh". Then swupdate_utils.sh will call "rdkvfwupgrader" if the RDK Firmware RFC is true else script based download will start. 
  3. In case of RDK-E maintenance manager is calling rdkvfwupdater using system call.
  4. Once the rdkvfwupgradr start it gets all device info like MAC, partner id, current running image, pdri image, peripheral image etc and create XCONF query request. Below is the sample XCONF query request.
    tbd
  5. Once the query request is formed then this module send the request to XCONF server and get the response. This response is in json format.
    tbd
  6. Once the XCONF response received then it processes the response and add to the data structure for future use.
  7. Then this module does the image validation if image is invalid then this module is exit with error message.
  8. Once the image validation pass then it goes for PCI download. If the download fail then it has 3 times retry before make download status fail. If the download completed successfully then this image is flashed to the flash memory. Before image download start this module will check if any chunk of the image already present if it present then download start from where it left last time.
  9. After 3 retry happen because of http error code 0 then download switch to codebig server download. This kind of proxy server. If this download pass, then status is successfully else download is failed.
  10. If the download is failed due to certificate validation error, then state red recovery download will trigger. This is a kind of recovery server which is use static certificate to download image.
  11. If no failure during download and download completed successfully then this image is flashed to flash memory. Before flashing the image sign verification happen.
  12. Same above step 7 to 10 repeat for PDRI image and peripheral image.
  13. Once the download completed the status of the download is send to maintenance manager and some other service using IARM event.

...

PlantUML Macro
scriptrefctordesign
@startuml
skinparam componentStyle rectangle
skinparam packageStyle rectangle

' Layer 1: Device System Components
package "New Device System" {
    [rdkvfwupdater Daemon] <<daemon>> as RDKV
    [App Plugin] <<component>> as AppPlugin
    [Firmware Update Library] <<library>> as FWUpdate

    package "Common Utilities" {
        [libdwnl] <<library>>
        [libjsonparser] <<library>>
        [libutils] <<library>>
    }

    [Flash Memory] <<storage>> as FlashMem
}

' Layer 2: External Network Servers
package "External Servers" {
    [XConf Server] <<cloud>> as XConf
    [SSR Server] <<cloud>> as SSR
}

' App Plugin interactions
AppPlugin --> FWUpdate : download + flash API calls

' Firmware update lib communicates with rdkvfwupdater
FWUpdate ..> RDKV : IPC Request\n(download/flash tasks)
RDKV ..> FWUpdate : IPC Response\n(task result)

' rdkvfwupdater uses common utilities and flash memory
RDKV --> libdwnl : fetch/download helpers
RDKV --> libjsonparser : parse JSON config
RDKV --> libutils : device info/utils
RDKV --> FlashMem : flash firmware

' Common utils interaction with servers
libdwnl --> XConf : fetch xconf data
libdwnl --> SSR : download firmware image

@enduml



NEW DEVICE SYSTEM:


PlantUML Macro
@startuml
skinparam componentStyle rectangle
skinparam packageStyle rectangle

' Layer 1: Device System Components
package "NEW Device System" {
    [rdkvfwupdater Daemon] <<daemon>> as RDKV
    [App Plugin] <<component>> as AppPlugin
    [Firmware Update Library] <<library>> as FWUpdate

    package "Common Utilities" {
        [libdwnl] <<library>>
        [libjsonparser] <<library>>
        [libutils] <<library>>
    }

    ' New libs placed outside "Common Utilities" per your instruction
    [iarmlib] <<library>>
    [rfclib] <<library>>
    [jsonlib] <<library>>
    [upgradelib] <<library>>

    [Flash Memory] <<storage>> as FlashMem
}

' Layer 2: External Network Servers
package "External Servers" {
    [XConf Server] <<cloud>> as XConf
    [SSR Server] <<cloud>> as SSR
}

' App Plugin interactions (unchanged)
AppPlugin --> FWUpdate : download + flash API calls

' Preserve original communication between daemon and Firmware Update Library (unchanged)
FWUpdate ..> RDKV : IPC Request\n(download/flash tasks)
RDKV ..> FWUpdate : IPC Response\n(task result)

' rdkvfwupdater uses new libs and common utilities and flash memory
RDKV --> rfclib : fetch RFC data
RDKV --> iarmlib : send status/notify MM
RDKV --> jsonlib : prepare JSON request
RDKV --> upgradelib : coordinate upgrade policies
upgradelib --> libdwnl : delegate network download calls
RDKV --> libjsonparser : parse JSON config (responses)
RDKV --> libutils : device info/utils
RDKV --> FlashMem : flash firmware

' Common utils interaction with servers (unchanged)
libdwnl --> XConf : fetch xconf data
libdwnl --> SSR : download firmware image
@enduml

...