From b33981b433dc88d1062a1f123c0b49d83578a2e3 Mon Sep 17 00:00:00 2001 From: alexander stefanov Date: Thu, 14 Nov 2024 00:34:01 +0300 Subject: [PATCH] bootstrap rootfs on any architecture --- build.py | 20 ++++++++---------- .../bootstrap_setup.cpython-311.pyc | Bin 4145 -> 0 bytes utils/bootstrap_setup.py | 8 ++++--- 3 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 utils/__pycache__/bootstrap_setup.cpython-311.pyc diff --git a/build.py b/build.py index 386a421..148f04c 100755 --- a/build.py +++ b/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}") diff --git a/utils/__pycache__/bootstrap_setup.cpython-311.pyc b/utils/__pycache__/bootstrap_setup.cpython-311.pyc deleted file mode 100644 index 9bc96ead09bce9917eeaab749c50c08effda2e10..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4145 zcmbVPU2GFq7QW+|@r=iD{s;lm08Y|^+>jVr2wgTwOEwAOFVJR}iWFo`JU3wyd&WC6 zPKcREe&8WRRJ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(cyH@UWtQIU5Q8VuyF!<5`$pcK)}B;OdffX z^vNSBNuNAw$&}wbdOK797ThA!T0j-j?q|RsSI9Wi$Q&r33h8cSj*{wTLTC3s&tC9v diff --git a/utils/bootstrap_setup.py b/utils/bootstrap_setup.py index ea5e9dd..1823a2f 100644 --- a/utils/bootstrap_setup.py +++ b/utils/bootstrap_setup.py @@ -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"])