11use anyhow:: { anyhow, bail, Context , Result } ;
2- use camino:: { Utf8Path , Utf8PathBuf } ;
2+ use camino:: Utf8Path ;
33use fn_error_context:: context;
44
55use crate :: task:: Task ;
66use bootc_blockdev:: PartitionTable ;
77
88/// The name of the mountpoint for efi (as a subdirectory of /boot, or at the toplevel)
99pub ( crate ) const EFI_DIR : & str = "efi" ;
10- #[ cfg( feature = "install-to-disk" ) ]
11- pub ( crate ) const ESP_GUID : & str = "C12A7328-F81F-11D2-BA4B-00A0C93EC93B" ;
12- #[ cfg( feature = "install-to-disk" ) ]
13- pub ( crate ) const PREPBOOT_GUID : & str = "9E1A2D38-C612-4316-AA26-8B49521E5A8B" ;
14- #[ cfg( feature = "install-to-disk" ) ]
15- pub ( crate ) const PREPBOOT_LABEL : & str = "PowerPC-PReP-boot" ;
16- #[ cfg( target_arch = "powerpc64" ) ]
17- /// We make a best-effort to support MBR partitioning too.
18- pub ( crate ) const PREPBOOT_MBR_TYPE : & str = "41" ;
19-
20- /// Find the device to pass to bootupd. Only on powerpc64 right now
21- /// we explicitly find one with a specific label.
22- ///
23- /// This should get fixed once we execute on https://github.com/coreos/bootupd/issues/432
24- fn get_bootupd_device ( device : & PartitionTable ) -> Result < Utf8PathBuf > {
25- #[ cfg( target_arch = "powerpc64" ) ]
26- {
27- return device
28- . partitions
29- . iter ( )
30- . find ( |p| matches ! ( p. parttype. as_str( ) , PREPBOOT_GUID | PREPBOOT_MBR_TYPE ) )
31- . ok_or_else ( || {
32- anyhow:: anyhow!( "Failed to find PReP partition with GUID {PREPBOOT_GUID}" )
33- } )
34- . map ( |dev| dev. node . as_str ( ) . into ( ) ) ;
35- }
36- #[ cfg( not( target_arch = "powerpc64" ) ) ]
37- return Ok ( device. path ( ) . into ( ) ) ;
38- }
3910
4011#[ context( "Installing bootloader" ) ]
4112pub ( crate ) fn install_via_bootupd (
@@ -47,7 +18,7 @@ pub(crate) fn install_via_bootupd(
4718 // bootc defaults to only targeting the platform boot method.
4819 let bootupd_opts = ( !configopts. generic_image ) . then_some ( [ "--update-firmware" , "--auto" ] ) ;
4920
50- let devpath = get_bootupd_device ( device) ? ;
21+ let devpath = device. path ( ) ;
5122 let args = [ "backend" , "install" , "--write-uuid" ]
5223 . into_iter ( )
5324 . chain ( verbose)
0 commit comments