imgtools/imaker/src/imaker_fat.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 FAT (File Allocation Table) image configuration
       
    15 #
       
    16 
       
    17 
       
    18 
       
    19 ###############################################################################
       
    20 #  ___  _  _____
       
    21 # | __|/_\|_   _|
       
    22 # | _|/ _ \ | |
       
    23 # |_|/_/ \_\|_|
       
    24 #
       
    25 
       
    26 USE_FILEDISK = 0
       
    27 USE_FSIMAGE  = 0
       
    28 USE_SOSUDA   = 1
       
    29 
       
    30 FATEMPTY_CMD =
       
    31 
       
    32 
       
    33 ###############################################################################
       
    34 #
       
    35 
       
    36 define FAT_EVAL
       
    37 $1_TITLE       = $1
       
    38 $1_ROOT        = $$(OUTDIR)/$2
       
    39 $1_DIR         = $$($1_ROOT)
       
    40 $1_NAME        = $$(NAME)
       
    41 $1_PREFIX      = $$($1_DIR)/$$($1_NAME)
       
    42 $1_IDIR        =
       
    43 $1_HBY         =
       
    44 $1_OBY         =
       
    45 $1_OPT         = $$(BLDROM_OPT) -D_EABI=$$(ARM_VERSION)
       
    46 $1_MSTOBY      = $$($1_PREFIX)_$2_master.oby
       
    47 $1_HEADER      =
       
    48 $1_INLINE      =
       
    49 $1_FOOTER      =
       
    50 $1_TIME        = $$(DAY)/$$(MONTH)/$$(YEAR)
       
    51 
       
    52 $1_DEFHRH      = $$($1_PREFIX)_$2_define.hrh
       
    53 $1_FEAXML      =
       
    54 $1_FEAIBY      =
       
    55 
       
    56 $1_ROMVER      = $$(CORE_ROMVER)
       
    57 $1_ID          = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID1),00)
       
    58 $1_REVISION    = 01
       
    59 $1_VERSION     = $$(CORE_VERSION).$$($1_ID).$$($1_REVISION)
       
    60 $1_SWVERFILE   = $$($1_DATADIR)/Resource/Versions/User Content Package_$1.txt
       
    61 $1_SWVERINFO   = $$($1_VERSION)
       
    62 
       
    63 $1_IMG         = $$($1_PREFIX).$2.img
       
    64 $1_LOG         = $$($1_PREFIX).$2.log
       
    65 $1_OUTOBY      = $$($1_PREFIX).$2.oby
       
    66 
       
    67 $1_PLUGINLOG   = $$($1_PREFIX)_$2_bldromplugin.log
       
    68 $1_UDEBFILE    = $$(TRACE_UDEBFILE)
       
    69 
       
    70 $1_OBYGEN      =
       
    71 $1_ORIDEIBY    = $$($1_PREFIX)_$2_override.iby
       
    72 $1_ORIDEFILES  = $$(IMAGE_ORIDEFILES)
       
    73 $1_ORIDECONF   = $$(IMAGE_ORIDECONF)
       
    74 
       
    75 $1_CONECONF    = $$(PRODUCT_NAME)_$2_$$($1_ID)$$(addprefix _,$$($1_VARNAME))_root.confml
       
    76 $1_CONEOPT     = --all-layers --impl-tag=target:$2
       
    77 
       
    78 $1_DRIVE       = C
       
    79 $1_FATTYPE     = 16# FAT16
       
    80 $1_SIZE        = 20480# kB
       
    81 $1_SIZEB       = $$(call peval,$$($1_SIZE) * 1024)# B
       
    82 $1_DISKSIZE    = $$($1_SIZE)# kB
       
    83 $1_SECTORSIZE  = 512# B
       
    84 $1_CLUSTERSIZE = 4# kB
       
    85 $1_FATTABLE    = 1
       
    86 $1_VOLUME      =
       
    87 
       
    88 $1_TOUCH       = 0#$$(YEAR)$$(MONTH)$$(DAY)000000
       
    89 $1_CPDIR       =
       
    90 $1_ZIP         =
       
    91 $1_DATADIR     = $$($1_DIR)/datadrive
       
    92 
       
    93 $1_VARNAME     = $$(if $$(filter $2_%,$$(TARGETNAME)),$$(TARGETID2-))
       
    94 $1_VARROOT     = $$(or $$(wildcard $$(PRODUCT_DIR)/$2),$$(or $$(if $$(PRODUCT_MSTNAME),$$(wildcard $$(PRODUCT_MSTDIR)/$2)),$$(PRODUCT_DIR)/$2))
       
    95 $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))
       
    96 
       
    97 $1_EXCLFILE    = $$($1_DATADIR)/private/100059C9/excludelist.txt
       
    98 
       
    99 define $1_EXCLADD
       
   100 *
       
   101 endef
       
   102 
       
   103 define $1_EXCLRM
       
   104 endef
       
   105 
       
   106 $1EMPTY_TITLE  = $$($1_TITLE) Empty
       
   107 $1EMPTY_IMG    = $$($1_PREFIX).$2empty.img
       
   108 $1EMPTY_CMD    = $$(FATEMPTY_CMD)
       
   109 
       
   110 #==============================================================================
       
   111 
       
   112 define $1_MSTOBYINFO
       
   113   $$(call BLDROM_HDRINFO,$1)
       
   114 
       
   115   ROM_IMAGE  0 non-xip size=0x00000000
       
   116 
       
   117   DATA_IMAGE 0 $$(basename $$($1_IMG)) size=$$(call peval,$$($1_DISKSIZE) * 1024) fat$$(if $$(filter %32,$$($1_FATTYPE)),32,16)
       
   118 
       
   119   $$(call BLDROM_PLUGINFO,$1)
       
   120 
       
   121   /* $1 header
       
   122   */
       
   123   $$($1_HDRINFO)
       
   124 
       
   125   DATA_IMAGE[0] {
       
   126     $$(if $$($1_VOLUME),volume=$$($1_VOLUME))
       
   127     fattable=$$($1_FATTABLE)
       
   128   #ifndef _IMAGE_INCLUDE_HEADER_ONLY
       
   129     $$(BLR.$1.OBY)
       
   130     $$($1_INLINE)
       
   131     $$($1_FOOTERINFO)
       
   132   }
       
   133   #endif // _IMAGE_INCLUDE_HEADER_ONLY
       
   134 endef
       
   135 
       
   136 define $1_HDRINFO
       
   137   $$(DEFINE) _IMAGE_WORKDIR $$($1_DIR)
       
   138   $$(call mac2cppdef,$$(BLR.$1.OPT))
       
   139   $$(BLR.$1.HBY)
       
   140   $$($1_HEADER)
       
   141   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(VARIANT_HEADER))
       
   142 endef
       
   143 
       
   144 define $1_FOOTERINFO
       
   145   $$(if $$($1_TIME),time=$$($1_TIME))
       
   146   $$(if $$($1_ROMVER),version=$$($1_ROMVER))
       
   147   $$($1_FOOTER)
       
   148 endef
       
   149 
       
   150 $1_ORIDEINFO =
       
   151 
       
   152 #==============================================================================
       
   153 # FAT pre-build
       
   154 
       
   155 CLEAN_$1PRE =\
       
   156   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(CLEAN_VARIANT),deldir | "$$($1_DATADIR)") |\
       
   157   $$(CLEAN_$1FILE) | $$(CLEAN_DEFHRH) | $$(CLEAN_FEATMAN)
       
   158 
       
   159 BUILD_$1PRE =\
       
   160   echo-q | Preparing $$($1_TITLE) FAT image creation |\
       
   161   $$(if $$(filter $3,$$(USE_VARIANTBLD)),$$(BUILD_VARIANT) |,\
       
   162     mkdir | "$$($1_DATADIR)" |\
       
   163     $$(if $$($1_ZIP),\
       
   164       $$(eval __i_zip := $$(foreach zip,$$($1_ZIP),$$(zip)$$(if $$(filter %.zip,$$(call lcase,$$(zip))),,/*.zip)))\
       
   165       echo-q | Extracting `$$(__i_zip)' to `$$($1_DATADIR)' |\
       
   166       unzip  | "$$(__i_zip)" | $$($1_DATADIR) |)\
       
   167     $$(if $$($1_CPDIR),\
       
   168       copydir | "$$($1_CPDIR)" | $$($1_DATADIR) |))\
       
   169   mkdir | "$$($1_DIR)" |\
       
   170   $$(BUILD_$1FILE) |\
       
   171   $$(call iif,$$(BLR.$1.OBY),$$(BUILD_DEFHRH) |)\
       
   172   $$(BUILD_FEATMAN)
       
   173 
       
   174 CLEAN_$1FILE =\
       
   175   del | "$$($1_MSTOBY)" "$$($1_ORIDEIBY)" "$$($1_SWVERFILE)" |\
       
   176   del | $$(call getgenfiles,$$($1_OBYGEN))
       
   177 
       
   178 BUILD_$1FILE =\
       
   179   echo-q  | Generating file(s) for $$($1_TITLE) FAT image creation |\
       
   180   $$(call iif,$$(BLR.$1.OBY),\
       
   181     write-c | "$$($1_MSTOBY)"    | $$(call def2str,$$($1_MSTOBYINFO))\n |)\
       
   182   $$(if $$($1_SWVERINFO),\
       
   183     writeu  | "$$($1_SWVERFILE)" | $$(call quote,$$($1_SWVERINFO)) |)\
       
   184   $$(if $$($1_ORIDEINFO),\
       
   185     write-c | "$$($1_ORIDEIBY)"  | $$(call def2str,$$($1_ORIDEINFO)) |)\
       
   186   $$(if $$($1_ORIDECONF),\
       
   187     genorideiby | >>$$($1_ORIDEIBY) | $$(call def2str,$$($1_ORIDEFILES) | $$($1_ORIDECONF)) |)\
       
   188   $$($1_OBYGEN)
       
   189 
       
   190 #==============================================================================
       
   191 # FAT build
       
   192 
       
   193 BLR.$1.IDIR = $$(call dir2inc,$$($1_IDIR) $$(call iif,$$(USE_FEATVAR),,$$(FEATVAR_IDIR)))
       
   194 BLR.$1.HBY  = $$(call includeiby,$$(IMAGE_HBY) $$($1_HBY))
       
   195 BLR.$1.OBY  = $$(call includeiby,$$($1_OBY))\
       
   196   $$(and $$(call true,$$(SYMBIAN_FEATURE_MANAGER)),$$($1_FEAIBY),$$(call mac2cppdef,-U__FEATURE_IBY__)$$(call includeiby,$$($1_FEAIBY)))\
       
   197   $$(call includeiby,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(VARIANT_INCDIR)$$(USE_SOSUDA)),$$(VARIANT_OBY))\
       
   198     $$(if $$(strip $$($1_ORIDEINFO)$$($1_ORIDECONF)),$$($1_ORIDEIBY)))
       
   199 BLR.$1.OPT  = $$($1_OPT) -noimage -o$$(call pathconv,$$($1_PREFIX)).dummy0.img $$(BLDROPT)
       
   200 BLR.$1.POST = $$(call iif,$$(USE_SOSUDA),,copyiby | "$$($1_OUTOBY)" | $$($1_DATADIR))
       
   201 
       
   202 CLEAN_$1 = $$(call CLEAN_BLDROM,$1) | $$(CLEAN_FILEDISK) | $$(CLEAN_WINIMAGE) | $$(CLEAN_FSIMAGE)
       
   203 BUILD_$1 =\
       
   204   $$(call iif,$$(BLR.$1.OBY),$$(call BUILD_BLDROM,$1) |)\
       
   205   $$(if $$($1_EXCLFILE),\
       
   206     genexclst | $$($1_EXCLFILE) | $$($1_DATADIR) | $$($1_DRIVE): |\
       
   207       $$(call def2str,$$($1_EXCLADD) | $$($1_EXCLRM)) |)\
       
   208   $$(call iif,$$($1_TOUCH),\
       
   209     finddir-r | "$$($1_DATADIR)" | * ||\
       
   210     find-ar   | "$$($1_DATADIR)" | * ||\
       
   211     touch     | __find__ | $$($1_TOUCH) |)\
       
   212   echo-q | Creating $$($1_TITLE) FAT image |\
       
   213   $$(call iif,$$(USE_SOSUDA),$$(BUILD_ROFSBLDFAT),\
       
   214     $$(call iif,$$(USE_FSIMAGE),$$(BUILD_FSIMAGE),\
       
   215       $$(call iif,$$(USE_FILEDISK),$$(BUILD_FILEDISK),$$(BUILD_WINIMAGE))))
       
   216 
       
   217 REPORT_$1 =\
       
   218   $$($1_TITLE) dir   | $$($1_DIR) | d |\
       
   219   $$($1_TITLE) image | $$($1_IMG) | f
       
   220 
       
   221 #==============================================================================
       
   222 # FAT post-build
       
   223 
       
   224 CLEAN_$1POST  =
       
   225 BUILD_$1POST  =
       
   226 REPORT_$1POST =
       
   227 
       
   228 #==============================================================================
       
   229 # Empty FAT
       
   230 
       
   231 CLEAN_$1EMPTY = del | "$$($1EMPTY_IMG)"
       
   232 BUILD_$1EMPTY = $$(if $$($1EMPTY_CMD),\
       
   233   echo-q | Creating $$($1EMPTY_TITLE) FAT image |\
       
   234   mkdir  | "$$($1_DIR)" |\
       
   235   cmd    | $$($1EMPTY_CMD))
       
   236 
       
   237 REPORT_$1EMPTY = $$($1EMPTY_TITLE) image | $$($1EMPTY_IMG) | f
       
   238 
       
   239 #==============================================================================
       
   240 # FAT steps
       
   241 
       
   242 SOS.$1.STEPS =\
       
   243   $$(call iif,$$(SKIPPRE),,$$(and $$(filter $3,$$(USE_VARIANTBLD)),$$(call true,$$(USE_CONE)),CONEGEN RESTART) $1PRE)\
       
   244   $$(call iif,$$(SKIPBLD),,$1) $$(call iif,$$(SKIPPOST),,$1POST)
       
   245 
       
   246 SOS.$1EMPTY.STEPS = $$(if $$(BUILD_$1EMPTY),$1EMPTY)
       
   247 
       
   248 ALL.$1.STEPS      = $$(SOS.$1.STEPS)
       
   249 ALL.$1EMPTY.STEPS = $$(SOS.$1EMPTY.STEPS)
       
   250 
       
   251 #==============================================================================
       
   252 # Targets
       
   253 
       
   254 .PHONY: $2 $2-cone $2-image $2-pre $2empty $2empty-image variant$2
       
   255 
       
   256 $2 $2%  : IMAGE_TYPE = $1
       
   257 
       
   258 $2      : ;@$$(call IMAKER,$$$$(ALL.$1.STEPS))
       
   259 $2-image: ;@$$(call IMAKER,$$$$(SOS.$1.STEPS))
       
   260 $2-cone : ;@$$(call IMAKER,CONEGEN)
       
   261 $2-pre  : ;@$$(call IMAKER,$1PRE)
       
   262 
       
   263 $2empty      : ;@$$(call IMAKER,$$$$(ALL.$1EMPTY.STEPS))
       
   264 $2empty-image: ;@$$(call IMAKER,$$$$(SOS.$1EMPTY.STEPS))
       
   265 
       
   266 variant$2 variant$2%     : USE_CONE = 0
       
   267 variant$2 variant$2% $2_%: USE_VARIANTBLD = $3
       
   268 variant$2 variant$2% $2_%: $2$$(TARGETEXT) ;
       
   269 
       
   270 #==============================================================================
       
   271 # Helps
       
   272 
       
   273 $(call add_help,$2,t,Create $$($1_TITLE) image.)
       
   274 $(call add_help,$2-dir,t,Create directory structure for $$($1_TITLE) creation.)
       
   275 $(call add_help,$2-image,t,Create $$($1_TITLE) image (.img) file.)
       
   276 $(call add_help,$2-pre,t,Run pre-step, create files etc. for $$($1_TITLE) creation.)
       
   277 $(call add_help,variant$2,t,Create $$($1_TITLE) image from a variant directory. Be sure to define the VARIANT_DIR.)
       
   278 
       
   279 BUILD_HELPDYNAMIC +=\
       
   280   $$(call add_help,$$(call getlastdir,$$(wildcard $$($1_VARROOT)/$2_*/)),t,$$($1_TITLE) variant target.)\
       
   281   $$(eval include $$(wildcard $$($1_VARROOT)/$2_*/$$(VARIANT_MKNAME)))
       
   282 
       
   283 endef # FAT_EVAL
       
   284 
       
   285 
       
   286 ###############################################################################
       
   287 #
       
   288 
       
   289 $(eval $(call FAT_EVAL,EMMC,emmc,e))
       
   290 $(eval $(call FAT_EVAL,MCARD,mcard,m))
       
   291 $(eval $(call FAT_EVAL,UDA,uda,u))
       
   292 
       
   293 $(call includechk,$(addprefix $(IMAKER_DIR)/imaker_,emmc.mk memcard.mk uda.mk))
       
   294 
       
   295 
       
   296 # END OF IMAKER_FAT.MK