File tree 3 files changed +75
-0
lines changed
3 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ use std:: path:: Path ;
2
+
3
+ use crate :: DiskImageBuilder ;
4
+
5
+ const BIOS_STAGE_3 : & str = "boot-stage-3" ;
6
+ const BIOS_STAGE_4 : & str = "boot-stage-4" ;
7
+
8
+ /// Create disk images for booting on legacy BIOS systems.
9
+ pub struct BiosBoot {
10
+ image_builder : DiskImageBuilder
11
+ }
12
+
13
+ impl BiosBoot {
14
+ /// Start creating a disk image for the given bootloader ELF executable.
15
+ pub fn new ( kernel_path : & Path ) -> Self {
16
+ Self {
17
+ image_builder : DiskImageBuilder :: new ( kernel_path)
18
+ }
19
+ }
20
+
21
+ /// Add a ramdisk file to the image
22
+ pub fn set_ramdisk ( & mut self , ramdisk_path : & Path ) -> & mut Self {
23
+ self . image_builder . set_ramdisk ( ramdisk_path) ;
24
+ self
25
+ }
26
+
27
+ /// Create a bootable BIOS disk image at the given path.
28
+ pub fn create_disk_image ( & self , out_path : & Path ) -> anyhow:: Result < ( ) > {
29
+ self . image_builder . create_bios_image ( out_path)
30
+ }
31
+ }
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ An experimental x86_64 bootloader that works on both BIOS and UEFI systems.
8
8
mod gpt;
9
9
#[ cfg( feature = "bios" ) ]
10
10
mod mbr;
11
+ #[ cfg( feature = "bios" ) ]
12
+ mod bios;
13
+ #[ cfg( feature = "uefi" ) ]
14
+ mod uefi;
11
15
12
16
mod fat;
13
17
Original file line number Diff line number Diff line change
1
+ use std:: path:: Path ;
2
+
3
+ use crate :: DiskImageBuilder ;
4
+
5
+ const BIOS_STAGE_3 : & str = "boot-stage-3" ;
6
+ const BIOS_STAGE_4 : & str = "boot-stage-4" ;
7
+
8
+ /// Create disk images for booting on legacy BIOS systems.
9
+ pub struct UefiBoot {
10
+ image_builder : DiskImageBuilder
11
+ }
12
+
13
+ impl UefiBoot {
14
+ /// Start creating a disk image for the given bootloader ELF executable.
15
+ pub fn new ( kernel_path : & Path ) -> Self {
16
+ Self {
17
+ image_builder : DiskImageBuilder :: new ( kernel_path)
18
+ }
19
+ }
20
+
21
+ /// Add a ramdisk file to the image
22
+ pub fn set_ramdisk ( & mut self , ramdisk_path : & Path ) -> & mut Self {
23
+ self . image_builder . set_ramdisk ( ramdisk_path) ;
24
+ self
25
+ }
26
+
27
+ /// Create a bootable UEFI disk image at the given path.
28
+ pub fn create_disk_image ( & self , out_path : & Path ) -> anyhow:: Result < ( ) > {
29
+ self . image_builder . create_uefi_image ( out_path)
30
+ }
31
+
32
+ /// Prepare a folder for use with booting over UEFI_PXE.
33
+ ///
34
+ /// This places the bootloader executable under the path "bootloader". The
35
+ /// DHCP server should set the filename option to that path, otherwise the
36
+ /// bootloader won't be found.
37
+ pub fn create_pxe_tftp_folder ( & self , out_path : & Path ) -> anyhow:: Result < ( ) > {
38
+ self . image_builder . create_uefi_tftp_folder ( out_path)
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments