[Removed l-k Cc]

On Mon, 23 Sep 2002, Jeff Dike wrote:

> [EMAIL PROTECTED] said:
> > 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. 
> 
> I'd actually prefer the one-stage link.  That takes better advantage of
> the infrastructure that you've put in place.
> 
> Instead of making LDFLAGS_vmlinux available to the arch Makefile, can
> you make cmd_link_vmlinux available?  Then I can just rewrite it.
> 
> That looks like it has no impact on the global Makefile except for moving
> it above the include of the arch Makefile.

Well, I don't think messing with cmd_link_vmlinux yourself is a good idea,
that basically means code duplication, which is bad ;)

If you really want the one-stage link, let's do it the way you suggested. 
However, I still think doing vmlinux first and linux afterwards is 
conceptually more similar to the normal vmlinux -> bzImage or whatever.

For example, there's a pending patch (kksymoops/kallsyms) which replaces 
the vmlinux link with a two-stage process, it'd be nice if such changes 
can happen without interfering with arch/*/Makefile at all.

So here's my current proposal, however I'm not entirely sure if that order 
of using the link script is okay or not, uml just segfaults here either 
way. Against your updates-2.5.

--Kai


===== Makefile 1.308 vs edited =====
--- 1.308/Makefile      Mon Sep 23 20:46:21 2002
+++ edited/Makefile     Tue Sep 24 11:32:18 2002
@@ -288,12 +288,10 @@
 #       we cannot yet know if we will need to relink vmlinux.
 #      So we descend into init/ inside the rule for vmlinux again.
 
-LD_vmlinux := $(if $(LD_vmlinux),$(LD_vmlinux),$(LD))
-
 vmlinux-objs := $(HEAD) $(INIT) $(CORE_FILES) $(LIBS) $(DRIVERS) $(NETWORKS)
 
 quiet_cmd_link_vmlinux = LD      $@
-cmd_link_vmlinux = $(LD_vmlinux) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
+cmd_link_vmlinux = $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $(HEAD) $(INIT) \
                --start-group \
                $(CORE_FILES) \
                $(LIBS) \
@@ -315,11 +313,7 @@
        $(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] 
\)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
 endef
 
-LDFLAGS_vmlinux_default = -T arch/$(ARCH)/vmlinux.lds.s
-LDFLAGS_vmlinux_gcc = -Wl,-T,arch/$(ARCH)/vmlinux.lds.s
-
-vmlinux_base = $(basename $(notdir $(LD_vmlinux)))
-LDFLAGS_vmlinux += $(if 
$(LDFLAGS_vmlinux_$(vmlinux_base)),$(LDFLAGS_vmlinux_$(vmlinux_base)),$(LDFLAGS_vmlinux_default))
+LDFLAGS_vmlinux += -T arch/$(ARCH)/vmlinux.lds.s
 
 vmlinux: $(vmlinux-objs) arch/$(ARCH)/vmlinux.lds.s FORCE
        $(call if_changed_rule,link_vmlinux)
===== arch/um/Makefile 1.3 vs edited =====
--- 1.3/arch/um/Makefile        Mon Sep 23 20:51:25 2002
+++ edited/arch/um/Makefile     Tue Sep 24 11:50:42 2002
@@ -32,8 +32,7 @@
 
 core-y                 += $(ARCH_DIR)/kernel/           \
                           $(ARCH_DIR)/drivers/          \
-                          $(ARCH_DIR)/sys-$(SUBARCH)/   \
-                          $(ARCH_DIR)/os-$(OS)/
+                          $(ARCH_DIR)/sys-$(SUBARCH)/
 
 libs-$(CONFIG_PT_PROXY)        += $(ARCH_DIR)/ptproxy/
 
@@ -48,8 +47,6 @@
        -DSUBARCH=\"$(SUBARCH)\" -D_LARGEFILE64_SOURCE -I$(ARCH_INCLUDE) \
        -Derrno=kernel_errno
 
-LDFLAGS += -r
-
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
 SIZE = (($(CONFIG_NEST_LEVEL) + $(CONFIG_KERNEL_HALF_GIGS)) * 0x20000000)
@@ -57,8 +54,7 @@
 AFLAGS_vmlinux.lds.o = -U$(SUBARCH) -DSTART=$$(($(TOP_ADDR) - $(SIZE))) \
        -DELF_ARCH=$(ELF_ARCH) -DELF_FORMAT=\"$(ELF_FORMAT)\"
 
-LD_vmlinux = $(CC) 
-LDFLAGS_vmlinux = $(LINK_PROFILE) $(LINK_WRAPS) -static $(ARCH_DIR)/main.o 
+LDFLAGS_vmlinux = -r $(LINK_PROFILE) -static $(ARCH_DIR)/main.o
 
 SYMLINK_HEADERS = include/asm-um/archparam.h include/asm-um/system.h \
        include/asm-um/sigcontext.h include/asm-um/processor.h \
@@ -72,7 +68,7 @@
 linux: scripts $(ARCH_SYMLINKS) $(GEN_HEADERS) $(SYS_HEADERS) \
        $(ARCH_DIR)/main.o \
        vmlinux
-       mv vmlinux linux
+       gcc -o $@ $(LINK_WRAPS) -lutil vmlinux
 
 USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
 USER_CFLAGS := $(patsubst -Derrno=kernel_errno,,$(USER_CFLAGS))
===== arch/um/Makefile-os-Linux 1.1 vs edited =====
--- 1.1/arch/um/Makefile-os-Linux       Fri Sep  6 12:29:28 2002
+++ edited/arch/um/Makefile-os-Linux    Tue Sep 24 11:44:02 2002
@@ -3,5 +3,4 @@
 # Licensed under the GPL
 #
 
-SUBDIRS += $(ARCH_DIR)/os-$(OS)/drivers
-LIBS += $(ARCH_DIR)/os-$(OS)/drivers/drivers.o
+core-y         += $(ARCH_DIR)/os-$(OS)/
===== arch/um/kernel/Makefile 1.2 vs edited =====
--- 1.2/arch/um/kernel/Makefile Sun Sep 22 18:40:07 2002
+++ edited/arch/um/kernel/Makefile      Tue Sep 24 11:36:03 2002
@@ -10,7 +10,6 @@
        umid.o user_util.o
 
 obj-$(CONFIG_BLK_DEV_INITRD) += initrd_kern.o initrd_user.o
-endif
 
 # user_syms.o not included here because Rules.make has its own ideas about
 # building anything in export-objs



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
kbuild-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/kbuild-devel

Reply via email to