@@ -21,11 +21,25 @@ use tempfile::TempDir;
2121use { std:: fs:: Permissions , std:: os:: unix:: fs:: PermissionsExt } ;
2222
2323/// Name of the ovmf-prebuilt release to use by default.
24- const OVMF_PREBUILT_SOURCE : Source = Source :: EDK2_STABLE202502_R2 ;
24+ ///
25+ /// This is typically the latest stable release.
26+ const OVMF_PREBUILT_SOURCE : Source = Source :: EDK2_STABLE202605_R1 ;
27+
28+ /// Name of the ovmf-prebuilt release to use for IA32.
29+ ///
30+ /// After EDK2_STABLE202508_R1, IA32 support was dropped in edk2.
31+ const OVMF_PREBUILT_IA32_SOURCE : Source = Source :: EDK2_STABLE202508_R1 ;
2532
2633/// Directory into which the prebuilts will be download (relative to the repo root).
2734const OVMF_PREBUILT_DIR : & str = "target/ovmf" ;
2835
36+ fn ovmf_prebuilt_source ( arch : UefiArch ) -> Source {
37+ match arch {
38+ UefiArch :: IA32 => OVMF_PREBUILT_IA32_SOURCE ,
39+ UefiArch :: AArch64 | UefiArch :: X86_64 => OVMF_PREBUILT_SOURCE ,
40+ }
41+ }
42+
2943impl From < UefiArch > for ovmf_prebuilt:: Arch {
3044 fn from ( arch : UefiArch ) -> Self {
3145 match arch {
@@ -52,6 +66,7 @@ struct OvmfPaths {
5266 code : PathBuf ,
5367 vars : PathBuf ,
5468 shell : PathBuf ,
69+ prebuilt_source_tag : & ' static str ,
5570}
5671
5772impl OvmfPaths {
@@ -62,7 +77,12 @@ impl OvmfPaths {
6277 /// 1. Command-line arg
6378 /// 2. Environment variable
6479 /// 3. Prebuilt file (automatically downloaded)
65- fn find_ovmf_file ( file_type : FileType , opt : & QemuOpt , arch : UefiArch ) -> Result < PathBuf > {
80+ fn find_ovmf_file (
81+ file_type : FileType ,
82+ opt : & QemuOpt ,
83+ arch : UefiArch ,
84+ prebuilt : & Prebuilt ,
85+ ) -> Result < PathBuf > {
6686 if let Some ( path) = get_user_provided_path ( file_type, opt) {
6787 // The user provided an exact path to use; verify that it
6888 // exists.
@@ -76,20 +96,42 @@ impl OvmfPaths {
7696 ) ;
7797 }
7898 } else {
79- let prebuilt = Prebuilt :: fetch ( OVMF_PREBUILT_SOURCE , OVMF_PREBUILT_DIR ) ?;
80-
8199 Ok ( prebuilt. get_file ( arch. into ( ) , file_type) )
82100 }
83101 }
84102
85103 /// Find path to OVMF files by the strategy documented for
86104 /// [`Self::find_ovmf_file`].
87105 fn find ( opt : & QemuOpt , arch : UefiArch ) -> Result < Self > {
88- let code = Self :: find_ovmf_file ( FileType :: Code , opt, arch) ?;
89- let vars = Self :: find_ovmf_file ( FileType :: Vars , opt, arch) ?;
90- let shell = Self :: find_ovmf_file ( FileType :: Shell , opt, arch) ?;
106+ let prebuilt_source = ovmf_prebuilt_source ( arch) ;
107+ let prebuilt = Prebuilt :: fetch ( prebuilt_source. clone ( ) , OVMF_PREBUILT_DIR ) ?;
108+ let code = Self :: find_ovmf_file ( FileType :: Code , opt, arch, & prebuilt) ?;
109+ let vars = Self :: find_ovmf_file ( FileType :: Vars , opt, arch, & prebuilt) ?;
110+ let shell = Self :: find_ovmf_file ( FileType :: Shell , opt, arch, & prebuilt) ?;
111+
112+ Ok ( Self {
113+ code,
114+ vars,
115+ shell,
116+ prebuilt_source_tag : prebuilt_source. tag ,
117+ } )
118+ }
91119
92- Ok ( Self { code, vars, shell } )
120+ fn log ( & self , arch : UefiArch ) {
121+ eprintln ! ( "OVMF:" ) ;
122+ eprintln ! ( " version: {}" , self . prebuilt_source_tag) ;
123+ if arch == UefiArch :: IA32 {
124+ // https://github.com/tianocore/edk2/commit/1fb88ffe284782cc79e306306b8d19829b6248b7
125+ eprintln ! (
126+ "{leftpadding}note: using this instead of {} as it is the last \
127+ release with IA32 support in edk2",
128+ OVMF_PREBUILT_SOURCE . tag,
129+ leftpadding = " " . repeat( 11 )
130+ ) ;
131+ }
132+ eprintln ! ( " code : {}" , self . code. display( ) ) ;
133+ eprintln ! ( " vars : {}" , self . vars. display( ) ) ;
134+ eprintln ! ( " shell : {}" , self . shell. display( ) ) ;
93135 }
94136}
95137
@@ -422,6 +464,7 @@ pub fn run_qemu(arch: UefiArch, opt: &QemuOpt) -> Result<()> {
422464
423465 // Set up OVMF.
424466 let ovmf_paths = OvmfPaths :: find ( opt, arch) ?;
467+ ovmf_paths. log ( arch) ;
425468
426469 // Make a copy of the OVMF vars file so that it can be used
427470 // read+write without modifying the original. Under AArch64, some
0 commit comments