11mod chainloader;
2- mod grub ;
2+ mod limine ;
33
44use alloc:: format;
55use alloc:: vec:: Vec ;
@@ -16,9 +16,9 @@ pub fn run(mbi: &BootInformation) -> anyhow::Result<()> {
1616 . name ( )
1717 . map_err ( anyhow:: Error :: msg) ?;
1818
19- if bootloader. to_lowercase ( ) . contains ( "grub " ) {
20- log:: info!( "loaded by grub " ) ;
21- grub :: run ( mbi) ?;
19+ if bootloader. to_lowercase ( ) . contains ( "limine " ) {
20+ log:: info!( "loaded by Limine " ) ;
21+ limine :: run ( mbi) ?;
2222 } else {
2323 log:: info!( "loaded by chainloader" ) ;
2424 chainloader:: run ( mbi) ?;
@@ -78,6 +78,15 @@ pub(self) fn print_module_info(mbi: &BootInformation) -> anyhow::Result<()> {
7878 }
7979 let module = modules. first ( ) . unwrap ( ) ;
8080 let module_cmdline = module. cmdline ( ) . map_err ( anyhow:: Error :: msg) ?;
81+
82+ let allowed_module_cmdlines = [ "Limine bootloader config" , "multiboot2_payload" ] ;
83+ assert ! (
84+ allowed_module_cmdlines
85+ . iter( )
86+ . any( |& str | module_cmdline == str ) ,
87+ "The module cmdline must be one of {allowed_module_cmdlines:?} but is {module_cmdline}"
88+ ) ;
89+
8190 println ! ( "Modules:" ) ;
8291 println ! (
8392 " 0x{:010x} - 0x{:010x} ({} B, cmdline='{}')" ,
@@ -86,13 +95,13 @@ pub(self) fn print_module_info(mbi: &BootInformation) -> anyhow::Result<()> {
8695 module. module_size( ) ,
8796 module_cmdline
8897 ) ;
89- println ! ( " grub cfg passed as boot module:" ) ;
98+ println ! ( " bootloader cfg passed as boot module:" ) ;
9099 let grup_cfg_ptr = module. start_address ( ) as * const u32 as * const u8 ;
91100 let grub_cfg =
92101 unsafe { core:: slice:: from_raw_parts ( grup_cfg_ptr, module. module_size ( ) as usize ) } ;
93102
94- // In the GRUB bootflow case, we pass the config as module with it. This is
95- // not done for the chainloaded case.
103+ // In the Limine bootflow case, we pass the config as module with it. This
104+ // is not done for the chainloaded case.
96105 if let Ok ( str) = core:: str:: from_utf8 ( grub_cfg) {
97106 println ! ( "=== file begin ===" ) ;
98107 for line in str. lines ( ) {
0 commit comments