Re: UML kbuild patch

Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Mon, 23 Sep 2002 19:24:01 -0500 (CDT)


On Mon, 23 Sep 2002, Jeff Dike wrote:

> The UML build needs a few kbuild changes in order to work with the latest
> stuff.
>
> Since kbuild now enforces the use of the linker script on the vmlinux build,
> UML can't use its old two-stage link, where
> vmlinux is a normal relocatable object file
> which is linked into the linux binary with the linker script
>
> So, in order to fold those into one stage and produce an ELF binary, I need
> the vmlinux "linker" to actually be gcc. This implies I need a
> "-Wl,-T,arch/$(ARCH)/vmlinux.lds.s" instead of the usual
> "-T arch/$(ARCH)/vmlinux.lds.s".
>
> This is done without breaking the other arches by changing the final link
> command to $(LD_vmlinux) which is defaulted to $(LD) if the arch doesn't
> define it.
>
> The "-Wl,..." is done similarly by using $(LDFLAGS_vmlinux_default) if
> the linker command is anything but gcc and $(LDFLAGS_vmlinux_gcc) if it is
> gcc.

I just thought of another solution, which actually seems cleaner and has
less impact on the top-level (generic) Makefile.

Let's just do the

LDFLAGS_vmlinux := -T arch/$(ARCH)/vmlinux.lds.s

before including arch/$(ARCH)/Makefile.
Normal archs can then just do

LDFLAGS_vmlinux += -extra_option

while UML does

LDFLAGS_vmlinux := -r

The actual executable UML generates is called "linux" anyway, so its
Makefile can have its own rule (as for other archs the boot images) which
builds "linux" from "vmlinux" using gcc and the link script. - I.e. the
same way as UML used to do it earlier, anyway.

The only impact on generic code is basically
s/LDFLAGS_vmlinux :=/LDFLAGS_vmlinux +=/
in arch/*/Makefile, and it makes the UML "linux" build conceptually
similar to other archs' "bzImage" or whatever targets.

What do you think?

--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/