[ar7] add Titan MTD partitionning support (#6632)
[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 define BuildKernel
48 $(if $(QUILT),$(Build/Quilt))
49 $(if $(LINUX_SITE),$(call Download,kernel))
50
51 $(STAMP_PREPARED): $(DL_DIR)/$(LINUX_SOURCE)
52 -rm -rf $(KERNEL_BUILD_DIR)
53 -mkdir -p $(KERNEL_BUILD_DIR)
54 $(Kernel/Prepare)
55 touch $$@
56
57 $(KERNEL_BUILD_DIR)/symtab.txt: FORCE
58 find $(LINUX_DIR) $(STAGING_DIR_ROOT)/lib/modules -name \*.ko | \
59 xargs $(TARGET_CROSS)nm | \
60 awk '$$$$1 == "U" { print $$$$2 } ' | \
61 sort -u > $$@
62
63 $(KERNEL_BUILD_DIR)/symtab.h: $(KERNEL_BUILD_DIR)/symtab.txt
64 ( \
65 echo '#define SYMTAB_KEEP \'; \
66 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
67 awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
68 echo; \
69 echo '#define SYMTAB_KEEP_GPL \'; \
70 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
71 awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
72 echo; \
73 echo '#define SYMTAB_KEEP_STR \'; \
74 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
75 awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
76 echo; \
77 ) > $$@
78
79 $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_CONFIG) $(GENERIC_LINUX_CONFIG) $(TOPDIR)/.config
80 $(Kernel/Configure)
81 touch $$@
82
83 $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
84 $(Kernel/CompileModules)
85 touch $$@
86
87 $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
88 $(Kernel/CompileImage)
89 touch $$@
90
91 mostlyclean: FORCE
92 $(Kernel/Clean)
93
94 define BuildKernel
95 endef
96
97 download: $(DL_DIR)/$(LINUX_SOURCE)
98 prepare: $(STAMP_CONFIGURED)
99 compile: $(LINUX_DIR)/.modules
100 $(MAKE) -C image compile TARGET_BUILD=
101
102 oldconfig menuconfig: $(STAMP_PREPARED) $(STAMP_CHECKED) FORCE
103 [ -e "$(LINUX_CONFIG)" ] || touch "$(LINUX_CONFIG)"
104 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config
105 touch $(LINUX_CONFIG)
106 $(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
107 $(SCRIPT_DIR)/kconfig.pl '>' $(if $(LINUX_SUBCONFIG),'+' $(GENERIC_LINUX_CONFIG) $(LINUX_CONFIG),$(GENERIC_LINUX_CONFIG)) \
108 $(LINUX_DIR)/.config > $(if $(LINUX_SUBCONFIG),$(LINUX_SUBCONFIG),$(LINUX_CONFIG))
109 $(Kernel/Configure)
110
111 install: $(LINUX_DIR)/.image
112 +$(MAKE) -C image compile install TARGET_BUILD=
113
114 clean: FORCE
115 rm -rf $(KERNEL_BUILD_DIR)
116
117 image-prereq:
118 @+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
119
120 prereq: image-prereq
121
122 endef
This page took 0.051553 seconds and 5 git commands to generate.