From 5a1f1c161397f6ca2b6a900ba4a54ebe0334093d Mon Sep 17 00:00:00 2001 From: alexander stefanov Date: Fri, 15 Nov 2024 20:29:47 +0300 Subject: [PATCH] add extra_packages env --- device/raspberry/pi4b/config | 10 ++++------ utils/bootstrap_setup.py | 11 +++++++++-- utils/make_disk.py | 2 ++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/device/raspberry/pi4b/config b/device/raspberry/pi4b/config index 313d6b1..7e2f3b9 100644 --- a/device/raspberry/pi4b/config +++ b/device/raspberry/pi4b/config @@ -1,16 +1,14 @@ ARCH="aarch64" -KERNEL="https://github.com/raspberrypi/linux.git#rpi-6.6.y" -KERNEL_CONFIG="bcm2711_defconfig" -KERNEL_EXTRACONFIG="--module NTFS3_FS --enable NTFS3_LZX_XPRESS --enable NTFS3_FS_POSIX_ACL --disable NTFS3_64BIT_CLUSTER" +EXTRA_PKGS="kernel-raspberry" +#KERNEL="https://github.com/raspberrypi/linux.git#rpi-6.6.y" +#KERNEL_CONFIG="bcm2711_defconfig" +#KERNEL_EXTRACONFIG="--module NTFS3_FS --enable NTFS3_LZX_XPRESS --enable NTFS3_FS_POSIX_ACL --disable NTFS3_64BIT_CLUSTER" DTB="broadcom/bcm2711-rpi-4-b" CMDLINE="dwc_otg.lpm_enable=0 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait" NEED_INITRD=no -UBOOT="https://github.com/radxa/u-boot.git" -UBOOT_VERSION="next-dev-v2024.03" - # disk section # /boot is vfat partition BOOT_FSTYPE="vfat" diff --git a/utils/bootstrap_setup.py b/utils/bootstrap_setup.py index 1823a2f..98e46ca 100644 --- a/utils/bootstrap_setup.py +++ b/utils/bootstrap_setup.py @@ -50,10 +50,12 @@ enabled=1 f.write(dnf_conf_content) -def run_dnf_install(config, dnf_conf_path, rootfs_dir, arch): +def run_dnf_install(config, dnf_conf_path, rootfs_dir, arch, extra_pkgs=""): """Run dnf command to install packages based on the bootstrap configuration.""" pkgs = config["PKGS"] weak_deps = config["WEAK_DEPS"].lower() + if extra_pkgs: + pkgs += f" {extra_pkgs}" print(f"Bootstrapping '{arch}' rootfs...") dnf_command = [ @@ -79,10 +81,15 @@ def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro, arch): config = load_config(distro_config_path) + device_config_path = os.path.join("device", vendor, device, "config") + device_config = load_config(device_config_path) if os.path.exists(device_config_path) else {} + + extra_pkgs = device_config.get("EXTRA_PKGS", "") + dnf_conf_path = os.path.join(tmp_dir, vendor, device, "dnf.conf") 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, arch) + run_dnf_install(config, dnf_conf_path, rootfs_dir, arch, extra_pkgs) #setup_user(rootfs_dir, config["DEFAULT_USER"], config["DEFAULT_USER_PASSWORD"], config["PASSWD_ROOT"]) diff --git a/utils/make_disk.py b/utils/make_disk.py index f3c72a3..56637c1 100644 --- a/utils/make_disk.py +++ b/utils/make_disk.py @@ -17,6 +17,7 @@ def create_disk_image(tmp_dir, config, vendor, device): boot_size = "0" disk_image_path = os.path.join(tmp_dir, vendor, device, "disk.img") + os.makedirs(os.path.dirname(disk_image_path), exist_ok=True) cmd = [ "dd", "if=/dev/zero", @@ -95,4 +96,5 @@ def mount_partitions(config, loop_device, tmp_dir, vendor, device): print(f"Mounting root (/) partition at {rootfs_dir}") subprocess.run(["sudo", "mount", root_partition, rootfs_dir], check=True) + print("Mounting complete.")