|
1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of the License "Symbian Foundation License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: iMaker ROFS2 image configuration |
|
15 # |
|
16 |
|
17 |
|
18 |
|
19 ############################################################################### |
|
20 # ___ ___ ___ ___ ___ |
|
21 # | _ \/ _ \| __/ __| |_ ) |
|
22 # | / (_) | _|\__ \ / / |
|
23 # |_|_\\___/|_| |___/ /___| |
|
24 # |
|
25 |
|
26 USE_NEWLOCLZTN = $(if $(filter 5%,$(S60_VERSION)),1,0) |
|
27 |
|
28 ROFS2_TITLE = ROFS2 |
|
29 ROFS2_DIR = $(WORKDIR)/rofs2 |
|
30 ROFS2_NAME = $(NAME) |
|
31 ROFS2_PREFIX = $(ROFS2_DIR)/$(ROFS2_NAME) |
|
32 ROFS2_IDIR = |
|
33 ROFS2_HBY = |
|
34 ROFS2_OBY = |
|
35 ROFS2_OPT = |
|
36 ROFS2_MSTOBY = $(ROFS2_PREFIX)_rofs2_master.oby |
|
37 ROFS2_HEADER = |
|
38 ROFS2_INLINE = |
|
39 ROFS2_FOOTER = |
|
40 ROFS2_TIME = $(DAY)/$(MONTH)/$(YEAR) |
|
41 |
|
42 ROFS2_OBYGEN = |
|
43 |
|
44 ROFS2_VERIBY = $(ROFS2_PREFIX)_rofs2_version.iby |
|
45 ROFS2_ROMVER = 0.01(0) |
|
46 ROFS2_VERSION = $(CORE_VERSION) |
|
47 ROFS2_FWIDFILE = $(ROFS2_PREFIX)_rofs2_fwid.txt |
|
48 ROFS2_FWID = language |
|
49 ROFS2_FWIDVER = $(LANGPACK_ID) |
|
50 ROFS2_FWIDINFO = id=$(ROFS2_FWID)\nversion=$(ROFS2_FWIDVER)\n |
|
51 |
|
52 ROFS2_IMG = $(ROFS2_PREFIX).rofs2.img |
|
53 ROFS2_LOG = $(ROFS2_PREFIX).rofs2.log |
|
54 ROFS2_OUTOBY = $(ROFS2_PREFIX).rofs2.oby |
|
55 ROFS2_SYM = $(ROFS2_PREFIX).rofs2.symbol |
|
56 |
|
57 ROFS2_PLUGINLOG = $(ROFS2_PREFIX)_rofs2_bldromplugin.log |
|
58 ROFS2_PAGEFILE = $(ODP_PAGEFILE) |
|
59 ROFS2_UDEBFILE = $(TRACE_UDEBFILE) |
|
60 |
|
61 ROFS2_ICHKLOG = $(ROFS2_PREFIX)_rofs2_imgcheck.log |
|
62 ROFS2_ICHKOPT = $(IMGCHK_OPT) |
|
63 ROFS2_ICHKIMG = $(ROFS2_IMG) $(CORE_ICHKIMG) |
|
64 |
|
65 ROFS2_I2FDIR = $(ROFS2_DIR)/img2file |
|
66 |
|
67 #============================================================================== |
|
68 |
|
69 define ROFS2_MSTOBYINFO |
|
70 $(BLDROM_HDRINFO) |
|
71 |
|
72 ROM_IMAGE 0 non-xip size=0x00000000 |
|
73 ROM_IMAGE 1 dummy1 non-xip size=$(ROFS_MAXSIZE) |
|
74 ROM_IMAGE 2 rofs2 non-xip size=$(ROFS_MAXSIZE) |
|
75 ROM_IMAGE 3 dummy3 non-xip size=$(ROFS_MAXSIZE) |
|
76 |
|
77 $(BLDROM_PLUGINFO) |
|
78 |
|
79 // ROFS2 header |
|
80 // |
|
81 $(ROFS2_HDRINFO) |
|
82 |
|
83 ROM_IMAGE[2] { |
|
84 $(call ODP_CODEINFO,2) |
|
85 $(BLR.ROFS2.OBY) |
|
86 $(ROFS2_INLINE) |
|
87 $(ROFS2_FOOTERINFO) |
|
88 } |
|
89 endef |
|
90 |
|
91 define ROFS2_HDRINFO |
|
92 $(DEFINE) _IMAGE_WORKDIR $(ROFS2_DIR) |
|
93 $(call mac2cppdef,$(BLR.ROFS2.OPT)) |
|
94 $(call iif,$(USE_NEWLOCLZTN), |
|
95 $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)), |
|
96 #define __LOCALES_$(lang)_IBY__) |
|
97 $(foreach lang,$(call getlangbyid,$(LANGPACK_LANGS)), |
|
98 ADD_LANGUAGE $(lang)) |
|
99 ) |
|
100 $(BLR.ROFS2.HBY) |
|
101 $(ROFS2_HEADER) |
|
102 $(if $(filter 2,$(USE_VARIANTBLD)),$(VARIANT_HEADER)) |
|
103 endef |
|
104 |
|
105 define ROFS2_FOOTERINFO |
|
106 $(if $(ROFS2_TIME),time=$(ROFS2_TIME)) |
|
107 $(ROFS2_FOOTER) |
|
108 endef |
|
109 |
|
110 define ROFS2_VERIBYINFO |
|
111 // Generated `$(ROFS2_VERIBY)$' for ROFS2 image creation |
|
112 $(if $(ROFS2_ROMVER), |
|
113 |
|
114 version=$(ROFS2_ROMVER)) |
|
115 |
|
116 OVERRIDE_REPLACE/ADD |
|
117 $(call iif,$(USE_NEWLOCLZTN), |
|
118 data-override=$(LANGPACK_LANGFILE) RESOURCE_FILES_DIR\Bootdata\languages.txt |
|
119 data-override=$(LANGPACK_IDFILE) RESOURCE_FILES_DIR\versions\lang.txt |
|
120 data-override=$(LANGPACK_SWVERFILE) RESOURCE_FILES_DIR\versions\langsw.txt |
|
121 ) |
|
122 $(call iif,$(USE_FOTA), |
|
123 data-override=$(ROFS2_FWIDFILE) RESOURCE_FILES_DIR\versions\fwid2.txt) |
|
124 OVERRIDE_END |
|
125 endef |
|
126 |
|
127 #============================================================================== |
|
128 |
|
129 CLEAN_ROFS2FILE =\ |
|
130 del | "$(ROFS2_MSTOBY)" "$(ROFS2_VERIBY)" "$(ROFS2_FWIDFILE)" |\ |
|
131 $(CLEAN_LANGFILE) |\ |
|
132 del | $(call getgenfiles,$(call _buildoby,$(ROFS2_OBYGEN))) |
|
133 |
|
134 BUILD_ROFS2FILE =\ |
|
135 echo-q | Generating file(s) for ROFS2 image creation |\ |
|
136 write | $(ROFS2_MSTOBY) | $(call def2str,$(ROFS2_MSTOBYINFO)) |\ |
|
137 $(call iif,$(USE_VERGEN),\ |
|
138 write | $(ROFS2_VERIBY) | $(call def2str,$(ROFS2_VERIBYINFO)) |\ |
|
139 writeu | $(ROFS2_FWIDFILE) | $(ROFS2_FWIDINFO) |)\ |
|
140 $(call iif,$(USE_NEWLOCLZTN),$(BUILD_LANGFILE)) |\ |
|
141 $(call _buildoby,$(ROFS2_OBYGEN)) |
|
142 |
|
143 |
|
144 ############################################################################### |
|
145 # |
|
146 |
|
147 LANGPACK_SYSLANGMK = system_languages.mk |
|
148 |
|
149 LANGPACK_ROOT = $(PRODUCT_DIR)/language |
|
150 LANGPACK_PREFIX = langpack_ |
|
151 LANGPACK_MKNAME = language_variant.mk |
|
152 LANGPACK_NAME = |
|
153 LANGPACK_DIR = $(LANGPACK_ROOT)/$(LANGPACK_NAME) |
|
154 LANGPACK_CONFML = $(or $(wildcard $(LANGPACK_DIR)/$(CONFT_CFGNAME).confml),$(PRODVARIANT_CONFML)) |
|
155 LANGPACK_CONFCP = $(PRODVARIANT_CONFCP) $(if $(wildcard $(LANGPACK_DIR)/$(CONFT_CFGNAME).confml),$(CONFT_CFGNAME)) |
|
156 |
|
157 LANGPACK_IDFILE = $(ROFS2_PREFIX)_rofs2_lang.txt |
|
158 LANGPACK_ID = 01 |
|
159 LANGPACK_LANGFILE = $(ROFS2_PREFIX)_rofs2_languages.txt |
|
160 LANGPACK_LANGS = English |
|
161 LANGPACK_DEFAULTLANG = $(word 1,$(LANGPACK_LANGS)) |
|
162 LANGPACK_DEFAULTREGION = Western |
|
163 LANGPACK_SWVERFILE = $(ROFS2_PREFIX)_rofs2_langsw.txt |
|
164 LANGPACK_SWVERINFO = $(CORE_SWVERINFO) |
|
165 LANGPACK_INFOFILE = $(ROFS2_PREFIX)_rofs2_$(LANGPACK_NAME)_info.txt |
|
166 |
|
167 LANGPACK_LANGNAMES = $(call getlangname,$(LANGPACK_LANGS)) |
|
168 LANGPACK_LANGIDS = $(call getlangid,$(LANGPACK_LANGS)) |
|
169 LANGPACK_DEFLANGNAME = $(call getlangname,$(LANGPACK_DEFAULTLANG)) |
|
170 LANGPACK_DEFLANGID = $(call getlangid,$(LANGPACK_DEFAULTLANG)) |
|
171 LANGPACK_REGION = $(call getlangregion,$(LANGPACK_DEFAULTLANG)) |
|
172 |
|
173 #============================================================================== |
|
174 |
|
175 CLEAN_LANGFILE = del | "$(LANGPACK_LANGFILE)" "$(LANGPACK_IDFILE)" "$(LANGPACK_SWVERFILE)" "$(LANGPACK_INFOFILE)" |
|
176 BUILD_LANGFILE =\ |
|
177 echo-q | Generating language files for Language Package image creation |\ |
|
178 $(if $(strip $(LANGUAGE_SYSLANGS)),,\ |
|
179 error | 1 | No system languages defined\n |)\ |
|
180 $(if $(strip $(LANGPACK_LANGS)),,\ |
|
181 error | 1 | No languages defined in the language pack\n |)\ |
|
182 $(call select,$(words $(LANGPACK_LANGS)),$(words $(LANGPACK_LANGIDS)),,\ |
|
183 error | 1 | Not all languages of the language pack defined in the system languages\n |)\ |
|
184 $(call select,$(words $(LANGPACK_LANGS)),$(words $(call getlangbyid,$(LANGPACK_LANGS))),,\ |
|
185 error | 1 | Duplicate language defined in the language pack\n |)\ |
|
186 $(if $(strip $(LANGPACK_DEFAULTLANG)),,\ |
|
187 error | 1 | No default language defined\n |)\ |
|
188 $(if $(word 2,$(LANGPACK_DEFAULTLANG)),\ |
|
189 error | 1 | More than one default language defined\n |)\ |
|
190 $(if $(filter $(call lcase,$(LANGPACK_DEFAULTLANG)),$(call lcase,$(LANGPACK_LANGS))),,\ |
|
191 error | 1 | Default language not defined in the language pack languages\n |)\ |
|
192 $(if $(word 2,$(sort $(call getlangregion,$(LANGPACK_LANGS)))),\ |
|
193 error | 1 | Not all languages of the language pack belong to the same region\n |)\ |
|
194 \ |
|
195 writeu | $(LANGPACK_LANGFILE) | $(LANGPACK_LANGINFO) |\ |
|
196 writeu | $(LANGPACK_IDFILE) | $(LANGPACK_ID) |\ |
|
197 writeu | $(LANGPACK_SWVERFILE) | $(LANGPACK_SWVERINFO) |\ |
|
198 $(if $(LANGPACK_NAME),\ |
|
199 write | $(LANGPACK_INFOFILE) | $(call def2str,$(LANGPACK_INFO))) |
|
200 |
|
201 LANGPACK_LANGINFO =\ |
|
202 $(foreach lang,$(LANGPACK_LANGIDS),\ |
|
203 $(lang)$(call select,$(lang),$(LANGPACK_DEFLANGID),$(,)d)\n) |
|
204 |
|
205 define LANGPACK_INFO |
|
206 Generated `$(LANGPACK_INFOFILE)$' for documenting the language selections |
|
207 |
|
208 Name : $(LANGPACK_NAME) |
|
209 Default Lang.: $(LANGPACK_DEFLANGNAME) ($(LANGPACK_DEFLANGID)) |
|
210 Languages : $(LANGPACK_LANGNAMES) |
|
211 Language IDs : $(LANGPACK_LANGIDS) |
|
212 Region : $(LANGPACK_REGION) |
|
213 endef |
|
214 |
|
215 |
|
216 ############################################################################### |
|
217 # ROFS2 pre |
|
218 |
|
219 CLEAN_ROFS2PRE = $(if $(filter 2,$(USE_VARIANTBLD)),$(CLEAN_CUSTVARIANT) |) $(CLEAN_ROFS2FILE) |
|
220 BUILD_ROFS2PRE =\ |
|
221 $(if $(filter 2,$(USE_VARIANTBLD)),$(BUILD_CUSTVARIANT) |)\ |
|
222 mkcd | $(ROFS2_DIR) |\ |
|
223 $(BUILD_ROFS2FILE) |
|
224 |
|
225 #============================================================================== |
|
226 # ROFS2 build |
|
227 |
|
228 BLR.ROFS2.IDIR = $(call dir2inc,$(ROFS2_IDIR) $(call iif,$(USE_FEATVAR),,$(FEATVAR_IDIR))) |
|
229 BLR.ROFS2.HBY = $(call includeiby,$(IMAGE_HBY) $(ROFS2_HBY)) |
|
230 BLR.ROFS2.OBY = $(call includeiby,$(ROFS2_OBY) $(if $(filter 2,$(USE_VARIANTBLD)),$(VARIANT_OBY)) $(call iif,$(USE_VERGEN),$(ROFS2_VERIBY))) |
|
231 BLR.ROFS2.OPT = $(ROFS2_OPT) $(if $(filter 2,$(USE_PAGEDCODE)),$(if $(ODP_CODECOMP),-c$(ODP_CODECOMP))) -o$(notdir $(ROFS2_NAME).img) $(BLDROPT) |
|
232 BLR.ROFS2.POST = $(call iif,$(KEEPTEMP),,del | $(ROFS2_PREFIX).???) |
|
233 |
|
234 CLEAN_ROFS2 = $(CLEAN_BLDROM) |
|
235 BUILD_ROFS2 = $(BUILD_BLDROM) |
|
236 |
|
237 #============================================================================== |
|
238 # ROFS2 post |
|
239 |
|
240 CLEAN_ROFS2POST = $(CLEAN_IMGCHK) | $(CLEAN_MAKSYMROFS) |
|
241 BUILD_ROFS2POST =\ |
|
242 $(call iif,$(USE_IMGCHK),$(BUILD_IMGCHK) |)\ |
|
243 $(call iif,$(USE_SYMGEN),$(BUILD_MAKSYMROFS)) |
|
244 |
|
245 #============================================================================== |
|
246 |
|
247 SOS.ROFS2.STEPS = $(call iif,$(USE_ROFS2),$(call iif,$(SKIPPRE),,ROFS2PRE) $(call iif,$(SKIPBLD),,ROFS2) $(call iif,$(SKIPPOST),,ROFS2POST)) |
|
248 ALL.ROFS2.STEPS = $(SOS.ROFS2.STEPS) |
|
249 |
|
250 |
|
251 ############################################################################### |
|
252 # Targets |
|
253 |
|
254 .PHONY: rofs2 rofs2-all rofs2-image rofs2-pre rofs2-check rofs2-symbol rofs2-i2file |
|
255 |
|
256 rofs2 rofs2-% : IMAGE_TYPE = ROFS2 |
|
257 rofs2-all : USE_SYMGEN = 1 |
|
258 |
|
259 rofs2 rofs2-all: ;@$(call IMAKER,$$(ALL.ROFS2.STEPS)) |
|
260 rofs2-image : ;@$(call IMAKER,$$(SOS.ROFS2.STEPS)) |
|
261 |
|
262 rofs2-pre : ;@$(call IMAKER,ROFS2PRE) |
|
263 rofs2-check : ;@$(call IMAKER,IMGCHK) |
|
264 rofs2-symbol : ;@$(call IMAKER,MAKSYMROFS) |
|
265 |
|
266 rofs2-i2file : USE_ROFS = 2 |
|
267 rofs2-i2file : ;@$(call IMAKER,VARIANTI2F) |
|
268 |
|
269 # langpack_% |
|
270 $(LANGPACK_PREFIX)%: LANGPACK_NAME = $(TARGETNAME) |
|
271 $(LANGPACK_PREFIX)%: LANGPACK_ID = $(TARGETID) |
|
272 $(LANGPACK_PREFIX)%: VARIANT_DIR = $(LANGPACK_DIR) |
|
273 $(LANGPACK_PREFIX)%: VARIANT_MKNAME = $(LANGPACK_MKNAME) |
|
274 $(LANGPACK_PREFIX)%: VARIANT_CONFML = $(LANGPACK_CONFML) |
|
275 $(LANGPACK_PREFIX)%: VARIANT_CONFCP = $(LANGPACK_CONFCP) |
|
276 $(LANGPACK_PREFIX)%: variantrofs2_$(TARGETID)$(TARGETEXT) ; |
|
277 |
|
278 # langpack_all langpack_china langpack_japan langpack_western |
|
279 .PHONY: $(addprefix $(LANGPACK_PREFIX),all china japan western) |
|
280 |
|
281 $(addprefix $(LANGPACK_PREFIX),all china japan western):\ |
|
282 ;@$(call IMAKER,$$(addsuffix |,$$(call getlpacksbyregion,$(LANGPACK_ID)))) |
|
283 |
|
284 #============================================================================== |
|
285 # Helps |
|
286 |
|
287 $(call add_help,LANGPACK_DIR,v,(string),Overrides the VARIANT_DIR for language pack, see the instructions of VARIANT_CONFCP for details.) |
|
288 $(call add_help,LANGPACK_CONFML,v,(string),Overrides the VARIANT_CONFML for language pack, see the instructions of VARIANT_CONFML for details.) |
|
289 $(call add_help,LANGPACK_CONFCP,v,(string),Overrides the VARIANT_CONFCP for language pack, see the instructions of VARIANT_CONFCP for details.) |
|
290 $(call add_help,LANGPACK_LANGS,v,(string),Languages are the languages that are taken to the image (SC language is is defaulting to 01 in languages.txt)) |
|
291 $(call add_help,LANGPACK_DEFAULTLANG,v,(string),Default language is the language where the device will boot to (SIM language overrides this selection)) |
|
292 $(call add_help,LANGPACK_ID,v,(string),Language id used in the lang.txt generation) |
|
293 |
|
294 $(call add_help,$(LANGPACK_PREFIX)all,t,Create all language packages.) |
|
295 $(call add_help,$(LANGPACK_PREFIX)china,t,Create language packages that belong to China region.) |
|
296 $(call add_help,$(LANGPACK_PREFIX)japan,t,Create language packages that belong to Japan region.) |
|
297 $(call add_help,$(LANGPACK_PREFIX)western,t,Create language packages that belong to Western region.) |
|
298 |
|
299 |
|
300 ############################################################################### |
|
301 # Functions |
|
302 |
|
303 # Convert a list of language names and/or ids to numeric codes (ids) based on the system language mapping, e.g. English => 01, etc. |
|
304 getlangid = $(call _getlang,$1,$(LANGUAGE_ID-NAME),2) |
|
305 # Sorted by language ids and duplicates removed |
|
306 getlangbyid = $(call _getlang,$1,$(LANGUAGE_ID-NAME),2,1) |
|
307 |
|
308 # Language ids/names to language names, e.g. 01 => English, etc. |
|
309 getlangname = $(call _getlang,$1,$(LANGUAGE_ID-NAME),3) |
|
310 getlnamebyid = $(call _getlang,$1,$(LANGUAGE_ID-NAME),3,1) |
|
311 |
|
312 # Language ids/names to language regions, e.g. 01/English => Western, etc. |
|
313 getlangregion = $(call _getlang,$1,$(LANGUAGE_ID-REGION),2) |
|
314 getlregionbyid = $(call _getlang,$1,$(LANGUAGE_ID-REGION),2,1) |
|
315 |
|
316 # Get all language pack targets that belong to a given region |
|
317 getlpacksbyregion = $(strip\ |
|
318 $(foreach file,$(wildcard $(LANGPACK_ROOT)/$(LANGPACK_PREFIX)*/$(LANGPACK_MKNAME)),\ |
|
319 $(eval include $(file))\ |
|
320 $(if $(call select,$1,all,1)$(call select,$1,$(LANGPACK_REGION),1),\ |
|
321 $(notdir $(patsubst %/,%,$(dir $(file))))))) |
|
322 |
|
323 |
|
324 ############################################################################### |
|
325 # Internal stuff |
|
326 |
|
327 LANGUAGE_EVAL =\ |
|
328 $(eval -include $(call findfile,$(LANGPACK_SYSLANGMK),$(FEATVAR_IDIR)))\ |
|
329 $(eval LANGUAGE_ID-NAME :=)$(eval LANGUAGE_ID-REGION :=)\ |
|
330 $(call _evallangdata,$(subst $(\n), | ,$(LANGUAGE_SYSLANGS))) |
|
331 |
|
332 _evallangdata = $(if $1,\ |
|
333 $(eval __i_ldata := $(call getelem,1,$1))\ |
|
334 $(if $(eval __i_lid := $(word 2,$(__i_ldata)))$(__i_lid),\ |
|
335 $(eval __i_lidx := $(call _getlangid,$(__i_lid)))\ |
|
336 $(eval __i_region := $(or $(word 3,$(__i_ldata)),$(LANGPACK_DEFAULTREGION)))\ |
|
337 $(eval LANGUAGE_ID-NAME += $(__i_lidx)|$(__i_lid)|$(word 1,$(__i_ldata))|$(call lcase,$(word 1,$(__i_ldata))))\ |
|
338 $(eval LANGUAGE_ID-REGION += $(__i_lidx)|$(__i_region)|$(call lcase,$(__i_region))))\ |
|
339 $(call _evallangdata,$(if $(__i_ldata),$(call restwords,3,$(call restwords,$(words $(__i_ldata)),$1)),$(call restwords,$1)))) |
|
340 |
|
341 _getlang = $(strip\ |
|
342 $(eval __i_lids :=)\ |
|
343 $(foreach id,$1,\ |
|
344 $(eval __i_lidx := $(call _getlangid,$(id)))\ |
|
345 $(eval __i_lids += $(if $(filter $(__i_lidx)|%,$(LANGUAGE_ID-NAME)),$(__i_lidx),\ |
|
346 $(word 1,$(subst |, ,$(filter %|$(call lcase,$(id)),$(LANGUAGE_ID-NAME)))))))\ |
|
347 $(foreach lid,$(if $4,$(sort $(__i_lids)),$(__i_lids)),\ |
|
348 $(word $3,$(subst |, ,$(filter $(lid)|%,$2))))) |
|
349 |
|
350 _getlangid =\ |
|
351 $(if $(filter 0%,$1),$(call _getlangid,$(call substr,2,,$1)),\ |
|
352 $(eval __i_len := $(call strlen,$1))$(eval __i_prefix := 0)\ |
|
353 $(call sstrip,$(foreach len,6 5 4 3 2 1,$(if $(filter $(len),$(__i_len)),$(eval __i_prefix :=))$(__i_prefix)))$1) |
|
354 |
|
355 |
|
356 # END OF IMAKER_ROFS2.MK |