Skip to content

Commit 18c029b

Browse files
authored
Merge pull request #1745 from afbjorklund/kernel-arch
Validate arch against image not default
2 parents 495271c + 46d0e82 commit 18c029b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/experimental/riscv64.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
arch: "riscv64"
44
images:
55
- location: "https://cloud-images.ubuntu.com/releases/23.04/release-20230810/ubuntu-23.04-server-cloudimg-riscv64.img"
6+
arch: "riscv64"
67
digest: "sha256:d9f56eac9c644f78353154d9f17e1ce739d7c63beac63ccefe2380b2f2e9aa38"
78
kernel:
89
# Extracted from http://http.us.debian.org/debian/pool/main/u/u-boot/u-boot-qemu_2023.01+dfsg-2_all.deb (GPL-2.0)
@@ -11,6 +12,7 @@ images:
1112
# Fallback to the latest release image.
1213
# Hint: run `limactl prune` to invalidate the cache
1314
- location: "https://cloud-images.ubuntu.com/releases/23.04/release/ubuntu-23.04-server-cloudimg-riscv64.img"
15+
arch: "riscv64"
1416
kernel:
1517
# Extracted from http://http.us.debian.org/debian/pool/main/u/u-boot/u-boot-qemu_2023.04+dfsg-1_all.deb (GPL-2.0)
1618
location: "https://github.com/lima-vm/u-boot-qemu-mirror/releases/download/2023.04%2Bdfsg-1/qemu-riscv64_smode_uboot.elf"

pkg/limayaml/validate.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ func Validate(y LimaYAML, warn bool) error {
7575
if err := validateFileObject(f.Kernel.File, fmt.Sprintf("images[%d].kernel", i)); err != nil {
7676
return err
7777
}
78-
if f.Kernel.Arch != *y.Arch {
79-
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, *y.Arch)
78+
if f.Kernel.Arch != f.Arch {
79+
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, f.Arch)
8080
}
8181
} else if f.Arch == RISCV64 {
8282
return errors.New("riscv64 needs the kernel (e.g., \"uboot.elf\") to be specified")
@@ -88,8 +88,8 @@ func Validate(y LimaYAML, warn bool) error {
8888
if f.Kernel == nil {
8989
return errors.New("initrd requires the kernel to be specified")
9090
}
91-
if f.Initrd.Arch != *y.Arch {
92-
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, *y.Arch)
91+
if f.Initrd.Arch != f.Arch {
92+
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, f.Arch)
9393
}
9494
}
9595
}

0 commit comments

Comments
 (0)