imgtools/imaker/src/imaker_rofs.mk
changeset 596 9f25be3da657
equal deleted inserted replaced
595:997c19261166 596:9f25be3da657
       
     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 "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: iMaker generic ROFS image configuration
       
    15 #
       
    16 
       
    17 
       
    18 
       
    19 ###############################################################################
       
    20 #  ___  ___  ___ ___
       
    21 # | _ \/ _ \| __/ __|
       
    22 # |   / (_) | _|\__ \
       
    23 # |_|_\\___/|_| |___/
       
    24 #
       
    25 
       
    26 ROFS_MAXSIZE = 0x10000000
       
    27 
       
    28 define ROFS_EVAL
       
    29 USE_$1        = $$(call userofs,$3)
       
    30 
       
    31 $1_TITLE      = $1
       
    32 $1_DRIVE      = Z
       
    33 $1_ROOT       = $$(OUTDIR)/$2
       
    34 $1_DIR        = $$($1_ROOT)
       
    35 $1_NAME       = $$(NAME)
       
    36 $1_PREFIX     = $$($1_DIR)/$$($1_NAME)
       
    37 $1_IDIR       =
       
    38 $1_HBY        =
       
    39 $1_OBY        =
       
    40 $1_OPT        =
       
    41 $1_MAXSIZE    = $$(ROFS_MAXSIZE)
       
    42 $1_MSTOBY     = $$($1_PREFIX)_$2_master.oby
       
    43 $1_HEADER     =
       
    44 $1_INLINE     =
       
    45 $1_FOOTER     =
       
    46 $1_TIME       = $$(DAY)/$$(MONTH)/$$(YEAR)
       
    47 
       
    48 $1_DEFHRH     = $$($1_PREFIX)_$2_define.hrh
       
    49 $1_FEAXML     =
       
    50 $1_FEAIBY     =
       
    51 
       
    52 $1_ROMVER     = $$(CORE_ROMVER)
       
    53 $1_ID         = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID1),00)
       
    54 $1_REVISION   = 01
       
    55 $1_VERSION    = $$(CORE_VERSION).$$($1_ID).$$($1_REVISION)
       
    56 $1_SWVERFILE  = $$($1_PREFIX)_$2_sw.txt
       
    57 $1_SWVERTGT   = $$(IMAGE_VERSDIR)\$2sw.txt
       
    58 $1_SWVERINFO  = $$($1_VERSION)\n$$(BUILD_YEAR)-$$(BUILD_MONTH)-$$(BUILD_DAY)
       
    59 $1_FWIDFILE   = $$($1_PREFIX)_$2_fwid.txt
       
    60 $1_FWID       = $2
       
    61 $1_FWIDVER    = $$($1_VERSION)$$(SW_TYPEINFO)
       
    62 $1_FWIDINFO   = id=$$($1_FWID)\nversion=$$($1_FWIDVER)\n
       
    63 
       
    64 $1_IMG        = $$($1_PREFIX).$2.img
       
    65 $1_LOG        = $$($1_PREFIX).$2.log
       
    66 $1_OUTOBY     = $$($1_PREFIX).$2.oby
       
    67 $1_SYM        = $$($1_PREFIX).$2.symbol
       
    68 
       
    69 $1_PLUGINLOG  = $$($1_PREFIX)_$2_bldromplugin.log
       
    70 $1_PAGEFILE   = $$(ODP_PAGEFILE)
       
    71 $1_UDEBFILE   = $$(TRACE_UDEBFILE)
       
    72 
       
    73 $1_OBYGEN     =
       
    74 $1_ORIDEIBY   = $$($1_PREFIX)_$2_override.iby
       
    75 $1_ORIDEFILES = $$(IMAGE_ORIDEFILES)
       
    76 $1_ORIDECONF  = $$(IMAGE_ORIDECONF)
       
    77 
       
    78 $1_ICHKLOG    = $$($1_PREFIX)_$2_imgcheck.log
       
    79 $1_ICHKOPT    = $$(IMGCHK_OPT)
       
    80 $1_ICHKIMG    = $$($1_IMG)
       
    81 
       
    82 $1_I2FDIR     = $$($1_DIR)/img2file
       
    83 
       
    84 $1_CONECONF   = $$(PRODUCT_NAME)_$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))_root.confml
       
    85 $1_CONEOPT    = --all-layers --impl-tag=target:$2
       
    86 
       
    87 $1_VARNAME    = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID2-))
       
    88 $1_VARROOT    = $$(or $$(wildcard $$(PRODUCT_DIR)/$2),$$(or $$(if $$(PRODUCT_MSTNAME),$$(wildcard $$(PRODUCT_MSTDIR)/$2)),$$(PRODUCT_DIR)/$2))
       
    89 $1_VARDIR     = $$(if $$(and $$(call true,$$(USE_CONE)),$$(call true,$$(IMAKER_MKRESTARTS))),$$(CONE_OUTDIR),$$($1_VARROOT)/$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))$$(call iif,$$(USE_CONE),/content))
       
    90 
       
    91 #==============================================================================
       
    92 
       
    93 define $1_MSTOBYINFO
       
    94   $$(call BLDROM_HDRINFO,$1)
       
    95 
       
    96   ROM_IMAGE 0        non-xip size=0x00000000
       
    97   $$(foreach rofs,1 2 3 4 5 6,
       
    98     ROM_IMAGE $$(rofs) $$(if $$(filter $$(rofs),$3), rofs,dummy)$$(rofs) non-xip size=$$($1_MAXSIZE))
       
    99 
       
   100   $$(call BLDROM_PLUGINFO,$1)
       
   101 
       
   102   /* $1 header
       
   103   */
       
   104   $$($1_HDRINFO)
       
   105 
       
   106   ROM_IMAGE[$3] {
       
   107     $$(ODP_ROFSINFO)
       
   108   #ifndef _IMAGE_INCLUDE_HEADER_ONLY
       
   109     $$(BLR.$1.OBY)
       
   110     $$($1_INLINE)
       
   111     $$($1_FOOTERINFO)
       
   112   }
       
   113   #endif // _IMAGE_INCLUDE_HEADER_ONLY
       
   114 endef
       
   115 
       
   116 define $1_HDRINFO
       
   117   $$(DEFINE) _IMAGE_WORKDIR $$($1_DIR)
       
   118   $$(call mac2cppdef,$$(BLR.$1.OPT))
       
   119   $$(BLR.$1.HBY)
       
   120   $$($1_HEADER)
       
   121   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_HEADER))
       
   122 endef
       
   123 
       
   124 define $1_FOOTERINFO
       
   125   $$(if $$($1_TIME),time=$$($1_TIME))
       
   126   $$(if $$($1_ROMVER),version=$$($1_ROMVER))
       
   127   $$($1_FOOTER)
       
   128 endef
       
   129 
       
   130 define $1_ORIDEINFO
       
   131   // Generated `$$($1_ORIDEIBY)' for $$($1_TITLE) image creation
       
   132 
       
   133   $$(if $$($1_SWVERINFO)$$($1_FWIDINFO),
       
   134     OVERRIDE_REPLACE/ADD
       
   135     $$(if $$($1_SWVERINFO),
       
   136       data-override="$$($1_SWVERFILE)"  "$$($1_SWVERTGT)")
       
   137     $$(if $$($1_FWIDINFO),
       
   138       data-override="$$($1_FWIDFILE)"  "$$(IMAGE_VERSDIR)\fwid$3.txt")
       
   139     OVERRIDE_END
       
   140   )
       
   141 endef
       
   142 
       
   143 #==============================================================================
       
   144 # ROFS pre-build
       
   145 
       
   146 CLEAN_$1PRE =\
       
   147   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(CLEAN_VARIANT) |)\
       
   148   $$(CLEAN_$1FILE) | $$(CLEAN_DEFHRH) | $$(CLEAN_FEATMAN)
       
   149 
       
   150 BUILD_$1PRE =\
       
   151   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(BUILD_VARIANT) |)\
       
   152   mkdir | "$$($1_DIR)" |\
       
   153   $$(BUILD_$1FILE) |\
       
   154   $$(BUILD_DEFHRH) |\
       
   155   $$(BUILD_FEATMAN)
       
   156 
       
   157 CLEAN_$1FILE =\
       
   158   del | "$$($1_MSTOBY)" "$$($1_ORIDEIBY)" "$$($1_SWVERFILE)" "$$($1_FWIDFILE)" |\
       
   159   del | $$(call getgenfiles,$$($1_OBYGEN))
       
   160 
       
   161 BUILD_$1FILE =\
       
   162   echo-q  | Generating file(s) for $$($1_TITLE) image creation |\
       
   163   write-c | "$$($1_MSTOBY)" | $$(call def2str,$$($1_MSTOBYINFO))\n |\
       
   164   $$(if $$($1_SWVERINFO),\
       
   165     writeu  | "$$($1_SWVERFILE)" | $$(call quote,$$($1_SWVERINFO)) |)\
       
   166   $$(if $$($1_FWIDINFO),\
       
   167     writeu  | "$$($1_FWIDFILE)"  | $$($1_FWIDINFO) |)\
       
   168   $$(if $$($1_ORIDEINFO),\
       
   169     write-c | "$$($1_ORIDEIBY)"  | $$(call def2str,$$($1_ORIDEINFO)) |)\
       
   170   $$(if $$($1_ORIDECONF),\
       
   171     genorideiby | >>$$($1_ORIDEIBY) | $$(call def2str,$$($1_ORIDEFILES) | $$($1_ORIDECONF)) |)\
       
   172   $$($1_OBYGEN)
       
   173 
       
   174 #==============================================================================
       
   175 # ROFS build
       
   176 
       
   177 $1_DUMMY     = $$(call rofsdummy,$1)
       
   178 
       
   179 BLR.$1.BUILD = $$(if $$(filter d%,$$(USE_$1)),echo-q | Creating dummy $$($1_TITLE) SOS image | write-q | "$$($1_IMG)" | $$($1_DUMMY))
       
   180 BLR.$1.IDIR  = $$(call dir2inc,$$($1_IDIR) $$(call iif,$$(USE_FEATVAR),,$$(FEATVAR_IDIR)))
       
   181 BLR.$1.HBY   = $$(call includeiby,$$(IMAGE_HBY) $$($1_HBY))
       
   182 BLR.$1.OBY   = $$(call includeiby,$$($1_OBY))\
       
   183   $$(and $$(call true,$$(SYMBIAN_FEATURE_MANAGER)),$$($1_FEAIBY),$$(call mac2cppdef,-U__FEATURE_IBY__)$$(call includeiby,$$($1_FEAIBY)))\
       
   184   $$(call includeiby,$$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_OBY)) $$($1_ORIDEIBY))
       
   185 BLR.$1.OPT   = $$($1_OPT) $$(if $$(filter $3,$$(USE_PAGEDCODE)),$$(if $$(ODP_CODECOMP),-c$$(ODP_CODECOMP))) -o$$(call pathconv,$$($1_PREFIX)).img $$(BLDROPT)
       
   186 BLR.$1.POST  = $$(call iif,$$(KEEPTEMP),,del | "$$($1_PREFIX).???")
       
   187 
       
   188 CLEAN_$1 = $$(call CLEAN_BLDROM,$1)
       
   189 BUILD_$1 = $$(call BUILD_BLDROM,$1)
       
   190 
       
   191 REPORT_$1 =\
       
   192   $$($1_TITLE) dir   | $$($1_DIR) | d |\
       
   193   $$($1_TITLE) image | $$($1_IMG) | f\
       
   194   $$(call iif,$$(USE_SYMGEN),| $$(REPORT_MAKSYMROFS))
       
   195 
       
   196 #==============================================================================
       
   197 # ROFS post-build
       
   198 
       
   199 CLEAN_$1POST  = $$(CLEAN_IMGCHK)
       
   200 BUILD_$1POST  = $$(call iif,$$(USE_IMGCHK),$$(BUILD_IMGCHK))
       
   201 REPORT_$1POST =
       
   202 
       
   203 #==============================================================================
       
   204 # ROFS steps
       
   205 
       
   206 SOS.$1.STEPS = $$(call iif,$$(USE_$1),\
       
   207   $$(call iif,$$(SKIPPRE),,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(USE_CONE)),CONEGEN RESTART) $1PRE)\
       
   208   $$(call iif,$$(SKIPBLD),,$1) $$(call iif,$$(SKIPPOST),,$1POST))
       
   209 
       
   210 ALL.$1.STEPS  = $$(SOS.$1.STEPS)
       
   211 
       
   212 #==============================================================================
       
   213 # Targets
       
   214 
       
   215 .PHONY: $2 $(addprefix $2-,all check cone i2file image pre symbol) variant$2
       
   216 
       
   217 $2 $2%: IMAGE_TYPE = $1
       
   218 $2-all: USE_SYMGEN = 1
       
   219 
       
   220 $2 $2-all: ;@$$(call IMAKER,$$$$(ALL.$1.STEPS))
       
   221 $2-image : ;@$$(call IMAKER,$$$$(SOS.$1.STEPS))
       
   222 
       
   223 $2-cone  : ;@$$(call IMAKER,CONEGEN)
       
   224 $2-pre   : ;@$$(call IMAKER,$1PRE)
       
   225 $2-check : ;@$$(call IMAKER,IMGCHK)
       
   226 $2-symbol: ;@$$(call IMAKER,MAKSYMROFS)
       
   227 $2-i2file: ;@$$(call IMAKER,I2FILE)
       
   228 
       
   229 variant$2 variant$2%     : USE_CONE = 0
       
   230 variant$2 variant$2% $2_%: USE_VARIANTBLD = $3
       
   231 variant$2 variant$2% $2_%: $2$$(TARGETEXT) ;
       
   232 
       
   233 #==============================================================================
       
   234 # Helps
       
   235 
       
   236 $(call add_help,$2,t,Create $$($1_TITLE) image.)
       
   237 $(call add_help,$2-dir,t,Create directory structure for $$($1_TITLE) creation.)
       
   238 $(call add_help,$2-i2file,t,Extract all files from $$($1_TITLE) image.)
       
   239 $(call add_help,$2-image,t,Create $$($1_TITLE) image (.img) file.)
       
   240 $(call add_help,$2-pre,t,Run pre-step, create files etc. for $$($1_TITLE) creation.)
       
   241 $(call add_help,$2-symbol,t,Create $$($1_TITLE) symbol file.)
       
   242 $(call add_help,variant$2,t,Create $$($1_TITLE) image from a variant directory. Be sure to define the VARIANT_DIR.)
       
   243 
       
   244 endef # ROFS_EVAL
       
   245 
       
   246 
       
   247 ###############################################################################
       
   248 #
       
   249 
       
   250 userofs = $(eval __i_rofs := $(filter-out :%,$(subst :, :,$(subst $(,), ,$(USE_ROFS)))))$(if\
       
   251   $(filter $1,$(__i_rofs)),1,$(if $(filter d$1 D$1,$(__i_rofs)),dummy,0))
       
   252 
       
   253 rofsdummy = $(if $(filter d%,$(USE_$1)),$(call prepeat,\
       
   254   $(call peval,$(call pquote,$(USE_ROFS)) =~ /d$1:(\d*)/i && $$1 || 100),X))
       
   255 
       
   256 $(foreach rofs,1 2 3 4 5 6,$(eval $(call ROFS_EVAL,ROFS$(rofs),rofs$(rofs),$(rofs))))
       
   257 
       
   258 $(call includechk,$(addprefix $(IMAKER_DIR)/imaker_rofs,2.mk 3.mk 4.mk))
       
   259 
       
   260 
       
   261 # END OF IMAKER_ROFS.MK