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