@@ -573,7 +573,12 @@ func Cmdline(ctx context.Context, cfg Config) (exe string, args []string, err er
573
573
}
574
574
args = appendArgsIfNoConflict (args , "-machine" , machine )
575
575
case limayaml .RISCV64 :
576
- machine := "virt,accel=" + accel
576
+ // https://github.com/tianocore/edk2/blob/edk2-stable202408/OvmfPkg/RiscVVirt/README.md#test
577
+ // > Note: the `acpi=off` machine property is specified because Linux guest
578
+ // > support for ACPI (that is, the ACPI consumer side) is a work in progress.
579
+ // > Currently, `acpi=off` is recommended unless you are developing ACPI support
580
+ // > yourself.
581
+ machine := "virt,acpi=off,accel=" + accel
577
582
args = appendArgsIfNoConflict (args , "-machine" , machine )
578
583
case limayaml .ARMV7L :
579
584
machine := "virt,accel=" + accel
@@ -613,7 +618,7 @@ func Cmdline(ctx context.Context, cfg Config) (exe string, args []string, err er
613
618
firmware = downloadedFirmware
614
619
logrus .Infof ("Using existing firmware (%q)" , firmware )
615
620
}
616
- if firmware == "" && * y . Arch != limayaml . RISCV64 {
621
+ if firmware == "" {
617
622
firmware , err = getFirmware (exe , * y .Arch )
618
623
if err != nil {
619
624
return "" , nil , err
@@ -1031,6 +1036,14 @@ func qemuArch(arch limayaml.Arch) string {
1031
1036
return arch
1032
1037
}
1033
1038
1039
+ // qemuEdk2 returns the arch string used by `/usr/local/share/qemu/edk2-*-code.fd`.
1040
+ func qemuEdk2Arch (arch limayaml.Arch ) string {
1041
+ if arch == limayaml .RISCV64 {
1042
+ return "riscv"
1043
+ }
1044
+ return qemuArch (arch )
1045
+ }
1046
+
1034
1047
func Exe (arch limayaml.Arch ) (exe string , args []string , err error ) {
1035
1048
exeBase := "qemu-system-" + qemuArch (arch )
1036
1049
envK := "QEMU_SYSTEM_" + strings .ToUpper (qemuArch (arch ))
@@ -1094,7 +1107,7 @@ func getQemuVersion(qemuExe string) (*semver.Version, error) {
1094
1107
1095
1108
func getFirmware (qemuExe string , arch limayaml.Arch ) (string , error ) {
1096
1109
switch arch {
1097
- case limayaml .X8664 , limayaml .AARCH64 , limayaml .ARMV7L :
1110
+ case limayaml .X8664 , limayaml .AARCH64 , limayaml .ARMV7L , limayaml . RISCV64 :
1098
1111
default :
1099
1112
return "" , fmt .Errorf ("unexpected architecture: %q" , arch )
1100
1113
}
@@ -1108,7 +1121,7 @@ func getFirmware(qemuExe string, arch limayaml.Arch) (string, error) {
1108
1121
localDir := filepath .Dir (binDir ) // "/usr/local"
1109
1122
userLocalDir := filepath .Join (currentUser .HomeDir , ".local" ) // "$HOME/.local"
1110
1123
1111
- relativePath := fmt .Sprintf ("share/qemu/edk2-%s-code.fd" , qemuArch (arch ))
1124
+ relativePath := fmt .Sprintf ("share/qemu/edk2-%s-code.fd" , qemuEdk2Arch (arch ))
1112
1125
candidates := []string {
1113
1126
filepath .Join (userLocalDir , relativePath ), // XDG-like
1114
1127
filepath .Join (localDir , relativePath ), // macOS (homebrew)
@@ -1135,6 +1148,8 @@ func getFirmware(qemuExe string, arch limayaml.Arch) (string, error) {
1135
1148
// Debian package "qemu-efi-arm"
1136
1149
// Fedora package "edk2-arm"
1137
1150
candidates = append (candidates , "/usr/share/AAVMF/AAVMF32_CODE.fd" )
1151
+ case limayaml .RISCV64 :
1152
+ // NOP, as EDK2 for RISCV64 is not packaged yet in well-known distros.
1138
1153
}
1139
1154
1140
1155
logrus .Debugf ("firmware candidates = %v" , candidates )
0 commit comments