treewide: remove direct access to external/
This prepares the repositoriy to be compatible with the flag
--nolegacy_external_runfiles. This reduces runfiles & sandbox creation
times.
Change-Id: I06720be4a3c873d68d8278dcb24271ed874f7134
Reviewed-on: https://review.monogon.dev/c/monogon/+/2747
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/test/launch/cluster/cluster.go b/metropolis/test/launch/cluster/cluster.go
index 06d13da..69d9667 100644
--- a/metropolis/test/launch/cluster/cluster.go
+++ b/metropolis/test/launch/cluster/cluster.go
@@ -276,13 +276,18 @@
options.Mac = mac
}
+ ovmfCodePath, err := runfiles.Rlocation("edk2/OVMF_CODE.fd")
+ if err != nil {
+ return err
+ }
+
tpmSocketPath := filepath.Join(r.sd, "tpm-socket")
fwVarPath := filepath.Join(r.ld, "OVMF_VARS.fd")
storagePath := filepath.Join(r.ld, "image.img")
qemuArgs := []string{
"-machine", "q35", "-accel", "kvm", "-nographic", "-nodefaults", "-m", "4096",
"-cpu", "host", "-smp", "sockets=1,cpus=1,cores=2,threads=2,maxcpus=4",
- "-drive", "if=pflash,format=raw,readonly=on,file=external/edk2/OVMF_CODE.fd",
+ "-drive", "if=pflash,format=raw,readonly=on,file=" + ovmfCodePath,
"-drive", "if=pflash,format=raw,file=" + fwVarPath,
"-drive", "if=virtio,format=raw,cache=unsafe,file=" + storagePath,
"-netdev", qemuNetConfig.ToOption(qemuNetType),
@@ -332,7 +337,7 @@
tpmEmuCmd.Stderr = os.Stderr
tpmEmuCmd.Stdout = os.Stdout
- err := tpmEmuCmd.Start()
+ err = tpmEmuCmd.Start()
if err != nil {
return fmt.Errorf("failed to start TPM emulator: %w", err)
}