diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-12-31 15:59:05 +0100 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-02-17 16:16:49 +0100 |
| commit | b2ac699439fbf663b9575e9ebe7301d032fb2047 (patch) | |
| tree | 657312e91c80dca4732ecd580516c05bf920a73d /scripts | |
| parent | afb3739ed54556532fbdffef41505cbe24df4e0e (diff) | |
| download | vyos-build-b2ac699439fbf663b9575e9ebe7301d032fb2047.tar.gz vyos-build-b2ac699439fbf663b9575e9ebe7301d032fb2047.zip | |
Kernel: T8134: support building from Git source directory
If build.py detects a local "linux" directory which could be a
Git repository - it is used over downloading the released tarball.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/package-build/linux-kernel/build.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py index 9d105228..fb630595 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -134,8 +134,8 @@ def build_package(package: dict, dependencies: list) -> None: # Execute the build command if package['build_cmd'] == 'build_kernel': - build_kernel(package['kernel_version']) - create_tarball(f'{package["name"]}-{package["kernel_version"]}', f'linux-{package["kernel_version"]}') + source_dir = build_kernel(package['kernel_version']) + create_tarball(f'{package["name"]}-{package["kernel_version"]}', 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"]}') @@ -191,17 +191,22 @@ def merge_dicts(defaults, package): return {**defaults, **package} -def build_kernel(kernel_version): +def build_kernel(kernel_version) -> str: """Build the Linux kernel""" - run(['gpg2', '--locate-keys', 'torvalds@kernel.org', 'gregkh@kernel.org'], check=True) - run(['curl', '-OL', f'https://www.kernel.org/pub/linux/kernel/v6.x/linux-{kernel_version}.tar.xz'], check=True) - run(['curl', '-OL', f'https://www.kernel.org/pub/linux/kernel/v6.x/linux-{kernel_version}.tar.sign'], check=True) - # Using pipes to handle decompression and verification - with subprocess.Popen(['xz', '-cd', f'linux-{kernel_version}.tar.xz'], stdout=subprocess.PIPE) as proc_xz: - run(['gpg2', '--verify', f'linux-{kernel_version}.tar.sign', '-'], stdin=proc_xz.stdout, check=True) - run(['tar', 'xf', f'linux-{kernel_version}.tar.xz'], check=True) - os.symlink(f'linux-{kernel_version}', 'linux') + source_dir = 'linux' # Git source repo name - preferred over TAR + if not os.path.exists(source_dir): + run(['gpg2', '--locate-keys', 'torvalds@kernel.org', 'gregkh@kernel.org'], check=True) + run(['curl', '-OL', f'https://www.kernel.org/pub/linux/kernel/v6.x/linux-{kernel_version}.tar.xz'], check=True) + run(['curl', '-OL', f'https://www.kernel.org/pub/linux/kernel/v6.x/linux-{kernel_version}.tar.sign'], check=True) + # Using pipes to handle decompression and verification + with subprocess.Popen(['xz', '-cd', f'linux-{kernel_version}.tar.xz'], stdout=subprocess.PIPE) as proc_xz: + run(['gpg2', '--verify', f'linux-{kernel_version}.tar.sign', '-'], stdin=proc_xz.stdout, check=True) + run(['tar', 'xf', f'linux-{kernel_version}.tar.xz'], check=True) + source_dir = f'linux-{kernel_version}' + os.symlink(source_dir, 'linux') + run(['./build-kernel.sh'], check=True) + return(source_dir) def build_linux_firmware(commit_id, scm_url): |
