2 # Copyright (C) 2006-2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(INCLUDE_DIR)/host.mk
8 include $(INCLUDE_DIR)/prereq.mk
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
22 $(call Kernel/Prepare/Default)
25 define Kernel/Configure
26 $(call Kernel/Configure/Default)
29 define Kernel/CompileModules
30 $(call Kernel/CompileModules/Default)
33 define Kernel/CompileImage
34 $(call Kernel/CompileImage/Default)
38 $(call Kernel/Clean/Default)
41 define Download/kernel
44 MD5SUM:=$(LINUX_KERNEL_MD5SUM)
48 $(if $(QUILT),$(Build/Quilt))
49 $(if $(LINUX_SITE),$(call Download,kernel))
51 $(STAMP_PREPARED): $(DL_DIR)/$(LINUX_SOURCE)
52 -rm -rf $(KERNEL_BUILD_DIR)
53 -mkdir -p $(KERNEL_BUILD_DIR)
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 } ' | \
63 $(KERNEL_BUILD_DIR)/symtab.h: $(KERNEL_BUILD_DIR)/symtab.txt
65 echo '#define SYMTAB_KEEP \'; \
66 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
67 awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
69 echo '#define SYMTAB_KEEP_GPL \'; \
70 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
71 awk '{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
73 echo '#define SYMTAB_KEEP_STR \'; \
74 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
75 awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
79 $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_CONFIG) $(GENERIC_LINUX_CONFIG) $(TOPDIR)/.config
83 $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
84 $(Kernel/CompileModules)
87 $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
88 $(Kernel/CompileImage)
97 download: $(DL_DIR)/$(LINUX_SOURCE)
98 prepare: $(STAMP_CONFIGURED)
99 compile: $(LINUX_DIR)/.modules
100 $(MAKE) -C image compile TARGET_BUILD=
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))
111 install: $(LINUX_DIR)/.image
112 +$(MAKE) -C image compile install TARGET_BUILD=
115 rm -rf $(KERNEL_BUILD_DIR)
118 @+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=