@@ -571,25 +571,33 @@ func Cmdline(cfg Config) (exe string, args []string, err error) {
571
571
}
572
572
if ! legacyBIOS {
573
573
var firmware string
574
- for _ , f := range y .Firmware .Images {
575
- switch f .VMType {
576
- case "" , limayaml .QEMU :
577
- if f .Arch == * y .Arch {
578
- firmwareCandidate := filepath .Join (cfg .InstanceDir , filenames .QemuEfiCodeFD )
579
- if _ , err = fileutils .DownloadFile (firmwareCandidate , f .File , true , "UEFI code" , * y .Arch ); err != nil {
580
- logrus .WithError (err ).Warnf ("failed to download %q" , f .Location )
581
- continue
574
+ downloadedFirmware := filepath .Join (cfg .InstanceDir , filenames .QemuEfiCodeFD )
575
+ if _ , stErr := os .Stat (downloadedFirmware ); errors .Is (stErr , os .ErrNotExist ) {
576
+ loop:
577
+ for _ , f := range y .Firmware .Images {
578
+ switch f .VMType {
579
+ case "" , limayaml .QEMU :
580
+ if f .Arch == * y .Arch {
581
+ if _ , err = fileutils .DownloadFile (downloadedFirmware , f .File , true , "UEFI code " + f .Location , * y .Arch ); err != nil {
582
+ logrus .WithError (err ).Warnf ("failed to download %q" , f .Location )
583
+ continue loop
584
+ }
585
+ firmware = downloadedFirmware
586
+ logrus .Infof ("Using firmware %q (downloaded from %q)" , firmware , f .Location )
587
+ break loop
582
588
}
583
- firmware = firmwareCandidate
584
- break
585
589
}
586
590
}
591
+ } else {
592
+ firmware = downloadedFirmware
593
+ logrus .Infof ("Using existing firmware (%q)" , firmware )
587
594
}
588
595
if firmware == "" && * y .Arch != limayaml .RISCV64 {
589
596
firmware , err = getFirmware (exe , * y .Arch )
590
597
if err != nil {
591
598
return "" , nil , err
592
599
}
600
+ logrus .Infof ("Using system firmware (%q)" , firmware )
593
601
}
594
602
if firmware != "" {
595
603
args = append (args , "-drive" , fmt .Sprintf ("if=pflash,format=raw,readonly=on,file=%s" , firmware ))
0 commit comments