Skip to content

Commit

Permalink
Merge pull request #1745 from afbjorklund/kernel-arch
Browse files Browse the repository at this point in the history
Validate arch against image not default
  • Loading branch information
AkihiroSuda authored Aug 13, 2023
2 parents 495271c + 46d0e82 commit 18c029b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions examples/experimental/riscv64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
arch: "riscv64"
images:
- location: "https://cloud-images.ubuntu.com/releases/23.04/release-20230810/ubuntu-23.04-server-cloudimg-riscv64.img"
arch: "riscv64"
digest: "sha256:d9f56eac9c644f78353154d9f17e1ce739d7c63beac63ccefe2380b2f2e9aa38"
kernel:
# 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)
Expand All @@ -11,6 +12,7 @@ images:
# Fallback to the latest release image.
# Hint: run `limactl prune` to invalidate the cache
- location: "https://cloud-images.ubuntu.com/releases/23.04/release/ubuntu-23.04-server-cloudimg-riscv64.img"
arch: "riscv64"
kernel:
# 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)
location: "https://github.com/lima-vm/u-boot-qemu-mirror/releases/download/2023.04%2Bdfsg-1/qemu-riscv64_smode_uboot.elf"
Expand Down
8 changes: 4 additions & 4 deletions pkg/limayaml/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func Validate(y LimaYAML, warn bool) error {
if err := validateFileObject(f.Kernel.File, fmt.Sprintf("images[%d].kernel", i)); err != nil {
return err
}
if f.Kernel.Arch != *y.Arch {
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, *y.Arch)
if f.Kernel.Arch != f.Arch {
return fmt.Errorf("images[%d].kernel has unexpected architecture %q, must be %q", i, f.Kernel.Arch, f.Arch)
}
} else if f.Arch == RISCV64 {
return errors.New("riscv64 needs the kernel (e.g., \"uboot.elf\") to be specified")
Expand All @@ -88,8 +88,8 @@ func Validate(y LimaYAML, warn bool) error {
if f.Kernel == nil {
return errors.New("initrd requires the kernel to be specified")
}
if f.Initrd.Arch != *y.Arch {
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, *y.Arch)
if f.Initrd.Arch != f.Arch {
return fmt.Errorf("images[%d].initrd has unexpected architecture %q, must be %q", i, f.Initrd.Arch, f.Arch)
}
}
}
Expand Down

0 comments on commit 18c029b

Please sign in to comment.