[kernel/3+] add missing DM/MD config symbols
[openwrt.git] / include / kernel-build.mk
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(INCLUDE_DIR)/host.mk
8 include $(INCLUDE_DIR)/prereq.mk
9
10 ifneq ($(DUMP),1)
11 all: compile
12 endif
13
14 export QUILT=1
15 STAMP_PREPARED:=$(LINUX_DIR)/.prepared
16 STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
17 include $(INCLUDE_DIR)/download.mk
18 include $(INCLUDE_DIR)/quilt.mk
19 include $(INCLUDE_DIR)/kernel-defaults.mk
20
21 define Kernel/Prepare
22 $(call Kernel/Prepare/Default)
23 endef
24
25 define Kernel/Configure
26 $(call Kernel/Configure/Default)
27 endef
28
29 define Kernel/CompileModules
30 $(call Kernel/CompileModules/Default)
31 endef
32
33 define Kernel/CompileImage
34 $(call Kernel/CompileImage/Default)
35 endef
36
37 define Kernel/Clean
38 $(call Kernel/Clean/Default)
39 endef
40
41 define Download/kernel
42 URL:=$(LINUX_SITE)
43 FILE:=$(LINUX_SOURCE)
44 MD5SUM:=$(LINUX_KERNEL_MD5SUM)
45 endef
46
47 ifdef CONFIG_COLLECT_KERNEL_DEBUG
48 define Kernel/CollectDebug
49 rm -rf $(KERNEL_BUILD_DIR)/debug
50 mkdir -p $(KERNEL_BUILD_DIR)/debug/modules
51 $(CP) $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/debug/
52 -$(CP) \
53 $(STAGING_DIR_ROOT)/lib/modules/$(LINUX_VERSION)/* \
54 $(KERNEL_BUILD_DIR)/debug/modules/
55 $(FIND) $(KERNEL_BUILD_DIR)/debug -type f | $(XARGS) $(KERNEL_CROSS)strip --only-keep-debug
56 $(TAR) c -C $(KERNEL_BUILD_DIR) debug | bzip2 -c -9 > $(BIN_DIR)/kernel-debug.tar.bz2
57 endef
58 endif
59
60 define BuildKernel
61 $(if $(QUILT),$(Build/Quilt))
62 $(if $(LINUX_SITE),$(call Download,kernel))
63
64 $(STAMP_PREPARED): $(if $(LINUX_SITE),$(DL_DIR)/$(LINUX_SOURCE))
65 -rm -rf $(KERNEL_BUILD_DIR)
66 -mkdir -p $(KERNEL_BUILD_DIR)
67 $(Kernel/Prepare)
68 touch $$@
69
70 $(KERNEL_BUILD_DIR)/symtab.txt: FORCE
71 find $(LINUX_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
72 xargs $(TARGET_CROSS)nm | \
73 awk '$$$$1 == "U" { print $$$$2 } ' | \
74 sort -u > $$@
75
76 $(KERNEL_BUILD_DIR)/symtab.h: $(KERNEL_BUILD_DIR)/symtab.txt
77 ( \
78 echo '#define SYMTAB_KEEP \'; \
79 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
80 awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
81 echo; \
82 echo '#define SYMTAB_KEEP_GPL \'; \
83 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
84 awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
85 echo; \
86 echo '#define SYMTAB_KEEP_STR \'; \
87 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
88 awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
89 echo; \
90 ) > $$@
91
92 $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_KCONFIG_LIST) $(TOPDIR)/.config
93 $(Kernel/Configure)
94 touch $$@
95
96 $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
97 $(Kernel/CompileModules)
98 touch $$@
99
100 $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
101 $(Kernel/CompileImage)
102 $(Kernel/CollectDebug)
103 touch $$@
104
105 mostlyclean: FORCE
106 $(Kernel/Clean)
107
108 define BuildKernel
109 endef
110
111 download: $(DL_DIR)/$(LINUX_SOURCE)
112 prepare: $(STAMP_CONFIGURED)
113 compile: $(LINUX_DIR)/.modules
114 $(MAKE) -C image compile TARGET_BUILD=
115
116 oldconfig menuconfig nconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
117 rm -f $(STAMP_CONFIGURED)
118 $(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
119 $(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
120 $(LINUX_RECONF_DIFF) $(LINUX_DIR)/.config > $(LINUX_RECONFIG_TARGET)
121
122 install: $(LINUX_DIR)/.image
123 +$(MAKE) -C image compile install TARGET_BUILD=
124
125 clean: FORCE
126 rm -rf $(KERNEL_BUILD_DIR)
127
128 image-prereq:
129 @+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
130
131 prereq: image-prereq
132
133 endef
This page took 0.049156 seconds and 5 git commands to generate.