From cfd0885cc7fff1c0e8fa6a26626e6ea66282dc59 Mon Sep 17 00:00:00 2001 From: tigro Date: Mon, 24 Feb 2025 15:19:42 +0300 Subject: [PATCH] Added support of MSVSphere 10 aarch64 --- http/msvsphere-10-gencloud.aarch64.ks | 75 +++++++++++++++++++++++++++ msvsphere-10-gencloud.pkr.hcl | 36 ++++++++++++- variables.pkr.hcl | 47 +++++++++++++++++ 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 http/msvsphere-10-gencloud.aarch64.ks diff --git a/http/msvsphere-10-gencloud.aarch64.ks b/http/msvsphere-10-gencloud.aarch64.ks new file mode 100644 index 0000000..9c151da --- /dev/null +++ b/http/msvsphere-10-gencloud.aarch64.ks @@ -0,0 +1,75 @@ +# MSVSphere 10 Generic Cloud image kickstart file + +url --url https://rsync.inferitos.ru/msvsphere/10.0-beta/BaseOS/aarch64/kickstart/ +repo --name=BaseOS --baseurl=https://rsync.inferitos.ru/msvsphere/10.0-beta/BaseOS/aarch64/os/ +repo --name=AppStream --baseurl=https://rsync.inferitos.ru/msvsphere/10.0-beta/AppStream/aarch64/os/ + +text +skipx +eula --agreed +firstboot --disabled + +lang C.UTF-8 +keyboard us +timezone UTC --utc + +network --bootproto=dhcp +firewall --enabled --service=ssh +services --disabled="kdump" --enabled="chronyd,rsyslog,sshd" +selinux --enforcing + +bootloader --timeout=1 --location=mbr --append="console=tty0 console=ttyS0,115200n8 no_timer_check crashkernel=auto net.ifnames=0" + +%pre --erroronfail + +parted -s -a optimal /dev/sda -- mklabel gpt +parted -s -a optimal /dev/sda -- mkpart biosboot 1MiB 2MiB set 1 bios_grub on +parted -s -a optimal /dev/sda -- mkpart '"EFI System Partition"' fat32 2MiB 202MiB set 2 esp on +parted -s -a optimal /dev/sda -- mkpart boot ext4 202MiB 1226MiB +parted -s -a optimal /dev/sda -- mkpart root ext4 1226MiB 100% +%end + +part biosboot --fstype=biosboot --onpart=sda1 +part /boot/efi --fstype=efi --onpart=sda2 +part /boot --fstype=ext4 --onpart=sda3 +part / --fstype=ext4 --onpart=sda4 + +rootpw --plaintext msvsphere + +reboot --eject + + +%packages --inst-langs=en +@core +dracut-config-generic +usermode +-biosdevname +-dnf-plugin-spacewalk +-dracut-config-rescue +-iprutils +-iwl*-firmware +-langpacks-* +-mdadm +-open-vm-tools +-plymouth +-rhn* +-nfs-utils +-rpcbind +sphere-release-identity-server +sphere-release-server +sphere-release +%end + + +# disable kdump service +%addon com_redhat_kdump --disable +%end + +%post --erroronfail + +grub2-install --target=i386-pc /dev/sda + +# permit root login via SSH with password authetication +echo "PermitRootLogin yes" > /etc/ssh/sshd_config.d/01-permitrootlogin.conf + +%end diff --git a/msvsphere-10-gencloud.pkr.hcl b/msvsphere-10-gencloud.pkr.hcl index aac82ca..9a55704 100644 --- a/msvsphere-10-gencloud.pkr.hcl +++ b/msvsphere-10-gencloud.pkr.hcl @@ -37,10 +37,44 @@ source "qemu" "msvsphere-10-gencloud-x86_64" { ] } +source "qemu" "msvsphere-10-gencloud-aarch64" { + iso_url = var.iso_url_10_aarch64 + iso_checksum = var.iso_checksum_10_aarch64 + http_directory = var.http_directory + shutdown_command = var.root_shutdown_command + ssh_username = var.gencloud_ssh_username + ssh_password = var.gencloud_ssh_password + ssh_timeout = var.ssh_timeout + boot_command = var.gencloud_boot_cmd_10_aarch64_uefi + boot_wait = var.boot_wait + accelerator = "kvm" + firmware = var.aavmf_code + use_pflash = false + disk_interface = "virtio-scsi" + disk_size = var.gencloud_disk_size + disk_cache = "unsafe" + disk_discard = "unmap" + disk_detect_zeroes = "unmap" + disk_compression = true + format = "qcow2" + headless = var.headless + machine_type = "virt,gic-version=max" + memory = var.memory_aarch64 + net_device = "virtio-net" + qemu_binary = var.qemu_binary + vm_name = "MSVSphere-${var.os_version_10}-${formatdate("YYYYMMDD", timestamp())}.gencloud.aarch64.qcow2" + cpu_model = "host" + cpus = var.cpus + qemuargs = [ + ["-boot", "strict=on"], + ["-monitor", "none"], + ] +} build { sources = [ - "qemu.msvsphere-10-gencloud-x86_64" + "qemu.msvsphere-10-gencloud-x86_64", + "qemu.msvsphere-10-gencloud-aarch64" ] provisioner "ansible" { diff --git a/variables.pkr.hcl b/variables.pkr.hcl index fbb4652..a0b6e18 100644 --- a/variables.pkr.hcl +++ b/variables.pkr.hcl @@ -27,6 +27,12 @@ variable "iso_url_10_x86_64" { default = "https://rsync.inferitos.ru/msvsphere/10.0-beta/isos/x86_64/MSVSphere-10.0-beta-x86_64-netinstall.iso" } +variable "iso_url_10_aarch64" { + description = "MSVSphere 10 aarch64 installation ISO URL" + type = string + default = "https://rsync.inferitos.ru/msvsphere/10.0-beta/isos/aarch64/MSVSphere-10.0-beta-aarch64-netinstall.iso" +} + variable "iso_url_9_x86_64" { description = "MSVSphere 9 x86_64 installation ISO URL" type = string @@ -45,6 +51,12 @@ variable "iso_checksum_10_x86_64" { default = "file:https://rsync.inferitos.ru/msvsphere/10.0-beta/isos/x86_64/MSVSphere-10.0-beta-x86_64-netinstall.iso.CHECKSUM" } +variable "iso_checksum_10_aarch64" { + description = "MSVSphere 10 aarch64 installation ISO checksum" + type = string + default = "file:https://rsync.inferitos.ru/msvsphere/10.0-beta/isos/aarch64/MSVSphere-10.0-beta-aarch64-netinstall.iso.CHECKSUM" +} + variable "iso_checksum_9_x86_64" { description = "MSVSphere 9 x86_64 installation ISO checksum" type = string @@ -82,6 +94,13 @@ variable "memory" { default = 2048 } +variable "memory_aarch64" { + description = "The amount of memory to use when building the aarch64 VM in megabytes" + + type = number + default = 4096 +} + variable "boot_wait" { description = "Time to wait before interacting with an OS bootloader menu" type = string @@ -132,6 +151,13 @@ variable "uefi_ovmf_vars" { default = "/usr/share/edk2/ovmf/OVMF_VARS.fd" } +variable "aavmf_code" { + description = "Path of AAVMF code file" + + type = string + default = "/usr/share/AAVMF/AAVMF_CODE.fd" +} + variable "qemu_binary" { description = "QEMU binary path" type = string @@ -249,6 +275,27 @@ variable "gencloud_boot_cmd_10_x86_64_uefi" { ] } +variable "gencloud_boot_cmd_10_aarch64_uefi" { + description = "The boot command for aarch64 VMs in UEFI mode" + + type = list(string) + + default = [ + "e", + "", + "e", + "", + "biosdevname=0", + "", + "net.ifnames=0", + "", + "inst.text", + "", + "inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/msvsphere-10-gencloud.aarch64.ks", + "x", + ] +} + variable "gencloud_boot_cmd_9_x86_64_uefi" { description = "The boot command for x86_64 VMs in UEFI mode" type = list(string)