Skip to content

Commit

Permalink
pillar: Separate OVMF firmware files and standardize naming.
Browse files Browse the repository at this point in the history
Switch to using separate OVMF_CODE.fd and OVMF_VARS.fd files for FML and
ARM modes instead of a combined .bin file. This ensures that settings
are stored correctly and maintains consistent naming conventions. These
changes do not affect containers or Xen.

Signed-off-by: Nikolay Martyanov <[email protected]>
  • Loading branch information
OhmSpectator committed Sep 18, 2024
1 parent 6c1a26b commit 68fe332
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkg/pillar/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ RUN set -e && for patch in /sys-patches/*.patch; do \
done

RUN mkdir -p /out/usr/lib/xen/boot
COPY --from=uefi-build /OVMF_VARS.fd /out/usr/lib/xen/boot/ovmf_vars.bin
COPY --from=uefi-build /OVMF_VARS.fd /out/usr/lib/xen/boot/OVMF_VARS.fd

COPY --from=zfs /out /out
COPY --from=fscrypt /opt/zededa/bin /out/opt/zededa/bin
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/cmd/zedmanager/handledomainmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func MaybeAddDomainConfig(ctx *zedmanagerContext,
}
}
if dc.BootLoader == "" && (dc.VirtualizationModeOrDefault() == types.FML || runtime.GOARCH == "arm64") {
dc.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
dc.BootLoader = "/usr/lib/xen/boot/OVMF_CODE.fd"
}
if ns != nil {
adapterCount := len(ns.AppNetAdapterList)
Expand Down
16 changes: 8 additions & 8 deletions pkg/pillar/hypervisor/kvm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
})

config.VirtualizationMode = types.FML
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoader = "/usr/lib/xen/boot/OVMF_CODE.fd"
t.Run("amd64-fml", func(t *testing.T) {
conf.Seek(0, 0)
if err := kvmIntel.CreateDomConfig(DefaultDomainName, config, types.DomainStatus{},
Expand Down Expand Up @@ -428,7 +428,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
format = "raw"
readonly = "on"
unit = "0"
file = "/usr/lib/xen/boot/ovmf.bin"
file = "/usr/lib/xen/boot/OVMF_CODE.fd"
[drive "drive-ovmf-vars"]
if = "pflash"
Expand Down Expand Up @@ -657,7 +657,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
})

config.VirtualizationMode = types.HVM
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoader = "/usr/lib/xen/boot/OVMF_CODE.fd"
t.Run("arm64", func(t *testing.T) {
conf.Seek(0, 0)
if err := kvmArm.CreateDomConfig(DefaultDomainName, config, types.DomainStatus{},
Expand All @@ -681,7 +681,7 @@ func TestCreateDomConfigOnlyCom1(t *testing.T) {
dump-guest-core = "off"
accel = "kvm:tcg"
gic-version = "host"
firmware = "/usr/lib/xen/boot/ovmf.bin"
firmware = "/usr/lib/xen/boot/OVMF_CODE.fd"
kernel = "/boot/kernel"
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
Expand Down Expand Up @@ -976,7 +976,7 @@ func TestCreateDomConfigAmd64Fml(t *testing.T) {
diskConfigs, diskStatuses := qemuDisks()
config, aa := domainConfigAndAssignableAdapters(diskConfigs)
config.VirtualizationMode = types.FML
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoader = "/usr/lib/xen/boot/OVMF_CODE.fd"
addNonExistingAdapter(&config, &aa)
if err := kvmIntel.CreateDomConfig(DefaultDomainName, config, types.DomainStatus{},
diskStatuses, &aa, nil, swtpmCtrlSock, conf); err != nil {
Expand Down Expand Up @@ -1009,7 +1009,7 @@ func TestCreateDomConfigArm64(t *testing.T) {
diskConfigs, diskStatuses := qemuDisks()
config, aa := domainConfigAndAssignableAdapters(diskConfigs)
config.VirtualizationMode = types.HVM
config.BootLoader = "/usr/lib/xen/boot/ovmf.bin"
config.BootLoader = "/usr/lib/xen/boot/OVMF_CODE.fd"
if err := kvmArm.CreateDomConfig(DefaultDomainName, config, types.DomainStatus{},
diskStatuses, &aa, nil, swtpmCtrlSock, conf); err != nil {
t.Errorf("CreateDomConfig failed %v", err)
Expand Down Expand Up @@ -1154,7 +1154,7 @@ func domConfigArm64() string {
dump-guest-core = "off"
accel = "kvm:tcg"
gic-version = "host"
firmware = "/usr/lib/xen/boot/ovmf.bin"
firmware = "/usr/lib/xen/boot/OVMF_CODE.fd"
kernel = "/boot/kernel"
initrd = "/boot/ramdisk"
append = "init=/bin/sh"
Expand Down Expand Up @@ -1451,7 +1451,7 @@ func domConfigAmd64FML() string {
format = "raw"
readonly = "on"
unit = "0"
file = "/usr/lib/xen/boot/ovmf.bin"
file = "/usr/lib/xen/boot/OVMF_CODE.fd"
[drive "drive-ovmf-vars"]
if = "pflash"
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/types/locationconsts.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const (
// OVMFSettingsDir - directory for OVMF settings, they are stored in per-domain files
OVMFSettingsDir = PersistDir + "/ovmf"
// OVMFSettingsTemplate - template file for OVMF settings
OVMFSettingsTemplate = "/usr/lib/xen/boot/ovmf_vars.bin"
OVMFSettingsTemplate = "/usr/lib/xen/boot/OVMF_VARS.fd"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion pkg/xen-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ RUN if [ "$(uname -m)" = "x86_64" ]; then rm -f qemu-system-i386 && ln -s "qemu-

COPY --from=uefi-build / /uefi/
RUN mkdir -p /out/usr/lib/xen/boot && cp /uefi/OVMF.fd /out/usr/lib/xen/boot/ovmf.bin && \
cp /uefi/OVMF_PVH.fd /out/usr/lib/xen/boot/ovmf-pvh.bin
cp /uefi/OVMF_PVH.fd /out/usr/lib/xen/boot/ovmf-pvh.bin && \
cp /uefi/OVMF_CODE.fd /out/usr/lib/xen/boot/OVMF_CODE.fd
RUN if [ "$(uname -m)" = "x86_64" ]; then cp /uefi/*.rom /out/usr/lib/xen/boot/;fi

FROM scratch
Expand Down

0 comments on commit 68fe332

Please sign in to comment.