RDKB-63545 : Add PSM defaults for SKY-UK XER10 device#221
RDKB-63545 : Add PSM defaults for SKY-UK XER10 device#221aadhithan01 wants to merge 12 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds PSM (Persistent Storage Manager) default configuration support for the SKY-UK partner on XER10 devices (model SCER11BEL). The changes enable PSM migration by allowing partner-specific JSON configuration values to be properly applied to PSM storage for this device model.
Changes:
- Added conditional logic in utopia_init.sh to call apply_system_defaults_psm for sky-uk partner on XER10 devices
- Implemented isXER10Device() helper function to detect SCER11BEL devices
- Added support for processing override-only parameters from partner JSON configuration
- Enhanced PSM parameter handling for XER10 devices in the partner defaults application logic
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| source/scripts/init/system/utopia_init.sh | Added conditional check to invoke apply_system_defaults_psm for sky-uk partner on XER10 (SCER11BEL) devices |
| source/scripts/init/src/apply_system_defaults_helper.c | Added isXER10Device() function, marked unused function with attribute, implemented override-only parameter processing in two functions, and added XER10-specific PSM logging |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Remove redundant XER10-specific logging that duplicates existing log output - Extract duplicated override processing logic into process_override_only_parameters helper function - Reduces code duplication and improves maintainability
This reverts commit 2ac1fb0.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixed memory leak where newParamObj was created but not added to JSON tree when psm_supported or syscfg_supported conditions failed. Now the object is always added to the tree unconditionally at line 2329, with only the database operations remaining conditional. This ensures proper memory cleanup when the root JSON is deleted.
- Added --with-machine configure option support - Added MACHINE_SCXER10 conditional to compile apply_system_defaults_psm - Modified Makefile.am to include apply_system_defaults_psm when MACHINE=scxer10
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3d5904d
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| PARTNER_ID=`syscfg get PartnerID` | ||
| if [ "$PARTNER_ID" = "sky-uk" ] && [ "$MODEL_NUM" = "SCER11BEL" ]; then | ||
| echo_t "[utopia][init] Partner ID is sky-uk and device is XER10, applying partner defaults for psm" | ||
| apply_system_defaults_psm & |
There was a problem hiding this comment.
apply_system_defaults_psm is started in the background, but the script immediately continues to mutate/commit syscfg and start other init tasks. This can lead to race conditions where partner PSM defaults/migration are not applied before dependent services start, or where concurrent syscfg commits interleave. Consider running it synchronously (no &), or explicitly waiting for completion before proceeding (or move it earlier/later with clear ordering guarantees).
| apply_system_defaults_psm & | |
| apply_system_defaults_psm |
| cJSON *bs_obj = cJSON_GetObjectItem(subitem_nvram_bs, override_key); | ||
| if (bs_obj == NULL) | ||
| { | ||
| cJSON *newParamObj = cJSON_CreateObject(); | ||
| cJSON_AddStringToObject(newParamObj, "DefaultValue", override_value); | ||
| cJSON_AddStringToObject(newParamObj, "BuildTime", getBuildTime()); | ||
| cJSON_AddStringToObject(newParamObj, "ActiveValue", override_value); | ||
| cJSON_AddStringToObject(newParamObj, "UpdateTime", "-"); | ||
| cJSON_AddStringToObject(newParamObj, "UpdateSource", "-"); | ||
|
|
||
| cJSON_AddItemToObject(subitem_nvram_bs, override_key, newParamObj); | ||
|
|
||
| // Handle dmsb.* parameters - store in PSM database | ||
| if (0 != strstr(override_key, "dmsb.") || 0 != strstr(override_key, "X_AIRTIES_Obj")) | ||
| { | ||
| if (psm_supported == 1) | ||
| { | ||
| APPLY_PRINT("Add override PSM value %s for param %s\n", override_value, override_key); | ||
| addParamInPartnersFile(override_key, PartnerID, override_value); | ||
| set_psm_record(override_key, override_value); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if (syscfg_supported == 1) | ||
| { | ||
| APPLY_PRINT("Add override syscfg value %s for param %s\n", override_value, override_key); | ||
| addParamInPartnersFile(override_key, PartnerID, override_value); | ||
| set_syscfg_partner_values(override_value, override_key); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The new override-only handling in compare_partner_json_param() only adds the parameter when it is missing (bs_obj == NULL). If an override-only key already exists in bootstrap.json and its value changes in the etc override section on a later firmware, this block will not update DefaultValue/ActiveValue (or trigger PSM/syscfg updates), leaving stale defaults. Add the same “value changed in firmware” update path for existing bs_obj entries (similar to the main loop), at least when UpdateSource is "-".
| /* Process override-only parameters (parameters that exist only in override, not in main partner defaults) | ||
| This allows model-specific parameters like dmsb.* to be added through override section */ | ||
| if (overrideObj) | ||
| { | ||
| APPLY_PRINT("%s - Processing override-only parameters for model %s\n", __FUNCTION__, devModel); | ||
| cJSON *overrideParam = overrideObj->child; | ||
| while (overrideParam) | ||
| { | ||
| char *override_key = overrideParam->string; | ||
|
|
||
| // Check if this key was already processed from subitem_etc | ||
| if (!cJSON_HasObjectItem(subitem_etc, override_key)) | ||
| { | ||
| char *override_value = overrideParam->valuestring; | ||
| if (override_value != NULL) | ||
| { | ||
| APPLY_PRINT("%s - Adding override-only parameter: %s = %s\n", __FUNCTION__, override_key, override_value); | ||
|
|
||
| cJSON *bs_obj = cJSON_GetObjectItem(subitem_nvram_bs, override_key); | ||
| if (bs_obj == NULL) | ||
| { | ||
| cJSON *newParamObj = cJSON_CreateObject(); | ||
| cJSON_AddStringToObject(newParamObj, "DefaultValue", override_value); | ||
| cJSON_AddStringToObject(newParamObj, "BuildTime", getBuildTime()); | ||
| cJSON_AddStringToObject(newParamObj, "ActiveValue", override_value); | ||
| cJSON_AddStringToObject(newParamObj, "UpdateTime", "-"); | ||
| cJSON_AddStringToObject(newParamObj, "UpdateSource", "-"); | ||
|
|
||
| cJSON_AddItemToObject(subitem_nvram_bs, override_key, newParamObj); | ||
|
|
||
| // Handle dmsb.* parameters - store in PSM database | ||
| if (0 != strstr(override_key, "dmsb.") || 0 != strstr(override_key, "X_AIRTIES_Obj")) | ||
| { | ||
| if (psm_supported == 1) | ||
| { | ||
| APPLY_PRINT("Add override PSM value %s for param %s\n", override_value, override_key); | ||
| addParamInPartnersFile(override_key, PartnerID, override_value); | ||
| set_psm_record(override_key, override_value); | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if (syscfg_supported == 1) | ||
| { | ||
| APPLY_PRINT("Add override syscfg value %s for param %s\n", override_value, override_key); | ||
| addParamInPartnersFile(override_key, PartnerID, override_value); | ||
| set_syscfg_partner_values(override_value, override_key); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| overrideParam = overrideParam->next; | ||
| } | ||
| } |
There was a problem hiding this comment.
New behavior was added to process “override-only” partner parameters (including special handling for dmsb.* / X_AIRTIES_Obj), but there are existing gtests for compare_partner_json_param()/helpers under source/test/apply_system_defaults. Add unit tests covering (1) override-only parameters being added when absent and (2) override-only parameters being updated when the override value changes across versions, for both syscfg and PSM-key paths.
| PARTNER_ID=`syscfg get PartnerID` | ||
| if [ "$PARTNER_ID" = "sky-uk" ] && [ "$MODEL_NUM" = "SCER11BEL" ]; then | ||
| echo_t "[utopia][init] Partner ID is sky-uk and device is XER10, applying partner defaults for psm" | ||
| apply_system_defaults_psm & |
There was a problem hiding this comment.
This block assumes apply_system_defaults_psm is present in the runtime image. If the binary isn’t built/installed for some reason, the init script will emit a “not found” error and skip applying required PSM defaults. Consider guarding the call with an executable check (e.g., command -v / -x) and logging an explicit error if it’s missing.
| apply_system_defaults_psm & | |
| if command -v apply_system_defaults_psm >/dev/null 2>&1; then | |
| apply_system_defaults_psm & | |
| else | |
| echo_t "[utopia][init] ERROR: apply_system_defaults_psm not found; skipping partner PSM defaults" | |
| fi |
Adding the PSM entries for the sky-uk partner ID, enabling the PSM migration, which will take the partner_json values to the PSM values
TEST STEPS : https://ccp.sys.comcast.net/browse/RDKB-63545
UT:
https://ccp.sys.comcast.net/browse/RDKB-63545?focusedId=24617629&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-24617629