File tree 2 files changed +20
-7
lines changed
2 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -100,13 +100,6 @@ pub fn output_message_byte(byte: u8) {
100
100
unsafe { COM1 . send ( byte) } ;
101
101
}
102
102
103
- // Right now, the kernel binary has to be hardcoded into the loader.
104
- // The binary has to be in the same directory (or its whereabouts have to specified in the "include_bytes!" statement).
105
- #[ cfg( target_os = "uefi" ) ]
106
- pub unsafe fn find_kernel ( ) -> & ' static [ u8 ] {
107
- include_bytes ! ( "hermit-rs-template" )
108
- }
109
-
110
103
/// This is the actual boot function.
111
104
/// The bootstack is cleared and provided/calculated BOOT_INFO is written into before the actual call to the assembly code to jump into the kernel.
112
105
#[ cfg( target_os = "uefi" ) ]
Original file line number Diff line number Diff line change @@ -11,6 +11,26 @@ use uefi::{
11
11
table:: { boot:: * , cfg} ,
12
12
} ;
13
13
14
+ /// This function reads the provided kernelbinary
15
+ /// req. location: same subdir as the bootloader itself
16
+ /// reg. name: hermit_app
17
+ fn read_app ( bt : & BootServices ) -> Vec < u8 > {
18
+ let fs = bt
19
+ . get_image_file_system ( bt. image_handle ( ) )
20
+ . expect ( "should open file system" ) ;
21
+
22
+ let path = Path :: new ( cstr16 ! ( r"\efi\boot\hermit_app" ) ) ;
23
+
24
+ let data = FileSystem :: new ( fs)
25
+ . read ( path)
26
+ . expect ( "should read file content" ) ;
27
+
28
+ let len = data. len ( ) ;
29
+ info ! ( "Read Hermit application from \" {path}\" (size = {len} B)" ) ;
30
+
31
+ data
32
+ }
33
+
14
34
/// Entry Point of the UEFI Loader
15
35
/// This function gets a so-called "EFI System Table" (see UEFI Specification, Section 4: EFI System Table) from the Firmware Interface.
16
36
/// Here, the RSDP (for BOOT_INFO) and the kernel are located and the kernel is parsed and loaded into memory.
You can’t perform that action at this time.
0 commit comments