uml: support a separate build tree; support USER_OBJS dependencies
PATCH 1/1 uml: support a separate build tree; support USER_OBJS dependencies
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.
---
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 =====
arch/um/Makefile +28 -9
@@ -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 $(ARCH_DIR)) + $(Q)cd $(ARCH_DIR) && ln -fsn $(if $(KBUILD_SRC), $(srctree)/$(ARCH_DIR)/)os-$(OS) os # Generated files define filechk_umlconfig
===== arch/um/drivers/Makefile 1.15 vs edited =====
arch/um/drivers/Makefile +2 -2
@@ -49,5 +49,5 @@ USER_OBJS := $(filter %_user.o,$(obj-y) null.o pty.o tty.o xterm.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) +
===== arch/um/include/sysdep-i386/sigcontext.h 1.4 vs edited =====
arch/um/include/sysdep-i386/sigcontext.h +1 -1
@@ -6,7 +6,7 @@#ifndef __SYS_SIGCONTEXT_I386_H#define __SYS_SIGCONTEXT_I386_H -#include "sc.h" +#include <sysdep/sc.h> #define IP_RESTART_SYSCALL (ip) ((ip) -= 2)
===== arch/um/kernel/Makefile 1.29 vs edited =====
arch/um/kernel/Makefile +3 -4
@@ -30,14 +30,13 @@ USER_OBJS := $(foreach file,$(USER_OBJS) CFLAGS_frame.o := -fno-omit-frame-pointer -$(USER_OBJS) : %.o: %.c - $(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }' +QUOTE = 'my $$config=`cat $(objtree)/.config`; $$config =~ s/"/\\"/g ; $$config =~ s/\n/\\n"\n"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }' quiet_cmd_quote = QUOTE $@ cmd_quote = $(PERL) -e $(QUOTE) < $< > $@ targets += config.c -$(obj)/config.c : $(src)/config.c.in $(TOPDIR)/.config FORCE +$(obj)/config.c : $(src)/config.c.in $(objtree)/.config FORCE $(call if_changed,quote)
===== arch/um/kernel/skas/Makefile 1.14 vs edited =====
arch/um/kernel/skas/Makefile +1 -2
@@ -9,7 +9,6 @@ obj-y := exec_kern.o mem.o mem_user.o mm USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) subdir- := util
===== arch/um/kernel/tt/Makefile 1.17 vs edited =====
arch/um/kernel/tt/Makefile +2 -5
@@ -18,11 +18,9 @@ USER_OBJS := $(foreach file,$(USER_OBJS) UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS)) UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -$(obj)/unmap.o: $(src)/unmap.c - $(CC) $(UNMAP_CFLAGS) -c -o $@ $< +$(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS) LIBC_DIR ?= /usr/lib
===== arch/um/kernel/tt/ptproxy/Makefile 1.9 vs edited =====
arch/um/kernel/tt/ptproxy/Makefile +1 -2
@@ -7,5 +7,4 @@ obj-y = proxy.o ptrace.o sysdep.o wait.o USER_OBJS := $(foreach file,$(obj-y),$(src)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
===== arch/um/os-Linux/Makefile 1.12 vs edited =====
arch/um/os-Linux/Makefile +1 -2
@@ -9,7 +9,6 @@ obj-y = elf_aux.o file.o process.o signa USER_OBJS := elf_aux.o file.o process.o signal.o time.o tty.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
===== arch/um/os-Linux/drivers/Makefile 1.5 vs edited =====
arch/um/os-Linux/drivers/Makefile +1 -2
@@ -15,5 +15,4 @@ USER_SINGLE_OBJS = $(foreach f,$(patsubs USER_OBJS = $(filter %_user.o,$(obj-y) $(USER_SINGLE_OBJS)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
===== arch/um/os-Linux/sys-i386/Makefile 1.1 vs edited =====
arch/um/os-Linux/sys-i386/Makefile +2 -2
@@ -7,5 +7,5 @@ obj-$(CONFIG_MODE_SKAS) = registers.o USER_OBJS := $(foreach file,$(obj-y),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) +
===== arch/um/sys-i386/Makefile 1.21 vs edited =====
arch/um/sys-i386/Makefile +2 -3
@@ -22,11 +22,10 @@ module.c-dir = kernel define make_link -rm -f $1 - ln -sf $(TOPDIR)/arch/i386/$($(notdir $1)-dir)/$(notdir $1) $1 + ln -sf $(srctree)/arch/i386/$($(notdir $1)-dir)/$(notdir $1) $1 endef -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) $(SYMLINKS): $(call make_link,$@)
===== include/asm-um/archparam-i386.h 1.9 vs edited =====
include/asm-um/archparam-i386.h +1 -1
@@ -8,7 +8,7 @@/********* Bits for asm-um/elf.h ************/ -#include "user.h" +#include <asm/user.h> extern char * elf_aux_platform;#define ELF_PLATFORM (elf_aux_platform)
Quoted 2 lines · [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
Quoted 4 lines · Jeff Dike
Quoted 2 lines · [email protected] said:
1. To support a separate build tree for the um/i386 architecture the following changes have been done:
Quoted 8 lines
Have a look at
http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/cross-buildThat'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.
Quoted 1 line · [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
Following up the dicussion started on the linux-kernel list.
Quoted 3 lines · Al Viro
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.
Apparently my changes to support 'O=' are quite obsolete: I was not aware about the pending patches on http://user-mode-linux.sourceforge.net/patches.html and about this mailing list dedicated to the uml development to which I have just subscribed. Now I'm aware :->
The second change proposed in my patch concerned USER_OBJS dependences:
I removed specific rules using the generic Kbuild rule just overwriting 'c_flags':
-$(USER_OBJS) : %.o: %.c
- $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $<
+$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) +
I agree that it's not very elegant and robust but it does the job and could be useful until Kbuild will provide a clean way to do it.
If you think useful, I may create a patch with this change only.
Should I do it against 2.6.10 as an add-on to the http://user-mode-linux.sourceforge.net/patches.html
tarball?
That lead me to another question: why we don't use directly BitKeeper? We could have a repository for uml development.
Dima
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 1 line · [email protected] said:
Apparently my changes to support 'O=' are quite obsolete:
Not entirely - it's nice to see the same changes from two different sources, although the first source was Al, which greatly reduces the chances that they are wrong...
Quoted 6 lines
The second change proposed in my patch concerned
USER_OBJS
dependences: I removed specific rules using the genericKbuildrule
just overwriting 'c_flags':I agree that it's not very elegant and robust but it does the job and
could be useful untilKbuildwill provide a clean way to do it.
It is still better than what I have now.
Quoted 3 lines
If you think useful, I may create a patch with this change only.
Should I do it against 2.6.10 as an add-on to the http://
user-mode-linux.sourceforge.net/patches.html tarball?
Yup, that would be useful.
Quoted 2 lines
That lead me to another question: why we don't use directly BitKeeper?
We could have a repository for uml development.
I used BK for a while. I just found that quilt fits my development style better.
Jeff
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 3 lines · Jeff Dike
Yup, that would be useful.
Quite simple.
BTW, after application of all patches from your tarboll I got an error compiling kernel-offsets.c. I solve it adding the following dependency:
arch/um/Makefile-i386 +1 -0
@@ -36,6 +36,7 @@ CLEAN_FILES += $(ARCH_DIR)/user-offsets. $(ARCH_DIR)/kernel-offsets.s: $(SUBARCH_CORE)/kernel-offsets.c \ $(ARCH_SYMLINKS) \ + $(ARCH_DIR)/include/user_constants.h \ $(SYS_DIR)/sc.h \ include/asm include/linux/version.h \ include/config/MARKER
This is the patch for USER_OBJS:
---
arch/um/drivers/Makefile +1 -2
@@ -54,5 +54,4 @@ USER_OBJS := $(filter %_user.o,$(obj-y) null.o pty.o tty.o xterm.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
arch/um/kernel/Makefile +1 -2
@@ -29,8 +29,7 @@ USER_OBJS := $(foreach file,$(USER_OBJS) CFLAGS_frame.o := -fno-omit-frame-pointer -$(USER_OBJS) : %.o: %.c - $(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) targets += config.c
arch/um/kernel/skas/Makefile +1 -2
@@ -9,7 +9,6 @@ obj-y := exec_kern.o mem.o mem_user.o mm USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) subdir- := util
arch/um/kernel/tt/Makefile +2 -5
@@ -18,11 +18,9 @@ USER_OBJS := $(foreach file,$(USER_OBJS) UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS)) UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -$(obj)/unmap.o: $(src)/unmap.c - $(CC) $(UNMAP_CFLAGS) -c -o $@ $< +$(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS) $(obj)/unmap_fin.o : $(obj)/unmap.o
$(LD) -r -o $(obj)/unmap_tmp.o $< $(shell $(CC) -print-file-name=libc.a)
arch/um/kernel/tt/ptproxy/Makefile +1 -2
@@ -7,5 +7,4 @@ obj-y = proxy.o ptrace.o sysdep.o wait.o USER_OBJS := $(foreach file,$(obj-y),$(src)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
arch/um/os-Linux/drivers/Makefile +1 -2
@@ -15,5 +15,4 @@ USER_SINGLE_OBJS = $(foreach f,$(patsubs USER_OBJS = $(filter %_user.o,$(obj-y) $(USER_SINGLE_OBJS)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
arch/um/os-Linux/Makefile +1 -2
@@ -10,7 +10,6 @@ USER_OBJS := aio.o elf_aux.o file.o mem. time.o tt.o tty.o USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
arch/um/sys-i386/Makefile +1 -2
@@ -26,8 +26,7 @@ define make_link ln -sf $(srctree)/arch/i386/$($(notdir $1)-dir)/$(notdir $1) $1 endef -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) $(SYMLINKS): $(call make_link,$@)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 3 lines · Vadim Abrossimov
On Sun, 13 Feb 2005 16:50:59 -0500, Jeff Dike <[email protected]> wrote:
This is the patch for
USER_OBJS:
Ok, I have two more requests, if possible:
1) add something like arch/um/Rules.make which is included everywhere needed and contains boilerplate, repeated code. Ideally that would also contain also these two lines:
USER_OBJS += $(filter %_user.o,$(obj-y)) USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
which are common to everything. So, most changes to this stuff could be insulated.
2) There is an error in the patch (even in Al's idea): you must swap, in the below code, CFLAGS_$(notdir $@) and $(USER_CFLAGS), since the former must be able to override the latter.
At least arch/um/kernel/frame.o will miscompile with the current patch; from arch/um/kernel/Makefile
#This must override the default -fomit-frame-pointer CFLAGS_frame.o := -fno-omit-frame-pointer
#Notice that this declaration is correct.
$(USER_OBJS) : %.o: %.c
$(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $<
And yes, this is a reason to use a common include instead of duplicating everything.
Quoted 2 lines
+$(USER_OBJS) :
c_flags= -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS)
Signature · 16 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 http://www.user-mode-linux.org/~blaisorblade ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 3 lines · Blaisorblade
Ok, I have two more requests, if possible:
1) add something likearch/um/Rules.makewhich is included everywhere needed
2) There is an error in the patch (even in Al's idea): you must swap, in the below code
OK. I will do it.
Against which version you would suggest me to do it:
- as an add-on to 2.6.11-rc3-mm2 + Jeff's tarball (which already includes the original USER_OBJ cleanup)
- 2.6 bk
- any other
Also I have more general questions about the usual way the uml community works:
- do the patches from Jeff's tarball are intended to be pushed in 2.6 BK? if yes when and how?
- if one propose a patch against which version he/she should do it in order to (1) be useful for the community (2) get the patch pushed in 2.6 BK soon? (Presumably (1) and (2) have the same answer :->)
Dima
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 9 lines · Vadim Abrossimov
On Wed, 16 Feb 2005 19:30:54 +0100, Blaisorblade <[email protected]>
Quoted 5 lines · wrote:
Ok, I have two more requests, if possible:
1) add something likearch/um/Rules.makewhich is included everywhere needed
2) There is an error in the patch (even in Al's idea): you must swap, in the below code
Quoted 4 lines
OK. I will do it.
Against which version you would suggest me to do it:
- as an add-on to 2.6.11-rc3-mm2 + Jeff's tarball (which already includes the originalUSER_OBJcleanup)
For now, against this one. The patch is still in development, so this is the right choice.
Quoted 8 lines
- 2.6 bk
- any otherAlso I have more general questions about the usual way the uml community works:
- do the patches from Jeff's tarball are intended to be pushed in 2.6 BK? if yes when and how?
Yes, "when they are felt as ready". However the process in most cases is possibly (author?) -> possibly (someone, including me, forwarding it; I often forward patches directly to -mm) -> Jeff's tree -> -mm tree -> BitKeeper repository and final release.
However, there are actually some little differences between the trees that interact with this patch. The patch also changes some additions to the Makefiles done in the Jeff's tree, for instance about "skas0" and "x11-fb".
Those hunks will have to stay in the tree even after the patch is merged, while the rest will go with the relevant patches.
I'm finding it not trivial to port these patches from the Jeff's tree to the mainline tree... there are some little differences which should move inside a "jeff-only" part of the patch
I'm doing the port to get it merged as soon as 2.6.12.
Quoted 3 lines
- if one propose a patch against which version he/she should do it in order to (1) be useful for the community (2) get the patch pushed in 2.6 BK soon? (Presumably (1) and (2) have the same answer :->)
Well, the Jeff's tree is highly experimental, so the casual user often does not apply the full tree, and patches can evolve in it for months, in the case of big rewrites (they are merged sooner if they are fixes).
Probably the better way to get the patch immediately useful is to prepare it against -bk or -mm... after all, normally you don't get big hunks of Jeff's tree merged at once.
When the patch is merged, it will need to get resync'ed against mainline anyway.
Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 http://www.user-mode-linux.org/~blaisorblade ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 2 lines · Blaisorblade
Ok, I have two more requests, if possible:
1) add something likearch/um/Rules.makewhich is included everywhere needed
Find below the patch which implements Paolo's suggestion with one exception:
I put the common definitions in arch/um/scripts/Makefile.rules to be more consistent with my understanding of conventions.
I did the patch against Jeff's tarball (http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches.tar)
the way it may be added to the end of the existing quilt 'series'.
Make me know if you think useful to do it also against some other versions.
Also I noticed that including my original patch in his tarball Jeff excluded changes in some Makefiles (e.g. arch/um/kernel/Makefile).
Jeff, had you a problem with those Makefiles?
Dima
---
#
# Move similar definitions from Makefiles to the newly created # arch/um/scripts/Makefile.rules and include it everywhere needed #
arch/um/drivers/Makefile +0 -0
@@ -50,9 +50,7 @@ USER_SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y)
$(obj-m)),$($(f)-objs))
-USER_OBJS := $(filter %_user.o,$(obj-y) $(obj-m) $(USER_SINGLE_OBJS)) fd.o \
+USER_OBJS := $(filter %_user.o, $(USER_SINGLE_OBJS)) fd.o \
null.o pty.o tty.o xterm.o
-USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file))
-$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \
- $(USER_CFLAGS)
+include arch/um/scripts/Makefile.rules
arch/um/kernel/Makefile +3 -4
@@ -23,14 +23,12 @@ user-objs-$(CONFIG_TTY_LOG) += tty_log.o -USER_OBJS := $(filter %_user.o,$(obj-y)) $(user-objs-y) config.o helper.o \ +USER_OBJS := $(user-objs-y) config.o helper.o \ main.o time.o tty_log.o umid.o user_util.o frame.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) CFLAGS_frame.o := -fno-omit-frame-pointer -$(USER_OBJS) : %.o: %.c - $(CC) $(USER_CFLAGS) $(CFLAGS_$(notdir $@)) -c -o $@ $< +include arch/um/scripts/Makefile.rules targets += config.c
@@ -54,3 +52,4 @@ -e 'a""\;' \ -e '}' \ $< > $@ +
arch/um/kernel/skas/Makefile +2 -4
@@ -6,10 +6,8 @@ obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ syscall_kern.o syscall_user.o time.o tlb.o trap_user.o uaccess.o \ -USER_OBJS = $(filter %_user.o,$(obj-y)) process.o time.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) +USER_OBJS := process.o time.o -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS) +include arch/um/scripts/Makefile.rules subdir- := util
arch/um/kernel/tt/Makefile +2 -5
@@ -12,14 +12,12 @@ obj-$(CONFIG_PT_PROXY) += gdb_kern.o ptproxy/ -USER_OBJS := $(filter %_user.o,$(obj-y)) gdb.o time.o tracer.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) +USER_OBJS := gdb.o time.o tracer.o UNMAP_CFLAGS := $(patsubst -pg -DPROFILING,,$(USER_CFLAGS)) UNMAP_CFLAGS := $(patsubst -fprofile-arcs -ftest-coverage,,$(UNMAP_CFLAGS)) -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS) +include arch/um/scripts/Makefile.rules $(obj)/unmap.o: c_flags = -Wp,-MD,$(depfile) $(UNMAP_CFLAGS)
arch/um/kernel/tt/ptproxy/Makefile +2 -3
@@ -5,7 +5,6 @@ obj-y = proxy.o ptrace.o sysdep.o wait.o -USER_OBJS := $(foreach file,$(obj-y),$(src)/$(file)) +USER_OBJS := $(obj-y) -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS) +include arch/um/scripts/Makefile.rules
arch/um/os-Linux/Makefile +2 -4
@@ -8,9 +8,7 @@ USER_OBJS := aio.o elf_aux.o file.o mem.o process.o signal.o start_up.o \ time.o tt.o tty.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) - -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS) CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) + +include arch/um/scripts/Makefile.rules
arch/um/os-Linux/drivers/Makefile +3 -4
@@ -12,8 +12,7 @@ USER_SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y)),$($(f)-objs)) -USER_OBJS = $(filter %_user.o,$(obj-y) $(USER_SINGLE_OBJS)) -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) +USER_OBJS := $(filter %_user.o, $(USER_SINGLE_OBJS)) + +include arch/um/scripts/Makefile.rules -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS)
arch/um/scripts/Makefile.rules +8 -0
@@ -0,0 +1,8 @@ +# =========================================================================== +# arch/um: Generic definitions +# =========================================================================== + +USER_OBJS += $(filter %_user.o,$(obj-y) $(obj-m)) +USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) + +$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(notdir $@))
arch/um/sys-i386/Makefile +1 -3
@@ -6,7 +6,6 @@ obj-$(CONFIG_MODULES) += module.o USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) SYMLINKS = bitops.c semaphore.c highmem.c module.c
@@ -26,8 +25,7 @@ ln -sf $(srctree)/arch/i386/$($(notdir $1)-dir)/$(notdir $1) $1 endef -$(USER_OBJS) : c_flags = -Wp,-MD,$(depfile) $(CFLAGS_$(notdir $@)) \ - $(USER_CFLAGS) +include arch/um/scripts/Makefile.rules $(SYMLINKS): $(call make_link,$@)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 9 lines · Vadim Abrossimov
On Wed, 16 Feb 2005 19:30:54 +0100, Blaisorblade <[email protected]>
Quoted 3 lines · wrote:
Ok, I have two more requests, if possible:
1) add something likearch/um/Rules.makewhich is included everywhere neededFind below the patch which implements Paolo's suggestion with one exception:
The patch is totally mangled by the mailer, sorry. Could you please reattach it? I've tried fixing it by hand but hadn't got the time.
*) Another suggestion (I'll implement it if you are not going to): the creation of USER_SINGLE_OBJS should also be moved to Makefile.rules (the below form should be the more general one); so even the "$(filter %_user.o, $(USER_SINGLE_OBJS))" snippet could move there.
USER_SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y) $(obj-m)), $($(f)-objs))
*) About
http://user-mode-linux.sourceforge.net/work/current/2.6/2.6.11-rc3-mm2/patches/user-obj-cleanup
at his end: I've seen that for stub.S you don't succeed to get it working. Have you tried setting a_flags for that one only?
*) Someone who has a working tree with this can check whether enabling CONFIG_MODVERSIONS works well? Without it it does not work, for what I remember, exactly for the kbuild problem.
When time ago I built a similar patch which changed c_flags (it hacked the main Makefiles though) it started to work well, since the object postprocessing step was also done. So this patch should also achieve this goal, I think.
*) (Slightly unrelated) About this change in the "skas0" patch:
Index: linux-2.6.10/arch/um/Makefile-i386
===================================================================
--- linux-2.6.10.orig/arch/um/Makefile-i386 2005-02-12 13:57:48.000000000
-0500
+++ linux-2.6.10/arch/um/Makefile-i386 2005-02-14 12:36:37.000000000 -0500 @@ -8,7 +8,7 @@
endif
endif
-CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) +CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) $(STUB_CFLAGS)
ARCH_USER_CFLAGS :=
ifneq ($(CONFIG_GPROF),y)
Index: linux-2.6.10/arch/um/Makefile-x86_64
===================================================================
--- linux-2.6.10.orig/arch/um/Makefile-x86_64 2005-02-12 13:57:48.000000000
-0500
+++ linux-2.6.10/arch/um/Makefile-x86_64 2005-02-14 12:36:37.000000000
-0500
@@ -4,7 +4,7 @@
SUBARCH_LIBS := arch/um/sys-x86_64/
START := 0x60000000
-CFLAGS += -U__$(SUBARCH)__ -fno-builtin +CFLAGS += -U__$(SUBARCH)__ -fno-builtin $(STUB_CFLAGS)
ARCH_USER_CFLAGS := -D__x86_64__
ELF_ARCH := i386:x86-64
I guess it's actually useless, because STUB_CFLAGS is not defined at that point, so it should be undone.
Quoted 3 lines
I put the common definitions in
arch/um/scripts/Makefile.rulesto be more consistent
with my understanding of conventions.
This form is also ok for me. If when merging they want it further renamed, we'll take care of it.
Quoted 4 lines
Also I noticed that including my original patch in his tarball Jeff excluded changes
in some Makefiles (e.g.arch/um/kernel/Makefile).
Jeff, had you a problem with those Makefiles?
I don't know what Jeff thought, but do you remember the bug I pointed out about USER_CFLAGS and CFLAGS_$@?
Well, that problem would cause a compilation problem on arch/um/kernel/frame.o, because this would not work:
CFLAGS_frame.o := -fno-omit-frame-pointer
Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 http://www.user-mode-linux.org/~blaisorblade ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ User-mode-linux-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 6 lines · Jeff Dike
Quoted 1 line · [email protected] said:
Apparently my changes to support 'O=' are quite obsolete:
Not entirely - it's nice to see the same changes from two different sources, although the first source was Al, which greatly reduces the chances that they are wrong...
Not particulary, seeing that I've done almost no work on kbuild-related stuff...
Quoted 8 lines
Quoted 6 lines
The second change proposed in my patch concerned
USER_OBJS
dependences: I removed specific rules using the genericKbuildrule
just overwriting 'c_flags':I agree that it's not very elegant and robust but it does the job and
could be useful untilKbuildwill provide a clean way to do it.It is still better than what I have now.
ACK. AFAICS, other parts of patch are already covered, except for adding arch/um/include/sysdep to search path. Why do we need that? Files in there get included as <sysdep/blah.h>, not <blah.h>, so...
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
Quoted 7 lines
ACK. AFAICS, other parts of patch are already covered, except for adding
arch/um/include/sysdepto search path. Why do we need that? Files in there get included as <sysdep/blah.h>, not <blah.h>, so...
I didn't add arch/um/include/sysdep to search path. I agree that it useless. The only difference in include pass betwenn Al's patch and the mine (Dima) is the fpllowing:
Al> ARCH_INCLUDE := -I$(ARCH_DIR)/include
Al> +ifneq ($(KBUILD_SRC),)
Al> +ARCH_INCLUDE += -I$(ARCH_DIR)/include2
Al> +ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include
Al> +MRPROPER_DIRS += $(ARCH_DIR)/include2
Al> +endif
Dima> include $(MAKEFILES-INCL)
Dima> endif
Dima> -ARCH_INCLUDE := -I$(ARCH_DIR)/include
Dima> +ARCH_INCLUDE := -I$(ARCH_DIR)/include \
Dima> + $(if $(KBUILD_SRC), -I$(objtree)/$(ARCH_DIR)/include2)
Dima> +
Dima> SYS_DIR := $(ARCH_DIR)/include/sysdep-$(SUBARCH)
Actually:
- It's preferable to give an absolute path to include2: it exist only in the build tree. Adding it as a relative path you ask Kbuild to add an absolute path to srctree as well.
- we don't need an explicit path to -I$(srctree)/$(ARCH_DIR)/include: Kbuild will do it for us from '-I$(ARCH_DIR)/include'.
You certainly added it because of USER_OBJS. To deal with this issue I added -I$(srctree)/$(ARCH_DIR)/include specifically to USER_CFLAGS:
Dima> USER_CFLAGS := $(patsubst -I%,,$(CFLAGS))
Dima> -USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
Dima> - $(MODE_INCLUDE) $(ARCH_USER_CFLAGS)
Dima> +USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS))
Dima> +# If building the kernel in a separate tree we need to add this path manually. Dima> +# Note, that for CFLAGS it's done in the generic 'scripts/Makefile.lib' Dima> +USER_CFLAGS += $(if $(KBUILD_SRC), -I$(srctree)/$(ARCH_DIR)/include) Dima> +USER_CFLAGS += $(ARCH_INCLUDE) $(MODE_INCLUDE) $(ARCH_USER_CFLAGS) Dima> +
Dima
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel