Page 1 of 1

[SOLVED] Can't load module with GRUB2

Posted: Sat Sep 09, 2017 10:33 am
by isaacwoods
I am trying to load a module (a flat binary file) using GRUB2. I have put the file I want to load at the root of the ISO and then modified my grub.cfg to:

Code: Select all

...
  multiboot2 /boot/kernel.bin
  module /test_program.bin
  boot
...
I am then trying to read the information about this module using the multiboot2 crate (my OS is written in Rust) with this code (just to test the number of modules loaded):

Code: Select all

    let boot_info = unsafe { multiboot2::load(multiboot_ptr) };
    println!("Detected {} modules", boot_info.module_tags().count());
This reports that 0 modules have been loaded. I am fairly sure the parsing of the multiboot header is working as intended, as I am using it for page frame allocation etc. successfully. Thanks in advance!

Re: Can't load module with GRUB2

Posted: Sat Sep 09, 2017 11:59 am
by simeonz
Try "module2" instead of "module" may be.

Re: Can't load module with GRUB2

Posted: Sat Sep 09, 2017 12:56 pm
by isaacwoods
That works! Thanks very much, albeit at the cost of making me feel a little stupid :oops: