diff --git a/build.py b/build.py index 60456c0..2d18758 100755 --- a/build.py +++ b/build.py @@ -15,19 +15,6 @@ BASE_DIR = os.getcwd() TMP_DIR = os.path.join(BASE_DIR, "tmp") NUM_CORES = str(multiprocessing.cpu_count()) -def build_uboot(config, vendor, device): - if "UBOOT" not in config or "UBOOT_VERSION" not in config: - print("U-Boot configuration not found. Skipping U-Boot build.") - return - - uboot_dir = os.path.join(TMP_DIR, vendor, device, "u-boot") - clone_repo(config["UBOOT"], config["UBOOT_VERSION"], uboot_dir, "U-Boot") - - os.chdir(uboot_dir) - subprocess.run(["make", config["UBOOT_CONFIG"]], check=True) - subprocess.run(["make", "-j" + NUM_CORES], check=True) - os.chdir(BASE_DIR) - def main(): if len(sys.argv) < 3 or "--distro" not in sys.argv: diff --git a/utils/kernel.py b/utils/kernel.py new file mode 100644 index 0000000..679933a --- /dev/null +++ b/utils/kernel.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import os +import sys +import subprocess +from utils.common import clone_repo + +def clone_kernel(TMP_DIR, config, vendor, device, kernel_dir): + kernel_git = config.get("KERNEL").split("#")[0] + kernel_branch = config.get("KERNEL").split("#")[1] + clone_repo(kernel_git, kernel_branch, kernel_dir, "kernel") + + +def make_kernel_tar(kernel_dir, kernel_rpm_dir): + os.chdir(kernel_dir) + subprocess.run(["git", "archive", + "--format=tar", "--prefix=kernel/", + f"--output={kernel_rpm_dir}/kernel.tar", "HEAD"]) diff --git a/utils/uboot.py b/utils/uboot.py new file mode 100644 index 0000000..e02131f --- /dev/null +++ b/utils/uboot.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +def build_uboot(config, vendor, device): + if "UBOOT" not in config or "UBOOT_VERSION" not in config: + print("U-Boot configuration not found. Skipping U-Boot build.") + return + + uboot_dir = os.path.join(TMP_DIR, vendor, device, "u-boot") + clone_repo(config["UBOOT"], config["UBOOT_VERSION"], uboot_dir, "U-Boot") + + os.chdir(uboot_dir) + subprocess.run(["make", config["UBOOT_CONFIG"]], check=True) + subprocess.run(["make", "-j" + NUM_CORES], check=True) +