Skip to content

Commit

Permalink
source installed: add ability to amend config values
Browse files Browse the repository at this point in the history
Add ability to enable/disable config entry or set it to 'm'.

Signed-off-by: Konstantin Olshanov <[email protected]>
  • Loading branch information
Konstantin Olshanov committed Oct 25, 2024
1 parent 8e6d4bc commit 22c0a4c
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ class SourceInstallerSchema(BaseInstallerSchema):
),
)

# Config options
kernel_config_enable: List[str] = field(default_factory=list)
kernel_config_disable: List[str] = field(default_factory=list)
kernel_config_module: List[str] = field(default_factory=list)


class SourceInstaller(BaseInstaller):
_code_path: PurePath

Expand Down Expand Up @@ -191,9 +197,13 @@ def install(self) -> str:

kconfig_file = runbook.kernel_config_file
local_version = runbook.kernel_local_version
kconfig_enable = runbook.kernel_config_enable
kconfig_disable = runbook.kernel_config_disable
kconfig_module = runbook.kernel_config_module
self._build_code(
node=node, code_path=self._code_path, kconfig_file=kconfig_file,
local_version=local_version
local_version=local_version, kconfig_enable=kconfig_enable,
kconfig_disable=kconfig_disable, kconfig_module=kconfig_module,
)

self._install_build(node=node, code_path=self._code_path)
Expand Down Expand Up @@ -274,7 +284,16 @@ def _modify_code(self, node: Node, code_path: PurePath) -> None:
self._log.debug(f"modifying code by {modifier.type_name()}")
modifier.modify()

def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str, local_version: str) -> None:
def _build_code(
self,
node: Node,
code_path: PurePath,
kconfig_file: str,
local_version: str,
kconfig_enable: list[str],
kconfig_disable: list[str],
kconfig_module: list[str],
) -> None:
self._log.info("building code...")

uname = node.tools[Uname]
Expand Down Expand Up @@ -340,6 +359,30 @@ def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str, local_
)
result.assert_exit_code()

for config_option in kconfig_enable:
result = node.execute(
f"scripts/config --enable {config_option}",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

for config_option in kconfig_disable:
result = node.execute(
f"scripts/config --disable {config_option}",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

for config_option in kconfig_module:
result = node.execute(
f"scripts/config --module {config_option}",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

# the gcc version of Redhat 7.x is too old. Upgrade it.
if isinstance(node.os, Redhat) and node.os.information.version < "8.0.0":
node.os.install_packages(["devtoolset-8"])
Expand Down

0 comments on commit 22c0a4c

Please sign in to comment.