bootloader & head.S weirdness & restructuring

Geert Uytterhoeven geert at
Fri Nov 26 04:13:28 EST 1999

On Tue, 23 Nov 1999, Dan Malek wrote:
> There are already "machine" dependent files at the lowest
> levels, just not in separate directories.  The complexity of
> the "#ifdefs" at the PPC level is mostly to ensure we get to
> the proper lower level dependent files.
> Further, because of the integrated nature of some PPC processors,
> the line between processor and machine is a little fuzzy.  For
> example, the 8240 is a 603/MPC106/CHRP...but not exactly.  You
> can leverage lots of existing code, but need to twist it just
> a little in a couple of places.  It doesn't fit the processor
> and machine model very well.

Alternatively, you can base your decisions on specific features that are shared
among different machine types, and say

    if (has_feature_a) {

instead of

    #if defined(CONFIG_x) || defined(CONFIG_y) || defined(CONFIG_z)

This way you can also easily create common kernel images that run on various
types of machines, since has_feature_a is just a variable that's set up
dynamically on kernel startup.

If you want to create an optimized kernel for a specific machine type, say

    #if defined(CONFIG_x) || defined(CONFIG_y) || defined(CONFIG_z)
    #define has_feature_a	1
    #define has_feature_a	0

and gcc will optimize away the unused parts.

Geert Uytterhoeven -- Linux/{m68k~Amiga,PPC~CHRP} -- geert at

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

** Sent via the linuxppc-dev mail list. See

More information about the Linuxppc-dev mailing list