From 24b812e7e7d3f9853cb15943621698bfb644fc5f Mon Sep 17 00:00:00 2001 From: yashwanthkumar-hm_comcast Date: Tue, 9 Sep 2025 17:31:24 +0100 Subject: [PATCH 1/2] RDKB-61372: Handling recovery cases of Unknown/Invalid syscfg PartnerID Reason for change: Add retry mechanism for PartnerID Unknown Test Procedure: 1. Set PartnerID via TR181 DMs a. Set the DM Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.PartnerId with one of following values : "Unknown", "known", "sky-", "" b. Set the DM dmcli eRT setv Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.RDKB_Control.ActivatePartnerId bool true c. CPE goes for reboot and after reboot, Check if the PartnerID recovers with respective PartnerID configurations applied d. After Recovery Reboot Reason should be Reboot-DueTo-InvalidPartnerID 2. Set PartnerID DB param via syscfg a. set PartnerID with following values : "Unknown", "known", "sky-", "" b. syscfg commit c. Reboot CPE and Check if the PartnerID recovers with respective PartnerID configurations applied d. After Recovery Reboot Reason should be Reboot-DueTo-InvalidPartnerID 3. Upgrade scenario a. Flash image without the fix, check Partner ID - sky-uk b. Set Partner ID to "Unknown" using Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.PartnerId c. Activate PartnerID using Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.RDKB_Control.ActivatePartnerId d. CPE goes for reboot and after reboot, check the DMs if the partner_defaults.json loaded for Unknown in the image without the fix. e. Flash the image with the fix and check if the partner ID is recovered and valid config is loaded f. After Recovery Reboot Reason should be Reboot-DueTo-InvalidPartnerID 4. Retry failure: If recovery fails after retry mechanism, then the PartnerID must be set to Unknown Priority: P1 Risks: Low Signed-off-by: Yashwanth Kumar H M --- .../apply_system_defaults.c | 115 +++++++++++++++++- .../apply_system_defaults_syscfg.c | 4 + .../init/src/apply_system_defaults_helper.c | 109 ++++++++++++++++- .../init/src/apply_system_defaults_helper.h | 8 ++ .../apply_system_defaults_psm.c | 4 + source/scripts/init/system/utopia_init.sh | 5 + .../scripts/init/system/utopia_init_hub4.sh | 13 +- source/scripts/init/system/utopia_init_xb6.sh | 5 + 8 files changed, 256 insertions(+), 7 deletions(-) diff --git a/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c b/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c index 7739b39b..284ddb66 100644 --- a/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c +++ b/source/scripts/init/src/apply_system_defaults/apply_system_defaults.c @@ -80,6 +80,8 @@ #define STATIC #endif +#define PARTNER_ID_MAX_RETRY 5 + static int syscfg_dirty; #define DEFAULT_FILE "/etc/utopia/system_defaults" @@ -689,7 +691,7 @@ static int GetDevicePropertiesEntry (char *pOutput, int size, char *sDevicePropC static int getFactoryPartnerId (char *pValue) { -#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) || defined(_SR300_PRODUCT_REQ_) || defined(_WNXL11BWL_PRODUCT_REQ_) || defined(_SCER11BEL_PRODUCT_REQ_) +#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) || defined(_SR300_PRODUCT_REQ_) || defined(_WNXL11BWL_PRODUCT_REQ_) || defined(_SCER11BEL_PRODUCT_REQ_) || defined (_RDKB_GLOBAL_PRODUCT_REQ_) if(0 == platform_hal_getFactoryPartnerId(pValue)) { APPLY_PRINT("%s:%d - %s\n",__FUNCTION__, __LINE__,pValue); @@ -746,6 +748,111 @@ static int validatePartnerId (char *PartnerID) return result; } +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) +static int PartnerId_FetchWithRetry(char *PartnerID ) { + int retries = 0; + char buf[PARTNER_ID_LEN] = {0}; + + for(retries = 0; retries < PARTNER_ID_MAX_RETRY; retries++) { + memset(PartnerID, 0, PARTNER_ID_LEN); + + if((0 == getFactoryPartnerId(PartnerID)) && (PartnerID[0] != '\0') && + validatePartnerId(PartnerID) && (0 != strcasecmp (PartnerID, "Unknown"))) { + return 0; + } + else { + memset(buf, 0, sizeof(buf)); + + if ( 0 == GetDevicePropertiesEntry(buf, sizeof(buf), "PARTNER_ID")) { + if(buf[0] != '\0') { + strncpy(PartnerID, buf, strlen(buf)); + PartnerID[strlen(buf)] = '\0'; + + if(validatePartnerId(PartnerID) && (0 != strcasecmp(PartnerID, "Unknown") )) { + return 0; + } + } + } + } + + if((retries + 1) < PARTNER_ID_MAX_RETRY) { + APPLY_PRINT("%s - Still obtaining invalid PartnerID value from various sources so Retrying, Iteration: <%d>\n", __FUNCTION__, retries); + sleep(2); + } + } + + return 1; +} + +int WritePartnerIDToFile(char* PartnerID) { + FILE *fp = NULL; + + fp = fopen(PARTNERID_FILE, "w"); + if(NULL == fp) { + APPLY_PRINT("%s - Failed to open file %s\n", __FUNCTION__, PARTNERID_FILE); + return 1; + } + + if( (NULL != PartnerID) && (strlen(PartnerID) > 0) ) { + fwrite(PartnerID, strlen(PartnerID), 1, fp); + APPLY_PRINT("%s - PartnerID %s written to file %s\n", __FUNCTION__, PartnerID, PARTNERID_FILE); + } + else { + APPLY_PRINT("%s - PartnerID is NULL\n", __FUNCTION__); + if(fp) { + fclose(fp); + } + + return 1; + } + + if(fp) { + fclose(fp); + } + + return 0; +} + +void CheckAndHandleInvalidPartnerIDRecoveryProcess(char *PartnerID) { + if( '\0' == PartnerID[0] || (0 == validatePartnerId(PartnerID)) || (0 == strcasecmp (PartnerID, "Unknown")) ) { + memset(PartnerID, 0, PARTNER_ID_LEN); + + APPLY_PRINT("%s - Current PartnerID value is Unknown/Invalid, So retrying to obtain valid PartnerID values. \n", __FUNCTION__); + t2_event_d("SYS_ERROR_INVALID_PARTNER_ID_DETECTED", 1); + if( 0 == PartnerId_FetchWithRetry(PartnerID) ) { + APPLY_PRINT("%s - INVALID_PARTNER_ID_RECOVERY_SUCCESS - Obtained Valid PartnerID is %s\n", __FUNCTION__, PartnerID ); + t2_event_d("SYS_INVALID_PARTNER_ID_RECOVERY_SUCCESS", 1); + + if (syscfg_set_commit(NULL, "PartnerID", PartnerID) != 0) { + APPLY_PRINT("%s - PartnerID syscfg_set failed\n", __FUNCTION__); + } + + WritePartnerIDToFile(PartnerID); + + if (syscfg_set_commit(NULL, "factory_reset", "y") != 0) { + APPLY_PRINT("%s - syscfg_set failed\n", __FUNCTION__); + } + + creat("/nvram/.Invalid_PartnerID", 0644); + v_secure_system("/rdklogger/backupLogs.sh"); + + } + else { + if (syscfg_set_commit(NULL, "PartnerID", "Unknown") != 0) { + APPLY_PRINT("%s - syscfg_set failed\n", __FUNCTION__); + } + + APPLY_PRINT("%s - INVALID_PARTNER_ID_RECOVERY_FAILURE - PartnerID is %s\n", __FUNCTION__, PartnerID ); + t2_event_d("SYS_ERROR_INVALID_PARTNER_ID_RECOVERY_FAILURE", 1); + } + } + else { + APPLY_PRINT("%s - Current PartnerID : %s value is Valid \n", __FUNCTION__, PartnerID ); + } +} + +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + static int get_PartnerID (char *PartnerID) { char buf[PARTNER_ID_LEN]; @@ -3138,7 +3245,7 @@ if ( paramObjVal != NULL ) } return 0; } -#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) +#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) || defined (_RDKB_GLOBAL_PRODUCT_REQ_) static void getPartnerIdWithRetry(char* buf, char* PartnerID) { int i; @@ -3293,6 +3400,10 @@ static void getPartnerIdWithRetry(char* buf, char* PartnerID) get_PartnerID ( PartnerID ); } +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) + CheckAndHandleInvalidPartnerIDRecoveryProcess(PartnerID); +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + APPLY_PRINT("%s - PartnerID :%s\n", __FUNCTION__, PartnerID ); unsigned int flags = 0; diff --git a/source/scripts/init/src/apply_system_defaults/apply_system_defaults_syscfg.c b/source/scripts/init/src/apply_system_defaults/apply_system_defaults_syscfg.c index 58054822..09b03f85 100644 --- a/source/scripts/init/src/apply_system_defaults/apply_system_defaults_syscfg.c +++ b/source/scripts/init/src/apply_system_defaults/apply_system_defaults_syscfg.c @@ -228,6 +228,10 @@ int main( int argc, char **argv ) get_PartnerID ( PartnerID ); } +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) + CheckAndHandleInvalidPartnerIDRecoveryProcess(PartnerID); +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + APPLY_PRINT("%s - PartnerID :%s\n", __FUNCTION__, PartnerID ); ptr_etc_json = json_file_parse( PARTNERS_INFO_FILE_ETC ); diff --git a/source/scripts/init/src/apply_system_defaults_helper.c b/source/scripts/init/src/apply_system_defaults_helper.c index cf567d8c..b4e983ec 100644 --- a/source/scripts/init/src/apply_system_defaults_helper.c +++ b/source/scripts/init/src/apply_system_defaults_helper.c @@ -733,9 +733,9 @@ static int GetDevicePropertiesEntry (char *pOutput, int size, char *sDevicePropC return ret; } -static int getFactoryPartnerId (char *pValue) +int getFactoryPartnerId (char *pValue) { -#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) || defined(_SR300_PRODUCT_REQ_) || defined(_WNXL11BWL_PRODUCT_REQ_) +#if defined (_XB6_PRODUCT_REQ_) || defined(_HUB4_PRODUCT_REQ_) || defined(_SR300_PRODUCT_REQ_) || defined(_WNXL11BWL_PRODUCT_REQ_) || defined (_RDKB_GLOBAL_PRODUCT_REQ_) if(0 == platform_hal_getFactoryPartnerId(pValue)) { APPLY_PRINT("%s:%d - %s\n",__FUNCTION__, __LINE__,pValue); @@ -1016,6 +1016,111 @@ static void ValidateAndUpdatePartnerVersionParam (cJSON *root_etc_json, cJSON *r } } +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) +int PartnerId_FetchWithRetry(char *PartnerID ) { + int retries = 0; + char buf[PARTNER_ID_LEN] = {0}; + + for(retries = 0; retries < PARTNER_ID_MAX_RETRY; retries++) { + memset(PartnerID, 0, PARTNER_ID_LEN); + + if((0 == getFactoryPartnerId(PartnerID)) && (PartnerID[0] != '\0') && + validatePartnerId(PartnerID) && (0 != strcasecmp (PartnerID, "Unknown"))) { + return 0; + } + else { + memset(buf, 0, sizeof(buf)); + + if ( 0 == GetDevicePropertiesEntry(buf, sizeof(buf), "PARTNER_ID")) { + if(buf[0] != '\0') { + strncpy(PartnerID, buf, strlen(buf)); + PartnerID[strlen(buf)] = '\0'; + + if(validatePartnerId(PartnerID) && (0 != strcasecmp(PartnerID, "Unknown") )) { + return 0; + } + } + } + } + + if((retries + 1) < PARTNER_ID_MAX_RETRY) { + APPLY_PRINT("%s - Still obtaining invalid PartnerID value from various sources so Retrying, Iteration: <%d>\n", __FUNCTION__, retries); + sleep(2); + } + } + + return 1; +} + +int WritePartnerIDToFile(char* PartnerID) { + FILE *fp = NULL; + + fp = fopen(PARTNERID_FILE, "w"); + if(NULL == fp) { + APPLY_PRINT("%s - Failed to open file %s\n", __FUNCTION__, PARTNERID_FILE); + return 1; + } + + if( (NULL != PartnerID) && (strlen(PartnerID) > 0) ) { + fwrite(PartnerID, strlen(PartnerID), 1, fp); + APPLY_PRINT("%s - PartnerID %s written to file %s\n", __FUNCTION__, PartnerID, PARTNERID_FILE); + } + else { + APPLY_PRINT("%s - PartnerID is NULL\n", __FUNCTION__); + if(fp) { + fclose(fp); + } + + return 1; + } + + if(fp) { + fclose(fp); + } + + return 0; +} + +void CheckAndHandleInvalidPartnerIDRecoveryProcess(char *PartnerID) { + if( '\0' == PartnerID[0] || (0 == validatePartnerId(PartnerID)) || (0 == strcasecmp (PartnerID, "Unknown")) ) { + memset(PartnerID, 0, PARTNER_ID_LEN); + + APPLY_PRINT("%s - Current PartnerID value is Unknown/Invalid, So retrying to obtain valid PartnerID values. \n", __FUNCTION__); + t2_event_d("SYS_ERROR_INVALID_PARTNER_ID_DETECTED", 1); + if( 0 == PartnerId_FetchWithRetry(PartnerID) ) { + APPLY_PRINT("%s - INVALID_PARTNER_ID_RECOVERY_SUCCESS - Obtained Valid PartnerID is %s\n", __FUNCTION__, PartnerID ); + t2_event_d("SYS_INVALID_PARTNER_ID_RECOVERY_SUCCESS", 1); + + if (syscfg_set_commit(NULL, "PartnerID", PartnerID) != 0) { + APPLY_PRINT("%s - PartnerID syscfg_set failed\n", __FUNCTION__); + } + + WritePartnerIDToFile(PartnerID); + + if (syscfg_set_commit(NULL, "factory_reset", "y") != 0) { + APPLY_PRINT("%s - syscfg_set failed\n", __FUNCTION__); + } + + creat("/nvram/.Invalid_PartnerID", 0644); + v_secure_system("/rdklogger/backupLogs.sh"); + + } + else { + if (syscfg_set_commit(NULL, "PartnerID", "Unknown") != 0) { + APPLY_PRINT("%s - syscfg_set failed\n", __FUNCTION__); + } + + APPLY_PRINT("%s - INVALID_PARTNER_ID_RECOVERY_FAILURE - PartnerID is %s\n", __FUNCTION__, PartnerID ); + t2_event_d("SYS_ERROR_INVALID_PARTNER_ID_RECOVERY_FAILURE", 1); + } + } + else { + APPLY_PRINT("%s - Current PartnerID : %s value is Valid \n", __FUNCTION__, PartnerID ); + } +} + +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + static char *getBuildTime (void) { static char buildTime[50] = {0}; diff --git a/source/scripts/init/src/apply_system_defaults_helper.h b/source/scripts/init/src/apply_system_defaults_helper.h index 136ee411..4be5bc15 100644 --- a/source/scripts/init/src/apply_system_defaults_helper.h +++ b/source/scripts/init/src/apply_system_defaults_helper.h @@ -27,7 +27,15 @@ #define APPLY_DEFAULTS_FACTORY_RESET "/tmp/.apply_defaults_factory_reset" +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) +#define PARTNER_ID_MAX_RETRY 5 +int PartnerId_FetchWithRetry(char *PartnerID ); +int WritePartnerIDToFile(char* PartnerID); +void CheckAndHandleInvalidPartnerIDRecoveryProcess(char *PartnerID); +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + int get_PartnerID( char *PartnerID); +int getFactoryPartnerId (char *pValue); int parse_command_line(int argc, char **argv); int set_defaults(void); int set_syscfg_partner_values (char *pValue, char *param); diff --git a/source/scripts/init/src/apply_system_defaults_psm/apply_system_defaults_psm.c b/source/scripts/init/src/apply_system_defaults_psm/apply_system_defaults_psm.c index 1bdc19b4..114671ce 100644 --- a/source/scripts/init/src/apply_system_defaults_psm/apply_system_defaults_psm.c +++ b/source/scripts/init/src/apply_system_defaults_psm/apply_system_defaults_psm.c @@ -221,6 +221,10 @@ int main( int argc, char **argv ) get_PartnerID ( PartnerID ); } +#if defined (_RDKB_GLOBAL_PRODUCT_REQ_) + CheckAndHandleInvalidPartnerIDRecoveryProcess(PartnerID); +#endif // (_RDKB_GLOBAL_PRODUCT_REQ_) + APPLY_PRINT("%s - PartnerID :%s\n", __FUNCTION__, PartnerID ); ptr_etc_json = json_file_parse( PARTNERS_INFO_FILE_ETC ); diff --git a/source/scripts/init/system/utopia_init.sh b/source/scripts/init/system/utopia_init.sh index e8620a00..05bb09c3 100755 --- a/source/scripts/init/system/utopia_init.sh +++ b/source/scripts/init/system/utopia_init.sh @@ -655,6 +655,11 @@ if [ "$FACTORY_RESET_REASON" = "true" ]; then syscfg set X_RDKCENTRAL-COM_LastRebootReason "FirmwareDownloadAndFactoryReset" syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" rm -f /nvram/.image_upgrade_and_FR_done + elif [ -f "/nvram/.Invalid_PartnerID" ]; then + echo "[utopia][init] Detected last reboot reason as Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootReason "Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" + rm -f /nvram/.Invalid_PartnerID else echo_t "[utopia][init] Detected last reboot reason as factory-reset" if [ -e "/usr/bin/onboarding_log" ]; then diff --git a/source/scripts/init/system/utopia_init_hub4.sh b/source/scripts/init/system/utopia_init_hub4.sh index 6e191e15..9239aa45 100755 --- a/source/scripts/init/system/utopia_init_hub4.sh +++ b/source/scripts/init/system/utopia_init_hub4.sh @@ -542,10 +542,17 @@ echo "[utopia][init] Detected last reboot reason from driver as $LastRebootReaso echo "" > /proc/skyrbd if [ "$FACTORY_RESET_REASON" = "true" ]; then - echo "[utopia][init] Detected last reboot reason as factory-reset" + if [ -f "/nvram/.Invalid_PartnerID" ]; then + echo "[utopia][init] Detected last reboot reason as Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootReason "Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" + rm -f /nvram/.Invalid_PartnerID + else + echo "[utopia][init] Detected last reboot reason as factory-reset" - syscfg set X_RDKCENTRAL-COM_LastRebootReason "factory-reset" - syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" + syscfg set X_RDKCENTRAL-COM_LastRebootReason "factory-reset" + syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" + fi else #Check last reboot reasons case "$LastRebootReason" in diff --git a/source/scripts/init/system/utopia_init_xb6.sh b/source/scripts/init/system/utopia_init_xb6.sh index ac64af33..d899a82c 100755 --- a/source/scripts/init/system/utopia_init_xb6.sh +++ b/source/scripts/init/system/utopia_init_xb6.sh @@ -791,6 +791,11 @@ if [ "$FACTORY_RESET_REASON" = "true" ]; then syscfg set X_RDKCENTRAL-COM_LastRebootReason "FirmwareDownloadAndFactoryReset" syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" rm -f /nvram/.image_upgrade_and_FR_done + elif [ -f "/nvram/.Invalid_PartnerID" ]; then + echo "[utopia][init] Detected last reboot reason as Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootReason "Reboot-DueTo-InvalidPartnerID" + syscfg set X_RDKCENTRAL-COM_LastRebootCounter "1" + rm -f /nvram/.Invalid_PartnerID else echo "[utopia][init] Detected last reboot reason as factory-reset" if [ -e "/usr/bin/onboarding_log" ]; then From 1074c4438b0686647008fd2e67cc10e4d6a424ab Mon Sep 17 00:00:00 2001 From: ap934 Date: Tue, 9 Sep 2025 18:23:50 +0530 Subject: [PATCH 2/2] RDKDEV-1132, RDKBACCL-846: Migrate scripts from RPI to BPI Reason for change: Migrate scripts from RPI to BPI Test Procedure: Image should bootup and all functionality should work Risks: Low Signed-off-by: ap934 --- source/scripts/init/service.d/lan_handler.sh | 10 +++++----- source/scripts/init/service.d/service_dhcp_server.sh | 8 ++++---- .../service_dhcp_server/dhcp_server_functions.sh | 2 +- source/scripts/init/service.d/service_forwarding.sh | 6 +++--- source/scripts/init/service.d/service_ipv4.sh | 2 +- source/scripts/init/service.d/service_mcastproxy.sh | 2 +- source/scripts/init/service.d/service_sshd.sh | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/scripts/init/service.d/lan_handler.sh b/source/scripts/init/service.d/lan_handler.sh index 5067f14d..6c020d9a 100755 --- a/source/scripts/init/service.d/lan_handler.sh +++ b/source/scripts/init/service.d/lan_handler.sh @@ -349,7 +349,7 @@ case "$1" in echo_t "THE INSTANT=$INST" echo_t "THE INSTANT=$INST" #(use a simpler test than this -- but Hacky, since it assumes everything we want is not XB3!!)if [ "$BOX_TYPE" = "TCCBR" ] || [ "$BOX_TYPE" = "XB6" -a "$MANUFACTURE" = "Technicolor" ] || [ "$BOX_TYPE" = "XB7" -a "$MANUFACTURE" = "Technicolor" ] ; then - if ( [ "$BOX_TYPE" != "XB3" ] && ( [ "$MANUFACTURE" = "Technicolor" ] || [ "$MANUFACTURE" = "Sercomm" ] ) ) || [ "$BOX_TYPE" = "rpi" ] ; then + if ( [ "$BOX_TYPE" != "XB3" ] && ( [ "$MANUFACTURE" = "Technicolor" ] || [ "$MANUFACTURE" = "Sercomm" ] ) ) || [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then COUNTER=1 while [ $COUNTER -lt 10 ]; do echo_t "RDKB_SYSTEM_BOOT_UP_LOG : INST returned null , retrying $COUNTER" @@ -393,7 +393,7 @@ case "$1" in sysevent set homesecurity_lan_l3net ${HSINST} sysevent set primary_lan_l3net ${INST} #BRLAN0 ISSUE : Manually invoking lan-start to fix brlan0 failure during intial booting. Root cause for event has to be identified - if [ "$RPI_SPECIFIC" = "rpi" ]; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then sleep 2 L3NET=`sysevent get primary_lan_l3net` if [ -z "$L3NET" ]; then @@ -418,7 +418,7 @@ case "$1" in # Laninit complete happens as part of the service_dhcp_server.sh itself.Firewall restart happens as part of service_ip4 itself.In the above code we #are setting many sysevents related to LAN hence adding the lan_init complete logs here.Also as oer the logs , we moving to bring the eth interface after this.Hence lan in # compelte can brought in here. - if [ "$RPI_SPECIFIC" = "rpi" ]; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then if [ -e "/usr/bin/print_uptime" ]; then /usr/bin/print_uptime "Laninit_complete" fi @@ -502,11 +502,11 @@ case "$1" in ;; lan-start) - if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "HUB4" ] || [ "$BOX_TYPE" = "SR213" ] || [ "$BOX_TYPE" = "SCER11BEL" ]; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ] || [ "$BOX_TYPE" = "HUB4" ] || [ "$BOX_TYPE" = "SR213" ] || [ "$BOX_TYPE" = "SCER11BEL" ]; then L3Net=`sysevent get primary_lan_l3net` if [ -z "$L3Net" ]; then echo_t "RDKB_SYSTEM_BOOT_UP_LOG : L3Net is null" - if [ "$RPI_SPECIFIC" = "rpi" ]; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then L3Net=4 sysevent set primary_lan_l3net $L3Net else diff --git a/source/scripts/init/service.d/service_dhcp_server.sh b/source/scripts/init/service.d/service_dhcp_server.sh index 5c5dac0a..95ba8b86 100755 --- a/source/scripts/init/service.d/service_dhcp_server.sh +++ b/source/scripts/init/service.d/service_dhcp_server.sh @@ -451,7 +451,7 @@ dhcp_server_start () return 1 fi - if [ "$BOX_TYPE" != "rpi" ] && [ "$BOX_TYPE" != "turris" ]; then + if [ "$BOX_TYPE" != "rpi" ] && [ "$BOX_TYPE" != "bpi" ] && [ "$BOX_TYPE" != "turris" ]; then DHCP_STATE=`sysevent get lan_status-dhcp` #if [ "started" != "$CURRENT_LAN_STATE" ] ; then if [ "started" != "$DHCP_STATE" ] ; then @@ -591,7 +591,7 @@ dhcp_server_start () if [ $? -eq 0 ]; then echo_t "$SERVER process started successfully" else - if [ "$BOX_TYPE" = "XB6" ] || [ "$BOX_TYPE" = "PUMA7_CGP" ] || [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "turris" ] ; then + if [ "$BOX_TYPE" = "XB6" ] || [ "$BOX_TYPE" = "PUMA7_CGP" ] || [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ] || [ "$BOX_TYPE" = "turris" ] ; then COUNTER=0 while [ $COUNTER -lt 5 ]; do @@ -622,7 +622,7 @@ dhcp_server_start () if [ "$PSM_MODE" != "1" ]; then if [ -f "/var/tmp/.refreshlan" ];then echo_t "RDKB_SYSTEM_BOOT_UP_LOG : Call gw_lan_refresh_from_dhcpscript:`uptime | cut -d "," -f1 | tr -d " \t\n\r"`" - if [ "$BOX_TYPE" = "rpi" ]; then + if [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then reset_eth_usb_ports else gw_lan_refresh & @@ -631,7 +631,7 @@ dhcp_server_start () elif [ ! -f "/var/tmp/lan_not_restart" ] && [ "$1" != "lan_not_restart" ]; then if [ x"ready" = x`sysevent get start-misc` ]; then echo_t "RDKB_SYSTEM_BOOT_UP_LOG : Call gw_lan_refresh_from_dhcpscript:`uptime | cut -d "," -f1 | tr -d " \t\n\r"`" - if [ "$BOX_TYPE" = "rpi" ]; then + if [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then reset_eth_usb_ports else gw_lan_refresh & diff --git a/source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh b/source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh index b77ddbd2..94761641 100755 --- a/source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh +++ b/source/scripts/init/service.d/service_dhcp_server/dhcp_server_functions.sh @@ -1097,7 +1097,7 @@ fi fi fi - if [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "turris" ]; then + if [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ] || [ "$BOX_TYPE" = "turris" ]; then LAN_STATUS=`sysevent get lan-status` BRIDGE_MODE=`syscfg get bridge_mode` if [ "$LAN_STATUS" = "stopped" ] && [ $BRIDGE_MODE == 0 ]; then diff --git a/source/scripts/init/service.d/service_forwarding.sh b/source/scripts/init/service.d/service_forwarding.sh index a2aa1669..e62ac5f8 100755 --- a/source/scripts/init/service.d/service_forwarding.sh +++ b/source/scripts/init/service.d/service_forwarding.sh @@ -125,7 +125,7 @@ service_start () STATUS=`sysevent get wan-status` if [ "stopped" != "$STATUS" ] ; then ulog forwarding status "stopping wan" - if [ "$RPI_SPECIFIC" != "rpi" ] ; then + if [ "$RPI_SPECIFIC" != "rpi" ] && [ "$BOX_TYPE" != "bpi" ] ; then sysevent set wan-stop fi wait_till_state wan stopped @@ -146,7 +146,7 @@ service_start () done fi - if [ "$RPI_SPECIFIC" = "rpi" ] ; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then LAN_STATUS=`sysevent get lan-status` if [ "$LAN_STATUS" = "stopped" ] ; then router_mode @@ -175,7 +175,7 @@ service_start () sysevent set firewall-restart else ulog forwarding status "starting wan" - if [ "$RPI_SPECIFIC" = "rpi" ] ; then + if [ "$RPI_SPECIFIC" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then STATUS=`sysevent get wan-status` if [ "started" != "$STATUS" ] ; then sysevent set wan-start diff --git a/source/scripts/init/service.d/service_ipv4.sh b/source/scripts/init/service.d/service_ipv4.sh index d41797bd..f3004e1c 100755 --- a/source/scripts/init/service.d/service_ipv4.sh +++ b/source/scripts/init/service.d/service_ipv4.sh @@ -129,7 +129,7 @@ handle_l2_status () { fi fi fi - if [ "$BOX_TYPE" = "rpi" ]; then + if [ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]; then LAN_STATUS=`sysevent get lan-status` if [ "$LAN_STATUS" = "stopped" ]; then echo_t "service_ipv4 : Starting lan-status" diff --git a/source/scripts/init/service.d/service_mcastproxy.sh b/source/scripts/init/service.d/service_mcastproxy.sh index a5e78523..1185bd79 100755 --- a/source/scripts/init/service.d/service_mcastproxy.sh +++ b/source/scripts/init/service.d/service_mcastproxy.sh @@ -113,7 +113,7 @@ fi else cat $LOCAL_CONF_FILE > $CONF_FILE rm -f $LOCAL_CONF_FILE - if [ "$BOX_TYPE" = "HUB4" ] || [ "$BOX_TYPE" = "SR300" ] || [ "$BOX_TYPE" = "SE501" ] || [ "$BOX_TYPE" = "SR213" ] || [ "$BOX_TYPE" == "WNXL11BWL" ] || [ "$BOX_TYPE" == "rpi" ] || [ "$BOX_TYPE" == "SCER11BEL" ]; then + if [ "$BOX_TYPE" = "HUB4" ] || [ "$BOX_TYPE" = "SR300" ] || [ "$BOX_TYPE" = "SE501" ] || [ "$BOX_TYPE" = "SR213" ] || [ "$BOX_TYPE" == "WNXL11BWL" ] || [ "$BOX_TYPE" == "rpi" ] || [ "$BOX_TYPE" == "bpi" ] || [ "$BOX_TYPE" == "SCER11BEL" ]; then $BIN $CONF_FILE & else $BIN -c $CONF_FILE & diff --git a/source/scripts/init/service.d/service_sshd.sh b/source/scripts/init/service.d/service_sshd.sh index 287a99d3..e67deee0 100755 --- a/source/scripts/init/service.d/service_sshd.sh +++ b/source/scripts/init/service.d/service_sshd.sh @@ -209,7 +209,7 @@ do_start() { fi else CM_IP="" - if ([ "$BOX_TYPE" = "rpi" ]) ;then + if ([ "$BOX_TYPE" = "rpi" ] || [ "$BOX_TYPE" = "bpi" ]) ;then #for Raspberry-pi, use the ipv4 address as default for ssh CM_IP=`ip -4 addr show dev $CMINTERFACE scope global | awk '/inet/{print $2}' | cut -d '/' -f1` else