[SOLVED] Can't load module with GRUB2

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
isaacwoods
Member
Member
Posts: 47
Joined: Sun Sep 06, 2015 5:40 am

[SOLVED] Can't load module with GRUB2

Post 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!
Last edited by isaacwoods on Sat Sep 09, 2017 12:56 pm, edited 1 time in total.
simeonz
Member
Member
Posts: 360
Joined: Fri Aug 19, 2016 10:28 pm

Re: Can't load module with GRUB2

Post by simeonz »

Try "module2" instead of "module" may be.
isaacwoods
Member
Member
Posts: 47
Joined: Sun Sep 06, 2015 5:40 am

Re: Can't load module with GRUB2

Post by isaacwoods »

That works! Thanks very much, albeit at the cost of making me feel a little stupid :oops:
Post Reply