Re: [PATCH] Initcall depends

Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Mon, 17 Jun 2002 17:43:11 -0500 (CDT)


On Tue, 18 Jun 2002, Rusty Russell wrote:

> Unfortunately, this is rather painful:
>
> 1) File A contains an initcall.
> 2) Find Module A which File A is part of.
> 3) For each exported symbol used by Module A
> 4) Find Module B which exports this symbol.
> 5) Find Files B which make up Module B.
> 6) For each initcall in Files B, insert a dependency.
>
> Any clues for (2) and (5)?

I agree that it may be painful.

Parts of a solution could be (based on yours above).

o Define KBUILD_OBJECT during the build, which contains the
name of the module the file we're building will/would end up.

o Use that to rename the __initcall_whatever to
__initcall__module__whatever.

o Make a symlink tree pointing to the objects that will be linked in
(Basically $(obj-y))

o Go through the symlink tree and for all objects which export objects
and have __initcalls, record that relation.

o For all __initcall__moduleA__ in the objects to be linked into
vmlinux, find the object that defines it in the symlink tree (its name
will be moduleA.o).

o Find the unresolved symbols in that object moduleA.o.

o For each unresolved symbol in moduleA.o, if you find the symbol in the
previously recorded pairs of (exported symbols, __initcall__moduleB),
move __initcall_moduleA behind __initcall_moduleB.

Probably some issues come up when actually trying to do this, but it
sounds doable at least in principle.

Then again, there's also the possibility of completing initramsfs, making
it mandatory, compiling things always as modules and leaving it to
"depmod" in initramfs to do the right thing.

--Kai

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/