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.
9 include $(INCLUDE_DIR)/kernel-version.mk
10 include $(INCLUDE_DIR)/host.mk
11 include $(INCLUDE_DIR)/kernel.mk
12 include $(INCLUDE_DIR)/prereq.mk
14 GENERIC_LINUX_CONFIG:=$(GENERIC_PLATFORM_DIR)/config-$(shell [ -f "$(GENERIC_PLATFORM_DIR)/config-$(KERNEL_PATCHVER)" ] && echo "$(KERNEL_PATCHVER)" || echo template )
15 LINUX_CONFIG_DIR ?= ./config$(shell [ -d "./config-$(KERNEL_PATCHVER)" ] && printf -- "-$(KERNEL_PATCHVER)" || true )
16 LINUX_CONFIG ?= $(LINUX_CONFIG_DIR)/default
18 -include $(GENERIC_LINUX_CONFIG)
19 -include $(LINUX_CONFIG)
21 ifneq ($(CONFIG_ATM),)
24 ifneq ($(CONFIG_PCI),)
27 ifneq ($(CONFIG_USB),)
30 ifneq ($(CONFIG_PCMCIA)$(CONFIG_PCCARD),)
33 ifneq ($(CONFIG_VIDEO_DEV),)
38 FEATURES:=$(sort $(FEATURES))
46 ifneq (,$(findstring uml,$(BOARD)))
49 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
58 STAMP_PREPARED:=$(LINUX_DIR)/.prepared
59 STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
60 include $(INCLUDE_DIR)/quilt.mk
61 include $(INCLUDE_DIR)/kernel-defaults.mk
64 $(call Kernel/Prepare/Default)
67 define Kernel/Configure
68 $(call Kernel/Configure/Default)
71 define Kernel/CompileModules
72 $(call Kernel/CompileModules/Default)
75 define Kernel/CompileImage
76 $(call Kernel/CompileImage/Default)
80 $(call Kernel/Clean/Default)
84 ifneq ($(LINUX_SITE),)
85 $(DL_DIR)/$(LINUX_SOURCE):
87 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
90 $(STAMP_PREPARED): $(DL_DIR)/$(LINUX_SOURCE)
91 -rm -rf $(KERNEL_BUILD_DIR)
92 -mkdir -p $(KERNEL_BUILD_DIR)
93 $(call Kernel/Prepare)
96 $(STAMP_CONFIGURED): $(LINUX_DIR)/.prepared $(LINUX_CONFIG)
97 $(call Kernel/Configure)
100 $(LINUX_DIR)/.modules: $(LINUX_DIR)/.configured $(LINUX_DIR)/.config FORCE
101 $(call Kernel/CompileModules)
104 $(LINUX_DIR)/.image: $(LINUX_DIR)/.configured FORCE
105 $(call Kernel/CompileImage)
113 @echo 'Target: $(BOARD)-$(KERNEL)'
114 @echo 'Target-Name: $(BOARDNAME) [$(KERNEL)]'
115 @echo 'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'
116 @echo 'Target-Arch: $(ARCH)'
117 @echo 'Target-Features: $(FEATURES)'
118 @echo 'Linux-Version: $(LINUX_VERSION)'
119 @echo 'Linux-Release: $(LINUX_RELEASE)'
120 @echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'
121 @echo 'Target-Description:'
122 @getvar $(call shvar,Target/Description)
124 @echo 'Default-Packages: $(DEFAULT_PACKAGES)'
134 define Profile/Default
139 confname=$(subst .,_,$(subst -,_,$(1)))
141 $(eval $(call Profile/Default))
142 $(eval $(call Profile/$(1)))
143 $(eval $(call shexport,Profile/$(1)/Config))
144 $(eval $(call shexport,Profile/$(1)/Description))
146 echo "Target-Profile: $(1)"; \
147 echo "Target-Profile-Name: $(NAME)"; \
148 echo "Target-Profile-Packages: $(PACKAGES)"; \
149 if [ -f ./config/profile-$(1) ]; then \
150 echo "Target-Profile-Kconfig: yes"; \
152 echo "Target-Profile-Config: "; \
153 getvar "$(call shvar,Profile/$(1)/Config)"; \
155 echo "Target-Profile-Description:"; \
156 getvar "$(call shvar,Profile/$(1)/Description)"; \
159 ifeq ($(CONFIG_LINUX_$(call confname,$(KERNEL)_$(1))),y)
164 $(eval $(call shexport,Target/Description))
166 download: $(DL_DIR)/$(LINUX_SOURCE)
167 prepare: $(LINUX_DIR)/.configured
168 compile: $(LINUX_DIR)/.modules
169 menuconfig: $(LINUX_DIR)/.prepared FORCE
170 $(call Kernel/Configure)
171 $(SCRIPT_DIR)/config.pl '+' $(GENERIC_LINUX_CONFIG) $(LINUX_CONFIG) > $(LINUX_DIR)/.config
172 $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) menuconfig
173 $(SCRIPT_DIR)/config.pl '>' $(GENERIC_LINUX_CONFIG) $(LINUX_DIR)/.config > $(LINUX_CONFIG)
175 install: $(LINUX_DIR)/.image
178 rm -f $(STAMP_DIR)/.linux-compile
179 rm -rf $(KERNEL_BUILD_DIR)
183 @if [ -f $(LINUX_KERNEL) ]; then \