linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: New kbuild filename: Kbuild
  2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
@ 2004-10-28 17:30   ` Geert Uytterhoeven
  2004-10-29 11:59   ` Christoph Hellwig
  1 sibling, 0 replies; 19+ messages in thread
From: Geert Uytterhoeven @ 2004-10-28 17:30 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Linux Kernel Development, Andrew Morton, linux-arch

On Thu, 28 Oct 2004, Sam Ravnborg wrote:
> --- a/Documentation/kbuild/makefiles.txt	2004-10-28 20:46:24 +02:00
> +++ b/Documentation/kbuild/makefiles.txt	2004-10-28 20:46:24 +02:00
>  This document is aimed towards normal developers and arch developers.
>  
>  
> -=== 3 The kbuild Makefiles
> +=== 3 The kbuild files
>  
>  Most Makefiles within the kernel are kbuild Makefiles that use the
>  kbuild infrastructure. This chapter introduce the syntax used in the
>  kbuild makefiles.
> +The preferred name for the kbuild files is 'Kbuild' but 'Makefile' will
> +continue to be supported. All new developmen is expected to use the
                                     ^^^^^^^^^^
				     development
> +Kbuild filename.
>  
>  Section 3.1 "Goal definitions" is a quick intro, further chapters provide
>  more details, with real examples.

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* kbuild/all archs: Sanitize creating offsets.h
@ 2004-10-28 18:59 Sam Ravnborg
  2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 18:59 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch; +Cc: Sam Ravnborg

When creating offsets.h from arch/$(ARCH)/Makefile we failed to check
all dependencies. A few key dependencies were listed - but a manually
edited list of include files are bound to be incomplete.
A few times I have tried building a kernel - which failed because
offsets.h needed to be updated but kbuild failed to do so.
I wonder what could happen with a kernel with an out-dated offsets.h
file with wrong assembler constants.

This serie of patches fixes this.
Generating offsets.h is moved to include/asm-$(ARCH)/Kbuild and
the usual dependency tracking is used to detect when an update is needed.

With this mail four patches are posted:
o Accept kbuild file named Kbuild
o generic support for offsets.h
o changes for i386
o changes for arm

The second patch breaks all architectures...

My bk tree at bk://linux-sam.bkbits.net/kbuild contains support for most
architectures (sh and cris missing for now).

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* New kbuild filename: Kbuild
  2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
@ 2004-10-28 19:00 ` Sam Ravnborg
  2004-10-28 17:30   ` Geert Uytterhoeven
  2004-10-29 11:59   ` Christoph Hellwig
  2004-10-28 19:01 ` kbuild: generic support for offsets.h Sam Ravnborg
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 19:00 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

kbuild: Prefer Kbuild as name of the kbuild files
   
The kbuild syntax is unique and does only have very few things in common with
usual Makefile syntax. So to avoid confusion make the filename 'Kbuild' be
the preferred name as replacement for 'Makefile'.
No global renaming planned to take place for now, but new stuff expected to use
the new 'Kbuild' filename.
   
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

diff -Nru a/Documentation/kbuild/makefiles.txt b/Documentation/kbuild/makefiles.txt
--- a/Documentation/kbuild/makefiles.txt	2004-10-28 20:46:24 +02:00
+++ b/Documentation/kbuild/makefiles.txt	2004-10-28 20:46:24 +02:00
@@ -6,7 +6,7 @@
 
 	=== 1 Overview
 	=== 2 Who does what
-	=== 3 The kbuild Makefiles
+	=== 3 The kbuild files
 	   --- 3.1 Goal definitions
 	   --- 3.2 Built-in object goals - obj-y
 	   --- 3.3 Loadable module goals - obj-m
@@ -101,11 +101,14 @@
 This document is aimed towards normal developers and arch developers.
 
 
-=== 3 The kbuild Makefiles
+=== 3 The kbuild files
 
 Most Makefiles within the kernel are kbuild Makefiles that use the
 kbuild infrastructure. This chapter introduce the syntax used in the
 kbuild makefiles.
+The preferred name for the kbuild files is 'Kbuild' but 'Makefile' will
+continue to be supported. All new developmen is expected to use the
+Kbuild filename.
 
 Section 3.1 "Goal definitions" is a quick intro, further chapters provide
 more details, with real examples.
diff -Nru a/scripts/Makefile.build b/scripts/Makefile.build
--- a/scripts/Makefile.build	2004-10-28 20:46:24 +02:00
+++ b/scripts/Makefile.build	2004-10-28 20:46:24 +02:00
@@ -10,7 +10,7 @@
 # Read .config if it exist, otherwise ignore
 -include .config
 
-include $(obj)/Makefile
+include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
 
 include scripts/Makefile.lib
 
diff -Nru a/scripts/Makefile.clean b/scripts/Makefile.clean
--- a/scripts/Makefile.clean	2004-10-28 20:46:24 +02:00
+++ b/scripts/Makefile.clean	2004-10-28 20:46:24 +02:00
@@ -7,7 +7,7 @@
 .PHONY: __clean
 __clean:
 
-include $(obj)/Makefile
+include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
 
 # Figure out what we need to build from the various variables
 # ==========================================================================

^ permalink raw reply	[flat|nested] 19+ messages in thread

* kbuild: generic support for offsets.h
  2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
  2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
@ 2004-10-28 19:01 ` Sam Ravnborg
  2004-10-28 19:02 ` i386: use " Sam Ravnborg
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 19:01 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

kbuild: introduce a generic method to generate offsets.h
   
The following patch will break most architectures because it introduce a new way to
generate the offsets.h file. The main rationale is to use correct dependencies for
the offsets.h file. Before one could change a .h file with no recompile of
offsets.h resulting in assembler code to use wrong constants - horror.
Follow-up patches will try to unbreak all relevant architectures.
   
As an added bonus give a nice print-out when .config is missing.
   
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

diff -Nru a/Makefile b/Makefile
--- a/Makefile	2004-10-28 20:46:51 +02:00
+++ b/Makefile	2004-10-28 20:46:51 +02:00
@@ -476,6 +476,9 @@
 -include .config.cmd
 
 include .config
+$(if $(wildcard .config),, \
+	$(warning *** Use 'make *config' to generate .config.) \
+	$(error Try 'make help'!))
 
 # If .config needs to be updated, it will be done via the dependency
 # that autoconf has on .config.
@@ -758,6 +761,7 @@
 prepare1: prepare2 outputmakefile
 
 prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
+	$(Q)$(MAKE) $(build)=$(srctree)/include/asm
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
@@ -904,26 +908,6 @@
 
 endif # CONFIG_MODULES
 
-# Generate asm-offsets.h 
-# ---------------------------------------------------------------------------
-
-define filechk_gen-asm-offsets
-	(set -e; \
-	 echo "#ifndef __ASM_OFFSETS_H__"; \
-	 echo "#define __ASM_OFFSETS_H__"; \
-	 echo "/*"; \
-	 echo " * DO NOT MODIFY."; \
-	 echo " *"; \
-	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
-	 echo " *"; \
-	 echo " */"; \
-	 echo ""; \
-	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
-	 echo ""; \
-	 echo "#endif" )
-endef
-
-
 ###
 # Cleaning is done on three levels.
 # make clean     Delete most generated files
@@ -946,7 +930,7 @@
 #
 clean: rm-dirs  := $(CLEAN_DIRS)
 clean: rm-files := $(CLEAN_FILES)
-clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
+clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs) include/asm-$(ARCH))
 
 .PHONY: $(clean-dirs) clean archclean
 $(clean-dirs):
diff -Nru a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-generic/Kbuild	2004-10-28 20:46:51 +02:00
@@ -0,0 +1,24 @@
+# kbuild file for asm-generic contains generic support
+# for usage in asm-$(ARCH)
+# This file is included from include/asm-$(ARCH)/Kbuild
+
+
+# Generate asm-offsets.h 
+# ---------------------------------------------------------------------------
+
+define filechk_gen-asm-offsets
+	(set -e; \
+	 echo "#ifndef __ASM_OFFSETS_H__"; \
+	 echo "#define __ASM_OFFSETS_H__"; \
+	 echo "/*"; \
+	 echo " * DO NOT MODIFY."; \
+	 echo " *"; \
+	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
+	 echo " *"; \
+	 echo " */"; \
+	 echo ""; \
+	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
+	 echo ""; \
+	 echo "#endif" )
+endef
+

^ permalink raw reply	[flat|nested] 19+ messages in thread

* i386: use generic support for offsets.h
  2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
  2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
  2004-10-28 19:01 ` kbuild: generic support for offsets.h Sam Ravnborg
@ 2004-10-28 19:02 ` Sam Ravnborg
  2004-10-29  9:52   ` Jan-Benedict Glaw
  2004-10-28 19:03 ` arm: use generic support for constants.h Sam Ravnborg
  2004-10-28 19:44 ` kbuild/all archs: Sanitize creating offsets.h Russell King
  4 siblings, 1 reply; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 19:02 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

i386: use new generic infrastructure to generate offsets.h
   
Also renamed .h file to offsets.h.
   
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	2004-10-28 20:47:38 +02:00
+++ b/arch/i386/Makefile	2004-10-28 20:47:38 +02:00
@@ -140,15 +140,6 @@
 install fdimage fdimage144 fdimage288: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
 
-prepare: include/asm-$(ARCH)/asm_offsets.h
-CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h
-
-arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
-				   include/config/MARKER
-
-include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
-	$(call filechk,gen-asm-offsets)
-
 archclean:
 	$(Q)$(MAKE) $(clean)=arch/i386/boot
 
diff -Nru a/arch/i386/kernel/asm-offsets.c b/arch/i386/kernel/asm-offsets.c
--- a/arch/i386/kernel/asm-offsets.c	2004-10-28 20:47:38 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,66 +0,0 @@
-/*
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed
- * to extract and format the required data.
- */
-
-#include <linux/sched.h>
-#include <linux/signal.h>
-#include <linux/personality.h>
-#include <asm/ucontext.h>
-#include "sigframe.h"
-#include <asm/fixmap.h>
-#include <asm/processor.h>
-#include <asm/thread_info.h>
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-#define OFFSET(sym, str, mem) \
-	DEFINE(sym, offsetof(struct str, mem));
-
-void foo(void)
-{
-	OFFSET(SIGCONTEXT_eax, sigcontext, eax);
-	OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
-	OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
-	OFFSET(SIGCONTEXT_edx, sigcontext, edx);
-	OFFSET(SIGCONTEXT_esi, sigcontext, esi);
-	OFFSET(SIGCONTEXT_edi, sigcontext, edi);
-	OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
-	OFFSET(SIGCONTEXT_esp, sigcontext, esp);
-	OFFSET(SIGCONTEXT_eip, sigcontext, eip);
-	BLANK();
-
-	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
-	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
-	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
-	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
-	OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
-	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
-	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
-	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
-	BLANK();
-
-	OFFSET(TI_task, thread_info, task);
-	OFFSET(TI_exec_domain, thread_info, exec_domain);
-	OFFSET(TI_flags, thread_info, flags);
-	OFFSET(TI_status, thread_info, status);
-	OFFSET(TI_cpu, thread_info, cpu);
-	OFFSET(TI_preempt_count, thread_info, preempt_count);
-	OFFSET(TI_addr_limit, thread_info, addr_limit);
-	OFFSET(TI_restart_block, thread_info, restart_block);
-	BLANK();
-
-	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
-	OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
-
-	/* Offset from the sysenter stack to tss.esp0 */
-	DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
-		 sizeof(struct tss_struct));
-
-	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
-	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
-}
diff -Nru a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
--- a/arch/i386/kernel/head.S	2004-10-28 20:47:38 +02:00
+++ b/arch/i386/kernel/head.S	2004-10-28 20:47:38 +02:00
@@ -17,7 +17,7 @@
 #include <asm/desc.h>
 #include <asm/cache.h>
 #include <asm/thread_info.h>
-#include <asm/asm_offsets.h>
+#include <asm/offsets.h>
 #include <asm/setup.h>
 
 /*
diff -Nru a/arch/i386/kernel/vsyscall-sigreturn.S b/arch/i386/kernel/vsyscall-sigreturn.S
--- a/arch/i386/kernel/vsyscall-sigreturn.S	2004-10-28 20:47:38 +02:00
+++ b/arch/i386/kernel/vsyscall-sigreturn.S	2004-10-28 20:47:38 +02:00
@@ -7,7 +7,7 @@
  */
 
 #include <asm/unistd.h>
-#include <asm/asm_offsets.h>
+#include <asm/offsets.h>
 
 
 /* XXX
diff -Nru a/arch/i386/kernel/vsyscall.lds.S b/arch/i386/kernel/vsyscall.lds.S
--- a/arch/i386/kernel/vsyscall.lds.S	2004-10-28 20:47:38 +02:00
+++ b/arch/i386/kernel/vsyscall.lds.S	2004-10-28 20:47:38 +02:00
@@ -3,7 +3,7 @@
  * object prelinked to its virtual address, and with only one read-only
  * segment (that fits in one page).  This script controls its layout.
  */
-#include <asm/asm_offsets.h>
+#include <asm/offsets.h>
 
 SECTIONS
 {
diff -Nru a/include/asm-i386/Kbuild b/include/asm-i386/Kbuild
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-i386/Kbuild	2004-10-28 20:47:38 +02:00
@@ -0,0 +1,17 @@
+# Generate header files required for i386
+# Pull in generic stuff from include/asm-generic
+# Used to:
+# 1) Generate include/asm/offset.h
+
+# pull in generic parts
+include $(srctree)/include/asm-generic/Kbuild
+
+
+# generate offsets.h file
+always  := offsets.h
+targets := offsets.s
+
+CFLAGS_offsets.o := -I arch/i386/kernel
+
+$(obj)/offsets.h: $(obj)/offsets.s FORCE
+	$(call filechk,gen-asm-offsets, < $<)
diff -Nru a/include/asm-i386/offsets.c b/include/asm-i386/offsets.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-i386/offsets.c	2004-10-28 20:47:38 +02:00
@@ -0,0 +1,66 @@
+/*
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed
+ * to extract and format the required data.
+ */
+
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/personality.h>
+#include <asm/ucontext.h>
+#include "sigframe.h"
+#include <asm/fixmap.h>
+#include <asm/processor.h>
+#include <asm/thread_info.h>
+
+#define DEFINE(sym, val) \
+        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+#define OFFSET(sym, str, mem) \
+	DEFINE(sym, offsetof(struct str, mem));
+
+void foo(void)
+{
+	OFFSET(SIGCONTEXT_eax, sigcontext, eax);
+	OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
+	OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
+	OFFSET(SIGCONTEXT_edx, sigcontext, edx);
+	OFFSET(SIGCONTEXT_esi, sigcontext, esi);
+	OFFSET(SIGCONTEXT_edi, sigcontext, edi);
+	OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
+	OFFSET(SIGCONTEXT_esp, sigcontext, esp);
+	OFFSET(SIGCONTEXT_eip, sigcontext, eip);
+	BLANK();
+
+	OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
+	OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
+	OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
+	OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
+	OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
+	OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
+	OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
+	OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
+	BLANK();
+
+	OFFSET(TI_task, thread_info, task);
+	OFFSET(TI_exec_domain, thread_info, exec_domain);
+	OFFSET(TI_flags, thread_info, flags);
+	OFFSET(TI_status, thread_info, status);
+	OFFSET(TI_cpu, thread_info, cpu);
+	OFFSET(TI_preempt_count, thread_info, preempt_count);
+	OFFSET(TI_addr_limit, thread_info, addr_limit);
+	OFFSET(TI_restart_block, thread_info, restart_block);
+	BLANK();
+
+	OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
+	OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
+
+	/* Offset from the sysenter stack to tss.esp0 */
+	DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, esp0) -
+		 sizeof(struct tss_struct));
+
+	DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
+	DEFINE(VSYSCALL_BASE, __fix_to_virt(FIX_VSYSCALL));
+}
diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
--- a/include/asm-i386/thread_info.h	2004-10-28 20:47:38 +02:00
+++ b/include/asm-i386/thread_info.h	2004-10-28 20:47:38 +02:00
@@ -47,7 +47,7 @@
 
 #else /* !__ASSEMBLY__ */
 
-#include <asm/asm_offsets.h>
+#include <asm/offsets.h>
 
 #endif
 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* arm: use generic support for constants.h
  2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
                   ` (2 preceding siblings ...)
  2004-10-28 19:02 ` i386: use " Sam Ravnborg
@ 2004-10-28 19:03 ` Sam Ravnborg
  2004-10-28 19:44 ` kbuild/all archs: Sanitize creating offsets.h Russell King
  4 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 19:03 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

arm: Use new generic offset.h infrastructure
   
The symlinking taking place in include/asm-arm had to move also.
Did not have an arm toolchain to test it..
  
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

diff -Nru a/arch/arm/Makefile b/arch/arm/Makefile
--- a/arch/arm/Makefile	2004-10-28 20:54:28 +02:00
+++ b/arch/arm/Makefile	2004-10-28 20:54:28 +02:00
@@ -108,7 +108,7 @@
 ifeq ($(incdir-y),)
 incdir-y := $(machine-y)
 endif
-INCDIR   := arch-$(incdir-y)
+export INCDIR   := arch-$(incdir-y)
 ifneq ($(machine-y),)
 MACHINE  := arch/arm/mach-$(machine-y)/
 else
@@ -141,21 +141,7 @@
 
 boot := arch/arm/boot
 
-#	Update machine arch and proc symlinks if something which affects
-#	them changed.  We use .arch to indicate when they were updated
-#	last, otherwise make uses the target directory mtime.
-
-include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/config/MARKER
-	@echo '  SYMLINK include/asm-arm/arch -> include/asm-arm/$(INCDIR)'
-ifneq ($(KBUILD_SRC),)
-	$(Q)mkdir -p include/asm-arm
-	$(Q)ln -fsn $(srctree)/include/asm-arm/$(INCDIR) include/asm-arm/arch
-else
-	$(Q)ln -fsn $(INCDIR) include/asm-arm/arch
-endif
-	@touch $@
-
-prepare: maketools include/asm-arm/.arch
+prepare: maketools
 
 .PHONY: maketools FORCE
 maketools: include/asm-arm/constants.h include/linux/version.h FORCE
@@ -171,7 +157,7 @@
 	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
 
 CLEAN_FILES += include/asm-arm/constants.h* include/asm-arm/mach-types.h \
-	       include/asm-arm/arch include/asm-arm/.arch
+	       include/asm-arm/arch
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
@@ -180,12 +166,6 @@
 # My testing targets (bypasses dependencies)
 bp:;	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/bootpImage
 i zi:;	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
-
-arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
-				   include/asm-arm/.arch
-
-include/asm-$(ARCH)/constants.h: arch/$(ARCH)/kernel/asm-offsets.s
-	$(call filechk,gen-asm-offsets)
 
 define archhelp
   echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
diff -Nru a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
--- a/arch/arm/kernel/asm-offsets.c	2004-10-28 20:54:28 +02:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 1995-2003 Russell King
- *               2001-2002 Keith Owens
- *     
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed to extract
- * and format the required data.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <asm/mach/arch.h>
-#include <asm/thread_info.h>
-
-/*
- * Make sure that the compiler and target are compatible.
- */
-#if defined(__APCS_26__)
-#error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
-#endif
-/*
- * GCC 2.95.1, 2.95.2: ignores register clobber list in asm().
- * GCC 3.0, 3.1: general bad code generation.
- * GCC 3.2.0: incorrect function argument offset calculation.
- * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c
- *            (http://gcc.gnu.org/PR8896) and incorrect structure
- *	      initialisation in fs/jffs2/erase.c
- */
-#if __GNUC__ < 2 || \
-   (__GNUC__ == 2 && __GNUC_MINOR__ < 95) || \
-   (__GNUC__ == 2 && __GNUC_MINOR__ == 95 && __GNUC_PATCHLEVEL__ != 0 && \
-					     __GNUC_PATCHLEVEL__ < 3) || \
-   (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
-#error Your compiler is too buggy; it is known to miscompile kernels.
-#error    Known good compilers: 2.95.3, 2.95.4, 2.96, 3.3
-#endif
-
-/* Use marker if you need to separate the values later */
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-int main(void)
-{
-  DEFINE(TSK_ACTIVE_MM,		offsetof(struct task_struct, active_mm));
-  BLANK();
-  DEFINE(TI_FLAGS,		offsetof(struct thread_info, flags));
-  DEFINE(TI_PREEMPT,		offsetof(struct thread_info, preempt_count));
-  DEFINE(TI_ADDR_LIMIT,		offsetof(struct thread_info, addr_limit));
-  DEFINE(TI_TASK,		offsetof(struct thread_info, task));
-  DEFINE(TI_EXEC_DOMAIN,	offsetof(struct thread_info, exec_domain));
-  DEFINE(TI_CPU,		offsetof(struct thread_info, cpu));
-  DEFINE(TI_CPU_DOMAIN,		offsetof(struct thread_info, cpu_domain));
-  DEFINE(TI_CPU_SAVE,		offsetof(struct thread_info, cpu_context));
-  DEFINE(TI_USED_CP,		offsetof(struct thread_info, used_cp));
-  DEFINE(TI_FPSTATE,		offsetof(struct thread_info, fpstate));
-  DEFINE(TI_VFPSTATE,		offsetof(struct thread_info, vfpstate));
-  DEFINE(TI_IWMMXT_STATE,	(offsetof(struct thread_info, fpstate)+4)&~7);
-  BLANK();
-#if __LINUX_ARM_ARCH__ >= 6
-  DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id));
-  BLANK();
-#endif
-  DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
-  DEFINE(VMA_VM_FLAGS,		offsetof(struct vm_area_struct, vm_flags));
-  BLANK();
-  DEFINE(VM_EXEC,	       	VM_EXEC);
-  BLANK();
-  DEFINE(PAGE_SZ,	       	PAGE_SIZE);
-  BLANK();
-  DEFINE(SYS_ERROR0,		0x9f0000);
-  BLANK();
-  DEFINE(SIZEOF_MACHINE_DESC,	sizeof(struct machine_desc));
-  return 0; 
-}
diff -Nru a/include/asm-arm/Kbuild b/include/asm-arm/Kbuild
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-arm/Kbuild	2004-10-28 20:54:28 +02:00
@@ -0,0 +1,35 @@
+# Generate header files required for $(ARCH)
+# Pull in generic stuff from include/asm-generic
+# Used to:
+# 1) Generate include/asm/offset.h
+
+# pull in generic parts
+include $(srctree)/include/asm-generic/Kbuild
+
+always  := constants.h include/asm-arm/.arch
+
+# Update machine arch and proc symlinks if something which affects
+# them changed.  We use .arch to indicate when they were updated
+# last, otherwise make uses the target directory mtime.
+
+include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/config/MARKER
+	@echo '  SYMLINK include/asm-arm/arch -> include/asm-arm/$(INCDIR)'
+ifneq ($(KBUILD_SRC),)
+	$(Q)mkdir -p include/asm-arm
+	$(Q)ln -fsn $(srctree)/include/asm-arm/$(INCDIR) include/asm-arm/arch
+else
+	$(Q)ln -fsn $(INCDIR) include/asm-arm/arch
+endif
+	@touch $@
+
+
+# generate offsets.h file
+targets := offsets.s
+
+CFLAGS_offsets.o := -I arch/$(ARCH)/kernel
+
+# explicit dependency
+$(obj)/offsets.s: include/asm-arm/.arch
+
+$(obj)/constants.h: $(obj)/offsets.s FORCE
+	$(call filechk,gen-asm-offsets, < $<)
diff -Nru a/include/asm-arm/offsets.c b/include/asm-arm/offsets.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-arm/offsets.c	2004-10-28 20:54:28 +02:00
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 1995-2003 Russell King
+ *               2001-2002 Keith Owens
+ *     
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed to extract
+ * and format the required data.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <asm/mach/arch.h>
+#include <asm/thread_info.h>
+
+/*
+ * Make sure that the compiler and target are compatible.
+ */
+#if defined(__APCS_26__)
+#error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
+#endif
+/*
+ * GCC 2.95.1, 2.95.2: ignores register clobber list in asm().
+ * GCC 3.0, 3.1: general bad code generation.
+ * GCC 3.2.0: incorrect function argument offset calculation.
+ * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c
+ *            (http://gcc.gnu.org/PR8896) and incorrect structure
+ *	      initialisation in fs/jffs2/erase.c
+ */
+#if __GNUC__ < 2 || \
+   (__GNUC__ == 2 && __GNUC_MINOR__ < 95) || \
+   (__GNUC__ == 2 && __GNUC_MINOR__ == 95 && __GNUC_PATCHLEVEL__ != 0 && \
+					     __GNUC_PATCHLEVEL__ < 3) || \
+   (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
+#error Your compiler is too buggy; it is known to miscompile kernels.
+#error    Known good compilers: 2.95.3, 2.95.4, 2.96, 3.3
+#endif
+
+/* Use marker if you need to separate the values later */
+
+#define DEFINE(sym, val) \
+        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+int main(void)
+{
+  DEFINE(TSK_ACTIVE_MM,		offsetof(struct task_struct, active_mm));
+  BLANK();
+  DEFINE(TI_FLAGS,		offsetof(struct thread_info, flags));
+  DEFINE(TI_PREEMPT,		offsetof(struct thread_info, preempt_count));
+  DEFINE(TI_ADDR_LIMIT,		offsetof(struct thread_info, addr_limit));
+  DEFINE(TI_TASK,		offsetof(struct thread_info, task));
+  DEFINE(TI_EXEC_DOMAIN,	offsetof(struct thread_info, exec_domain));
+  DEFINE(TI_CPU,		offsetof(struct thread_info, cpu));
+  DEFINE(TI_CPU_DOMAIN,		offsetof(struct thread_info, cpu_domain));
+  DEFINE(TI_CPU_SAVE,		offsetof(struct thread_info, cpu_context));
+  DEFINE(TI_USED_CP,		offsetof(struct thread_info, used_cp));
+  DEFINE(TI_FPSTATE,		offsetof(struct thread_info, fpstate));
+  DEFINE(TI_VFPSTATE,		offsetof(struct thread_info, vfpstate));
+  DEFINE(TI_IWMMXT_STATE,	(offsetof(struct thread_info, fpstate)+4)&~7);
+  BLANK();
+#if __LINUX_ARM_ARCH__ >= 6
+  DEFINE(MM_CONTEXT_ID,		offsetof(struct mm_struct, context.id));
+  BLANK();
+#endif
+  DEFINE(VMA_VM_MM,		offsetof(struct vm_area_struct, vm_mm));
+  DEFINE(VMA_VM_FLAGS,		offsetof(struct vm_area_struct, vm_flags));
+  BLANK();
+  DEFINE(VM_EXEC,	       	VM_EXEC);
+  BLANK();
+  DEFINE(PAGE_SZ,	       	PAGE_SIZE);
+  BLANK();
+  DEFINE(SYS_ERROR0,		0x9f0000);
+  BLANK();
+  DEFINE(SIZEOF_MACHINE_DESC,	sizeof(struct machine_desc));
+  return 0; 
+}

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
                   ` (3 preceding siblings ...)
  2004-10-28 19:03 ` arm: use generic support for constants.h Sam Ravnborg
@ 2004-10-28 19:44 ` Russell King
  2004-10-28 21:59   ` Sam Ravnborg
  4 siblings, 1 reply; 19+ messages in thread
From: Russell King @ 2004-10-28 19:44 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Thu, Oct 28, 2004 at 08:59:18PM +0200, Sam Ravnborg wrote:
> When creating offsets.h from arch/$(ARCH)/Makefile we failed to check
> all dependencies. A few key dependencies were listed - but a manually
> edited list of include files are bound to be incomplete.
> A few times I have tried building a kernel - which failed because
> offsets.h needed to be updated but kbuild failed to do so.
> I wonder what could happen with a kernel with an out-dated offsets.h
> file with wrong assembler constants.

This fails:

rmk@dyn-67:[linux-2.6-rmk]:<1041> amake O=../build/rpc
  Using /home/rmk/bk/linux-2.6-rmk as source for kernel
  GEN    /home/rmk/bk/build/rpc/Makefile
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/basic/split-include
  HOSTCC  scripts/basic/docproc
  GEN    /home/rmk/bk/build/rpc/Makefile
  SHIPPED scripts/kconfig/zconf.tab.h
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/mconf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/lex.zconf.c
  HOSTCC  -fPIC scripts/kconfig/zconf.tab.o
  HOSTLLD -shared scripts/kconfig/libkconfig.so
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf -s arch/arm/Kconfig
#
# using defaults found in .config
#
  SPLIT   include/linux/autoconf.h -> include/config/*
/home/rmk/bk/linux-2.6-rmk/scripts/Makefile.build:13: /home/rmk/bk/linux-2.6-rmk/include/asm/Makefile: No such file or directory
make[2]: *** No rule to make target `/home/rmk/bk/linux-2.6-rmk/include/asm/Makefile'.  Stop.
make[1]: *** [prepare0] Error 2
make: *** [_all] Error 2

../build/rpc only contained .version and .config

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-28 21:59   ` Sam Ravnborg
@ 2004-10-28 21:00     ` Russell King
  2004-10-28 23:45       ` Sam Ravnborg
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King @ 2004-10-28 21:00 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Thu, Oct 28, 2004 at 11:59:59PM +0200, Sam Ravnborg wrote:
> >   SPLIT   include/linux/autoconf.h -> include/config/*
> > /home/rmk/bk/linux-2.6-rmk/scripts/Makefile.build:13: /home/rmk/bk/linux-2.6-rmk/include/asm/Makefile: No such file or directory
> > make[2]: *** No rule to make target `/home/rmk/bk/linux-2.6-rmk/include/asm/Makefile'.  Stop.
> > make[1]: *** [prepare0] Error 2
> > make: *** [_all] Error 2
> > 
> > ../build/rpc only contained .version and .config
> 
> Did you apply the patch that enabled kbuild files to be named Kbuild?
> It looks like this patch is missing.

I applied three patches.  The first was "kbuild: Prefer Kbuild as name of
the kbuild files"

> If you did apply the patch could you please check if the asm->asm-arm
> symlink exists when the error happens and that a file named Kbuild is
> located in the directory: include/asm-arm/

In the source tree, I have:

drwxrwxr-x   2 rmk rmk  4096 Oct 28 20:38 include/asm
-rw-rw-r--   1 rmk rmk  1026 Oct 28 20:37 include/asm-arm/Kbuild

Note that kbuild created an extra directory called asm in the source
tree.  In the output tree:

rmk@dyn-67:[linux-2.6-rmk]:<1047> vdir ../build/rpc/include/
drwxr-xr-x  120 rmk rmk 4096 Oct 28 20:42 config
drwxrwxr-x    2 rmk rmk 4096 Oct 28 20:42 linux
rmk@dyn-67:[linux-2.6-rmk]:<1048> vdir ../build/rpc/include2/
total 0
lrwxrwxrwx  1 rmk rmk 42 Oct 28 20:42 asm -> /home/rmk/bk/linux-2.6-rmk/include/asm-arm

After removing ../build/rpc/include* and include/asm:

rmk@dyn-67:[linux-2.6-rmk]:<1050> amake O=../build/rpc
  Using /home/rmk/bk/linux-2.6-rmk as source for kernel
  GEN    /home/rmk/bk/build/rpc/Makefile
  CHK     include/linux/version.h
  UPD     include/linux/version.h
  SYMLINK include/asm -> include/asm-arm
  GEN    /home/rmk/bk/build/rpc/Makefile
scripts/kconfig/conf -s arch/arm/Kconfig
#
# using defaults found in .config
#
  SPLIT   include/linux/autoconf.h -> include/config/*
/home/rmk/bk/linux-2.6-rmk/scripts/Makefile.build:13: /home/rmk/bk/linux-2.6-rmk/include/asm/Makefile: No such file or directory
make[2]: *** No rule to make target `/home/rmk/bk/linux-2.6-rmk/include/asm/Makefile'.  Stop.
make[1]: *** [prepare0] Error 2
make: *** [_all] Error 2
rmk@dyn-67:[linux-2.6-rmk]:<1051> vdir ../build/rpc/include*
../build/rpc/include:
total 8
lrwxrwxrwx    1 rmk rmk    7 Oct 28 21:59 asm -> asm-arm
drwxr-xr-x  120 rmk rmk 4096 Oct 28 21:59 config
drwxrwxr-x    2 rmk rmk 4096 Oct 28 21:59 linux
 
../build/rpc/include2:
total 0
lrwxrwxrwx  1 rmk rmk 42 Oct 28 21:59 asm -> /home/rmk/bk/linux-2.6-rmk/include/asm-arm
rmk@dyn-67:[linux-2.6-rmk]:<1052> vdir include/
...
drwxrwxr-x   2 rmk rmk  4096 Oct 28 21:59 asm
drwxrwxr-x  25 rmk rmk  4096 Oct 28 20:37 asm-arm

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-28 19:44 ` kbuild/all archs: Sanitize creating offsets.h Russell King
@ 2004-10-28 21:59   ` Sam Ravnborg
  2004-10-28 21:00     ` Russell King
  0 siblings, 1 reply; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 21:59 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Thu, Oct 28, 2004 at 08:44:30PM +0100, Russell King wrote:
> On Thu, Oct 28, 2004 at 08:59:18PM +0200, Sam Ravnborg wrote:
> > When creating offsets.h from arch/$(ARCH)/Makefile we failed to check
> > all dependencies. A few key dependencies were listed - but a manually
> > edited list of include files are bound to be incomplete.
> > A few times I have tried building a kernel - which failed because
> > offsets.h needed to be updated but kbuild failed to do so.
> > I wonder what could happen with a kernel with an out-dated offsets.h
> > file with wrong assembler constants.
> 
> This fails:
> 
> rmk@dyn-67:[linux-2.6-rmk]:<1041> amake O=../build/rpc
>   Using /home/rmk/bk/linux-2.6-rmk as source for kernel
>   GEN    /home/rmk/bk/build/rpc/Makefile
>   CHK     include/linux/version.h
>   UPD     include/linux/version.h
>   HOSTCC  scripts/basic/fixdep
>   HOSTCC  scripts/basic/split-include
>   HOSTCC  scripts/basic/docproc
>   GEN    /home/rmk/bk/build/rpc/Makefile
>   SHIPPED scripts/kconfig/zconf.tab.h
>   HOSTCC  scripts/kconfig/conf.o
>   HOSTCC  scripts/kconfig/mconf.o
>   SHIPPED scripts/kconfig/zconf.tab.c
>   SHIPPED scripts/kconfig/lex.zconf.c
>   HOSTCC  -fPIC scripts/kconfig/zconf.tab.o
>   HOSTLLD -shared scripts/kconfig/libkconfig.so
>   HOSTLD  scripts/kconfig/conf
> scripts/kconfig/conf -s arch/arm/Kconfig
> #
> # using defaults found in .config
> #
>   SPLIT   include/linux/autoconf.h -> include/config/*
> /home/rmk/bk/linux-2.6-rmk/scripts/Makefile.build:13: /home/rmk/bk/linux-2.6-rmk/include/asm/Makefile: No such file or directory
> make[2]: *** No rule to make target `/home/rmk/bk/linux-2.6-rmk/include/asm/Makefile'.  Stop.
> make[1]: *** [prepare0] Error 2
> make: *** [_all] Error 2
> 
> ../build/rpc only contained .version and .config

Did you apply the patch that enabled kbuild files to be named Kbuild?
It looks like this patch is missing.

If you did apply the patch could you please check if the asm->asm-arm symlink exists
when the error happens and that a file named Kbuild is located in the directory:
include/asm-arm/

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-28 21:00     ` Russell King
@ 2004-10-28 23:45       ` Sam Ravnborg
  2004-10-29 21:28         ` Sam Ravnborg
  0 siblings, 1 reply; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-28 23:45 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Thu, Oct 28, 2004 at 10:00:24PM +0100, Russell King wrote:
> > Did you apply the patch that enabled kbuild files to be named Kbuild?
> > It looks like this patch is missing.
> 
> I applied three patches.  The first was "kbuild: Prefer Kbuild as name of
> the kbuild files"
> 
> > If you did apply the patch could you please check if the asm->asm-arm
> > symlink exists when the error happens and that a file named Kbuild is
> > located in the directory: include/asm-arm/

OK - I see it now.
It's in i386 also - I will have a fix ready tomorrow. Thanks for testing!

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: i386: use generic support for offsets.h
  2004-10-28 19:02 ` i386: use " Sam Ravnborg
@ 2004-10-29  9:52   ` Jan-Benedict Glaw
  2004-10-29 19:05     ` Sam Ravnborg
  0 siblings, 1 reply; 19+ messages in thread
From: Jan-Benedict Glaw @ 2004-10-29  9:52 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

On Thu, 2004-10-28 21:02:21 +0200, Sam Ravnborg <sam@ravnborg.org>
wrote in message <20041028190221.GD9004@mars.ravnborg.org>:
> diff -Nru a/include/asm-i386/offsets.c b/include/asm-i386/offsets.c
> --- /dev/null	Wed Dec 31 16:00:00 196900
> +++ b/include/asm-i386/offsets.c	2004-10-28 20:47:38 +02:00
> @@ -0,0 +1,66 @@

To be honest, I don't really like to have .c files in the include
pathes... However, I don't know about a better idea (except maybe to
place this into ./linux/arch/$(ARCH)/lib/)...

MfG, JBG

-- 
Jan-Benedict Glaw       jbglaw@lug-owl.de    . +49-172-7608481             _ O _
"Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg  _ _ O
 fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!   O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: New kbuild filename: Kbuild
  2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
  2004-10-28 17:30   ` Geert Uytterhoeven
@ 2004-10-29 11:59   ` Christoph Hellwig
  2004-10-29 19:12     ` Sam Ravnborg
  1 sibling, 1 reply; 19+ messages in thread
From: Christoph Hellwig @ 2004-10-29 11:59 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Thu, Oct 28, 2004 at 09:00:20PM +0200, Sam Ravnborg wrote:
> kbuild: Prefer Kbuild as name of the kbuild files
>    
> The kbuild syntax is unique and does only have very few things in common with
> usual Makefile syntax. So to avoid confusion make the filename 'Kbuild' be
> the preferred name as replacement for 'Makefile'.
> No global renaming planned to take place for now, but new stuff expected to use
> the new 'Kbuild' filename.

Disagree.  These are just makefiles, and renaming for the sake of it
doesn't buy us.  If you really want to improve things implement something like

 module foo.ko
 sources foo.c blah.c
 sources foobar.c if FOO_BAR

in Kconfig and get rid of driver makefiles compeltely


^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: New kbuild filename: Kbuild
  2004-10-29 19:12     ` Sam Ravnborg
@ 2004-10-29 17:47       ` Roman Zippel
  2004-10-29 20:46         ` Sam Ravnborg
  0 siblings, 1 reply; 19+ messages in thread
From: Roman Zippel @ 2004-10-29 17:47 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: Christoph Hellwig, linux-kernel, Andrew Morton, linux-arch

Hi,

On Fri, 29 Oct 2004, Sam Ravnborg wrote:

> > If you really want to improve things implement something like
> > 
> >  module foo.ko
> >  sources foo.c blah.c
> >  sources foobar.c if FOO_BAR
> > 
> > in Kconfig and get rid of driver makefiles compeltely
> 
> I'm in favour of this too - but so far Roman has rejected it.

I never rejected this, I just haven't implemented this yet. :)

bye, Roman

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: i386: use generic support for offsets.h
  2004-10-29  9:52   ` Jan-Benedict Glaw
@ 2004-10-29 19:05     ` Sam Ravnborg
  0 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-29 19:05 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 11:52:14AM +0200, Jan-Benedict Glaw wrote:
> On Thu, 2004-10-28 21:02:21 +0200, Sam Ravnborg <sam@ravnborg.org>
> wrote in message <20041028190221.GD9004@mars.ravnborg.org>:
> > diff -Nru a/include/asm-i386/offsets.c b/include/asm-i386/offsets.c
> > --- /dev/null	Wed Dec 31 16:00:00 196900
> > +++ b/include/asm-i386/offsets.c	2004-10-28 20:47:38 +02:00
> > @@ -0,0 +1,66 @@
> 
> To be honest, I don't really like to have .c files in the include
> pathes... However, I don't know about a better idea (except maybe to
> place this into ./linux/arch/$(ARCH)/lib/)...

Having the source file in same directory as the result file is a
pattern used all over the kernel. Moving the .c file to include/asm-xxx
just made this true for offsets.h.
In this process a renaming took place so the name of the source file
and the result file match except for the extension.

Some architectures had: asm_offsets.c => offsets.h
A non-logical renaming.

As for the idea of having source file located in a separate
directory. It's not supported by kbuild today, and I'm reluctant
to support it - since it usually triggers misuse.
kbuild is about making the trivial stuff easy, but not about full
flexibility. If we wanted full flexibility we would not have used
so much effort to define a simple syntax.

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: New kbuild filename: Kbuild
  2004-10-29 11:59   ` Christoph Hellwig
@ 2004-10-29 19:12     ` Sam Ravnborg
  2004-10-29 17:47       ` Roman Zippel
  0 siblings, 1 reply; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-29 19:12 UTC (permalink / raw)
  To: Christoph Hellwig, linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 12:59:03PM +0100, Christoph Hellwig wrote:
> On Thu, Oct 28, 2004 at 09:00:20PM +0200, Sam Ravnborg wrote:
> > kbuild: Prefer Kbuild as name of the kbuild files
> >    
> > The kbuild syntax is unique and does only have very few things in common with
> > usual Makefile syntax. So to avoid confusion make the filename 'Kbuild' be
> > the preferred name as replacement for 'Makefile'.
> > No global renaming planned to take place for now, but new stuff expected to use
> > the new 'Kbuild' filename.
> 
> Disagree.  These are just makefiles, and renaming for the sake of it
> doesn't buy us.
Makefiles are valid input files to make, and the kbuild files has
for a long time had their own documented syntax.
Introduce the Kbuild name just makes this even more apperant for the reader.

When we in two years time start to deal with external modules that only support
kernel 2.6.10 and never then we can avoid the ugly:

ifeq ($(KERNELRELEASE),)
...

To separate out the real makefile and the Kbuild stuff.

> If you really want to improve things implement something like
> 
>  module foo.ko
>  sources foo.c blah.c
>  sources foobar.c if FOO_BAR
> 
> in Kconfig and get rid of driver makefiles compeltely

I'm in favour of this too - but so far Roman has rejected it.
But this still leaves out the other parts where the Kbuild name makes
more sense.

PArt of the longer term plaaning is a split of
arch/$(ARCH)/Makefile in a Kbuild.define and Kbuild.rules part.
This split will allows the kbuild infrastructure to be used
also for the top-level part of the kernel - and the next generation
kbuild will read in all relevant Kbuild files and create a single
Makfilefile for that part of the kernel compilation.

This is part of the vision at least - introducing kbuild
contant in Kconfig files is not a hindering for this.

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-29 21:28         ` Sam Ravnborg
@ 2004-10-29 19:51           ` Russell King
  2004-10-29 22:36             ` Sam Ravnborg
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King @ 2004-10-29 19:51 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 11:28:52PM +0200, Sam Ravnborg wrote:
> On Fri, Oct 29, 2004 at 01:45:49AM +0200, Sam Ravnborg wrote:
> > On Thu, Oct 28, 2004 at 10:00:24PM +0100, Russell King wrote:
> > > > Did you apply the patch that enabled kbuild files to be named Kbuild?
> > > > It looks like this patch is missing.
> > > 
> > > I applied three patches.  The first was "kbuild: Prefer Kbuild as name of
> > > the kbuild files"
> > > 
> > > > If you did apply the patch could you please check if the asm->asm-arm
> > > > symlink exists when the error happens and that a file named Kbuild is
> > > > located in the directory: include/asm-arm/
> > 
> > OK - I see it now.
> > It's in i386 also - I will have a fix ready tomorrow. Thanks for testing!
> 
> Fix attached - next time I better check O= support myself.
> Russell - I would be glad if you could test this version. There is 
> some symlink handling for arm I like to see tested.

Getting better, but still not right:

make -f /home/rmk/bk/linux-2.6-rmk/scripts/Makefile.build obj=include/asm-arm
  SYMLINK include/asm-arm/arch -> include/asm-arm/arch-rpc
mkdir -p include/asm-arm
ln -fsn /home/rmk/bk/linux-2.6-rmk/include/asm-arm/arch-rpc include/asm-arm/arch
  arm-linux-gcc -Wp,-MD,include/asm-arm/.offsets.s.d -nostdinc -iwithprefix include -D__KERNEL__ -Iinclude -Iinclude2 -I/home/rmk/bk/linux-2.6-rmk/include -I/home/rmk/bk/linux-2.6-rmk/include/asm-arm -Iinclude/asm-arm -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os -fno-omit-frame-pointer -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mlittle-endian -mapcs-32 -D__LINUX_ARM_ARCH__=3 -march=armv3 -mtune=strongarm110 -malignment-traps -msoft-float -Uarm -Wdeclaration-after-statement -I/home/rmk/bk/linux-2.6-rmk/ -I arch/arm/kernel  -DKBUILD_BASENAME=offsets -DKBUILD_MODNAME=offsets -S -o include/asm-arm/offsets.s /home/rmk/bk/linux-2.6-rmk/include/asm-arm/offsets.c
set -e; echo '  CHK     include/asm-arm/constants.h'; mkdir -p include/asm-arm/;        (set -e; echo "#ifndef __ASM_OFFSETS_H__"; echo "#define __ASM_OFFSETS_H__"; echo "/*"; echo " * DO NOT MODIFY."; echo " *"; echo " * This file was generated by arch/arm/Makefile"; echo " *"; echo " */"; echo ""; sed -ne "/^->/{s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; echo ""; echo "#endif" )  < include/asm-arm/offsets.s > include/asm-arm/constants.h.tmp; if [ -r include/asm-arm/constants.h ] && cmp -s include/asm-arm/constants.h include/asm-arm/constants.h.tmp; then rm -f include/asm-arm/constants.h.tmp; else echo '  UPD     include/asm-arm/constants.h'; mv -f include/asm-arm/constants.h.tmp include/asm-arm/constants.h; fi
  CHK     include/asm-arm/constants.h
  UPD     include/asm-arm/constants.h
make[2]: *** No rule to make target `include/asm-arm/include/asm-arm/.arch', needed by `__build'.  Stop.
make[1]: *** [prepare0] Error 2
make: *** [_all] Error 2

Removing "include/asm-arm/" from the always := line in asm-arm/Kbuild
appears to fix this.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: New kbuild filename: Kbuild
  2004-10-29 17:47       ` Roman Zippel
@ 2004-10-29 20:46         ` Sam Ravnborg
  0 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-29 20:46 UTC (permalink / raw)
  To: Roman Zippel
  Cc: Sam Ravnborg, Christoph Hellwig, linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 07:47:53PM +0200, Roman Zippel wrote:
> Hi,
> 
> On Fri, 29 Oct 2004, Sam Ravnborg wrote:
> 
> > > If you really want to improve things implement something like
> > > 
> > >  module foo.ko
> > >  sources foo.c blah.c
> > >  sources foobar.c if FOO_BAR
> > > 
> > > in Kconfig and get rid of driver makefiles compeltely
> > 
> > I'm in favour of this too - but so far Roman has rejected it.
> 
> I never rejected this, I just haven't implemented this yet. :)

OK!

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-28 23:45       ` Sam Ravnborg
@ 2004-10-29 21:28         ` Sam Ravnborg
  2004-10-29 19:51           ` Russell King
  0 siblings, 1 reply; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-29 21:28 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 01:45:49AM +0200, Sam Ravnborg wrote:
> On Thu, Oct 28, 2004 at 10:00:24PM +0100, Russell King wrote:
> > > Did you apply the patch that enabled kbuild files to be named Kbuild?
> > > It looks like this patch is missing.
> > 
> > I applied three patches.  The first was "kbuild: Prefer Kbuild as name of
> > the kbuild files"
> > 
> > > If you did apply the patch could you please check if the asm->asm-arm
> > > symlink exists when the error happens and that a file named Kbuild is
> > > located in the directory: include/asm-arm/
> 
> OK - I see it now.
> It's in i386 also - I will have a fix ready tomorrow. Thanks for testing!

Fix attached - next time I better check O= support myself.
Russell - I would be glad if you could test this version. There is 
some symlink handling for arm I like to see tested.

	Sam


===== Makefile 1.546 vs edited =====
--- 1.546/Makefile	2004-10-27 23:00:25 +02:00
+++ edited/Makefile	2004-10-29 23:05:42 +02:00
@@ -761,7 +761,7 @@
 prepare1: prepare2 outputmakefile
 
 prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER
-	$(Q)$(MAKE) $(build)=$(srctree)/include/asm
+	$(Q)$(MAKE) $(build)=include/asm-$(ARCH)
 ifneq ($(KBUILD_MODULES),)
 	$(Q)rm -rf $(MODVERDIR)
 	$(Q)mkdir -p $(MODVERDIR)
===== include/asm-i386/Kbuild 1.1 vs edited =====
--- 1.1/include/asm-i386/Kbuild	2004-10-27 23:06:50 +02:00
+++ edited/include/asm-i386/Kbuild	2004-10-29 01:44:08 +02:00
@@ -11,7 +11,7 @@
 always  := offsets.h
 targets := offsets.s
 
-CFLAGS_offsets.o := -I arch/i386/kernel
+CFLAGS_offsets.o := -Iarch/i386/kernel
 
 $(obj)/offsets.h: $(obj)/offsets.s FORCE
 	$(call filechk,gen-asm-offsets, < $<)
===== scripts/Makefile.build 1.51 vs edited =====
--- 1.51/scripts/Makefile.build	2004-10-27 22:49:53 +02:00
+++ edited/scripts/Makefile.build	2004-10-29 23:04:40 +02:00
@@ -10,7 +10,7 @@
 # Read .config if it exist, otherwise ignore
 -include .config
 
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+include $(if $(wildcard $(srctree)/$(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
 
 include scripts/Makefile.lib
 
===== scripts/Makefile.clean 1.17 vs edited =====
--- 1.17/scripts/Makefile.clean	2004-10-27 22:49:53 +02:00
+++ edited/scripts/Makefile.clean	2004-10-29 23:22:26 +02:00
@@ -7,7 +7,7 @@
 .PHONY: __clean
 __clean:
 
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+include $(if $(wildcard $(srctree)/$(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
 
 # Figure out what we need to build from the various variables
 # ==========================================================================

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: kbuild/all archs: Sanitize creating offsets.h
  2004-10-29 19:51           ` Russell King
@ 2004-10-29 22:36             ` Sam Ravnborg
  0 siblings, 0 replies; 19+ messages in thread
From: Sam Ravnborg @ 2004-10-29 22:36 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton, linux-arch

On Fri, Oct 29, 2004 at 08:51:06PM +0100, Russell King wrote:
> On Fri, Oct 29, 2004 at 11:28:52PM +0200, Sam Ravnborg wrote:
> > On Fri, Oct 29, 2004 at 01:45:49AM +0200, Sam Ravnborg wrote:
> > > On Thu, Oct 28, 2004 at 10:00:24PM +0100, Russell King wrote:
> > > > > Did you apply the patch that enabled kbuild files to be named Kbuild?
> > > > > It looks like this patch is missing.
> > > > 
> > > > I applied three patches.  The first was "kbuild: Prefer Kbuild as name of
> > > > the kbuild files"
> > > > 
> > > > > If you did apply the patch could you please check if the asm->asm-arm
> > > > > symlink exists when the error happens and that a file named Kbuild is
> > > > > located in the directory: include/asm-arm/
> > > 
> > > OK - I see it now.
> > > It's in i386 also - I will have a fix ready tomorrow. Thanks for testing!
> > 
> > Fix attached - next time I better check O= support myself.
> > Russell - I would be glad if you could test this version. There is 
> > some symlink handling for arm I like to see tested.
> 
> Getting better, but still not right:

Thanks.
Building arm toolchain atm so I can test myself.
The .arch stuff was the main reason to post arm.

	Sam

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2004-10-30  1:38 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 18:59 kbuild/all archs: Sanitize creating offsets.h Sam Ravnborg
2004-10-28 19:00 ` New kbuild filename: Kbuild Sam Ravnborg
2004-10-28 17:30   ` Geert Uytterhoeven
2004-10-29 11:59   ` Christoph Hellwig
2004-10-29 19:12     ` Sam Ravnborg
2004-10-29 17:47       ` Roman Zippel
2004-10-29 20:46         ` Sam Ravnborg
2004-10-28 19:01 ` kbuild: generic support for offsets.h Sam Ravnborg
2004-10-28 19:02 ` i386: use " Sam Ravnborg
2004-10-29  9:52   ` Jan-Benedict Glaw
2004-10-29 19:05     ` Sam Ravnborg
2004-10-28 19:03 ` arm: use generic support for constants.h Sam Ravnborg
2004-10-28 19:44 ` kbuild/all archs: Sanitize creating offsets.h Russell King
2004-10-28 21:59   ` Sam Ravnborg
2004-10-28 21:00     ` Russell King
2004-10-28 23:45       ` Sam Ravnborg
2004-10-29 21:28         ` Sam Ravnborg
2004-10-29 19:51           ` Russell King
2004-10-29 22:36             ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).