diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-05-17 17:56:32 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-05-17 17:56:32 +0200 |
| commit | b956a4b265dc76f4441b7fe596a9f1efb1dc8b90 (patch) | |
| tree | 21b8e0c6e6a66b62c1bfe85c9cc45ec444b9c351 /scripts/package-build/linux-kernel | |
| parent | 82f47ed4be04f4ec0ff4f13c0a6d71688e93e14d (diff) | |
| download | vyos-build-b956a4b265dc76f4441b7fe596a9f1efb1dc8b90.tar.gz vyos-build-b956a4b265dc76f4441b7fe596a9f1efb1dc8b90.zip | |
Kernel: T8880: reduce size of Kernel source TAR
Enable "make mrproper" before packaging kernel source tarball. After enabling
PWRU support in T8496, the auto-generated kernel source tarball grew from under
1 GB to ~4 GB, largely due to intermediate build artifacts (for example,
vmlinuz.o growing from 54 MB to 618 MB with additional debug symbols).
Since the tarball is intended to contain kernel sources and custom patches and
not intermediate objects, we now clean the tree with "make mrproper" before
creating the tarball. This keeps package size down while preserving
rebuildability.
Diffstat (limited to 'scripts/package-build/linux-kernel')
| -rwxr-xr-x | scripts/package-build/linux-kernel/build.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py index e73b2519..6cb6f90f 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -113,12 +113,15 @@ def create_tarball(package_name, source_dir=None): print(f"I: Failed to create tarball for {package_name}: {e}") -def build_package(package: dict, dependencies: list) -> None: +def build_package(package: dict, dependencies: list, + linux_kernel_tarball: dict | None = None) -> None: """Build a package from the repository Args: package (dict): Package information dependencies (list): List of additional dependencies + linux_kernel_tarball (dict | None): If set, successful ``build_kernel`` fills this + for a final-stage tarball after all packages complete. """ timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') repo_name = package['name'] @@ -135,7 +138,11 @@ def build_package(package: dict, dependencies: list) -> None: # Execute the build command if package['build_cmd'] == 'build_kernel': source_dir = build_kernel(package['kernel_version']) - create_tarball(f'{package["name"]}-{package["kernel_version"]}', source_dir) + if linux_kernel_tarball is not None: + linux_kernel_tarball.clear() + linux_kernel_tarball['package_name'] = package['name'] + linux_kernel_tarball['kernel_version'] = package['kernel_version'] + linux_kernel_tarball['source_dir'] = source_dir elif package['build_cmd'] == 'build_linux_firmware': build_linux_firmware(package['commit_id'], package['scm_url']) create_tarball(f'{package["name"]}-{package["commit_id"]}', f'{package["name"]}') @@ -293,11 +300,24 @@ if __name__ == '__main__': # Merge defaults into each package packages = [merge_dicts(defaults, pkg) for pkg in packages] + linux_kernel_tarball: dict = {} + for package in packages: dependencies = package.get('dependencies', {}).get('packages', []) # Build the package - build_package(package, dependencies) + build_package(package, dependencies, linux_kernel_tarball) # Copy generated .deb packages to parent directory copy_packages(Path(package['name'])) + + if linux_kernel_tarball: + source_dir = linux_kernel_tarball['source_dir'] + trusted_keys = f'{source_dir}/trusted_keys.pem' + if os.path.exists(trusted_keys): + os.remove(trusted_keys) + run(['make', '-C', source_dir, 'mrproper'], check=True) + create_tarball( + f'{linux_kernel_tarball["package_name"]}-{linux_kernel_tarball["kernel_version"]}', + source_dir, + ) |
