Skip to contentSkip to conversation

initcall and setup

parisc-linux Matthew Wilcox 3 participants 3 messages Jan 14, 2000 – Jan 15, 2000

lore
Share & tools
lore
#0 lore raw

One of the things which has changed during 2.3 development is initialisation. We used to have files full of:

#ifdef CONFIG_FOO
	init_foo();

#endif

#ifdef CONFIG_BAR
	init_bar();

#endif

#ifdef CONFIG_QUUX
	init_quux();

#endif

which was pretty ugly stuff.

Instead, we have declarations like:

__setup("video=", video_setup);
__setup("wd33c93", wd33c93_setup);
__setup("es1370=", es1370_setup);

in each driver and then a loop in init/main.c which goes through and calls all the __setup functions. Much prettier, more modular, less dependent on CONFIG_, etc.

Unfortunately, we can't take advantage of this, because we don't yet have ELF tools. This is implemented through an ELF section called __initcall which contains the address of the function to call. We could try to hack something together with SOM, but I'd really rather not put the work in that will just be dumped later.

This explains why we get some of the warnings on compilation;' eg:

init/main.c:170: warning: `__setup_profile_setup' defined but not used

and why if you diff our kernel against Linus', you will find that we have reinserted some of the explicit calls to the setup routines that have been eliminated from the mainline tree. It also explains why sometimes a driver may not be called even though you compiled it in.

#1 lore raw
Quoted 3 lines · Matthew Wilcox

One of the things which has changed during 2.3 development is initialisation.

...

Quoted 5 lines

Unfortunately, we can't take advantage of this, because we don't yet have ELF tools. This is implemented through an ELF section called __initcall which contains the address of the function to call. We could try to hack something together with SOM, but I'd really rather not put the work in that will just be dumped later.

Just a clarification: The kernel will use ELF once the tool chain is in place. The kernel is SOM now only because of our dependency on HP-UX ld. Any forcasts for when we can switch to ELF?

...

Quoted 4 lines

and why if you diff our kernel against Linus', you will find that we have reinserted some of the explicit calls to the setup routines that have been eliminated from the mainline tree. It also explains why sometimes a driver may not be called even though you compiled it in.

Any general rules on where to reinsert stuff? (eg tulip_probe) In the same place it's in the linux-2.2?
Is someone making a note to make sure the reinserted code gets dropped when we migrate to either the next 2.3 (or possibly 2.4) release?

thanks,
grant

Grant Grundler
Unix Development Lab
+1.408.447.7253

#2 lore raw
Quoted 3 lines · Grant Grundler

Just a clarification: The kernel will use ELF once the tool chain is in place. The kernel is SOM now only because of our dependency on HP-UX ld. Any forcasts for when we can switch to ELF?

Yup. The 64 bit parisc GCC package will be released shortly. We've been busy packaging it up in the last couple of days.

After that, we'll have to start looking at making a 32 bit ELF toolchain.

- Alex

Signature · 3 lines
Alex deVries
Director of Professional Services
The Puffins at Linuxcare