Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Noble build fixes + More #228

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions ubuntu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ URL ?= http://releases.ubuntu.com
SUMS ?= SHA256SUMS
TIMEOUT ?= 1h

ifeq ($(wildcard /usr/share/OVMF/OVMF_CODE.fd),)
OVMF_SFX ?= _4M
else
OVMF_SFX ?=
endif

ISO=$(shell wget -O- -q ${URL}/${SERIES}/${SUMS} | grep live-server | cut -d'*' -f2)

.PHONY: all clean
Expand All @@ -33,29 +39,32 @@ seeds-lvm.iso: user-data-lvm meta-data
seeds-flat.iso: user-data-flat meta-data
cloud-localds $@ $^

OVMF_VARS.fd: /usr/share/OVMF/OVMF_VARS.fd
OVMF_VARS.fd: /usr/share/OVMF/OVMF_VARS*.fd
cp -v $< $@

custom-cloudimg.tar.gz: check-deps clean
${PACKER} init . && ${PACKER} build \
-only='cloudimg.*' \
-var ubuntu_series=${SERIES} \
-var architecture=${ARCH} \
-var ovmf_suffix=${OVMF_SFX} \
-var timeout=${TIMEOUT} .

custom-ubuntu.tar.gz: check-deps clean seeds-flat.iso OVMF_VARS.fd \
packages/custom-packages.tar.gz
${PACKER} init . && ${PACKER} build -only=qemu.flat \
-var ubuntu_series=${SERIES} \
-var ubuntu_iso=${ISO} \
-var architecture=${ARCH} \
-var ubuntu_series=${SERIES} \
-var ubuntu_iso=${ISO} \
-var architecture=${ARCH} \
-var ovmf_suffix=${OVMF_SFX} \
-var timeout=${TIMEOUT} .

custom-ubuntu-lvm.dd.gz: check-deps clean seeds-lvm.iso OVMF_VARS.fd
${PACKER} init . && ${PACKER} build -only=qemu.lvm \
-var ubuntu_series=${SERIES} \
-var ubuntu_lvm_iso=${ISO} \
-var architecture=${ARCH} \
-var ubuntu_series=${SERIES} \
-var ubuntu_lvm_iso=${ISO} \
-var architecture=${ARCH} \
-var ovmf_suffix=${OVMF_SFX} \
-var timeout=${TIMEOUT} .
clean:
${RM} -rf output-* custom-*.gz \
Expand Down
1 change: 1 addition & 0 deletions ubuntu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The Packer templates in this directory creates Ubuntu images for use with MAAS.
* A machine running Ubuntu 18.04+ with the ability to run KVM virtual machines.
* qemu-utils, libnbd-bin, nbdkit and fuse2fs
* qemu-system
* qemu-system-modules-spice (If building on Ubuntu 24.04 LTS "Noble")
* ovmf
* cloud-image-utils
* parted
Expand Down
2 changes: 1 addition & 1 deletion ubuntu/ubuntu-cloudimg.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ source "qemu" "cloudimg" {
["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"],
["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"],
["-device", "virtio-gpu-pci"],
["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE${var.ovmf_suffix}.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"],
["-drive", "file=output-cloudimg/packer-cloudimg,format=qcow2"],
["-drive", "file=seeds-cloudimg.iso,format=raw"]
Expand Down
9 changes: 8 additions & 1 deletion ubuntu/ubuntu-cloudimg.variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ variable "architecture" {
type = string
default = "amd64"
description = "The architecture to build the image for (amd64 or arm64)"
}
}

variable "ovmf_suffix" {
type = string
default = ""
description = "Suffix for OVMF CODE and VARS files. Newer systems such as Noble use _4M."
}

4 changes: 2 additions & 2 deletions ubuntu/ubuntu-flat.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source "qemu" "flat" {
["-device", "virtio-blk-pci,drive=drive0,bootindex=0"],
["-device", "virtio-blk-pci,drive=cdrom0,bootindex=1"],
["-device", "virtio-blk-pci,drive=drive1,bootindex=2"],
["-drive", "if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd"],
["-drive", "if=pflash,format=raw,file=OVMF_VARS.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE${var.ovmf_suffix}.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"],
["-drive", "file=output-flat/packer-flat,if=none,id=drive0,cache=writeback,discard=ignore,format=raw"],
["-drive", "file=seeds-flat.iso,format=raw,cache=none,if=none,id=drive1,readonly=on"],
["-drive", "file=packer_cache/${var.ubuntu_series}.iso,if=none,id=cdrom0,media=cdrom"]
Expand Down
2 changes: 1 addition & 1 deletion ubuntu/ubuntu-flat.variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variable "flat_filename" {

variable "ubuntu_iso" {
type = string
default = "ubuntu-22.04.3-live-server-amd64.iso"
default = "ubuntu-22.04.4-live-server-amd64.iso"
description = "The ISO name to build the image from"
}

4 changes: 2 additions & 2 deletions ubuntu/ubuntu-lvm.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ source "qemu" "lvm" {
["-device", "virtio-blk-pci,drive=drive0,bootindex=0"],
["-device", "virtio-blk-pci,drive=cdrom0,bootindex=1"],
["-device", "virtio-blk-pci,drive=drive1,bootindex=2"],
["-drive", "if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd"],
["-drive", "if=pflash,format=raw,file=OVMF_VARS.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE${var.ovmf_suffix}.fd"],
["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"],
["-drive", "file=output-lvm/packer-lvm,if=none,id=drive0,cache=writeback,discard=ignore,format=raw"],
["-drive", "file=seeds-lvm.iso,format=raw,cache=none,if=none,id=drive1,readonly=on"],
["-drive", "file=packer_cache/${var.ubuntu_series}.iso,if=none,id=cdrom0,media=cdrom"]
Expand Down
2 changes: 1 addition & 1 deletion ubuntu/ubuntu-lvm.variables.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "ubuntu_lvm_iso" {
type = string
default = "ubuntu-22.04.3-live-server-amd64.iso"
default = "ubuntu-22.04.4-live-server-amd64.iso"
description = "The ISO name to build the image from"
}

Loading