Commit 0a227985 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Thomas Gleixner

time: Move timeconst.h into include/generated

kernel/time/timeconst.h is moved to include/generated/ and generated 
by the top level Kbuild. This allows using timeconst.h in an earlier
build stage.
Signed-off-by: default avatarNicholas Mc Guire <hofrat@osadl.org>
Cc: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Joe Perches <joe@perches.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Andrew Hunter <ahh@google.com>
Cc: Paul Turner <pjt@google.com>
Cc: Michal Marek <mmarek@suse.cz>
Link: http://lkml.kernel.org/r/1431951554-5563-1-git-send-email-hofrat@osadl.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4cfafd30
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
# Kbuild for top-level directory of the kernel # Kbuild for top-level directory of the kernel
# This file takes care of the following: # This file takes care of the following:
# 1) Generate bounds.h # 1) Generate bounds.h
# 2) Generate asm-offsets.h (may need bounds.h) # 2) Generate timeconst.h
# 3) Check for missing system calls # 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
# 4) Check for missing system calls
# Default sed regexp - multiline due to syntax constraints # Default sed regexp - multiline due to syntax constraints
define sed-y define sed-y
...@@ -47,7 +48,26 @@ $(obj)/$(bounds-file): kernel/bounds.s FORCE ...@@ -47,7 +48,26 @@ $(obj)/$(bounds-file): kernel/bounds.s FORCE
$(call filechk,offsets,__LINUX_BOUNDS_H__) $(call filechk,offsets,__LINUX_BOUNDS_H__)
##### #####
# 2) Generate asm-offsets.h # 2) Generate timeconst.h
timeconst-file := include/generated/timeconst.h
#always += $(timeconst-file)
targets += $(timeconst-file)
quiet_cmd_gentimeconst = GEN $@
define cmd_gentimeconst
(echo $(CONFIG_HZ) | bc -q $< ) > $@
endef
define filechk_gentimeconst
(echo $(CONFIG_HZ) | bc -q $< )
endef
$(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
$(call filechk,gentimeconst)
#####
# 3) Generate asm-offsets.h
# #
offsets-file := include/generated/asm-offsets.h offsets-file := include/generated/asm-offsets.h
...@@ -57,7 +77,7 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s ...@@ -57,7 +77,7 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s
# We use internal kbuild rules to avoid the "is up to date" message from make # We use internal kbuild rules to avoid the "is up to date" message from make
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \ arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
$(obj)/$(bounds-file) FORCE $(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
$(Q)mkdir -p $(dir $@) $(Q)mkdir -p $(dir $@)
$(call if_changed_dep,cc_s_c) $(call if_changed_dep,cc_s_c)
...@@ -65,7 +85,7 @@ $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE ...@@ -65,7 +85,7 @@ $(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
$(call filechk,offsets,__ASM_OFFSETS_H__) $(call filechk,offsets,__ASM_OFFSETS_H__)
##### #####
# 3) Check for missing system calls # 4) Check for missing system calls
# #
always += missing-syscalls always += missing-syscalls
...@@ -77,5 +97,5 @@ quiet_cmd_syscalls = CALL $< ...@@ -77,5 +97,5 @@ quiet_cmd_syscalls = CALL $<
missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
$(call cmd,syscalls) $(call cmd,syscalls)
# Keep these two files during make clean # Keep these three files during make clean
no-clean-files := $(bounds-file) $(offsets-file) no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)
...@@ -13,19 +13,4 @@ obj-$(CONFIG_TIMER_STATS) += timer_stats.o ...@@ -13,19 +13,4 @@ obj-$(CONFIG_TIMER_STATS) += timer_stats.o
obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o
obj-$(CONFIG_TEST_UDELAY) += test_udelay.o obj-$(CONFIG_TEST_UDELAY) += test_udelay.o
$(obj)/time.o: $(obj)/timeconst.h $(obj)/time.o: $(objtree)/include/config/
quiet_cmd_hzfile = HZFILE $@
cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@
targets += hz.bc
$(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE
$(call if_changed,hzfile)
quiet_cmd_bc = BC $@
cmd_bc = bc -q $(filter-out FORCE,$^) > $@
targets += timeconst.h
$(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
$(call if_changed,bc)
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/unistd.h> #include <asm/unistd.h>
#include "timeconst.h" #include <generated/timeconst.h>
#include "timekeeping.h" #include "timekeeping.h"
/* /*
......
...@@ -50,7 +50,7 @@ define timeconst(hz) { ...@@ -50,7 +50,7 @@ define timeconst(hz) {
print "#include <linux/types.h>\n\n" print "#include <linux/types.h>\n\n"
print "#if HZ != ", hz, "\n" print "#if HZ != ", hz, "\n"
print "#error \qkernel/timeconst.h has the wrong HZ value!\q\n" print "#error \qinclude/generated/timeconst.h has the wrong HZ value!\q\n"
print "#endif\n\n" print "#endif\n\n"
if (hz < 2) { if (hz < 2) {
...@@ -105,4 +105,5 @@ define timeconst(hz) { ...@@ -105,4 +105,5 @@ define timeconst(hz) {
halt halt
} }
hz = read();
timeconst(hz) timeconst(hz)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment