add extra_packages env

This commit is contained in:
alexander stefanov 2024-11-15 20:29:47 +03:00
parent d768a00a96
commit 5a1f1c1613
3 changed files with 15 additions and 8 deletions

View file

@ -1,16 +1,14 @@
ARCH="aarch64" ARCH="aarch64"
KERNEL="https://github.com/raspberrypi/linux.git#rpi-6.6.y" EXTRA_PKGS="kernel-raspberry"
KERNEL_CONFIG="bcm2711_defconfig" #KERNEL="https://github.com/raspberrypi/linux.git#rpi-6.6.y"
KERNEL_EXTRACONFIG="--module NTFS3_FS --enable NTFS3_LZX_XPRESS --enable NTFS3_FS_POSIX_ACL --disable NTFS3_64BIT_CLUSTER" #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" 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" 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 NEED_INITRD=no
UBOOT="https://github.com/radxa/u-boot.git"
UBOOT_VERSION="next-dev-v2024.03"
# disk section # disk section
# /boot is vfat partition # /boot is vfat partition
BOOT_FSTYPE="vfat" BOOT_FSTYPE="vfat"

View file

@ -50,10 +50,12 @@ enabled=1
f.write(dnf_conf_content) 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.""" """Run dnf command to install packages based on the bootstrap configuration."""
pkgs = config["PKGS"] pkgs = config["PKGS"]
weak_deps = config["WEAK_DEPS"].lower() weak_deps = config["WEAK_DEPS"].lower()
if extra_pkgs:
pkgs += f" {extra_pkgs}"
print(f"Bootstrapping '{arch}' rootfs...") print(f"Bootstrapping '{arch}' rootfs...")
dnf_command = [ dnf_command = [
@ -79,10 +81,15 @@ def setup_bootstrap(bootstrap_dir, tmp_dir, vendor, device, distro, arch):
config = load_config(distro_config_path) 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") dnf_conf_path = os.path.join(tmp_dir, vendor, device, "dnf.conf")
rootfs_dir = os.path.join(tmp_dir, vendor, device, "rootfs") rootfs_dir = os.path.join(tmp_dir, vendor, device, "rootfs")
generate_dnf_conf(dnf_conf_path, config["ABF_DOWNLOADS"], config["RELEASE"]) 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"]) #setup_user(rootfs_dir, config["DEFAULT_USER"], config["DEFAULT_USER_PASSWORD"], config["PASSWD_ROOT"])

View file

@ -17,6 +17,7 @@ def create_disk_image(tmp_dir, config, vendor, device):
boot_size = "0" boot_size = "0"
disk_image_path = os.path.join(tmp_dir, vendor, device, "disk.img") disk_image_path = os.path.join(tmp_dir, vendor, device, "disk.img")
os.makedirs(os.path.dirname(disk_image_path), exist_ok=True)
cmd = [ cmd = [
"dd", "dd",
"if=/dev/zero", "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}") print(f"Mounting root (/) partition at {rootfs_dir}")
subprocess.run(["sudo", "mount", root_partition, rootfs_dir], check=True) subprocess.run(["sudo", "mount", root_partition, rootfs_dir], check=True)
print("Mounting complete.") print("Mounting complete.")