Home | History | Annotate | Download | only in porting
      1 page.title=Configuring a New Product
      2 pdk.version=1.0
      3 doc.type=porting
      4 @jd:body
      5 
      6 
      7 
      8 <div id="qv-wrapper">
      9 <div id="qv">
     10 <h2>In this document</h2>
     11 <a name="toc"/>
     12 <ul>
     13 <li><a href="#androidOHDPortingDeviceBuildingProcess">Detailed Instructions</a></li>
     14 <li><a href="#androidBuildNewFileTree">New Product File Tree</a></li>
     15 <li><a href="#androidBuildSystemProductDefFiles">Product Definition Files</a></li>
     16 </ul>
     17 </div>
     18 </div>
     19 
     20 
     21 <a name="androidOHDPortingDeviceBuildingProcess"></a><h3>Detailed Instructions</h3>
     22 
     23 <p>The steps below describe how to configure makefiles for new mobile devices and products running Android.</p>
     24 <ol>
     25   <li>Create a company directory in <code>//vendor/</code>.<br/>
     26   <pre class="prettyprint">
     27   mkdir vendor/&lt;company_name&gt;</pre></li>
     28   <li>Create a <code>products</code> directory beneath the company directory you created in step 1.<BR>
     29   <pre class="prettyprint">
     30   mkdir vendor/&lt;company_name&gt;/products/</pre></li>
     31   <li>Create a product-specific makefile, called <code>vendor/&lt;company_name&gt;/products/&lt;first_product_name&gt;.mk</code>, that includes at least the following code:<BR>
     32     <pre class="prettyprint">
     33   $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
     34   #
     35   # Overrides
     36   PRODUCT_NAME := &lt;first_product_name&gt;
     37   PRODUCT_DEVICE := &lt;board_name&gt;</pre>
     38   <li>
     39   Additional product-specific variables can be added to this <a href="#androidBuildSystemProductDefFiles">Product Definition</a> 
     40 file.
     41   </li>
     42   <li>In the <code>products</code> directory, create an <code>AndroidProducts.mk</code> file that point to (and is responsible for finding) the individual product make files.<BR>
     43   <pre class="prettyprint">
     44   #
     45   # This file should set PRODUCT_MAKEFILES to a list of product makefiles
     46   # to expose to the build system.  LOCAL_DIR will already be set to
     47   # the directory containing this file. 
     48   #
     49   # This file may not rely on the value of any variable other than
     50   # LOCAL_DIR; do not use any conditionals, and do not look up the
     51   # value of any variable that isn't set in this file or in a file that
     52   # it includes.
     53   #
     54   
     55   PRODUCT_MAKEFILES := \
     56     $(LOCAL_DIR)/first_product_name.mk \</pre></li>
     57   <li>Create a board-specific directory beneath your company directory that matches the <code>PRODUCT_DEVICE</code> variable <code>&lt;board_name&gt;</code> referenced in the product-specific make file above. This will include a make file that gets accessed by any product using this board.<BR>
     58   <pre class="prettyprint">
     59   mkdir vendor/&lt;company_name&gt;/&lt;board_name&gt;</pre></li>
     60     <li>Create a <code>BoardConfig.mk</code> file in the directory created in the previous step (<code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code>). <BR>
     61   <pre class="prettyprint">
     62   # These definitions override the defaults in config/config.make for &lt;board_name&gt;
     63   #
     64   # TARGET_NO_BOOTLOADER := false
     65   #
     66   TARGET_USE_GENERIC_AUDIO := true</pre></li>  
     67   <li>If you wish to modify system properties, create a <code>system.prop</code> file in your <code>&lt;board_name&gt;</code> directory(<code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code>).<BR>
     68   <pre class="prettyprint">
     69   # system.prop for <board_name>
     70   # This overrides settings in the products/generic/system.prop file
     71   #
     72   # rild.libpath=/system/lib/libreference-ril.so
     73   # rild.libargs=-d /dev/ttyS0</pre></li>   
     74   <li>Add a pointer to <code>&lt;second_product_name&gt;.mk</code> within <code>products/AndroidProducts.mk</code>.<BR>
     75   <pre class="prettypring">
     76   PRODUCT_MAKEFILES := \
     77     $(LOCAL_DIR)/first_product_name.mk \
     78     $(LOCAL_DIR)/second_product_name.mk</pre></li>
     79   <li>An <code>Android.mk</code> file must be included in <code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code> with at least the following code:<BR>
     80   <pre class="prettyprint">
     81   # make file for new hardware <board_name> from <company_name>
     82   #
     83   LOCAL_PATH := $(call my-dir)
     84   #
     85   # this is here to use the pre-built kernel
     86   ifeq ($(TARGET_PREBUILT_KERNEL),)
     87   TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
     88   endif
     89   #
     90   file := $(INSTALLED_KERNEL_TARGET)
     91   ALL_PREBUILT += $(file)
     92   $(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
     93 		$(transform-prebuilt-to-target)
     94   #
     95   # no boot loader, so we don't need any of that stuff..  
     96   #
     97   LOCAL_PATH := vendor/&lt;company_name&gt;/&lt;board_name&gt;
     98   #
     99   include $(CLEAR_VARS)
    100   #
    101   # include more board specific stuff here? Such as Audio parameters.      
    102   #</pre>
    103 
    104   </li>
    105 <li>To create a second product for the same board, create a second product-specific make file called <code>vendor/company_name/products/&lt;second_product_name&gt;.mk</code> that includes:<BR>
    106 <pre class="prettyprint">
    107   $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
    108   #
    109   # Overrides
    110   PRODUCT_NAME := &lt;second_product_name&gt;
    111   PRODUCT_DEVICE := &lt;board_name&gt;</pre></li>   	
    112 </ol>
    113 <p>By now, you should have two new products, called <code>&lt;first_product_name&gt;</code> and <code>&lt;second_product_name&gt;</code> associated with <code>&lt;company_name&gt;</code>. To verify that a product is properly configured (<code>&lt;first_product_name&gt;</code>, for example), execute the following:<BR>
    114 <pre class="prettyprint">
    115   . build/envsetup.sh
    116   make PRODUCT-&lt;first_product_name&gt;-user
    117 </pre>
    118 <p>You should find new build binaries located in <code>/out/target/product/&lt;board_name&gt;</code>.
    119 
    120 
    121 <a name="androidBuildNewFileTree"></a><h3>New Product File Tree</h3>
    122 
    123 <p>The file tree below illustrates what your own system should look like after completing the steps above.</p>
    124 <p>
    125 <ul>
    126   <li><code>&lt;company_name&gt;</code></li>
    127   <ul>
    128     <li><code>&lt;board_name&gt;</code></li>
    129     <ul>
    130       <li><code>Android.mk</code></li>
    131       <li><code>product_config.mk</code></li>
    132       <li><code>system.prop</code></li>
    133     </ul>
    134     <li><code>products</code></li>
    135     <ul>
    136       <li><code>AndroidProducts.mk</code></li>
    137       <li><code>&lt;first_product_name&gt;.mk</code></li>
    138       <li><code>&lt;second_product_name&gt;.mk</code></li>
    139     </ul>
    140   </ul>
    141 </ul>
    142 </p>
    143 
    144 <a name="androidBuildSystemProductDefFiles"></a><h3>Product Definition Files</h3>
    145 
    146 <p>Product-specific variables are defined in product definition files. A product definition file can inherit from other product definition files, thus reducing the need to copy and simplifying maintenance.</p>
    147 <p>Variables maintained in a product definition files include:</p>
    148 <p>
    149 <table border=1 cellpadding=2 cellspacing=0>
    150  <tbody><tr>
    151   <th scope="col">Parameter</th>
    152   <th scope="col">Description</th>
    153   <th scope="col">Example</th>
    154  </tr>
    155  <tr>
    156    <td valign="top">PRODUCT_NAME</td>
    157    <td valign="top">End-user-visible name for the overall product. Appears in the "About the phone" info.</td>
    158    <td valign="top"></td>
    159  </tr>
    160  <tr>
    161    <td valign="top">PRODUCT_MODEL</td>
    162    <td valign="top">End-user-visible name for the end product</td>
    163    <td valign="top"></td>
    164  </tr>
    165  <tr>
    166    <td valign="top">PRODUCT_LOCALES</td>
    167    <td valign="top">A space-separated list of two-letter language code, two-letter country code pairs that describe several settings for the user, such as the UI language and time, date and currency formatting. The first locale listed in PRODUCT_LOCALES is is used if the locale has never been set before.</td>
    168    <td valign="top"><code>en_GB de_DE es_ES fr_CA</code></td>
    169  </tr>
    170  <tr>
    171    <td valign="top">PRODUCT_PACKAGES</td>
    172    <td valign="top">Lists the APKs to install.</td>
    173    <td valign="top"><code>Calendar Contacts</code></td>
    174  </tr>
    175  <tr>
    176    <td valign="top">PRODUCT_DEVICE</td>
    177    <td valign="top">Name of the industrial design</td>
    178    <td valign="top"><code>dream</code></td>
    179  </tr>
    180  <tr>
    181    <td valign="top">PRODUCT_MANUFACTURER</td>
    182    <td valign="top">Name of the manufacturer</td>
    183    <td valign="top"><code>acme</code></td>
    184  </tr>
    185  <tr>
    186    <td valign="top">PRODUCT_BRAND</td>
    187    <td valign="top">The brand (e.g., carrier) the software is customized for, if any</td>
    188    <td valign="top"></td>
    189  </tr>
    190  <tr>
    191    <td valign="top">PRODUCT_PROPERTY_OVERRIDES</td>
    192    <td valign="top">List of property assignments in the format "key=value"</td>
    193    <td valign="top"></td>
    194  </tr>
    195  <tr>
    196    <td valign="top">PRODUCT_COPY_FILES</td>
    197    <td valign="top">List of words like <code>source_path:destination_path</code>. The file at the source path should be copied to the destination path when building this product. The rules for the copy steps are defined in config/Makefile</td>
    198    <td valign="top"></td>
    199  </tr>
    200  <tr>
    201    <td valign="top">PRODUCT_OTA_PUBLIC_KEYS</td>
    202    <td valign="top">List of OTA public keys for the product</td>
    203    <td valign="top"></td>
    204  </tr>
    205  <tr>
    206    <td valign="top">PRODUCT_POLICY</td>
    207    <td valign="top">Indicate which policy this product should use</td>
    208    <td valign="top"></td>
    209  </tr>
    210  <tr>
    211    <td valign="top">PRODUCT_PACKAGE_OVERLAYS</td>
    212    <td valign="top">Indicate whether to use default resources or add any product specific overlays</td>
    213    <td valign="top"><code>vendor/acme/overlay</code></td>
    214  </tr>
    215  <tr>
    216    <td valign="top">PRODUCT_CONTRIBUTORS_FILE</td>
    217    <td valign="top">HTML file containing the contributors to the project.</td>
    218    <td valign="top"></td>
    219  </tr>
    220  <tr>
    221    <td valign="top">PRODUCT_TAGS</td>
    222    <td valign="top">list of space-separated words for a given product</td>
    223    <td valign="top"></td>
    224  </tr>
    225 </table>
    226 
    227 </P>
    228 <p>The snippet below illustrates a typical product definition file.</p>
    229 <pre class="prettyprint">
    230 $(call inherit-product, build/target/product/generic.mk)
    231 
    232 #Overrides
    233 PRODUCT_NAME := MyDevice
    234 PRODUCT_MANUFACTURER := acme
    235 PRODUCT_BRAND := acme_us
    236 PRODUCT_LOCALES := en_GB es_ES fr_FR
    237 PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay
    238 
    239 </pre>
    240 
    241 
    242