Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Jeff Dike
[EMAIL PROTECTED] said:
> Err...  FWIW, aforementioned patch lacks e.g. vmlinux.lds.S.

Yeah, I have that fixed locally.  I just haven't pushed out the new stuff yet.

Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Al Viro
On Sun, Feb 13, 2005 at 01:12:54PM -0500, Jeff Dike wrote:
> [EMAIL PROTECTED] said:
> > 1. To support a separate build tree for the um/i386 architecture the
> > following changes have been done: 
> 
> Have a look at 
>   
> http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/cross-build
> 
> That's Al Viro's take on the same problem, plus -j and some other things he
> noted in passing.
> 
> If you could remove the stuff that's common (and flag the overlapping, but 
> different things) from your patch, that would be helpful.

Err...  FWIW, aforementioned patch lacks e.g. vmlinux.lds.S.  The latest
I have on anonftp is ftp.linux.org.uk/pub/people/viro/UML-kbuild; there's
more in my local tree, but that's a separate story.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Jeff Dike
[EMAIL PROTECTED] said:
> 1. To support a separate build tree for the um/i386 architecture the
> following changes have been done: 

Have a look at 

http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/cross-build

That's Al Viro's take on the same problem, plus -j and some other things he
noted in passing.

If you could remove the stuff that's common (and flag the overlapping, but 
different things) from your patch, that would be helpful.

Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Vadim Abrossimov
1. To support a separate build tree for the um/i386 architecture
the following changes have been done:
- fix makefiles to generate new files and to create symlinks in the  
'' only
- in particular, to solve the issue of 'arch/um/include/sysdep-',
the same technique as for 'include/asm' has been used: create a symlink  
from
'/arch/um/include2/sysdep' to  
'/arch/um/include/sysdep-'
- fix '#include's in the header files that the assumption of included  
files located in
the same directory has been broken.

The patch applies (and has been tested) on the i386 sub-architecture only.
Other supported sub-architectures should still work as previously building  
in
the source tree only.

2. In order to support dependencies for 'USER_OBJS' object files use the  
generic Kbuild
infrastructure overwriting 'c_flags' as needed.

These two changes have been combined in one patch because some makefiles  
are impacted by both.

Signed-off-by: <[EMAIL PROTECTED]>
---
 arch/um/Makefile |   37  
+++
 arch/um/drivers/Makefile |4 +--
 arch/um/include/sysdep-i386/sigcontext.h |2 -
 arch/um/kernel/Makefile  |7 ++---
 arch/um/kernel/skas/Makefile |3 --
 arch/um/kernel/tt/Makefile   |6 +
 arch/um/kernel/tt/ptproxy/Makefile   |3 --
 arch/um/os-Linux/Makefile|3 --
 arch/um/os-Linux/drivers/Makefile|3 --
 arch/um/os-Linux/sys-i386/Makefile   |4 +--
 arch/um/sys-i386/Makefile|5 +---
 include/asm-um/archparam-i386.h  |2 -
 12 files changed, 45 insertions(+), 34 deletions(-)

= arch/um/Makefile 1.54 vs edited =
--- 1.54/arch/um/Makefile   2005-02-11 07:57:42 +01:00
+++ edited/arch/um/Makefile 2005-02-13 11:57:01 +01:00
@@ -43,7 +43,9 @@ ifneq ($(MAKEFILES-INCL),)
   include $(MAKEFILES-INCL)
 endif
-ARCH_INCLUDE   := -I$(ARCH_DIR)/include
+ARCH_INCLUDE   := -I$(ARCH_DIR)/include \
+   $(if $(KBUILD_SRC), -I$(objtree)/$(ARCH_DIR)/include2)
+
 SYS_DIR:= $(ARCH_DIR)/include/sysdep-$(SUBARCH)
 include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
@@ -60,8 +62,12 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSU
$(ARCH_INCLUDE) $(MODE_INCLUDE)
 USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
-USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
-	$(MODE_INCLUDE) $(ARCH_USER_CFLAGS)
+USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS))
+# If building the kernel in a separate tree we need to add this path  
manually.
+# Note, that for CFLAGS it's done in the generic 'scripts/Makefile.lib'
+USER_CFLAGS += $(if $(KBUILD_SRC), -I$(srctree)/$(ARCH_DIR)/include)
+USER_CFLAGS += $(ARCH_INCLUDE) $(MODE_INCLUDE) $(ARCH_USER_CFLAGS)
+
 CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask
 CFLAGS += $(call cc-option,-fno-unit-at-a-time,)

@@ -94,7 +100,7 @@ define archhelp
   echo '  find in the kernel root.'
 endef
-$(shell cd $(ARCH_DIR) && ln -sf Kconfig_$(SUBARCH) Kconfig_arch)
+$(shell cd $(ARCH_DIR) && ln -sf $(if $(KBUILD_SRC),  
$(srctree)/$(ARCH_DIR)/)Kconfig_$(SUBARCH) Kconfig_arch)

 prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
$(ARCH_DIR)/kernel/vmlinux.lds.S
@@ -138,6 +144,7 @@ CLEAN_FILES += linux x.i gmon.out $(ARCH
 MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \
+   $(ARCH_DIR)/include2/sysdep \
$(ARCH_DIR)/Kconfig_arch
 archclean:
@@ -150,26 +157,38 @@ archclean:
 $(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
 	$(Q)if [ "$(shell readlink $@)" != "$(LD_SCRIPT-y)" ]; then \
 		echo '  SYMLINK $@'; \
-		ln -sf $(LD_SCRIPT-y) $@; \
+		ln -sf $(if $(KBUILD_SRC),  
$(srctree)/$(ARCH_DIR)/kernel/)$(LD_SCRIPT-y) $@; \
 		touch $@; \
 	fi;

 $(SYMLINK_HEADERS):
@echo '  SYMLINK $@'
-   $(Q)cd $(TOPDIR)/$(dir $@) ; \
+ifneq ($(KBUILD_SRC),)
+   $(Q)mkdir -p $(dir $@)
+   $(Q)cd $(dir $@) ; \
+   ln -sf $(srctree)/$(basename $@)-$(SUBARCH)$(suffix $@) $(notdir $@)
+else
+   $(Q)cd $(srctree)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
+endif
 include/asm-um/arch:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
+	$(if $(KBUILD_SRC), $(Q)mkdir -p include/asm-um)
+	$(Q)cd include/asm-um && ln -fsn $(if $(KBUILD_SRC), $(srctree)/include,  
..)/asm-$(SUBARCH) arch

 $(ARCH_DIR)/include/sysdep:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(ARCH_DIR)/include && ln -sf sysdep-$(SUBARCH) sysdep
+ifneq ($(KBUILD_SRC),)
+	$(Q)mkdir -p $(ARCH_DIR)/include2
+	$(Q)cd $(ARCH_DIR)/include2 && ln -fsn  
$(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) sysdep
+endif
+	$(Q)cd $(ARCH_DIR)/include && ln -fsn sysdep-$(SUBARCH) sysdep

 $(ARCH_DIR)/os:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(ARCH_DIR) && ln -sf os-$(OS) os
+	$(if $(KBUILD_SRC), $(Q)mkdir -p 

[PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Vadim Abrossimov
1. To support a separate build tree for the um/i386 architecture
the following changes have been done:
- fix makefiles to generate new files and to create symlinks in the  
'objtree' only
- in particular, to solve the issue of 'arch/um/include/sysdep-subarch',
the same technique as for 'include/asm' has been used: create a symlink  
from
'objtree/arch/um/include2/sysdep' to  
'srctree/arch/um/include/sysdep-subarch'
- fix '#include's in the header files that the assumption of included  
files located in
the same directory has been broken.

The patch applies (and has been tested) on the i386 sub-architecture only.
Other supported sub-architectures should still work as previously building  
in
the source tree only.

2. In order to support dependencies for 'USER_OBJS' object files use the  
generic Kbuild
infrastructure overwriting 'c_flags' as needed.

These two changes have been combined in one patch because some makefiles  
are impacted by both.

Signed-off-by: [EMAIL PROTECTED]
---
 arch/um/Makefile |   37  
+++
 arch/um/drivers/Makefile |4 +--
 arch/um/include/sysdep-i386/sigcontext.h |2 -
 arch/um/kernel/Makefile  |7 ++---
 arch/um/kernel/skas/Makefile |3 --
 arch/um/kernel/tt/Makefile   |6 +
 arch/um/kernel/tt/ptproxy/Makefile   |3 --
 arch/um/os-Linux/Makefile|3 --
 arch/um/os-Linux/drivers/Makefile|3 --
 arch/um/os-Linux/sys-i386/Makefile   |4 +--
 arch/um/sys-i386/Makefile|5 +---
 include/asm-um/archparam-i386.h  |2 -
 12 files changed, 45 insertions(+), 34 deletions(-)

= arch/um/Makefile 1.54 vs edited =
--- 1.54/arch/um/Makefile   2005-02-11 07:57:42 +01:00
+++ edited/arch/um/Makefile 2005-02-13 11:57:01 +01:00
@@ -43,7 +43,9 @@ ifneq ($(MAKEFILES-INCL),)
   include $(MAKEFILES-INCL)
 endif
-ARCH_INCLUDE   := -I$(ARCH_DIR)/include
+ARCH_INCLUDE   := -I$(ARCH_DIR)/include \
+   $(if $(KBUILD_SRC), -I$(objtree)/$(ARCH_DIR)/include2)
+
 SYS_DIR:= $(ARCH_DIR)/include/sysdep-$(SUBARCH)
 include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
@@ -60,8 +62,12 @@ CFLAGS += $(CFLAGS-y) -D__arch_um__ -DSU
$(ARCH_INCLUDE) $(MODE_INCLUDE)
 USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
-USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
-	$(MODE_INCLUDE) $(ARCH_USER_CFLAGS)
+USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS))
+# If building the kernel in a separate tree we need to add this path  
manually.
+# Note, that for CFLAGS it's done in the generic 'scripts/Makefile.lib'
+USER_CFLAGS += $(if $(KBUILD_SRC), -I$(srctree)/$(ARCH_DIR)/include)
+USER_CFLAGS += $(ARCH_INCLUDE) $(MODE_INCLUDE) $(ARCH_USER_CFLAGS)
+
 CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask
 CFLAGS += $(call cc-option,-fno-unit-at-a-time,)

@@ -94,7 +100,7 @@ define archhelp
   echo '  find in the kernel root.'
 endef
-$(shell cd $(ARCH_DIR)  ln -sf Kconfig_$(SUBARCH) Kconfig_arch)
+$(shell cd $(ARCH_DIR)  ln -sf $(if $(KBUILD_SRC),  
$(srctree)/$(ARCH_DIR)/)Kconfig_$(SUBARCH) Kconfig_arch)

 prepare: $(ARCH_SYMLINKS) $(SYS_HEADERS) $(GEN_HEADERS) \
$(ARCH_DIR)/kernel/vmlinux.lds.S
@@ -138,6 +144,7 @@ CLEAN_FILES += linux x.i gmon.out $(ARCH
 MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \
+   $(ARCH_DIR)/include2/sysdep \
$(ARCH_DIR)/Kconfig_arch
 archclean:
@@ -150,26 +157,38 @@ archclean:
 $(ARCH_DIR)/kernel/vmlinux.lds.S: FORCE
 	$(Q)if [ $(shell readlink $@) != $(LD_SCRIPT-y) ]; then \
 		echo '  SYMLINK $@'; \
-		ln -sf $(LD_SCRIPT-y) $@; \
+		ln -sf $(if $(KBUILD_SRC),  
$(srctree)/$(ARCH_DIR)/kernel/)$(LD_SCRIPT-y) $@; \
 		touch $@; \
 	fi;

 $(SYMLINK_HEADERS):
@echo '  SYMLINK $@'
-   $(Q)cd $(TOPDIR)/$(dir $@) ; \
+ifneq ($(KBUILD_SRC),)
+   $(Q)mkdir -p $(dir $@)
+   $(Q)cd $(dir $@) ; \
+   ln -sf $(srctree)/$(basename $@)-$(SUBARCH)$(suffix $@) $(notdir $@)
+else
+   $(Q)cd $(srctree)/$(dir $@) ; \
ln -sf $(basename $(notdir $@))-$(SUBARCH)$(suffix $@) $(notdir $@)
+endif
 include/asm-um/arch:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(TOPDIR)/include/asm-um  ln -sf ../asm-$(SUBARCH) arch
+	$(if $(KBUILD_SRC), $(Q)mkdir -p include/asm-um)
+	$(Q)cd include/asm-um  ln -fsn $(if $(KBUILD_SRC), $(srctree)/include,  
..)/asm-$(SUBARCH) arch

 $(ARCH_DIR)/include/sysdep:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(ARCH_DIR)/include  ln -sf sysdep-$(SUBARCH) sysdep
+ifneq ($(KBUILD_SRC),)
+	$(Q)mkdir -p $(ARCH_DIR)/include2
+	$(Q)cd $(ARCH_DIR)/include2  ln -fsn  
$(srctree)/$(ARCH_DIR)/include/sysdep-$(SUBARCH) sysdep
+endif
+	$(Q)cd $(ARCH_DIR)/include  ln -fsn sysdep-$(SUBARCH) sysdep

 $(ARCH_DIR)/os:
 	@echo '  SYMLINK $@'
-	$(Q)cd $(ARCH_DIR)  ln -sf os-$(OS) os
+	$(if $(KBUILD_SRC), 

Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Jeff Dike
[EMAIL PROTECTED] said:
 1. To support a separate build tree for the um/i386 architecture the
 following changes have been done: 

Have a look at 

http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/cross-build

That's Al Viro's take on the same problem, plus -j and some other things he
noted in passing.

If you could remove the stuff that's common (and flag the overlapping, but 
different things) from your patch, that would be helpful.

Jeff
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Al Viro
On Sun, Feb 13, 2005 at 01:12:54PM -0500, Jeff Dike wrote:
 [EMAIL PROTECTED] said:
  1. To support a separate build tree for the um/i386 architecture the
  following changes have been done: 
 
 Have a look at 
   
 http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/cross-build
 
 That's Al Viro's take on the same problem, plus -j and some other things he
 noted in passing.
 
 If you could remove the stuff that's common (and flag the overlapping, but 
 different things) from your patch, that would be helpful.

Err...  FWIW, aforementioned patch lacks e.g. vmlinux.lds.S.  The latest
I have on anonftp is ftp.linux.org.uk/pub/people/viro/UML-kbuild; there's
more in my local tree, but that's a separate story.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] uml: support a separate build tree; support USER_OBJS dependencies

2005-02-13 Thread Jeff Dike
[EMAIL PROTECTED] said:
 Err...  FWIW, aforementioned patch lacks e.g. vmlinux.lds.S.

Yeah, I have that fixed locally.  I just haven't pushed out the new stuff yet.

Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/