grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Module dependencies


From: Daniel Kiper
Subject: Re: Module dependencies
Date: Fri, 10 Nov 2023 18:31:34 +0100
User-agent: NeoMutt/20170113 (1.7.2)

Adding Vladimir...

On Thu, Oct 19, 2023 at 04:50:10AM -0700, Oliver Steffen wrote:
> 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.

I chatted with Vladimir and he suggested this:

diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk
index 247436392..716732a91 100644
--- a/grub-core/genmoddep.awk
+++ b/grub-core/genmoddep.awk
@@ -51,6 +51,9 @@ END {
     for (depmod in uniqmods) {
       delete uniqmods[depmod];
     }
+    if (mod == "bli") {
+      uniqmods["part_gpt"] = 1;
+    }
     for (i in depmods) {
       depmod = depmods[i];
       # Ignore kernel, as always loaded.

I think it makes sense. Though I would go a bit further and create
a hash of arrays which would contain extra dependencies for modules.
If you are OK with this idea please create a patch for bli module
and post it on the grub-devel.

Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]