Skip to content

Commit 0a22798

Browse files
Nicholas Mc GuireKAGA-KOKO
authored andcommitted
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: Nicholas Mc Guire <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: Sam Ravnborg <[email protected]> Cc: Joe Perches <[email protected]> Cc: John Stultz <[email protected]> Cc: Andrew Hunter <[email protected]> Cc: Paul Turner <[email protected]> Cc: Michal Marek <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 4cfafd3 commit 0a22798

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

Kbuild

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# Kbuild for top-level directory of the kernel
33
# This file takes care of the following:
44
# 1) Generate bounds.h
5-
# 2) Generate asm-offsets.h (may need bounds.h)
6-
# 3) Check for missing system calls
5+
# 2) Generate timeconst.h
6+
# 3) Generate asm-offsets.h (may need bounds.h and timeconst.h)
7+
# 4) Check for missing system calls
78

89
# Default sed regexp - multiline due to syntax constraints
910
define sed-y
@@ -47,7 +48,26 @@ $(obj)/$(bounds-file): kernel/bounds.s FORCE
4748
$(call filechk,offsets,__LINUX_BOUNDS_H__)
4849

4950
#####
50-
# 2) Generate asm-offsets.h
51+
# 2) Generate timeconst.h
52+
53+
timeconst-file := include/generated/timeconst.h
54+
55+
#always += $(timeconst-file)
56+
targets += $(timeconst-file)
57+
58+
quiet_cmd_gentimeconst = GEN $@
59+
define cmd_gentimeconst
60+
(echo $(CONFIG_HZ) | bc -q $< ) > $@
61+
endef
62+
define filechk_gentimeconst
63+
(echo $(CONFIG_HZ) | bc -q $< )
64+
endef
65+
66+
$(obj)/$(timeconst-file): kernel/time/timeconst.bc FORCE
67+
$(call filechk,gentimeconst)
68+
69+
#####
70+
# 3) Generate asm-offsets.h
5171
#
5272

5373
offsets-file := include/generated/asm-offsets.h
@@ -57,15 +77,15 @@ targets += arch/$(SRCARCH)/kernel/asm-offsets.s
5777

5878
# We use internal kbuild rules to avoid the "is up to date" message from make
5979
arch/$(SRCARCH)/kernel/asm-offsets.s: arch/$(SRCARCH)/kernel/asm-offsets.c \
60-
$(obj)/$(bounds-file) FORCE
80+
$(obj)/$(timeconst-file) $(obj)/$(bounds-file) FORCE
6181
$(Q)mkdir -p $(dir $@)
6282
$(call if_changed_dep,cc_s_c)
6383

6484
$(obj)/$(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE
6585
$(call filechk,offsets,__ASM_OFFSETS_H__)
6686

6787
#####
68-
# 3) Check for missing system calls
88+
# 4) Check for missing system calls
6989
#
7090

7191
always += missing-syscalls
@@ -77,5 +97,5 @@ quiet_cmd_syscalls = CALL $<
7797
missing-syscalls: scripts/checksyscalls.sh $(offsets-file) FORCE
7898
$(call cmd,syscalls)
7999

80-
# Keep these two files during make clean
81-
no-clean-files := $(bounds-file) $(offsets-file)
100+
# Keep these three files during make clean
101+
no-clean-files := $(bounds-file) $(offsets-file) $(timeconst-file)

kernel/time/Makefile

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,4 @@ obj-$(CONFIG_TIMER_STATS) += timer_stats.o
1313
obj-$(CONFIG_DEBUG_FS) += timekeeping_debug.o
1414
obj-$(CONFIG_TEST_UDELAY) += test_udelay.o
1515

16-
$(obj)/time.o: $(obj)/timeconst.h
17-
18-
quiet_cmd_hzfile = HZFILE $@
19-
cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@
20-
21-
targets += hz.bc
22-
$(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE
23-
$(call if_changed,hzfile)
24-
25-
quiet_cmd_bc = BC $@
26-
cmd_bc = bc -q $(filter-out FORCE,$^) > $@
27-
28-
targets += timeconst.h
29-
$(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
30-
$(call if_changed,bc)
31-
16+
$(obj)/time.o: $(objtree)/include/config/

kernel/time/time.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#include <asm/uaccess.h>
4242
#include <asm/unistd.h>
4343

44-
#include "timeconst.h"
44+
#include <generated/timeconst.h>
4545
#include "timekeeping.h"
4646

4747
/*

kernel/time/timeconst.bc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ define timeconst(hz) {
5050
print "#include <linux/types.h>\n\n"
5151

5252
print "#if HZ != ", hz, "\n"
53-
print "#error \qkernel/timeconst.h has the wrong HZ value!\q\n"
53+
print "#error \qinclude/generated/timeconst.h has the wrong HZ value!\q\n"
5454
print "#endif\n\n"
5555

5656
if (hz < 2) {
@@ -105,4 +105,5 @@ define timeconst(hz) {
105105
halt
106106
}
107107

108+
hz = read();
108109
timeconst(hz)

0 commit comments

Comments
 (0)