fix typo
[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 KERNEL_BUILD:=1
8
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
13
14 LINUX_CONFIG ?= ./config/default
15
16 -include $(TOPDIR)/target/linux/generic-$(KERNEL)/config-template
17 -include $(LINUX_CONFIG)
18
19 ifneq ($(CONFIG_ATM),)
20 FEATURES += atm
21 endif
22 ifneq ($(CONFIG_PCI),)
23 FEATURES += pci
24 endif
25 ifneq ($(CONFIG_USB),)
26 FEATURES += usb
27 endif
28 ifneq ($(CONFIG_PCMCIA)$(CONFIG_PCCARD),)
29 FEATURES += pcmcia
30 endif
31 ifneq ($(CONFIG_VIDEO_DEV),)
32 FEATURES += video
33 endif
34
35 # remove duplicates
36 FEATURES:=$(sort $(FEATURES))
37
38 ifeq ($(DUMP),1)
39 all: dumpinfo
40 else
41 all: compile
42 endif
43
44 ifneq (,$(findstring uml,$(BOARD)))
45 LINUX_KARCH:=um
46 else
47 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
48 -e 's/mipsel/mips/' \
49 -e 's/mipseb/mips/' \
50 -e 's/powerpc/ppc/' \
51 -e 's/sh[234]/sh/' \
52 -e 's/armeb/arm/' \
53 )
54 endif
55
56 include $(INCLUDE_DIR)/kernel-defaults.mk
57
58 define Kernel/Prepare
59 $(call Kernel/Prepare/Default)
60 endef
61
62 define Kernel/Configure
63 $(call Kernel/Configure/Default)
64 endef
65
66 define Kernel/CompileModules
67 $(call Kernel/CompileModules/Default)
68 endef
69
70 define Kernel/CompileImage
71 $(call Kernel/CompileImage/Default)
72 endef
73
74 define Kernel/Clean
75 $(call Kernel/Clean/Default)
76 endef
77
78 define BuildKernel
79 ifneq ($(LINUX_SITE),)
80 $(DL_DIR)/$(LINUX_SOURCE):
81 -mkdir -p $(DL_DIR)
82 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(LINUX_SOURCE) $(LINUX_KERNEL_MD5SUM) $(LINUX_SITE)
83 endif
84
85 $(LINUX_DIR)/.prepared: $(DL_DIR)/$(LINUX_SOURCE)
86 -rm -rf $(KERNEL_BUILD_DIR)
87 -mkdir -p $(KERNEL_BUILD_DIR)
88 $(call Kernel/Prepare)
89 touch $$@
90
91 $(LINUX_DIR)/.configured: $(LINUX_DIR)/.prepared $(LINUX_CONFIG)
92 $(call Kernel/Configure)
93 touch $$@
94
95 $(LINUX_DIR)/.modules: $(LINUX_DIR)/.configured $(LINUX_DIR)/.config FORCE
96 $(call Kernel/CompileModules)
97 touch $$@
98
99 $(LINUX_DIR)/.image: $(LINUX_DIR)/.configured FORCE
100 $(call Kernel/CompileImage)
101 touch $$@
102
103 mostlyclean: FORCE
104 $(call Kernel/Clean)
105
106 ifeq ($(DUMP),1)
107 dumpinfo:
108 @echo 'Target: $(BOARD)-$(KERNEL)'
109 @echo 'Target-Name: $(BOARDNAME) [$(KERNEL)]'
110 @echo 'Target-Path: $(subst $(TOPDIR)/,,$(PWD))'
111 @echo 'Target-Arch: $(ARCH)'
112 @echo 'Target-Features: $(FEATURES)'
113 @echo 'Linux-Version: $(LINUX_VERSION)'
114 @echo 'Linux-Release: $(LINUX_RELEASE)'
115 @echo 'Linux-Kernel-Arch: $(LINUX_KARCH)'
116 @echo 'Target-Description:'
117 @getvar $(call shvar,Target/Description)
118 @echo '@@'
119 @echo 'Default-Packages: $(DEFAULT_PACKAGES)'
120 ifneq ($(DUMPINFO),)
121 @$(DUMPINFO)
122 endif
123 endif
124
125 define BuildKernel
126 endef
127 endef
128
129 define Profile/Default
130 NAME:=
131 PACKAGES:=
132 endef
133
134 confname=$(subst .,_,$(subst -,_,$(1)))
135 define Profile
136 $(eval $(call Profile/Default))
137 $(eval $(call Profile/$(1)))
138 $(eval $(call shexport,Profile/$(1)/Config))
139 $(eval $(call shexport,Profile/$(1)/Description))
140 DUMPINFO += \
141 echo "Target-Profile: $(1)"; \
142 echo "Target-Profile-Name: $(NAME)"; \
143 echo "Target-Profile-Packages: $(PACKAGES)"; \
144 if [ -f ./config/profile-$(1) ]; then \
145 echo "Target-Profile-Kconfig: yes"; \
146 fi; \
147 echo "Target-Profile-Config: "; \
148 getvar "$(call shvar,Profile/$(1)/Config)"; \
149 echo "@@"; \
150 echo "Target-Profile-Description:"; \
151 getvar "$(call shvar,Profile/$(1)/Description)"; \
152 echo "@@"; \
153 echo;
154 ifeq ($(CONFIG_LINUX_$(call confname,$(KERNEL)_$(1))),y)
155 PROFILE=$(1)
156 endif
157 endef
158
159 $(eval $(call shexport,Target/Description))
160
161 download: $(DL_DIR)/$(LINUX_SOURCE)
162 prepare: $(LINUX_DIR)/.configured
163 compile: $(LINUX_DIR)/.modules
164 menuconfig: $(LINUX_DIR)/.prepared FORCE
165 $(call Kernel/Configure)
166 $(SCRIPT_DIR)/config.pl '+' $(GENERIC_PLATFORM_DIR)/config-template $(LINUX_CONFIG) > $(LINUX_DIR)/.config
167 $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) menuconfig
168 $(SCRIPT_DIR)/config.pl '>' $(GENERIC_PLATFORM_DIR)/config-template $(LINUX_DIR)/.config > $(LINUX_CONFIG)
169
170 install: $(LINUX_DIR)/.image
171
172 clean: FORCE
173 rm -f $(STAMP_DIR)/.linux-compile
174 rm -rf $(KERNEL_BUILD_DIR)
175
176 rebuild: FORCE
177 @$(MAKE) mostlyclean
178 @if [ -f $(LINUX_KERNEL) ]; then \
179 $(MAKE) clean; \
180 fi
181 @$(MAKE) compile
182
183
This page took 0.071659 seconds and 5 git commands to generate.