Skip to content

Commit

Permalink
F #158: Introduce aarch64 images
Browse files Browse the repository at this point in the history
  • Loading branch information
ONE user authored and xorel committed Dec 16, 2024
1 parent c72a0b7 commit 3dec306
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ VERBOSE := 1
PACKER_LOG := 0
PACKER_HEADLESS := true

DISTROS := alma8 alma9 \
DISTROS := alma8 alma8.aarch64 alma9 alma9.aarch64 \
alpine316 alpine317 alpine318 alpine319 alpine320 \
alt10 \
amazon2 amazon2023 \
debian11 debian12 \
debian11 debian11.aarch64 debian12 debian12.aarch64 \
devuan4 devuan5 \
fedora38 fedora39 fedora40 \
freebsd13 freebsd14 \
Expand Down
7 changes: 6 additions & 1 deletion packer/alma/alma.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ build {
# Build VM image
source "qemu" "alma" {
cpus = 2
cpu_model = "host"
memory = 2048
accelerator = "kvm"

iso_url = lookup(lookup(var.alma, var.version, {}), "iso_url", "")
iso_checksum = lookup(lookup(var.alma, var.version, {}), "iso_checksum", "")

firmware = lookup(lookup(var.arch_vars, var.arch, {}), "firmware", "")
use_pflash = lookup(lookup(var.arch_vars, var.arch, {}), "use_pflash", "")
machine_type = lookup(lookup(var.arch_vars, var.arch, {}), "machine_type", "")
qemu_binary = lookup(lookup(var.arch_vars, var.arch, {}), "qemu_binary", "")

headless = var.headless

disk_image = true
Expand All @@ -33,7 +39,6 @@ source "qemu" "alma" {
output_directory = var.output_dir

qemuargs = [
["-cpu", "host"],
["-cdrom", "${var.input_dir}/${var.appliance_name}-cloud-init.iso"],
["-serial", "stdio"],
]
Expand Down
10 changes: 10 additions & 0 deletions packer/alma/variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,19 @@ variable "alma" {
iso_checksum = "file:https://repo.almalinux.org/almalinux/8/cloud/x86_64/images/CHECKSUM"
}

"8.aarch64" = {
iso_url = "https://repo.almalinux.org/almalinux/8/cloud/aarch64/images/AlmaLinux-8-GenericCloud-latest.aarch64.qcow2"
iso_checksum = "file:https://repo.almalinux.org/almalinux/8/cloud/aarch64/images/CHECKSUM"
}

"9" = {
iso_url = "https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/AlmaLinux-9-GenericCloud-latest.x86_64.qcow2"
iso_checksum = "file:https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/CHECKSUM"
}

"9.aarch64" = {
iso_url = "https://repo.almalinux.org/almalinux/9/cloud/aarch64/images/AlmaLinux-9-GenericCloud-latest.aarch64.qcow2"
iso_checksum = "file:https://repo.almalinux.org/almalinux/9/cloud/aarch64/images/CHECKSUM"
}
}
}
8 changes: 8 additions & 0 deletions packer/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ INPUT_DIR="$(dirname "$0")/$DISTRO_NAME" # e.g. packer/debian
OUTPUT_DIR="$DIR_BUILD/$DISTRO" # e.g. build/debian11 (working dir)
mkdir -p "$OUTPUT_DIR"

# detect architecture using `arch`
ARCH='x86_64'
if type arch 2>&1 >/dev/null; then
ARCH=$(arch)
fi

packer init "$INPUT_DIR"

packer build -force \
Expand All @@ -15,6 +21,8 @@ packer build -force \
-var "input_dir=${INPUT_DIR}" \
-var "output_dir=${OUTPUT_DIR}" \
-var "headless=${PACKER_HEADLESS}" \
-var "arch=${ARCH}" \
-var "arch=${ARCH}" \
"$INPUT_DIR" # loads all *.pkr.hcl from dir

# delete potential temporary cloud-init files
Expand Down
6 changes: 5 additions & 1 deletion packer/debian/debian.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ source "qemu" "debian" {
iso_url = lookup(lookup(var.debian, var.version, {}), "iso_url", "")
iso_checksum = lookup(lookup(var.debian, var.version, {}), "iso_checksum", "")

firmware = lookup(lookup(var.arch_vars, var.arch, {}), "firmware", "")
use_pflash = lookup(lookup(var.arch_vars, var.arch, {}), "use_pflash", "")
machine_type = lookup(lookup(var.arch_vars, var.arch, {}), "machine_type", "")
qemu_binary = lookup(lookup(var.arch_vars, var.arch, {}), "qemu_binary", "")

headless = var.headless

disk_image = true
Expand All @@ -33,7 +38,6 @@ source "qemu" "debian" {
output_directory = var.output_dir

qemuargs = [
["-cpu", "host"],
["-cdrom", "${var.input_dir}/${var.appliance_name}-cloud-init.iso"],
["-serial", "stdio"],
]
Expand Down
11 changes: 11 additions & 0 deletions packer/debian/variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ variable "debian" {
iso_url = "https://cdimage.debian.org/cdimage/cloud/bullseye/latest/debian-11-generic-amd64.qcow2"
iso_checksum = "file:https://cdimage.debian.org/cdimage/cloud/bullseye/latest/SHA512SUMS"
}

"11.aarch64" = {
iso_url = "https://cdimage.debian.org/cdimage/cloud/bullseye/latest/debian-11-generic-arm64.qcow2"
iso_checksum = "file:https://cdimage.debian.org/cdimage/cloud/bullseye/latest/SHA512SUMS"
}

"12" = {
iso_url = "https://cdimage.debian.org/cdimage/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
iso_checksum = "file:https://cdimage.debian.org/cdimage/cloud/bookworm/latest/SHA512SUMS"
}

"12.aarch64" = {
iso_url = "https://cdimage.debian.org/cdimage/cloud/bookworm/latest/debian-12-generic-arm64.qcow2"
iso_checksum = "file:https://cdimage.debian.org/cdimage/cloud/bookworm/latest/SHA512SUMS"
}
}
}

0 comments on commit 3dec306

Please sign in to comment.