mirror of
https://github.com/rosalinux/image-builder.git
synced 2025-02-23 10:22:50 +00:00
add kernel.py and uboot.py
This commit is contained in:
parent
2ec4a74c46
commit
a85802905c
3 changed files with 33 additions and 13 deletions
13
build.py
13
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:
|
||||
|
|
18
utils/kernel.py
Normal file
18
utils/kernel.py
Normal file
|
@ -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"])
|
15
utils/uboot.py
Normal file
15
utils/uboot.py
Normal file
|
@ -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)
|
||||
|
Loading…
Add table
Reference in a new issue