Skip to content

RDKOSS-387: Add host_locked_sstate.bbclass - #91

Open
maniselva006c wants to merge 2 commits into
developfrom
feature/RDKOSS-387
Open

RDKOSS-387: Add host_locked_sstate.bbclass#91
maniselva006c wants to merge 2 commits into
developfrom
feature/RDKOSS-387

Conversation

@maniselva006c

Copy link
Copy Markdown
Contributor

Reason for the change:
This class enables leveraging a pre-populated locked sstate cache from the host machine or Docker container to avoid rebuilding native tools repeatedly, reducing overall build time. It supports both native and target components and allows configuration of the locked sstate path via HOST_LOCKED_SSTATE_PATH (default: /opt/locked_sstate).

Reason for the change:
This class enables leveraging a pre-populated locked sstate cache from the host
machine or Docker container to avoid rebuilding native tools repeatedly, reducing
overall build time. It supports both native and target components and allows
configuration of the locked sstate path via HOST_LOCKED_SSTATE_PATH (default: /opt/locked_sstate).

Signed-off-by: mselva006c <mani_selvaraj@comcast.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new BitBake class host_locked_sstate.bbclass to enable leveraging pre-populated locked sstate cache from the host machine or Docker container, reducing build time by avoiding repeated rebuilds of native tools.

Key Changes:

  • Introduces host_locked_sstate.bbclass with configurable locked sstate path via HOST_LOCKED_SSTATE_PATH (default: /opt/locked_sstate)
  • Implements automatic selection of appropriate locked-sigs files based on DEFAULTTUNE and MULTILIBS configuration
  • Adds sstate mirror configuration to point to the host locked sstate cache

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread classes/host_locked_sstate.bbclass Outdated
Comment thread classes/host_locked_sstate.bbclass Outdated
Comment on lines +40 to +44
# need to fix: Workaround to check for 64bit machine with multilib configuration
multilib_support = d.getVar('MULTILIBS') or ""

# Determine the correct sigs_file based on the configuration
if multilib_support:

Copilot AI Nov 14, 2025

Copy link

Choose a reason for hiding this comment

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

The comment "need to fix: Workaround to check for 64bit machine with multilib configuration" indicates this is a temporary solution that needs improvement. The current logic assumes that ANY multilib configuration means ARM64, which may not always be correct. Consider implementing a more robust detection mechanism that explicitly checks for ARM64 architecture rather than relying solely on the presence of MULTILIBS.

Suggested change
# need to fix: Workaround to check for 64bit machine with multilib configuration
multilib_support = d.getVar('MULTILIBS') or ""
# Determine the correct sigs_file based on the configuration
if multilib_support:
# Improved: Explicitly check for ARM64 architecture with multilib configuration
multilib_support = d.getVar('MULTILIBS') or ""
# Determine the correct sigs_file based on the configuration
if multilib_support and ("aarch64" in default_tune or "arm64" in default_tune):

Copilot uses AI. Check for mistakes.
# - SIGGEN_LOCKEDSIGS_TASKSIG_CHECK is set to "warn" to allow flexibility.
#
#==============================================================================

Copilot AI Nov 14, 2025

Copy link

Choose a reason for hiding this comment

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

Missing import statement for os module. The function get_locked_sig_file uses os.path.join() and os.path.exists() on lines 52-53, but the os module is not imported at the top of the file. This will cause a NameError when the function is executed.

Suggested change
import os

Copilot uses AI. Check for mistakes.
Comment thread classes/host_locked_sstate.bbclass Outdated
if os.path.exists(sigs_file_path):
return sigs_file_path
else:
bb.fatal("ERROR: The expected locked sigs file(%s) is not found" %sigs_file_path)

Copilot AI Nov 14, 2025

Copy link

Choose a reason for hiding this comment

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

The error message is redundant with "ERROR:" prefix. Since bb.fatal() already indicates a fatal error and will stop the build, adding "ERROR:" to the message is unnecessary. Consider simplifying to: bb.fatal("The expected locked sigs file (%s) is not found" % sigs_file_path). Also, add a space after "file" for readability.

Suggested change
bb.fatal("ERROR: The expected locked sigs file(%s) is not found" %sigs_file_path)
bb.fatal("The expected locked sigs file (%s) is not found" % sigs_file_path)

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 25, 2025 17:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


SIG_FILE = "${@get_locked_sig_file(d)}"
include ${SIG_FILE}
SSTATE_MIRRORS += "file://.* file:///${HOST_LOCKED_SSTATE_PATH}/PATH"

Copilot AI Nov 25, 2025

Copy link

Choose a reason for hiding this comment

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

The SSTATE_MIRRORS pattern appears incorrect. The literal string "PATH" should be replaced with the actual sstate path pattern. In BitBake, SSTATE_MIRRORS typically uses the format: "file://.* file:///${HOST_LOCKED_SSTATE_PATH}/PATH" where "PATH" is a placeholder that should be substituted with the actual path layout pattern (e.g., matching the SSTATE_DIR structure). Consider verifying this against BitBake documentation or using a tested pattern like "file://.* file:///${HOST_LOCKED_SSTATE_PATH}/" or the proper path substitution pattern.

Suggested change
SSTATE_MIRRORS += "file://.* file:///${HOST_LOCKED_SSTATE_PATH}/PATH"
SSTATE_MIRRORS += "file://.* file:///${HOST_LOCKED_SSTATE_PATH}/"

Copilot uses AI. Check for mistakes.
host_locked_sstate_path = d.expand('${HOST_LOCKED_SSTATE_PATH}')

default_tune = d.getVar('DEFAULTTUNE')
# need to fix: Workaround to check for 64bit machine with multilib configuration

Copilot AI Nov 25, 2025

Copy link

Choose a reason for hiding this comment

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

The comment "need to fix: Workaround to check for 64bit machine with multilib configuration" indicates this is a temporary solution that should be addressed. Consider creating a ticket to track the proper implementation or removing this comment if the current approach is acceptable long-term.

Suggested change
# need to fix: Workaround to check for 64bit machine with multilib configuration

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +51
if multilib_support:
sigs_file = "locked-sigs_rdk-arm64.inc"
elif "armv7athf-neon" in default_tune:
sigs_file = "locked-sigs_rdk-arm7a.inc"
elif "armv7vethf-neon" in default_tune:
sigs_file = "locked-sigs_rdk-arm7ve.inc"
else:
sigs_file = default_sigs_file

Copilot AI Nov 25, 2025

Copy link

Choose a reason for hiding this comment

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

The architecture-specific filenames ("locked-sigs_rdk-arm64.inc", "locked-sigs_rdk-arm7a.inc", "locked-sigs_rdk-arm7ve.inc") are hardcoded magic strings. Consider defining these as configurable variables (e.g., LOCKED_SIGS_ARM64_FILE, LOCKED_SIGS_ARM7A_FILE) to improve maintainability and allow easier customization for different projects or configurations.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants