diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml new file mode 100644 index 0000000..4cb370d --- /dev/null +++ b/.github/workflows/native-build.yml @@ -0,0 +1,27 @@ +name: Build MoCA Agent Component in Native Environment + +on: + push: + branches: [ main, 'sprint/**', 'release/**', develop ] + pull_request: + branches: [ main, 'sprint/**', 'release/**', topic/RDK*, develop ] + +jobs: + build-moca-agent-on-pr: + name: Build moca-agent component in github rdkcentral + runs-on: ubuntu-latest + container: + image: ghcr.io/rdkcentral/docker-rdk-ci:latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: native build + run: | + chmod +x cov_docker_script/run_setup_dependencies.sh + ./cov_docker_script/run_setup_dependencies.sh + chmod +x cov_docker_script/run_native_build.sh + ./cov_docker_script/run_native_build.sh + env: + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} diff --git a/CHANGELOG.md b/CHANGELOG.md index bfad6b3..3c95131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,16 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [2.0.0](https://github.com/rdkcentral/moca-agent/compare/1.0.0...2.0.0) +#### [2.1.0](https://github.com/rdkcentral/moca-agent/compare/2.0.0...2.1.0) + +- RDKB-62979 RDKB-62980: Native Build for Coverity [`#19`](https://github.com/rdkcentral/moca-agent/pull/19) +- RDKB-62979 RDKB-62980: Native Build for Coverity [`#17`](https://github.com/rdkcentral/moca-agent/pull/17) +- RDKB-62979 RDKB-62980: Native Build for Coverity [`#12`](https://github.com/rdkcentral/moca-agent/pull/12) +- Merge tag '2.0.0' into develop [`906b3bc`](https://github.com/rdkcentral/moca-agent/commit/906b3bc0598abc8b71f97f4969a802e8cffbe7bb) + +### [2.0.0](https://github.com/rdkcentral/moca-agent/compare/1.0.0...2.0.0) + +> 7 January 2026 - RDKB-61948 RDKB-62265 coverity issues in ccsp-moca [`#11`](https://github.com/rdkcentral/moca-agent/pull/11) - Update CODEOWNERS [`#9`](https://github.com/rdkcentral/moca-agent/pull/9) @@ -12,6 +21,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - Update CODEOWNERS [`#6`](https://github.com/rdkcentral/moca-agent/pull/6) - Deploy cla action [`#7`](https://github.com/rdkcentral/moca-agent/pull/7) - Update run_ut.sh [`#5`](https://github.com/rdkcentral/moca-agent/pull/5) +- Add changelog for release 2.0.0 [`48328e7`](https://github.com/rdkcentral/moca-agent/commit/48328e771045f2388bd5e2bc8fa1bbf4d6621b86) - Add execute permission to run_ut.sh [`fee10f7`](https://github.com/rdkcentral/moca-agent/commit/fee10f7cbe02988e4d038fbf020bf8444f9812d5) - Merge tag '1.0.0' into develop [`6604ea6`](https://github.com/rdkcentral/moca-agent/commit/6604ea65ca3442823e1886420771abcbc9a82c19) diff --git a/cov_docker_script/README.md b/cov_docker_script/README.md new file mode 100644 index 0000000..e06d1a2 --- /dev/null +++ b/cov_docker_script/README.md @@ -0,0 +1,487 @@ +# Component Native Build Configuration + +**Coverity/Native build configuration for RDK-B components.** + +--- + +## 📋 Overview + +This directory contains the configuration and wrapper scripts necessary for building RDK-B components in a native (non-Yocto) environment. This setup enables Coverity static analysis and validates that components can be built with explicitly declared dependencies. + +### Directory Contents + +``` +/cov_docker_script/ +├── README.md # This file +├── component_config.json # Dependency & build configuration +├── configure_options.conf # Autotools configure flags (optional) +├── run_setup_dependencies.sh # Wrapper: Setup build tools & dependencies +├── run_native_build.sh # Wrapper: Build main component +└── run_external_build.sh # Wrapper: For dependency builds (used in component_config.json) +``` + +### Important: Add to .gitignore + +Add the following to your component's `.gitignore` to exclude temporary build artifacts: + +```gitignore +# Build tools (downloaded by wrapper scripts) +build_tools_workflows/ + +# Dependency build artifacts +build/ +``` + +--- + +## 🚀 Quick Start + +### Prerequisites + +- Docker container with [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) image +- All wrapper scripts have execute permissions + +### Build Commands + +#### Complete Build Pipeline + +```bash +# From your component root directory +cd /path/to/your-component + +# Standard build pipeline for main component +./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh + +# Clean build (removes previous artifacts) +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh +./cov_docker_script/run_native_build.sh +``` + +#### Alternative: Single-Script Build (All-in-One) + +If you prefer to run everything in a single command: + +```bash +# Run setup dependencies + native build in one script +./cov_docker_script/run_external_build.sh + +# Clean build +CLEAN_BUILD=true ./cov_docker_script/run_external_build.sh +``` + +**Note:** `run_external_build.sh` performs both dependency setup and component build in one execution. While primarily designed to be invoked by the dependency setup process when specified in `component_config.json` (see [run_external_build.sh](#3-run_external_buildsh) section), it can also be used directly for the main component as a convenience script that handles the complete build pipeline. + +#### Individual Steps + +```bash +# Step 1: Setup dependencies only +./cov_docker_script/run_setup_dependencies.sh + +# Step 2: Build component only (requires Step 1 completed) +./cov_docker_script/run_native_build.sh +``` + +--- + +## 📖 Scripts Reference + +### 1. run_setup_dependencies.sh + +**Purpose:** Sets up build tools and runs dependency setup. + +**What it does:** +1. Clones `build_tools_workflows` repository (develop branch) +2. Verifies required scripts are present +3. Runs `setup_dependencies.sh` from build_tools_workflows with config path to: + - Clone all dependency repositories + - Copy headers to `$HOME/usr/include/rdkb/` + - Build and install dependency libraries +4. Leaves build_tools_workflows in place for run_native_build.sh + +**Usage:** +```bash +./run_setup_dependencies.sh + +# Clean build +CLEAN_BUILD=true ./run_setup_dependencies.sh +``` + +**Required files:** +- `component_config.json` (defines dependencies) + +**Outputs:** +- Downloads: `$HOME/build/` (dependency repositories) +- Headers: `$HOME/usr/include/rdkb/` +- Libraries: `$HOME/usr/local/lib/`, `$HOME/usr/lib/` +- build_tools_workflows: Remains in place for run_native_build.sh + +**Environment Variables:** +- `BUILD_DIR` - Override build directory (default: `$HOME/build`) +- `USR_DIR` - Override install directory (default: `$HOME/usr`) +- `CLEAN_BUILD` - Set to `true` to remove previous builds + +--- + +### 2. run_native_build.sh + +**Purpose:** Verifies build tools and builds the component. + +**What it does:** +1. Verifies `build_tools_workflows` directory exists (cloned by `run_setup_dependencies.sh`) +2. Verifies `build_native.sh` is present +3. Runs `build_native.sh` from build_tools_workflows with config and component paths to: + - Apply patches to source code + - Configure build environment + - Build component + - Install libraries +4. Cleans up build_tools_workflows directory + +**Usage:** +```bash +./run_native_build.sh +``` + +**Prerequisites:** +- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) +- All dependency headers/libraries must be available + +**Required files:** +- `component_config.json` (defines component build settings) +- `configure_options.conf` (autotools configuration) + +**Outputs:** +- Component libraries in `$HOME/usr/local/lib/` +- Build artifacts in component root directory + +--- + +### 3. run_external_build.sh + +**Purpose:** Builds dependencies with complex build requirements (invoked from component_config.json). + +**Key Differences from run_native_build.sh:** +- Designed for **dependency repositories**, not the main component +- Invokes `common_external_build.sh` without arguments (dependencies manage their own configuration) +- Does **NOT** clean up `build_tools_workflows` (may be used by multiple dependencies) +- Typically called automatically during dependency setup, not manually + +**What it does:** +1. Clones `build_tools_workflows` if not present (or verifies it exists) +2. Verifies `common_external_build.sh` is present +3. Runs `common_external_build.sh` from build_tools_workflows +4. Preserves `build_tools_workflows` directory for subsequent use + +**Usage:** +```bash +./run_external_build.sh +``` + +**Prerequisites:** +- `run_setup_dependencies.sh` must be run first (to clone build_tools_workflows) +- All dependency headers/libraries must be available + +**Outputs:** +- Build artifacts based on common_external_build.sh implementation +- build_tools_workflows remains in place (not cleaned up) + +**Primary Use Case - Dependency Builds in component_config.json:** + +This script is primarily used to build **dependency repositories** that have complex build requirements. When a dependency has its own `cov_docker_script/run_external_build.sh`, it can be invoked from the parent component's `component_config.json`. + +**Example configuration in component_config.json:** + +```json +{ + "name": "Utopia", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "feature/cov_native_build", + "header_paths": [ + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "script", + "script": "cov_docker_script/run_external_build.sh" + } +} +``` + +**How it works for dependencies:** +1. The parent component's `setup_dependencies.sh` clones the dependency repository (e.g., Utopia) +2. The dependency's `run_external_build.sh` is executed from the dependency's directory +3. This script internally: + - Sets up the dependency's own build tools and dependencies + - Runs the dependency's native build process + - Produces shared libraries (`.so` files) +4. The generated shared libraries are installed to `$HOME/usr/local/lib/` or `$HOME/usr/lib/` +5. These libraries are then available for the parent component's native build + +**When to use this approach:** +- Dependency has complex multi-step build requirements +- Dependency has its own sub-dependencies that need to be built +- Dependency requires custom build logic beyond standard autotools/cmake/meson +- Dependency repository already has a `cov_docker_script/run_external_build.sh` script + +**Note:** This approach allows dependencies to manage their own complete build pipeline, producing the necessary shared libraries that the parent component links against during its native compilation. + +--- + +## 📝 Configuration Files + +### component_config.json + +**JSON configuration defining all dependencies and build settings.** + +**Key Sections:** + +1. **dependencies.repos[]** - External dependencies required by your component + ```json + { + "name": "rbus", + "repo": "https://github.com/rdkcentral/rbus.git", + "branch": "v2.7.0", + "header_paths": [...], + "build": {...} + } + ``` + +2. **native_component** - Component build configuration + ```json + { + "name": "your-component", + "build": { + "type": "autotools", + "configure_options_file": "cov_docker_script/configure_options.conf" + } + } + ``` + +**Example Dependencies:** +Your component may require dependencies such as: +- rbus +- rdk_logger +- safec +- common-library +- halinterface +- And other component-specific dependencies + +See [component_config.json](component_config.json) for your component's specific dependency configuration. + +--- + +### configure_options.conf + +**Autotools configuration file with preprocessor, compiler, and linker flags.** + +**Format:** +```properties +[CPPFLAGS] +-I$HOME/usr/include/rdkb/ +-DFEATURE_FLAG + +[CFLAGS] +-Wall -Wextra + +[LDFLAGS] +-L$HOME/usr/local/lib/ +``` + +**Sections:** +- `[CPPFLAGS]` - Preprocessor flags (includes `-I`, defines `-D`) +- `[CFLAGS]` - C compiler flags +- `[CXXFLAGS]` - C++ compiler flags +- `[LDFLAGS]` - Linker flags (library paths `-L`, linker options `-Wl`) + +**Component-Specific Flags:** +Customize flags based on your component's requirements: +- Platform defines: `_COSA_INTEL_USG_ARM_`, `_COSA_BCM_ARM_`, etc. +- Product defines: `_XB6_PRODUCT_REQ_`, `_XB7_PRODUCT_REQ_`, etc. +- Feature flags: `FEATURE_SUPPORT_RDKLOG`, component-specific features, etc. + +See [configure_options.conf](configure_options.conf) for your component's complete flag list. + +--- + +## 🔧 Build System Architecture + +``` +┌─────────────────────────────────────────────────────┐ +│ run_setup_dependencies.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Clone build_tools_workflows │ │ +│ │ (develop branch) │ │ +│ │ │ │ +│ │ 2. Verify required scripts present │ │ +│ │ │ │ +│ │ 3. Run setup_dependencies.sh from │ │ +│ │ build_tools_workflows with config path │ │ +│ │ - Read component_config.json │ │ +│ │ - Clone dependency repos │ │ +│ │ - Copy headers │ │ +│ │ - Build & install libraries │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ + │ + ▼ +┌─────────────────────────────────────────────────────┐ +│ run_native_build.sh │ +│ ┌──────────────────────────────────────────────┐ │ +│ │ 1. Verify build_tools_workflows exists │ │ +│ │ (cloned by run_setup_dependencies.sh) │ │ +│ │ │ │ +│ │ 2. Run build_native.sh from │ │ +│ │ build_tools_workflows with config and │ │ +│ │ component directory paths │ │ +│ │ - Process component headers │ │ +│ │ - Apply source patches (if configured) │ │ +│ │ - Read configure_options.conf │ │ +│ │ - Configure build (autogen/configure) │ │ +│ │ - Build component (make/cmake/meson) │ │ +│ │ - Install libraries │ │ +│ │ │ │ +│ │ 3. Cleanup build_tools_workflows directory │ │ +│ └──────────────────────────────────────────────┘ │ +└─────────────────────────────────────────────────────┘ +``` + +--- + +## 🐛 Troubleshooting + +### Build Failures + +**Problem:** Missing headers + +```bash +# Solution: Check if dependencies were installed +ls -la $HOME/usr/include/rdkb/ + +# Verify component_config.json has correct header_paths +cat component_config.json | jq '.dependencies.repos[].header_paths' + +# Re-run dependency setup +CLEAN_BUILD=true ./cov_docker_script/run_setup_dependencies.sh +``` + +**Problem:** Missing libraries + +```bash +# Solution: Check library installation +ls -la $HOME/usr/local/lib/ +ls -la $HOME/usr/lib/ + +# Verify PKG_CONFIG_PATH +echo $PKG_CONFIG_PATH + +# Check if dependency build failed +cd $HOME/build/ +cat config.log # For autotools +cat build/meson-log.txt # For meson +``` + +**Problem:** Configure errors + +```bash +# Solution: Check configure_options.conf syntax +cat cov_docker_script/configure_options.conf + +# Verify flags are valid +./configure --help +``` + +### Script Errors + +**Problem:** Script not found + +```bash +# Solution: Ensure scripts are executable +chmod +x cov_docker_script/*.sh + +# Check if build_tools_workflows was cloned +ls -la ../build_tools_workflows/ +``` + +**Problem:** Permission denied + +```bash +# Solution: Fix container permissions +# (Run on host, not in container) +sudo docker exec rdkb-builder groupadd $USER --gid=$(id -g $USER) +sudo docker exec rdkb-builder useradd -m $USER -G users \ + --uid=$(id -u $USER) --gid=$(id -g $USER) +``` + +--- + +## 📚 Related Documentation + +- **Build Tools Repository:** [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/tree/develop) +- **Docker Environment:** [docker-rdk-ci](https://github.com/rdkcentral/docker-rdk-ci) +- **Example Component:** [moca-agent](https://github.com/rdkcentral/moca-agent) (reference implementation) +- **Detailed Build Guide:** See `build_tools_workflows/cov_docker_script/README.md` + +--- + +## ⚠️ Important Notes + +### DO NOT Modify + +The following scripts are automatically copied from `build_tools_workflows` and **must not be modified locally**: + +- ❌ `build_native.sh` +- ❌ `common_build_utils.sh` +- ❌ `common_external_build.sh` +- ❌ `setup_dependencies.sh` + +Any changes will be overwritten when wrapper scripts run. + +### DO Modify + +The following files are component-specific and **should be customized**: + +- ✅ `component_config.json` - Dependency and build configuration +- ✅ `configure_options.conf` - Autotools flags +- ✅ `run_setup_dependencies.sh` - Wrapper script (if needed) +- ✅ `run_native_build.sh` - Wrapper script (if needed) + +--- + +## 🔄 Workflow Integration + +### Local Development + +```bash +# Make changes to source code +vim source/your_component.c + +# Rebuild component +CLEAN_BUILD=true ./cov_docker_script/run_native_build.sh +``` + +### CI/CD Integration + +This configuration is used by GitHub Actions to validate builds: + +```yaml +- name: Setup Dependencies + run: ./cov_docker_script/run_setup_dependencies.sh + +- name: Build Component + run: ./cov_docker_script/run_native_build.sh +``` + +See `.github/workflows/` for complete CI configuration. + +--- + +## 📞 Support + +For issues or questions: + +1. Check [Troubleshooting](#troubleshooting) section +2. Review [build_tools_workflows README](https://github.com/rdkcentral/build_tools_workflows/blob/develop/cov_docker_script/README.md) +3. Raise issue in your component repository or [build_tools_workflows](https://github.com/rdkcentral/build_tools_workflows/issues) + +--- + +**Last Updated:** January 2026 diff --git a/cov_docker_script/component_config.json b/cov_docker_script/component_config.json new file mode 100644 index 0000000..ef34891 --- /dev/null +++ b/cov_docker_script/component_config.json @@ -0,0 +1,251 @@ +{ + "_comment": "Component Build Configuration for Coverity/Native Builds", + "_version": "2.0", + "_description": "Defines dependencies and build settings for the native component", + +"dependencies": { + "_comment": "External repositories needed by this component", + "repos": [ + { + "name": "rbus", + "repo": "https://github.com/rdkcentral/rbus.git", + "branch": "v2.7.0", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb/rbus" }, + { "source": "src/rbus", "destination": "$HOME/usr/include/rdkb/rbus" }, + { "source": "src/core", "destination": "$HOME/usr/include/rdkb/rbus" }, + { "source": "src/rtmessage", "destination": "$HOME/usr/include/rdkb/rtmessage" } + ], + "build": { + "type": "cmake", + "build_dir": "build", + "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr -DCMAKE_PREFIX_PATH=/usr -DBUILD_FOR_DESKTOP=ON -DCMAKE_BUILD_TYPE=Debug" + } + }, + { + "name": "trower-base64", + "repo": "https://github.com/xmidt-org/trower-base64.git", + "branch": "v1.2.7", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "commands", + "commands": [ + "meson setup build --prefix=$HOME/usr", + "meson compile -C build" + ] + } + }, + { + "name": "jsoncpp", + "repo": "https://github.com/open-source-parsers/jsoncpp.git", + "branch": "master", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "cmake", + "build_dir": "build", + "cmake_flags": "-DCMAKE_INSTALL_PREFIX=$HOME/usr/local -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release" + } + }, + { + "name": "rdk_logger", + "repo": "https://github.com/rdkcentral/rdk_logger.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools" + } + }, + { + "name": "gmock-broadband", + "repo": "https://github.com/rdkcentral/gmock-broadband.git", + "branch": "develop", + "header_paths": [ + { "source": "docker_scripts/common_headers", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "libSyscallWrapper", + "repo": "https://github.com/rdkcentral/libSyscallWrapper.git", + "branch": "develop", + "header_paths": [ + { "source": "source", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "CPPFLAGS=\"-I$HOME/usr/include/rdkb\" LDFLAGS=\"-L$HOME/usr/local/lib\"" + } + }, + { + "name": "rdk-libunpriv", + "repo": "https://github.com/rdkcentral/rdk-libunpriv.git", + "branch": "develop", + "header_paths": [ + { "source": "source", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "CPPFLAGS=\"-I$HOME/usr/include/rdkb\" LDFLAGS=\"-L$HOME/usr/local/lib\"" + } + }, + { + "name": "WebconfigFramework", + "repo": "https://github.com/rdkcentral/WebconfigFramework.git", + "branch": "develop", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "CPPFLAGS=\"-I$HOME/usr/include/rdkb -I$HOME/usr/include/rdkb/rbus -I$HOME/usr/local/include -I$HOME/usr/include/rdkb/rtmessage\" LDFLAGS=\"-L$HOME/usr/local/lib -L$HOME/usr/lib\" LIBS=\"-lrbus -lrtMessage\"" + } + }, + { + "name": "telemetry", + "repo": "https://github.com/rdkcentral/telemetry.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "--enable-shared --disable-static CPPFLAGS=\"-I$HOME/usr/include/rdkb\" LDFLAGS=\"-L$HOME/usr/local/lib -L$HOME/usr/lib -Wl,-rpath-link,$HOME/usr/local/lib\"" + } + }, + { + "name": "rdkb-halif-moca", + "repo": "https://github.com/rdkcentral/rdkb-halif-moca.git", + "branch": "main", + "header_paths": [ + { "source": "include", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "hal_moca", + "repo": "https://github.com/rdkcentral/hardware-abstraction-layer.git", + "branch": "develop", + "build": { + "type": "commands", + "commands": [ + "./autogen.sh", + "./configure", + "make -C source/moca CPPFLAGS=\"-I$HOME/usr/include/rdkb\" LDFLAGS=\"-L$HOME/usr/local/lib\"" + ] + } + }, + { + "name": "OvsAgent", + "repo": "https://github.com/rdkcentral/open-virtual-switch-agent.git", + "branch": "main", + "header_paths": [ + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "hotspot", + "repo": "https://github.com/rdkcentral/hotspot.git", + "branch": "main", + "header_paths": [ + { "source": "source/HotspotApi", "destination": "$HOME/usr/include/rdkb" } + ] + }, + { + "name": "common-library", + "repo": "https://github.com/rdkcentral/common-library.git", + "branch": "develop", + "header_paths": [ + { "source": "source/ccsp/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/components/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/custom", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/cosa/include/linux", "destination": "$HOME/usr/include/rdkb/linux" }, + { "source": "source/cosa/package/slap/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/debug_api/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/util_api/http/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/util_api/ansc/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/ccsp/components/common/MessageBusHelper/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/dm_pack", "destination": "$HOME/usr/include/rdkb" } + ], + "source_patches": [ + { + "file": "source/ccsp/include/ccsp_message_bus.h", + "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", + "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" + }, + { + "file": "$HOME/usr/include/rdkb/ccsp_message_bus.h", + "search": "typedef struct _CCSP_MESSAGE_BUS_CONNECTION", + "replace": "typedef struct DBusLoop DBusLoop;\n\ntypedef struct _CCSP_MESSAGE_BUS_CONNECTION" + } + ], + "build": { + "type": "script", + "script": "cov_docker_script/run_external_build.sh" + } + }, + { + "name": "core-net-library", + "repo": "https://github.com/rdkcentral/core-net-library.git", + "branch": "main", + "header_paths": [ + { "source": "source", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "autotools", + "configure_flags": "CPPFLAGS=\"-I$HOME/usr/include/rdkb -DSAFEC_DUMMY_API\" LDFLAGS=\"-L$HOME/usr/local/lib\"" + } + }, + { + "name": "Utopia", + "repo": "https://github.com/rdkcentral/utopia.git", + "branch": "develop", + "header_paths": [ + { "source": "source/include/sysevent", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/include/syscfg", "destination": "$HOME/usr/include/rdkb/syscfg" }, + { "source": "source/include", "destination": "$HOME/usr/include/rdkb/utctx" }, + { "source": "source/include", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/utapi/lib", "destination": "$HOME/usr/include/rdkb/utapi" }, + { "source": "source/include/ulog", "destination": "$HOME/usr/include/rdkb/ulog" }, + { "source": "source/util/utils", "destination": "$HOME/usr/include/rdkb" }, + { "source": "source/sysevent/lib", "destination": "$HOME/usr/include/rdkb/sysevent" }, + { "source": "source/util/print_uptime", "destination": "$HOME/usr/include/rdkb" } + ], + "build": { + "type": "script", + "script": "cov_docker_script/run_external_build.sh" + } + }, + { + "name": "breakpad_wrapper", + "repo": "https://github.com/rdkcentral/breakpad_wrapper.git", + "branch": "main", + "header_paths": [ + { "source": ".", "destination": "$HOME/usr/include/rdkb" } + ] + } + ] + }, + + "native_component": { + "_comment": "Configuration for the main component being built", + "name": "moca-agent", + "include_path": "$HOME/usr/include/rdkb/", + "lib_output_path": "$HOME/usr/local/lib/", + "pre_build_commands": [ + { + "description": "Generate dm_pack_datamodel.c from XML", + "command": "python3 $HOME/usr/include/rdkb/dm_pack_code_gen.py config/TR181-MoCA.XML source/MoCASsp/dm_pack_datamodel.c" + } + ], + "build": { + "type": "autotools", + "configure_options_file": "cov_docker_script/configure_options.conf" + } + } +} diff --git a/cov_docker_script/configure_options.conf b/cov_docker_script/configure_options.conf new file mode 100644 index 0000000..88f933d --- /dev/null +++ b/cov_docker_script/configure_options.conf @@ -0,0 +1,140 @@ +# MoCA Agent Configure Options +# This file contains autotools configure options for the moca-agent component +# Each section can be edited independently for better maintainability + +# ============================================================================ +# CPPFLAGS - Preprocessor flags (includes and defines) +# ============================================================================ +[CPPFLAGS] +# Autotools configuration +-DHAVE_CONFIG_H + +# Include paths +-I$HOME/usr/include/rdkb/ +-I/usr/include/dbus-1.0 +-I/usr/lib/x86_64-linux-gnu/dbus-1.0/include + +# Core system defines +-DSAFEC_DUMMY_API +-D_COSA_HAL_ +-U_COSA_SIM_ +-DCONFIG_SYSTEM_MOCA + +# ANSC framework defines +-D_ANSC_LINUX +-D_ANSC_USER +-D_ANSC_LITTLE_ENDIAN_ +-D_ANSC_USE_OPENSSL_ +-D_ANSC_AES_USED_ +-D_NO_ANSC_ZLIB_ +-U_ANSC_IPV6_COMPATIBLE_ + +# CCSP/Component defines +-D_CCSP_CWMP_TCP_CONNREQ_HANDLER +-D_DSLH_STUN_ +-D_NO_PKI_KB5_SUPPORT +-D_BBHM_SSE_FILE_IO +-DCCSP_SUPPORT_ENABLED + +# Product/Platform defines +-D_COSA_INTEL_USG_ARM_ +-D_COSA_FOR_COMCAST_ +-D_COSA_BCM_ARM_ +-D_XB6_PRODUCT_REQ_ +-D_XB7_PRODUCT_REQ_ +-D_XB8_PRODUCT_REQ_ + +# Vendor/Customer configuration +-DCONFIG_VENDOR_CUSTOMER_COMCAST +-DCONFIG_CISCO_HOTSPOT + +# Security and debugging +-DENABLE_SA_KEY +-D_NO_EXECINFO_H_ +-D_DEBUG +-DINCLUDE_BREAKPAD + +# System features +-DFEATURE_SUPPORT_RDKLOG +-DFEATURE_SUPPORT_SYSLOG +-DBUILD_WEB +-DUSE_NOTIFY_COMPONENT +-DNTPD_ENABLE +-DUTC_ENABLE +-DUTC_ENABLE_ATOM +-DXDNS_ENABLE + +# MoCA specific +-DMOCA_HOME_ISOLATION +-DMOCA_DIAGONISTIC + +# Network features +-DENABLE_ETH_WAN +-DEROUTER_DHCP_OPTION_MTA +-DETH_4_PORTS +-D_2_5G_ETHERNET_SUPPORT_ +-D_MACSEC_SUPPORT_ +-D_BRIDGE_UTILS_BIN_ +-DAUTOWAN_ENABLE +-DENABLE_WANMODECHANGE_NOREBOOT +-DFEATURE_RDKB_WAN_MANAGER +-DFEATURE_RDKB_CONFIGURABLE_WAN_INTERFACE +-DWAN_MANAGER_UNIFICATION_ENABLED +-DWAN_FAILOVER_SUPPORTED +-DGATEWAY_FAILOVER_SUPPORTED + +# WiFi features +-D_ENABLE_BAND_STEERING_ +-D_BEACONRATE_SUPPORT +-D_TRI_BAND_WIFI_ +-D_WIFI_AX_SUPPORT_ +-D_WIFI_CONSOLIDATED_STANDARDS_ +-DWIFI_HAL_VERSION_3 +-DFEATURE_SUPPORT_MESH +-DFEATURE_SUPPORT_WEBCONFIG +-DFEATURE_SUPPORT_INTERWORKING +-DFEATURE_SUPPORT_PASSPOINT +-DWIFI_STATS_DISABLE_SPEEDTEST_RUNNING +-DFEATURE_SUPPORT_RADIUSGREYLIST +-DFEATURE_SUPPORT_ACL_SELFHEAL +-DFEATURE_CSI +-DFEATURE_SUPPORT_ONBOARD_LOGGING +-DFEATURE_OFF_CHANNEL_SCAN_5G +-DRDK_ONEWIFI +-DWIFI_MANAGE_SUPPORTED + +# Advanced features +-D_PSM_TRANS_RDK_TRIGG_ +-D_CM_HIGHSPLIT_SUPPORTED_ +-DFEATURE_RDKB_INTER_DEVICE_MANAGER +-DFEATURE_SUPPORT_MAPT_NAT46 +-DMAPT_UNIFICATION_ENABLED +-DSPEED_BOOST_SUPPORTED +-DAMENITIES_NETWORK_ENABLED + +# Test/Development +-DCOLUMBO_HWTEST + +# Build system +-DRBUS_BUILD_FLAG_ENABLE + +# Standard defines +-D_GNU_SOURCE +-D__USE_XOPEN + +# ============================================================================ +# CFLAGS - Compiler flags +# ============================================================================ +[CFLAGS] +-ffunction-sections +-fdata-sections +-fomit-frame-pointer +-fno-strict-aliasing + +# ============================================================================ +# LDFLAGS - Linker flags +# ============================================================================ +[LDFLAGS] +-L$HOME/usr/local/lib/ +-Wl,--allow-shlib-undefined +-Wl,--unresolved-symbols=ignore-all diff --git a/cov_docker_script/run_external_build.sh b/cov_docker_script/run_external_build.sh new file mode 100644 index 0000000..d6e9a21 --- /dev/null +++ b/cov_docker_script/run_external_build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# External Build Wrapper Script +# Verifies build tools and runs common_external_build.sh +# Usage: ./run_external_build.sh +# Note: run_setup_dependencies.sh should be executed first +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== External Build Pipeline =====" +echo "" + +# Clone build_tools_workflows if it doesn't exist +if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then + log "build_tools_workflows not found, cloning repository..." + cd "$NATIVE_COMPONENT_DIR" + git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } + ok "Repository cloned successfully" +else + log "build_tools_workflows already exists" +fi + +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" ]]; then + err "common_external_build.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." + exit 1 +fi + +log "Build script found, proceeding with build..." + +# Run common_external_build.sh from build_tools_workflows +echo "" +log "Running common_external_build.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/common_external_build.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" + +echo "" +ok "External build completed successfully!" + +echo "" diff --git a/cov_docker_script/run_native_build.sh b/cov_docker_script/run_native_build.sh new file mode 100755 index 0000000..9d3aea3 --- /dev/null +++ b/cov_docker_script/run_native_build.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Native Build Wrapper Script +# Verifies build tools and runs build_native.sh +# Usage: ./run_native_build.sh +# Note: run_setup_dependencies.sh should be executed first +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Native Build Pipeline =====" +echo "" + +# Verify build_tools_workflows exists (should be cloned by run_setup_dependencies.sh) +if [[ ! -d "$BUILD_TOOLS_DIR" ]]; then + err "build_tools_workflows directory not found. Please run run_setup_dependencies.sh first." + exit 1 +fi + +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" ]]; then + err "build_native.sh not found in build_tools_workflows. Please run run_setup_dependencies.sh first." + exit 1 +fi + +log "Build script found, proceeding with build..." + +# Run build_native.sh from build_tools_workflows +echo "" +log "Running build_native.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/build_native.sh" "$SCRIPT_DIR/component_config.json" "$NATIVE_COMPONENT_DIR" + +echo "" +ok "Native build completed successfully!" + +# Cleanup build_tools_workflows directory +log "Cleaning up build_tools_workflows directory..." +rm -rf "$BUILD_TOOLS_DIR" +ok "Cleanup completed" + +echo "" diff --git a/cov_docker_script/run_setup_dependencies.sh b/cov_docker_script/run_setup_dependencies.sh new file mode 100755 index 0000000..5223c84 --- /dev/null +++ b/cov_docker_script/run_setup_dependencies.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +set -e + +################################################################################ +# Setup Dependencies Wrapper Script +# Sets up build tools and runs setup_dependencies.sh +# Usage: ./run_setup_dependencies.sh +################################################################################ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +NATIVE_COMPONENT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +BUILD_TOOLS_REPO_URL="https://github.com/rdkcentral/build_tools_workflows" +BUILD_TOOLS_DIR="$NATIVE_COMPONENT_DIR/build_tools_workflows" +REQUIRED_SCRIPTS=("build_native.sh" "common_build_utils.sh" "common_external_build.sh" "setup_dependencies.sh") + +# Basic logging functions +log() { echo "[INFO] $*"; } +ok() { echo "[OK] $*"; } +err() { echo "[ERROR] $*" >&2; } + +echo "" +echo "===== Setup Dependencies Pipeline =====" +echo "" + +# Setup build tools +log "Setting up build tools..." + +# Clone build_tools_workflows +if [[ -d "$BUILD_TOOLS_DIR" ]]; then + log "build_tools_workflows already exists, skipping clone" +else + log "Cloning build_tools_workflows (develop)" + cd "$NATIVE_COMPONENT_DIR" + git clone -b develop "$BUILD_TOOLS_REPO_URL" || { err "Clone failed"; exit 1; } + ok "Repository cloned" +fi + +# Verify required scripts +[[ ! -d "$BUILD_TOOLS_DIR/cov_docker_script" ]] && { err "cov_docker_script not found"; exit 1; } + +log "Verifying required scripts..." +MISSING=() +for script in "${REQUIRED_SCRIPTS[@]}"; do + [[ -f "$BUILD_TOOLS_DIR/cov_docker_script/$script" ]] || MISSING+=("$script") +done + +if [[ ${#MISSING[@]} -gt 0 ]]; then + err "Missing scripts: ${MISSING[*]}" + exit 1 +fi +ok "All required scripts found" + +# Verify setup_dependencies.sh exists before running +if [[ ! -f "$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" ]]; then + err "setup_dependencies.sh not found in build_tools_workflows" + exit 1 +fi + +# Run setup_dependencies.sh from build_tools_workflows +echo "" +log "Running setup_dependencies.sh from build_tools_workflows..." +cd "$NATIVE_COMPONENT_DIR" +"$BUILD_TOOLS_DIR/cov_docker_script/setup_dependencies.sh" "$SCRIPT_DIR/component_config.json" + +echo "" +echo "[OK] Dependencies setup completed successfully!" +echo ""