mirror of
https://github.com/rosalinux/image-builder.git
synced 2025-02-23 10:22:50 +00:00
bootstrap rootfs on any architecture
This commit is contained in:
parent
d6c3da6a4f
commit
b33981b433
3 changed files with 14 additions and 14 deletions
20
build.py
20
build.py
|
@ -69,9 +69,7 @@ def main():
|
|||
sys.exit(1)
|
||||
|
||||
config = load_config(config_path)
|
||||
if config["ARCH"] != "aarch64":
|
||||
print("Unsupported architecture.")
|
||||
sys.exit(1)
|
||||
arch = config["ARCH"]
|
||||
|
||||
print(f"Building for {vendor}/{device} with distro {distro}...")
|
||||
|
||||
|
@ -86,17 +84,17 @@ def main():
|
|||
print("Skipping U-Boot build.")
|
||||
|
||||
if not skip_rootfs:
|
||||
setup_bootstrap("bootstrap", TMP_DIR, vendor, device, distro)
|
||||
disk_image_path = create_disk_image(TMP_DIR, config, vendor, device)
|
||||
if disk_image_path:
|
||||
loop_device = setup_loop_device(disk_image_path)
|
||||
print(f"Loop device setup at {loop_device}")
|
||||
create_partitions(loop_device, config)
|
||||
mount_partitions(config, loop_device, TMP_DIR, vendor, device)
|
||||
setup_bootstrap("bootstrap", TMP_DIR, vendor, device, distro, arch)
|
||||
|
||||
else:
|
||||
print("Skipping rootfs bootstrap")
|
||||
|
||||
disk_image_path = create_disk_image(TMP_DIR, config, vendor, device)
|
||||
if disk_image_path:
|
||||
loop_device = setup_loop_device(disk_image_path)
|
||||
print(f"Loop device setup at {loop_device}")
|
||||
create_partitions(loop_device, config)
|
||||
mount_partitions(config, loop_device, TMP_DIR, vendor, device)
|
||||
|
||||
print(f"Build completed for {vendor}/{device} with distro {distro}")
|
||||
|
||||
|
||||
|
|
Binary file not shown.
|
@ -50,16 +50,18 @@ enabled=1
|
|||
f.write(dnf_conf_content)
|
||||
|
||||
|
||||
def run_dnf_install(config, dnf_conf_path, rootfs_dir):
|
||||
def run_dnf_install(config, dnf_conf_path, rootfs_dir, arch):
|
||||
"""Run dnf command to install packages based on the bootstrap configuration."""
|
||||
pkgs = config["PKGS"]
|
||||
weak_deps = config["WEAK_DEPS"].lower()
|
||||
|
||||
print(f"Bootstrapping '{arch}' rootfs...")
|
||||
dnf_command = [
|
||||
"sudo",
|
||||
"dnf",
|
||||
"--setopt=install_weak_deps=" + str(weak_deps),
|
||||
"--config", dnf_conf_path,
|
||||
"--forcearch", arch,
|
||||
"--installroot", rootfs_dir,
|
||||
"install"
|
||||
] + pkgs.split()
|
||||
|
@ -67,7 +69,7 @@ def run_dnf_install(config, dnf_conf_path, rootfs_dir):
|
|||
subprocess.run(dnf_command, check=True)
|
||||
|
||||
|
||||
def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro):
|
||||
def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro, arch):
|
||||
# load distro config
|
||||
# bootstrap/DISTRO_NAME
|
||||
distro_config_path = os.path.join(bootstrap_dir, distro)
|
||||
|
@ -81,6 +83,6 @@ def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro):
|
|||
rootfs_dir = os.path.join(tmp_dir, vendor, device, "rootfs")
|
||||
|
||||
generate_dnf_conf(dnf_conf_path, config["ABF_DOWNLOADS"], config["RELEASE"])
|
||||
run_dnf_install(config, dnf_conf_path, rootfs_dir)
|
||||
run_dnf_install(config, dnf_conf_path, rootfs_dir, arch)
|
||||
|
||||
#setup_user(rootfs_dir, config["DEFAULT_USER"], config["DEFAULT_USER_PASSWORD"], config["PASSWD_ROOT"])
|
||||
|
|
Loading…
Add table
Reference in a new issue