Move generated files to include/generated
Subsystems (27)
In 2.6.30 we introduced support for adding generated files to a dedicated directory named "include/generated".
This had a number of benefits:
- avoid mixing generated and normal files
- allow us to finally kill the asm symlink
- simpler .gitignore rules
- simpler list of mrproper files
The following patchset introduces use of include/generated in several places as documented by the shortlog:
Sam Ravnborg (10):
kbuild: move bounds.h to include/generated
kbuild: move asm-offsets.h to include/generated
ia64: move nr-irqs.h to include/generated
sh: move machtypes.h to include/generated
arm: move mach-types to include/generated
kbuild: drop asm symlink
kbuild: move compile.h to include/generated drop unneeded include of autoconf.h
kbuild: move autoconf.h to include/generated
kbuild: move utsrelease.h to include/generated
We are left with version.h that is still generated in include/linux.
And there may be a few architecture specific files I have missed.
This patch serie has a few shortcomings...
1)
After applying one _must_ do a "make clean" to get a buildable kernel.
This is because we change the path of autoconf.h but the patch does not include anything to force a new autoconf.h to be created.
Another workaround is to use a simple "make oldconfig".
2)
All files will be rebuild.
We change an option to gcc due to path change of autoconf.h so all files will be rebuild.
3)
If some files are left in include/asm/ we may still pick them up.
This is relevant for asm-offsets.h where we have a lot of "#include <asm/asm-offsets.h>". And include/asm comes before arch/$ARCH/include/asm in the search order.
4)
We loose the check if this is the correct ARCH we are building for as we can no longer check the asm symlink. This shortcoming is addressed by another patch that saves ARCH and CROSS_COMPILE. But it is not part of this serie.
Individual patches will follow.
Patches are based on todays mainline.
It is also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/sam/generated.git
Comments welcome!
Sam
PATCH 1/10 kbuild: move bounds.h to include/generated
--- .gitignore | 1 - Kbuild | 2 +- Makefile | 2 +- include/linux/mmzone.h | 2 +- include/linux/page-flags.h | 2 +- kernel/bounds.c | 2 +- 6 files changed, 5 insertions(+), 6 deletions(-)
.gitignore +0 -1
@@ -51,7 +51,6 @@ include/linux/autoconf.h include/linux/compile.h include/linux/version.h include/linux/utsrelease.h -include/linux/bounds.h include/generated # stgit generated dirs
Kbuild +1 -1
@@ -8,7 +8,7 @@ ##### # 1) Generate bounds.h -bounds-file := include/linux/bounds.h +bounds-file := include/generated/bounds.h always := $(bounds-file) targets := $(bounds-file) kernel/bounds.s
Makefile +1 -1
@@ -1197,7 +1197,7 @@ MRPROPER_DIRS += include/config include2 usr/include include/generated MRPROPER_FILES += .config .config.old include/asm .version .old_version \ include/linux/autoconf.h include/linux/version.h \ include/linux/utsrelease.h \ - include/linux/bounds.h include/asm*/asm-offsets.h \ + include/asm*/asm-offsets.h \ Module.symvers Module.markers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules
include/linux/mmzone.h +1 -1
@@ -15,7 +15,7 @@#include <linux/seqlock.h> #include <linux/nodemask.h> #include <linux/pageblock-flags.h> -#include <linux/bounds.h> +#include <generated/bounds.h> #include <asm/atomic.h> #include <asm/page.h>
include/linux/page-flags.h +1 -1
@@ -8,7 +8,7 @@#include <linux/types.h> #ifndef __GENERATING_BOUNDS_H#include <linux/mm_types.h> -#include <linux/bounds.h> +#include <generated/bounds.h> #endif /* !__GENERATING_BOUNDS_H */ /*
kernel/bounds.c +1 -1
@@ -12,7 +12,7 @@void foo (void ) { -/* The enum constants to put into include/linux/bounds.h */ +/* The enum constants to put into include/generated/bounds.h */ DEFINE (NR_PAGEFLAGS , __NR_PAGEFLAGS);DEFINE (MAX_NR_ZONES , __MAX_NR_ZONES);/* End of constants */
Signature · 1 line
1.6.2.5
PATCH 2/10 kbuild: move asm-offsets.h to include/generated
In reply to Sam RavnborgThe simplest method was to add an extra asm-offsets.h file in arch/$ARCH/include/asm that references the generated file.
We can now migrate the architectures one-by-one to reference the generated file direct - and when done we can delete the temporary arch/$ARCH/include/asm/asm-offsets.h file.
--- .gitignore | 1 - Kbuild | 2 +- Makefile | 1 - arch/alpha/include/asm/asm-offsets.h | 1 + arch/arm/include/asm/asm-offsets.h | 1 + arch/avr32/include/asm/asm-offsets.h | 1 + arch/blackfin/include/asm/asm-offsets.h | 1 + arch/cris/include/asm/asm-offsets.h | 1 + arch/frv/include/asm/asm-offsets.h | 1 + arch/h8300/include/asm/asm-offsets.h | 1 + arch/ia64/include/asm/asm-offsets.h | 1 + arch/m68k/include/asm/asm-offsets.h | 1 + arch/microblaze/include/asm/asm-offsets.h | 1 + arch/mips/include/asm/asm-offsets.h | 1 + arch/mn10300/include/asm/asm-offsets.h | 1 + arch/parisc/include/asm/asm-offsets.h | 1 + arch/powerpc/include/asm/asm-offsets.h | 1 + arch/s390/include/asm/asm-offsets.h | 1 + arch/sh/include/asm/asm-offsets.h | 1 + arch/sparc/include/asm/asm-offsets.h | 1 + arch/um/Makefile | 2 +- arch/um/include/asm/asm-offsets.h | 1 + arch/x86/include/asm/asm-offsets.h | 1 + arch/xtensa/include/asm/asm-offsets.h | 1 + 24 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 arch/alpha/include/asm/asm-offsets.h create mode 100644 arch/arm/include/asm/asm-offsets.h create mode 100644 arch/avr32/include/asm/asm-offsets.h create mode 100644 arch/blackfin/include/asm/asm-offsets.h create mode 100644 arch/cris/include/asm/asm-offsets.h create mode 100644 arch/frv/include/asm/asm-offsets.h create mode 100644 arch/h8300/include/asm/asm-offsets.h create mode 100644 arch/ia64/include/asm/asm-offsets.h create mode 100644 arch/m68k/include/asm/asm-offsets.h create mode 100644 arch/microblaze/include/asm/asm-offsets.h create mode 100644 arch/mips/include/asm/asm-offsets.h create mode 100644 arch/mn10300/include/asm/asm-offsets.h create mode 100644 arch/parisc/include/asm/asm-offsets.h create mode 100644 arch/powerpc/include/asm/asm-offsets.h create mode 100644 arch/s390/include/asm/asm-offsets.h create mode 100644 arch/sh/include/asm/asm-offsets.h create mode 100644 arch/sparc/include/asm/asm-offsets.h create mode 100644 arch/um/include/asm/asm-offsets.h create mode 100644 arch/x86/include/asm/asm-offsets.h create mode 100644 arch/xtensa/include/asm/asm-offsets.h
.gitignore +0 -1
@@ -45,7 +45,6 @@ Module.symvers # Generated include files # include/asm -include/asm-*/asm-offsets.h include/config include/linux/autoconf.h include/linux/compile.h
Kbuild +1 -1
@@ -43,7 +43,7 @@ $(obj)/$(bounds-file): kernel/bounds.s Kbuild # 2) Generate asm-offsets.h # -offsets-file := include/asm/asm-offsets.h +offsets-file := include/generated/asm-offsets.h always += $(offsets-file) targets += $(offsets-file)
Makefile +0 -1
@@ -1197,7 +1197,6 @@ MRPROPER_DIRS += include/config include2 usr/include include/generated MRPROPER_FILES += .config .config.old include/asm .version .old_version \ include/linux/autoconf.h include/linux/version.h \ include/linux/utsrelease.h \ - include/asm*/asm-offsets.h \ Module.symvers Module.markers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules
arch/alpha/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/arm/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/avr32/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/blackfin/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/cris/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/frv/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/h8300/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/ia64/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/m68k/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/microblaze/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/mips/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/mn10300/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/parisc/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/powerpc/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/s390/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/sh/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/sparc/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/um/Makefile +1 -1
@@ -150,6 +150,6 @@ $(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s $(SHARED_HEADERS)/kern_constants.h: $(Q)mkdir -p $(dir $@) - $(Q)echo '#include "../../../../include/asm/asm-offsets.h"' >$@ + $(Q)echo '#include "../../../../include/generated/asm-offsets.h"' >$@ export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH
arch/um/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/x86/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
arch/xtensa/include/asm/asm-offsets.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/asm-offsets.h>
Signature · 1 line
1.6.2.5
PATCH 3/10 ia64: move nr-irqs.h to include/generated
In reply to Sam RavnborgAvoid generating files in the now deprecated asm-ia64 dir Simplified the logic in the Makefile when editing stuff in the area
--- arch/ia64/Makefile | 2 +- arch/ia64/include/asm/irq.h | 2 +- arch/ia64/kernel/Makefile | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-)
arch/ia64/Makefile +1 -1
@@ -108,4 +108,4 @@ archprepare: make_nr_irqs_h FORCE PHONY += make_nr_irqs_h FORCE make_nr_irqs_h: FORCE - $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h + $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.h
arch/ia64/include/asm/irq.h +1 -1
@@ -13,7 +13,7 @@#include <linux/types.h> #include <linux/cpumask.h> -#include <asm-ia64/nr-irqs.h> +#include <generated/nr-irqs.h> static __inline__int irq_canonicalize (int irq)
arch/ia64/kernel/Makefile +2 -5
@@ -81,17 +81,14 @@ define cmd_nr_irqs endef # We use internal kbuild rules to avoid the "is up to date" message from make -arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c \ - $(wildcard $(srctree)/include/asm-ia64/*/irq.h) +arch/ia64/kernel/nr-irqs.s: arch/ia64/kernel/nr-irqs.c $(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c) -include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s +include/generated/nr-irqs.h: arch/ia64/kernel/nr-irqs.s $(Q)mkdir -p $(dir $@) $(call cmd,nr_irqs) -clean-files += $(objtree)/include/asm-ia64/nr-irqs.h - # # native ivt.S, entry.S and fsys.S #
Signature · 1 line
1.6.2.5
PATCH 4/10 sh: move machtypes.h to include/generated
In reply to Sam Ravnborg--- arch/sh/Makefile | 9 ++------- arch/sh/include/asm/.gitignore | 1 - arch/sh/include/asm/machvec.h | 2 +- arch/sh/tools/Makefile | 4 ++-- arch/sh/tools/gen-mach-types | 2 +- 5 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 arch/sh/include/asm/.gitignore
arch/sh/Makefile +2 -7
@@ -189,10 +189,6 @@ KBUILD_AFLAGS += $(cflags-y) libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) -PHONY += maketools FORCE - -maketools: include/linux/version.h FORCE - $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h all: $(KBUILD_IMAGE)
@@ -201,7 +197,8 @@ zImage uImage uImage.srec vmlinux.srec: vmlinux compressed: zImage -archprepare: maketools +archprepare: + $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h archclean: $(Q)$(MAKE) $(clean)=$(boot)
@@ -213,5 +210,3 @@ define archhelp @echo ' uImage - Create a bootable image for U-Boot' @echo ' uImage.srec - Create an S-record for U-Boot' endef - -CLEAN_FILES += include/asm-sh/machtypes.h
arch/sh/include/asm/.gitignore deleted +0 -1
@@ -1 +0,0 @@ -machtypes.h
arch/sh/include/asm/machvec.h +1 -1
@@ -12,7 +12,7 @@#include <linux/types.h> #include <linux/time.h> -#include <asm/machtypes.h> +#include <generated/machtypes.h> struct sh_machine_vector {void (*mv_setup)(char **cmdline_p);
arch/sh/tools/Makefile +2 -2
@@ -10,7 +10,7 @@ # Shamelessly cloned from ARM. # -include/asm-sh/machtypes.h: $(src)/gen-mach-types $(src)/mach-types +include/generated/machtypes.h: $(src)/gen-mach-types $(src)/mach-types @echo ' Generating $@' - $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi + $(Q)mkdir -p $(dir $@) $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
arch/sh/tools/gen-mach-types +1 -1
@@ -1,6 +1,6 @@ #!/bin/awk # -# Awk script to generate include/asm-sh/machtypes.h +# Awk script to generate include/generated/machtypes.h # Heavily based on arch/arm/tools/gen-mach-types # BEGIN { nr = 0 }
Signature · 1 line
1.6.2.5
PATCH 5/10 arm: move mach-types to include/generated
In reply to Sam RavnborgSimplified arch/arm/Makefile by dropping the maketools target It was undocumented and not needed
--- arch/arm/Makefile | 14 ++------------ arch/arm/include/asm/mach-types.h | 1 + arch/arm/tools/Makefile | 2 +- arch/arm/tools/gen-mach-types | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) create mode 100644 arch/arm/include/asm/mach-types.h
arch/arm/Makefile +2 -12
@@ -226,15 +226,8 @@ all: $(KBUILD_IMAGE) 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. - -archprepare: maketools - -PHONY += maketools FORCE -maketools: include/linux/version.h FORCE - $(Q)$(MAKE) $(build)=arch/arm/tools include/asm-arm/mach-types.h +archprepare: + $(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h # Convert bzImage to zImage bzImage: zImage
@@ -245,9 +238,6 @@ zImage Image xipImage bootpImage uImage: vmlinux zinstall install: vmlinux $(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@ -CLEAN_FILES += include/asm-arm/mach-types.h \ - include/asm-arm/arch include/asm-arm/.arch - # We use MRPROPER_FILES and CLEAN_FILES now archclean: $(Q)$(MAKE) $(clean)=$(boot)
arch/arm/include/asm/mach-types.h new file +1 -0
@@ -0,0 +1 @@ +#include <generated/mach-types.h>
arch/arm/tools/Makefile +1 -1
@@ -4,7 +4,7 @@ # Copyright (C) 2001 Russell King # -include/asm-arm/mach-types.h: $(src)/gen-mach-types $(src)/mach-types +include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types @echo ' Generating $@' @mkdir -p $(dir $@) $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
arch/arm/tools/gen-mach-types +1 -1
@@ -1,6 +1,6 @@ #!/bin/awk # -# Awk script to generate include/asm-arm/mach-types.h +# Awk script to generate include/generated/mach-types.h # BEGIN { nr = 0 } /^#/ { next }
Signature · 1 line
1.6.2.5
PATCH 7/10 kbuild: move compile.h to include/generated
In reply to Sam Ravnborg--- .gitignore | 1 - arch/x86/boot/version.c | 2 +- init/Makefile | 6 +++--- init/version.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
.gitignore +0 -1
@@ -46,7 +46,6 @@ Module.symvers # include/config include/linux/autoconf.h -include/linux/compile.h include/linux/version.h include/linux/utsrelease.h include/generated
arch/x86/boot/version.c +1 -1
@@ -14,7 +14,7 @@#include "boot.h" #include <linux/utsrelease.h> -#include <linux/compile.h> +#include <generated/compile.h> const char kernel_version[] =UTS_RELEASE " (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ") "
init/Makefile +3 -3
@@ -16,11 +16,11 @@ mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o # files to be removed upon make clean -clean-files := ../include/linux/compile.h +clean-files := ../include/generated/compile.h # dependencies on generated files need to be listed explicitly -$(obj)/version.o: include/linux/compile.h +$(obj)/version.o: include/generated/compile.h # compile.h changes depending on hostname, generation number, etc, # so we regenerate it always.
@@ -30,7 +30,7 @@ $(obj)/version.o: include/linux/compile.h chk_compile.h = : quiet_chk_compile.h = echo ' CHK $@' silent_chk_compile.h = : -include/linux/compile.h: FORCE +include/generated/compile.h: FORCE @$($(quiet)chk_compile.h) $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(KBUILD_CFLAGS)"
init/version.c +1 -1
@@ -6,7 +6,7 @@* May be freely distributed as part of Linux. */ -#include <linux/compile.h> +#include <generated/compile.h> #include <linux/module.h> #include <linux/uts.h> #include <linux/utsname.h>
Signature · 1 line
1.6.2.5
PATCH 6/10 kbuild: drop asm symlink
In reply to Sam RavnborgGenerated files are no longer saved in include/asm so there is no use left of this.
This also allowed us to get rid of the ugly "include2" directory used for O=... builds.
--- .gitignore | 1 - Makefile | 51 +++++---------------------------------------------- 2 files changed, 5 insertions(+), 47 deletions(-)
.gitignore +0 -1
@@ -44,7 +44,6 @@ Module.symvers # # Generated include files # -include/asm include/config include/linux/autoconf.h include/linux/compile.h
Makefile +5 -46
93 lines not on this page · raw message
Signature · 1 line
1.6.2.5
PATCH 8/10 drop unneeded include of autoconf.h
In reply to Sam Ravnborgkbuild.h forces include of autoconf.h on the
commandline using -include - so we do not need to
include the file explicit.
--- arch/cris/arch-v32/kernel/head.S | 1 - arch/cris/kernel/asm-offsets.c | 1 - arch/cris/kernel/vmlinux.lds.S | 1 - arch/ia64/kvm/asm-offsets.c | 1 - drivers/accessibility/braille/braille_console.c | 1 - drivers/hid/hid-lg.h | 2 -- drivers/platform/x86/compal-laptop.c | 1 - include/linux/mmdebug.h | 2 -- 8 files changed, 0 insertions(+), 10 deletions(-)
arch/cris/arch-v32/kernel/head.S +0 -1
@@ -10,7 +10,6 @@ * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so * -traditional must not be used when assembling this file. */ -#include <linux/autoconf.h> #include <arch/memmap.h> #include <hwregs/reg_rdwr.h> #include <hwregs/intr_vect.h>
arch/cris/kernel/asm-offsets.c +0 -1
@@ -1,6 +1,5 @@#include <linux/sched.h> #include <asm/thread_info.h> -#include <linux/autoconf.h> /* * Generate definitions needed by assembly language modules.
arch/cris/kernel/vmlinux.lds.S +0 -1
@@ -8,7 +8,6 @@ * the kernel has booted. */ -#include <linux/autoconf.h> #include <asm-generic/vmlinux.lds.h> #include <asm/page.h>
arch/ia64/kvm/asm-offsets.c +0 -1
@@ -22,7 +22,6 @@* */ -#include <linux/autoconf.h> #include <linux/kvm_host.h> #include <linux/kbuild.h>
drivers/accessibility/braille/braille_console.c +0 -1
@@ -21,7 +21,6 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include <linux/autoconf.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h>
drivers/hid/hid-lg.h +0 -2
@@ -1,8 +1,6 @@#ifndef __HID_LG_H#define __HID_LG_H -#include <linux/autoconf.h> -#ifdef CONFIG_LOGITECH_FF int lgff_init (struct hid_device *hdev);#else
drivers/platform/x86/compal-laptop.c +0 -1
@@ -51,7 +51,6 @@#include <linux/dmi.h> #include <linux/backlight.h> #include <linux/platform_device.h> -#include <linux/autoconf.h> #define COMPAL_DRIVER_VERSION "0.2.6"
include/linux/mmdebug.h +0 -2
@@ -1,8 +1,6 @@#ifndef LINUX_MM_DEBUG_H #define LINUX_MM_DEBUG_H 1 -#include <linux/autoconf.h> -#ifdef CONFIG_DEBUG_VM #define VM_BUG_ON (cond) BUG_ON(cond)#else
Signature · 1 line
1.6.2.5
PATCH 9/10 kbuild: move autoconf.h to include/generated
In reply to Sam Ravnborg--- .gitignore | 1 - Documentation/kbuild/kconfig.txt | 3 ++- Makefile | 11 ++++++----- arch/m68k/kernel/head.S | 2 +- scripts/basic/fixdep.c | 10 +++++----- scripts/kconfig/confdata.c | 2 +- scripts/mkcompile_h | 2 +- 7 files changed, 16 insertions(+), 15 deletions(-)
.gitignore +0 -1
@@ -45,7 +45,6 @@ Module.symvers # Generated include files # include/config -include/linux/autoconf.h include/linux/version.h include/linux/utsrelease.h include/generated
Documentation/kbuild/kconfig.txt +2 -1
@@ -106,7 +106,8 @@ This environment variable can be set to specify the path & name of the KCONFIG_AUTOHEADER -------------------------------------------------- This environment variable can be set to specify the path & name of the -"autoconf.h" (header) file. Its default value is "include/linux/autoconf.h". +"autoconf.h" (header) file. +Its default value is "include/generated/autoconf.h". ======================================================================
Makefile +6 -5
@@ -336,7 +336,7 @@ CFLAGS_GCOV = -fprofile-arcs -ftest-coverage LINUXINCLUDE := -Iinclude \ $(if $(KBUILD_SRC), -I$(srctree)/include) \ -I$(srctree)/arch/$(hdr-arch)/include \ - -include include/linux/autoconf.h + -include include/generated/autoconf.h KBUILD_CPPFLAGS := -D__KERNEL__
@@ -490,17 +490,18 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # if auto.conf.cmd is missing then we are probably in a cleaned tree so # we execute the config step to be sure to catch updated Kconfig files include/config/auto.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd + $(Q)mkdir -p include/generated $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig else -# external modules needs include/linux/autoconf.h and include/config/auto.conf +# external modules needs include/generated/autoconf.h and include/config/auto.conf # but do not care if they are up-to-date. Use auto.conf to trigger the test PHONY += include/config/auto.conf include/config/auto.conf: - $(Q)test -e include/linux/autoconf.h -a -e $@ || ( \ + $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ echo; \ echo " ERROR: Kernel configuration is invalid."; \ - echo " include/linux/autoconf.h or $@ are missing."; \ + echo " include/generated/autoconf.h or $@ are missing.";\ echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ echo; \ /bin/false)
@@ -1154,7 +1155,7 @@ CLEAN_FILES += vmlinux System.map \ # Directories & files removed with 'make mrproper' MRPROPER_DIRS += include/config usr/include include/generated MRPROPER_FILES += .config .config.old .version .old_version \ - include/linux/autoconf.h include/linux/version.h \ + include/linux/version.h \ include/linux/utsrelease.h \ Module.symvers Module.markers tags TAGS cscope*
arch/m68k/kernel/head.S +1 -1
@@ -196,7 +196,7 @@ * for them and trying to understand what they mean. * * CONFIG_xxx: These are the obvious machine configuration defines created - * during configuration. These are defined in include/linux/autoconf.h. + * during configuration. These are defined in autoconf.h. * * CONSOLE: There is support for head.S console in this file. This * console can talk to a Mac frame buffer, but could easily be extrapolated
scripts/basic/fixdep.c +5 -5
@@ -17,15 +17,15 @@* * To use this list as-is however has the drawback that virtually * every file in the kernel includes <linux/config.h> which then again -* includes <linux/autoconf.h> +* includes autoconf.h * -* If the user re-runs make *config, linux/autoconf.h will be +* If the user re-runs make *config, autoconf.h will be * regenerated. make notices that and will rebuild every file which * includes autoconf.h, i.e. basically all files. This is extremely * annoying if the user just changed CONFIG_HIS_DRIVER from n to m. * * So we play the same trick that "mkdep" played before. We replace -* the dependency on linux/autoconf.h by a dependency on every config +* the dependency on autoconf.h by a dependency on every config * option which is mentioned in any of the listed prequisites. * * kconfig populates a tree in include/config/ with an empty file
@@ -74,7 +74,7 @@* cmd_<target> = <cmdline> * * and then basically copies the .<target>.d file to stdout, in the -* process filtering out the dependency on linux/autoconf.h and adding +* process filtering out the dependency on autoconf.h and adding * dependencies on include/config/my/option.h for every * CONFIG_MY_OPTION encountered in any of the prequisites. *
@@ -326,7 +326,7 @@ void parse_dep_file(void *map, size_t len) p++; }memcpy (s, m, p-m); s[p-m] =0 ; -if (strrcmp (s,"include/linux/autoconf.h" ) && +if (strrcmp (s,"include/generated/autoconf.h" ) &&strrcmp (s,"arch/um/include/uml-config.h" ) &&strrcmp (s,".ver" )) {printf (" %s \\\n" , s);
scripts/kconfig/confdata.c +1 -1
@@ -776,7 +776,7 @@ int conf_write_autoconf(void) name =getenv ("KCONFIG_AUTOHEADER" );if (!name) - name ="include/linux/autoconf.h" ; + name ="include/generated/autoconf.h" ;if (rename (".tmpconfig.h" , name))return 1 ; name =conf_get_autoconfig_name ();
scripts/mkcompile_h +1 -1
@@ -12,7 +12,7 @@ vecho() { [ "${quiet}" = "silent_" ] || echo "$@" ; } # So "sudo make install" won't change the "compiled by <user>" # do "compiled by root" -if [ -r $TARGET -a ! -O include/linux/autoconf.h ]; then +if [ -r $TARGET -a ! -O include/generated/autoconf.h ]; then vecho " SKIPPED $TARGET" exit 0 fi
Signature · 1 line
1.6.2.5
PATCH 10/10 kbuild: move utsrelease.h to include/generated
In reply to Sam RavnborgFix up all users of utsrelease.h
--- .gitignore | 1 - Makefile | 5 ++--- arch/alpha/boot/bootp.c | 2 +- arch/alpha/boot/bootpz.c | 2 +- arch/alpha/boot/main.c | 2 +- arch/frv/kernel/setup.c | 2 +- arch/powerpc/platforms/52xx/efika.c | 2 +- arch/powerpc/platforms/amigaone/setup.c | 2 +- arch/powerpc/platforms/chrp/setup.c | 2 +- arch/powerpc/platforms/powermac/bootx_init.c | 2 +- arch/x86/boot/header.S | 2 +- arch/x86/boot/version.c | 2 +- drivers/staging/panel/panel.c | 2 +- include/linux/vermagic.h | 2 +- init/version.c | 2 +- kernel/kexec.c | 2 +- kernel/trace/trace.c | 2 +- 17 files changed, 17 insertions(+), 19 deletions(-)
.gitignore +0 -1
@@ -46,7 +46,6 @@ Module.symvers # include/config include/linux/version.h -include/linux/utsrelease.h include/generated # stgit generated dirs
Makefile +2 -3
@@ -963,7 +963,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile -prepare1: prepare2 include/linux/version.h include/linux/utsrelease.h \ +prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ include/config/auto.conf $(cmd_crmodverdir)
@@ -1005,7 +1005,7 @@ endef include/linux/version.h: $(srctree)/Makefile FORCE $(call filechk,version.h) -include/linux/utsrelease.h: include/config/kernel.release FORCE +include/generated/utsrelease.h: include/config/kernel.release FORCE $(call filechk,utsrelease.h) PHONY += headerdep
@@ -1156,7 +1156,6 @@ CLEAN_FILES += vmlinux System.map \ MRPROPER_DIRS += include/config usr/include include/generated MRPROPER_FILES += .config .config.old .version .old_version \ include/linux/version.h \ - include/linux/utsrelease.h \ Module.symvers Module.markers tags TAGS cscope* # clean - Delete most, but leave enough to build external modules
arch/alpha/boot/bootp.c +1 -1
@@ -9,7 +9,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/mm.h> #include <asm/system.h>
arch/alpha/boot/bootpz.c +1 -1
@@ -11,7 +11,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/mm.h> #include <asm/system.h>
arch/alpha/boot/main.c +1 -1
@@ -7,7 +7,7 @@*/ #include <linux/kernel.h> #include <linux/string.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/mm.h> #include <asm/system.h>
arch/frv/kernel/setup.c +1 -1
@@ -10,7 +10,7 @@* 2 of the License, or (at your option) any later version. */ -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/delay.h>
arch/powerpc/platforms/52xx/efika.c +1 -1
@@ -10,7 +10,7 @@*/ #include <linux/init.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/pci.h> #include <linux/of.h> #include <asm/prom.h>
arch/powerpc/platforms/amigaone/setup.c +1 -1
@@ -14,7 +14,7 @@#include <linux/kernel.h> #include <linux/seq_file.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <asm/machdep.h> #include <asm/cputable.h>
arch/powerpc/platforms/chrp/setup.c +1 -1
@@ -23,7 +23,7 @@#include <linux/reboot.h> #include <linux/init.h> #include <linux/pci.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/adb.h> #include <linux/module.h> #include <linux/delay.h>
arch/powerpc/platforms/powermac/bootx_init.c +1 -1
@@ -12,7 +12,7 @@#include <linux/kernel.h> #include <linux/string.h> #include <linux/init.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <asm/sections.h> #include <asm/prom.h> #include <asm/page.h>
arch/x86/boot/header.S +1 -1
@@ -16,7 +16,7 @@ */ #include <asm/segment.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <asm/boot.h> #include <asm/e820.h> #include <asm/page_types.h>
arch/x86/boot/version.c +1 -1
@@ -13,7 +13,7 @@*/ #include "boot.h" -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <generated/compile.h> const char kernel_version[] =
drivers/staging/panel/panel.c +1 -1
@@ -55,7 +55,7 @@#include <linux/list.h> #include <linux/notifier.h> #include <linux/reboot.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/io.h> #include <asm/uaccess.h>
include/linux/vermagic.h +1 -1
@@ -1,4 +1,4 @@ -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/module.h> /* Simply sanity version stamp for modules. */
init/version.c +1 -1
@@ -10,7 +10,7 @@#include <linux/module.h> #include <linux/uts.h> #include <linux/utsname.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/version.h> #ifndef CONFIG_KALLSYMS
kernel/kexec.c +1 -1
@@ -21,7 +21,7 @@#include <linux/hardirq.h> #include <linux/elf.h> #include <linux/elfcore.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/utsname.h> #include <linux/numa.h> #include <linux/suspend.h>
kernel/trace/trace.c +1 -1
@@ -12,7 +12,7 @@* Copyright (C) 2004 William Lee Irwin III */ #include <linux/ring_buffer.h> -#include <linux/utsrelease.h> +#include <generated/utsrelease.h> #include <linux/stacktrace.h> #include <linux/writeback.h> #include <linux/kallsyms.h>
Signature · 1 line
1.6.2.5
RE: [PATCH 03/10] ia64: move nr-irqs.h to include/generated
In reply to Sam RavnborgQuoted 42 lines
---
arch/ia64/Makefile | 2 +- arch/ia64/include/asm/irq.h | 2 +- arch/ia64/kernel/Makefile | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-)arch/ia64/Makefile +0
-0@@ -108,4 +108,4 @@ archprepare: make_nr_irqs_h FORCEPHONY +=
make_nr_irqs_hFORCE
make_nr_irqs_h: FORCEarch/ia64/Makefile +1
-1- $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h + $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.harch/ia64/include/asm/irq.h +1
-1@@ -13,7 +13,7 @@#include <linux/types.h> #include <linux/cpumask.h> -#include <asm-ia64/nr-irqs.h> +#include <generated/nr-irqs.h> static
__inline__intirq_canonicalize(int irq)arch/ia64/kernel/Makefile +0
-0@@ -81,17 +81,14 @@ define cmd_nr_irqsendef
# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c\arch/ia64/kernel/Makefile +1
-1- $(wildcard $(srctree)/include/asm-ia64/*/irq.h) +arch/ia64/kernel/nr-irqs.s: arch/ia64/kernel/nr-irqs.c
Quoted 3 lines
$(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c)
Could you keep the SRCARCH and srctree variables? There is no need to hard code them.
Quoted 10 lines
arch/ia64/kernel/Makefile +1
-1-include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s +include/generated/nr-irqs.h: arch/ia64/kernel/nr-irqs.s$(Q)mkdir -p $(dir $@) $(call cmd,nr_irqs)arch/ia64/kernel/Makefile +0
-2-clean-files += $(objtree)/include/asm-ia64/nr-irqs.h -#
# native ivt.S, entry.S and fsys.S #
Ditto.
RE: [PATCH 03/10] ia64: move nr-irqs.h to include/generated
In reply to Sam RavnborgQuoted 42 lines
---
arch/ia64/Makefile | 2 +- arch/ia64/include/asm/irq.h | 2 +- arch/ia64/kernel/Makefile | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-)arch/ia64/Makefile +0
-0@@ -108,4 +108,4 @@ archprepare: make_nr_irqs_h FORCEPHONY +=
make_nr_irqs_hFORCE
make_nr_irqs_h: FORCEarch/ia64/Makefile +1
-1- $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h + $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.harch/ia64/include/asm/irq.h +1
-1@@ -13,7 +13,7 @@#include <linux/types.h> #include <linux/cpumask.h> -#include <asm-ia64/nr-irqs.h> +#include <generated/nr-irqs.h> static
__inline__intirq_canonicalize(int irq)arch/ia64/kernel/Makefile +0
-0@@ -81,17 +81,14 @@ define cmd_nr_irqsendef
# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c\arch/ia64/kernel/Makefile +1
-1- $(wildcard $(srctree)/include/asm-ia64/*/irq.h) +arch/ia64/kernel/nr-irqs.s: arch/ia64/kernel/nr-irqs.c
Quoted 3 lines
$(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c)
Could you keep the SRCARCH and srctree variables? There is no need to hard code them.
Quoted 10 lines
arch/ia64/kernel/Makefile +1
-1-include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s +include/generated/nr-irqs.h: arch/ia64/kernel/nr-irqs.s$(Q)mkdir -p $(dir $@) $(call cmd,nr_irqs)arch/ia64/kernel/Makefile +0
-2-clean-files += $(objtree)/include/asm-ia64/nr-irqs.h -#
# native ivt.S, entry.S and fsys.S #
Ditto.
Re: [PATCH 03/10] ia64: move nr-irqs.h to include/generated
In reply to Yu, FenghuaQuoted 36 lines · Fenghua
Quoted 36 lines
---
arch/ia64/Makefile | 2 +- arch/ia64/include/asm/irq.h | 2 +- arch/ia64/kernel/Makefile | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-)arch/ia64/Makefile +0
-0@@ -108,4 +108,4 @@ archprepare: make_nr_irqs_h FORCEPHONY +=
make_nr_irqs_hFORCE
make_nr_irqs_h: FORCEarch/ia64/Makefile +1
-1- $(Q)$(MAKE) $(build)=arch/ia64/kernel include/asm-ia64/nr-irqs.h + $(Q)$(MAKE) $(build)=arch/ia64/kernel include/generated/nr-irqs.harch/ia64/include/asm/irq.h +1
-1@@ -13,7 +13,7 @@#include <linux/types.h> #include <linux/cpumask.h> -#include <asm-ia64/nr-irqs.h> +#include <generated/nr-irqs.h> static
__inline__intirq_canonicalize(int irq)arch/ia64/kernel/Makefile +0
-0@@ -81,17 +81,14 @@ define cmd_nr_irqsendef
Quoted 11 lines
Quoted 9 lines
# We use internal kbuild rules to avoid the "is up to date" message from make
-arch/$(SRCARCH)/kernel/nr-irqs.s: $(srctree)/arch/$(SRCARCH)/kernel/nr-irqs.c\arch/ia64/kernel/Makefile +1
-1- $(wildcard $(srctree)/include/asm-ia64/*/irq.h) +arch/ia64/kernel/nr-irqs.s: arch/ia64/kernel/nr-irqs.c$(Q)mkdir -p $(dir $@) $(call if_changed_dep,cc_s_c)Could you keep the SRCARCH and srctree variables? There is no need to hard code them.
I will update my patch to continue using SRCARCH.
I usually hardcode the name of the arch because it makes the code IMO more explicit and thus more readable.
The use of srctree is not needed but I can add that back too. Both changes are unrelated to the actual patch and I just rutinely made it look like I would have doen it.
Quoted 6 lines
Quoted 6 lines
arch/ia64/kernel/Makefile +1
-1-include/asm-ia64/nr-irqs.h: arch/$(SRCARCH)/kernel/nr-irqs.s +include/generated/nr-irqs.h: arch/ia64/kernel/nr-irqs.s$(Q)mkdir -p $(dir $@) $(call cmd,nr_irqs)
Quoted 7 lines
Quoted 5 lines
arch/ia64/kernel/Makefile +0
-2-clean-files += $(objtree)/include/asm-ia64/nr-irqs.h -#
# native ivt.S, entry.S and fsys.S #Ditto.
OK.
Sam
Quoted 3 lines · Sam Ravnborg
In 2.6.30 we introduced support for adding generated files to a dedicated directory named "
include/generated".
Personally, I don't like this, I hate to see
#include <generated/foo.h>
.
Quoted 3 lines
This had a number of benefits:
- avoid mixing generated and normal files
I don't think this is an advantage...
Quoted 1 line
- allow us to finally kill the asm symlink
This makes sense, but it looks like only when 'make O=xxx', no?
Quoted 2 lines
- simpler .gitignore rules
- simpler list of mrproper files
Neither these two.
The benifits we get is little, I think.
Thanks.
Arnd Bergmann
maintainerQuoted 6 lines · Amerigo Wang
Quoted 2 lines · Sam Ravnborg
In 2.6.30 we introduced support for adding generated files to a dedicated directory named "
include/generated".Personally, I don't like this, I hate to see
#include <generated/foo.h>
I think that moving the generated files to a common location makes a lot of sense, but it seems easier to move them to include/generated/linux/ or even to (generated/linux/) and then add -Iinclude/generated/ to the gcc command line so you don't need to actually change all the users.
For the files in asm/, you could either add a generated/asm directory or move them to generated/linux/ and change the users.
Arnd <><
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Amerigo Wang
Quoted 2 lines · Sam Ravnborg
In 2.6.30 we introduced support for adding generated files to a dedicated directory named "
include/generated".
Quoted 8 lines
Quoted 2 lines
Personally, I don't like this, I hate to see
#include <generated/foo.h>I think that moving the generated files to a common location makes a lot of sense, but it seems easier to move them to
include/generated/linux/or even to (generated/linux/) and then add -Iinclude/generated/ to the gcc command line so you don't need to actually change all the users.
To put some numbers on this..utsrelease.h - incuded in 19 filesautoconf.h - included in 0 filesbounds.h - included in 2 filescompile.h - included in 1 fileasm-offsets.h - included in 240 filesversion.h - included in 184 files
So the only relevant files to discuss here is asm-offsets.h and version.h.
We cannot break "#include <linux/version.h>" because that would break each and every external module.
The solution to this is a simple file:
cat include/linux/version.h
#include <generated.version.h>
For asm-offsets.h the patch-set create an architecture specific asm-offsets.h that include the generated version. But I would prefer to see this redone so they include the generated version directly.
This would also document that asm-offsets.h is a generated file.
The amount of includes pr arch is listed below - not a huge deal to fix up.
alpha 5 arm 30 avr32 3 blackfin 9 cris 3 frv 5 h8300 2 ia64 15 m32r 0 m68k 6 m68knommu 5 microblaze 5 mips 25 mn10300 6 parisc 14 powerpc 43 s390 13 sh 8 sparc 6 um 2 x86 24 xtensa 8
Sam