Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ AM_CONDITIONAL(CCSP_PLATFORM_BCM, test "x$CCSP_PLATFORM" = xbcm)
AM_CONDITIONAL(CCSP_PLATFORM_INTEL_PUMA7, test "x$CCSP_PLATFORM" = xintel_puma7)
AM_CONDITIONAL([MULTILAN_FEATURE], [test "$MULTILAN_FEATURE" = "yes"])
AM_CONDITIONAL([CPC_FIREWALL_ENABLE], [test "x$CPC_FIREWALL_ENABLE" = "xtrue"])
AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], [test "x$ONESTACK_PRODUCT_REQ" = "xtrue"])
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], ...) only controls automake conditionals; it does not define a C preprocessor symbol. Since the code changes are guarded by #ifdef _ONESTACK_PRODUCT_REQ_, you’ll also need to define that macro when ONESTACK_PRODUCT_REQ=true (e.g., AS_IF + AC_DEFINE([_ONESTACK_PRODUCT_REQ_], [1], ...), or have the relevant Makefile add -D_ONESTACK_PRODUCT_REQ_).

Suggested change
AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], [test "x$ONESTACK_PRODUCT_REQ" = "xtrue"])
AM_CONDITIONAL([ONESTACK_PRODUCT_REQ], [test "x$ONESTACK_PRODUCT_REQ" = "xtrue"])
AS_IF([test "x$ONESTACK_PRODUCT_REQ" = "xtrue"], [
AC_DEFINE([_ONESTACK_PRODUCT_REQ_], [1],
[Define to 1 if OneStack product requirements are enabled])
])

Copilot uses AI. Check for mistakes.
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])

Expand Down
9 changes: 7 additions & 2 deletions source/scripts/init/src/apply_system_defaults/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ AUTOMAKE_OPTIONS = subdir-objects
AM_CFLAGS = -I$(top_srcdir)/source/include \
-I$(top_srcdir)/source/util \
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)/dbus-1.0 \
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include
-I${PKG_CONFIG_SYSROOT_DIR}$(libdir)/dbus-1.0/include \
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation on this line uses spaces, which is inconsistent with the rest of the Makefile that uses tabs. Line 24 and line 35 use tabs for indentation. For consistency, this line should also use tabs to match the existing code style.

Suggested change
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)
-I${PKG_CONFIG_SYSROOT_DIR}$(includedir)

Copilot uses AI. Check for mistakes.

AM_LDFLAGS = $(top_builddir)/source/services/lib/libsrvmgr.la \
$(top_builddir)/source/sysevent/lib/libsysevent.la \
Expand All @@ -31,7 +32,11 @@ AM_LDFLAGS = $(top_builddir)/source/services/lib/libsrvmgr.la \
$(top_builddir)/source/utctx/lib/libutctx.la \
-ltelemetry_msgsender \
-lcjson \
-lccsp_common $(DBUS_LIBS)
-lccsp_common $(DBUS_LIBS)

if ONESTACK_PRODUCT_REQ
AM_LDFLAGS += -L${PKG_CONFIG_SYSROOT_DIR}$(libdir) -ldevicemode -lonestack_syscfg -lonestack_log
endif

if PLATFORM_HAL_SYNDICATION
AM_LDFLAGS += "-lhal_platform -lsysevent -lutctx -lutapi -lhal_wifi"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* If not stated otherwise in this file or this component's Licenses.txt file the

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-3-Clause' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1812, 3391 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/rdk-dev-1812.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-3-Clause' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1904, 3433 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/rdk-dev-1904.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3541 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-TEST-RELEASE-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/1, 3541 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-1.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)

Check failure on line 2 in source/scripts/init/src/apply_system_defaults/apply_system_defaults.c

View workflow job for this annotation

GitHub Actions / call-fossid-workflow / Fossid Annotate PR

FossID License Issue Detected

Source code with 'BSD-Intel' license found in local file 'source/scripts/init/src/apply_system_defaults/apply_system_defaults.c' (Match: rdkb/components/opensource/ccsp/Utopia/rdkb/components/opensource/ccsp/Utopia/2, 3541 lines, url: https://code.rdkcentral.com/r/plugins/gitiles/rdkb/components/opensource/ccsp/Utopia/+archive/RDKB-RELEASE-TEST-DUNFELL-2.tar.gz, file: source/scripts/init/src/apply_system_defaults/apply_system_defaults.c)
* following copyright and licenses apply:
*
* Copyright 2015 RDK Management
Expand Down Expand Up @@ -59,6 +59,10 @@
#include <cjson/cJSON.h>
#include "safec_lib_common.h"

#ifdef _ONESTACK_PRODUCT_REQ_
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OneStack include is gated by _ONESTACK_PRODUCT_REQ_, but linking is gated by the BUILD_ONESTACKUTILS automake conditional. If _ONESTACK_PRODUCT_REQ_ is defined by the product build while --enable-onestackutils is not set, this will compile the call but omit -lonestackutils, leading to a link failure. Use a single feature flag for both compilation and linking (e.g., have configure.ac AC_DEFINE([HAVE_ONESTACKUTILS],1,...) when enabled and gate both the include/call and -lonestackutils on that).

Suggested change
#ifdef _ONESTACK_PRODUCT_REQ_
#ifdef HAVE_ONESTACKUTILS

Copilot uses AI. Check for mistakes.
#include <devicemode.h>
#endif

#include <telemetry_busmessage_sender.h>
#define PARTNERS_INFO_FILE "/nvram/partners_defaults.json"
#define PARTNERS_INFO_FILE_ETC "/etc/partners_defaults.json"
Expand Down Expand Up @@ -889,6 +893,13 @@
if( ( 0 == getFactoryPartnerId( PartnerID ) ) && ( PartnerID [ 0 ] != '\0' ) )
{
APPLY_PRINT("%s - PartnerID from HAL: %s\n",__FUNCTION__,PartnerID );
#ifdef _ONESTACK_PRODUCT_REQ_
// Override PartnerID if needed and set devicemode
// Must be called BEFORE set_syscfg_partner_values to ensure syscfg gets the correct PartnerID
APPLY_PRINT("%s - Calling onestackutils_override_partnerid_and_set_devicemode with PartnerID from HAL: %s\n", __FUNCTION__, PartnerID);
onestackutils_override_partnerid_and_set_devicemode(PartnerID);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to onestackutils_override_partnerid_and_set_devicemode does not include any error handling. If this function can fail or return an error code, that return value should be checked and appropriate error handling or logging should be added. If the function has a return value, consider checking it and logging an error if the operation fails.

Suggested change
onestackutils_override_partnerid_and_set_devicemode(PartnerID);
int os_ret = onestackutils_override_partnerid_and_set_devicemode(PartnerID);
if (os_ret != 0)
{
APPLY_PRINT("%s - ERROR: onestackutils_override_partnerid_and_set_devicemode failed with code %d for PartnerID from HAL: %s\n",
__FUNCTION__, os_ret, PartnerID);
}

Copilot uses AI. Check for mistakes.
APPLY_PRINT("%s - onestackutils_override_partnerid_and_set_devicemode completed. PartnerID from HAL: %s\n", __FUNCTION__, PartnerID);
#endif // _ONESTACK_PRODUCT_REQ_
Comment on lines +896 to +902
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are existing gtests for apply_system_defaults.c, but the new OneStack-specific PartnerID override/devicemode behavior in get_PartnerID isn’t covered. Add a unit test for the OneStack path (e.g., compile tests with the feature macro and provide a stub/mock for onestackutils_override_partnerid_and_set_devicemode) to verify it’s invoked and that the overridden PartnerID is what reaches syscfg.

Copilot uses AI. Check for mistakes.
validatePartnerId ( PartnerID );
}
else
Expand Down Expand Up @@ -941,9 +952,18 @@
sprintf( PartnerID, "%s", fileContent );

APPLY_PRINT("%s - PartnerID from File: %s\n",__FUNCTION__,PartnerID );
#ifdef _ONESTACK_PRODUCT_REQ_
// Override PartnerID if needed and set devicemode
// Must be called BEFORE set_syscfg_partner_values to ensure syscfg gets the correct PartnerID
APPLY_PRINT("%s - Calling onestackutils_override_partnerid_and_set_devicemode with PartnerID: %s\n", __FUNCTION__, PartnerID);
onestackutils_override_partnerid_and_set_devicemode(PartnerID);
APPLY_PRINT("%s - onestackutils_override_partnerid_and_set_devicemode completed. PartnerID: %s\n", __FUNCTION__, PartnerID);
Comment on lines +959 to +960
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to onestackutils_override_partnerid_and_set_devicemode does not include any error handling. If this function can fail or return an error code, that return value should be checked and appropriate error handling or logging should be added. If the function has a return value, consider checking it and logging an error if the operation fails.

Suggested change
onestackutils_override_partnerid_and_set_devicemode(PartnerID);
APPLY_PRINT("%s - onestackutils_override_partnerid_and_set_devicemode completed. PartnerID: %s\n", __FUNCTION__, PartnerID);
int rc = onestackutils_override_partnerid_and_set_devicemode(PartnerID);
if (rc != 0)
{
APPLY_PRINT("%s - ERROR: onestackutils_override_partnerid_and_set_devicemode failed with rc=%d for PartnerID: %s\n", __FUNCTION__, rc, PartnerID);
}
else
{
APPLY_PRINT("%s - onestackutils_override_partnerid_and_set_devicemode completed successfully. PartnerID: %s\n", __FUNCTION__, PartnerID);
}

Copilot uses AI. Check for mistakes.
#endif // _ONESTACK_PRODUCT_REQ_
Comment on lines +956 to +961
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OneStack override/devicemode call is duplicated in both the HAL and file-based PartnerID paths. Consider extracting this into a small helper (guarded by the same feature macro) so future changes (logging, error handling, ordering) don’t diverge between the two branches.

Copilot uses AI. Check for mistakes.

validatePartnerId ( PartnerID );
unlink("/nvram/.partner_ID");
}

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line contains trailing whitespace. Remove the trailing whitespace for consistency with coding standards.

Suggested change

Copilot uses AI. Check for mistakes.
set_syscfg_partner_values(PartnerID,"PartnerID");

//To print Facgtory PartnerID on every boot-up
Expand Down
Loading