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
)
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
/
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
61 $(if
$(QUILT
),$(Build
/Quilt
))
62 $(if
$(LINUX_SITE
),$(call Download
,kernel
))
64 $(STAMP_PREPARED
): $(DL_DIR
)/$(LINUX_SOURCE
)
65 -rm -rf
$(KERNEL_BUILD_DIR
)
66 -mkdir
-p
$(KERNEL_BUILD_DIR
)
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 } ' | \
76 $(KERNEL_BUILD_DIR
)/symtab.h
: $(KERNEL_BUILD_DIR
)/symtab.txt
78 echo
'#define SYMTAB_KEEP \'; \
79 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
80 awk '{print "*(__ksymtab." $$$$1 ") \\" }'; \
82 echo '#define SYMTAB_KEEP_GPL \'; \
83 cat
$(KERNEL_BUILD_DIR
)/symtab.txt | \
84 awk
'{print "*(__ksymtab_gpl." $$$$1 ") \\" }'; \
86 echo
'#define SYMTAB_KEEP_STR \'; \
87 cat $(KERNEL_BUILD_DIR)/symtab.txt | \
88 awk '{print "*(__ksymtab_strings." $$$$1 ") \\" }'; \
92 $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_KCONFIG_LIST) $(TOPDIR)/.config
96 $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
97 $(Kernel/CompileModules)
100 $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) $(if $(CONFIG_STRIP_KERNEL_EXPORTS),$(KERNEL_BUILD_DIR)/symtab.h) FORCE
101 $(Kernel/CompileImage)
102 $(Kernel/CollectDebug)
111 download: $(DL_DIR)/$(LINUX_SOURCE)
112 prepare: $(STAMP_CONFIGURED)
113 compile: $(LINUX_DIR)/.modules
114 $(MAKE) -C image compile TARGET_BUILD=
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)
122 install: $(LINUX_DIR)/.image
123 +$(MAKE) -C image compile install TARGET_BUILD=
126 rm -rf $(KERNEL_BUILD_DIR)
129 @+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=