Quoting Daniel Axtens (2023-10-05 08:07:47)
> (Unless anything has changed dramatically in the last year:) Dependencies are 
> calculated automatically on the basis of symbols that you use in your module. 
> If you look at genmoddep.awk and work out from there you can get a handle on 
> the process. If you only use symbols provided by the ‘kernel’, then you won’t 
> have any dependencies.
>
Thanks for the info, that makes sense.

> If you are writing a new module, make sure it’s specified in 
> Makefile.core.def and you’ve regenerated the necessary files. (From memory I 
> used to need a full bootstrap to get changes to percolate through.)
>
> Kind regards,
> Daniel

There is the problem with the new bli module, that it requires the
part_gpt module to be loaded beforehand, but the module dependency list
for bli is emplty (see moddep.lst).

The part_gpt module only exports one function,
grub_gpt_partition_map_iterate(). This is not used in the bli module.
However, if part_gpt is not loaded grub does not know how to work with
gpt formatted disks and these are not visible.
The bli module then can't use grub_device_open(), grub_disk_open(), etc.
to get the partition UUID of the ESP.

Adding this dummy call to bli.c causes part_gpt to appear as a
dependency:
  (void) grub_gpt_partition_map_iterate (NULL, NULL, NULL);

Thanks, I understand the problem now.

Oliver

> > On 4 Oct 2023, at 8:31 pm, Oliver Steffen <ostef...@redhat.com> wrote:
> >
> > Hi,
> >
> > Is there a way to specify dependencies for a module? As in a list of
> > other modules that need to be loaded before?
> >
> > I found a macro named GRUB_MOD_DEP in dh.h, but when I use it in the
> > module's .c file I get errors about a missing .moddeps section. It also
> > does not seem to be in use anywhere.
> >
> > How are dependencies handled? I looked at moddep.lst and it does not
> > show anything listed for the module I am working on, while other modules
> > have a list of dependencies. What am I missing here?
> >
> > Thanks a lot,
> >
> > Oliver
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/grub-devel
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel

--
🎩Oliver Steffen (he/him) - Software Engineer, Virtualization
Red Hat GmbH <https://www.redhat.com/de/global/dach>,
Registered seat: Werner-von-Siemens-Ring 12, D-85630 Grasbrunn, Germany
Commercial register: Amtsgericht München/Munich, HRB 153243,
Managing Directors: Ryan Barnhart, Charles Cachera, Michael O'Neill,
Amy Ross

Everyone has different working hours… Please do not feel obligated to
reply outside of your normal work schedule.


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to