Can you wrap this code into small functions like machine_detect() and
board_setup() and put it all in one place? That way those of us who
just want a simple system supporting only one board can just replace
those two functions with defines that alias the proper machine_detect
and board_setup fuctions. Then all of the special elf sections and
function pointers go away.
If it's all in one place like this, then maybe it could be configured
in the config.in file. I can ifdef it out for boards like mine or other
boards that can't possibly support more than one system in a given binary
image. config.in could ifdef it in for configurations that could possibly
support more than one configuration in a given binary image.
Jun Sun wrote:
The actual mechanism can vary and be flexible, but here is more detail what I
had in mind:
1. <my>_detect is placed in a special ELF section (mips_mach_detect), using
similar mechanism as .initcall.init section and __setup() macro.
2. in addition to the 3 possible return value, <my>_detect also returns a
function pointer to <my>_setup. Once a final candidate is chosen, the machine
detection code will issue the right <my>_setup call.
There are probably some other related changes which need to be made, (e.g.,
prom_init() may be eliminated, etc).
It seems like I get more and more positive feedbacks on this idea. We should
try to implement this in 2.5.