• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Configuring a New Product
2pdk.version=1.0
3doc.type=guide
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>
40file.
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  # TARGET_HARDWARE_3D := false
66  #
67  TARGET_USE_GENERIC_AUDIO := true</pre></li>
68  <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>
69  <pre class="prettyprint">
70  # system.prop for <board_name>
71  # This overrides settings in the products/generic/system.prop file
72  #
73  # rild.libpath=/system/lib/libreference-ril.so
74  # rild.libargs=-d /dev/ttyS0</pre></li>
75  <li>Add a pointer to <code>&lt;second_product_name&gt;.mk</code> within <code>products/AndroidProducts.mk</code>.<BR>
76  <pre class="prettypring">
77  PRODUCT_MAKEFILES := \
78    $(LOCAL_DIR)/first_product_name.mk \
79    $(LOCAL_DIR)/second_product_name.mk</pre></li>
80  <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>
81  <pre class="prettyprint">
82  # make file for new hardware <board_name> from <company_name>
83  #
84  LOCAL_PATH := $(call my-dir)
85  #
86  # this is here to use the pre-built kernel
87  ifeq ($(TARGET_PREBUILT_KERNEL),)
88  TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
89  endif
90  #
91  file := $(INSTALLED_KERNEL_TARGET)
92  ALL_PREBUILT += $(file)
93  $(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
94		$(transform-prebuilt-to-target)
95  #
96  # no boot loader, so we don't need any of that stuff..
97  #
98  LOCAL_PATH := vendor/&lt;company_name&gt;/&lt;board_name&gt;
99  #
100  include $(CLEAR_VARS)
101  #
102  # include more board specific stuff here? Such as Audio parameters.
103  #</pre>
104
105  </li>
106<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>
107<pre class="prettyprint">
108  $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
109  #
110  # Overrides
111  PRODUCT_NAME := &lt;second_product_name&gt;
112  PRODUCT_DEVICE := &lt;board_name&gt;</pre></li>
113</ol>
114<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>
115<pre class="prettyprint">
116  . build/envsetup.sh
117  make PRODUCT-&lt;first_product_name&gt;-user
118</pre>
119<p>You should find new build binaries located in <code>/out/target/product/&lt;board_name&gt;</code>.
120
121
122<a name="androidBuildNewFileTree"></a><h3>New Product File Tree</h3>
123
124<p>The file tree below illustrates what your own system should look like after completing the steps above.</p>
125<p>
126<ul>
127  <li><code>&lt;company_name&gt;</code></li>
128  <ul>
129    <li><code>&lt;board_name&gt;</code></li>
130    <ul>
131      <li><code>Android.mk</code></li>
132      <li><code>product_config.mk</code></li>
133      <li><code>system.prop</code></li>
134    </ul>
135    <li><code>products</code></li>
136    <ul>
137      <li><code>AndroidProducts.mk</code></li>
138      <li><code>&lt;first_product_name&gt;.mk</code></li>
139      <li><code>&lt;second_product_name&gt;.mk</code></li>
140    </ul>
141  </ul>
142</ul>
143</p>
144
145<a name="androidBuildSystemProductDefFiles"></a><h3>Product Definition Files</h3>
146
147<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>
148<p>Variables maintained in a product definition files include:</p>
149<p>
150<table border=1 cellpadding=2 cellspacing=0>
151 <tbody><tr>
152  <th scope="col">Parameter</th>
153  <th scope="col">Description</th>
154  <th scope="col">Example</th>
155 </tr>
156 <tr>
157   <td valign="top">PRODUCT_NAME</td>
158   <td valign="top">End-user-visible name for the overall product. Appears in the "About the phone" info.</td>
159   <td valign="top"></td>
160 </tr>
161 <tr>
162   <td valign="top">PRODUCT_MODEL</td>
163   <td valign="top">End-user-visible name for the end product</td>
164   <td valign="top"></td>
165 </tr>
166 <tr>
167   <td valign="top">PRODUCT_LOCALES</td>
168   <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>
169   <td valign="top"><code>en_GB de_DE es_ES fr_CA</code></td>
170 </tr>
171 <tr>
172   <td valign="top">PRODUCT_PACKAGES</td>
173   <td valign="top">Lists the APKs to install.</td>
174   <td valign="top"><code>Calendar Contacts</code></td>
175 </tr>
176 <tr>
177   <td valign="top">PRODUCT_DEVICE</td>
178   <td valign="top">Name of the industrial design</td>
179   <td valign="top"><code>dream</code></td>
180 </tr>
181 <tr>
182   <td valign="top">PRODUCT_MANUFACTURER</td>
183   <td valign="top">Name of the manufacturer</td>
184   <td valign="top"><code>acme</code></td>
185 </tr>
186 <tr>
187   <td valign="top">PRODUCT_BRAND</td>
188   <td valign="top">The brand (e.g., carrier) the software is customized for, if any</td>
189   <td valign="top"></td>
190 </tr>
191 <tr>
192   <td valign="top">PRODUCT_PROPERTY_OVERRIDES</td>
193   <td valign="top">List of property assignments in the format "key=value"</td>
194   <td valign="top"></td>
195 </tr>
196 <tr>
197   <td valign="top">PRODUCT_COPY_FILES</td>
198   <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>
199   <td valign="top"></td>
200 </tr>
201 <tr>
202   <td valign="top">PRODUCT_OTA_PUBLIC_KEYS</td>
203   <td valign="top">List of OTA public keys for the product</td>
204   <td valign="top"></td>
205 </tr>
206 <tr>
207   <td valign="top">PRODUCT_POLICY</td>
208   <td valign="top">Indicate which policy this product should use</td>
209   <td valign="top"></td>
210 </tr>
211 <tr>
212   <td valign="top">PRODUCT_PACKAGE_OVERLAYS</td>
213   <td valign="top">Indicate whether to use default resources or add any product specific overlays</td>
214   <td valign="top"><code>vendor/acme/overlay</code></td>
215 </tr>
216 <tr>
217   <td valign="top">PRODUCT_CONTRIBUTORS_FILE</td>
218   <td valign="top">HTML file containing the contributors to the project.</td>
219   <td valign="top"></td>
220 </tr>
221 <tr>
222   <td valign="top">PRODUCT_TAGS</td>
223   <td valign="top">list of space-separated words for a given product</td>
224   <td valign="top"></td>
225 </tr>
226</table>
227
228</P>
229<p>The snippet below illustrates a typical product definition file.</p>
230<pre class="prettyprint">
231$(call inherit-product, build/target/product/generic.mk)
232
233#Overrides
234PRODUCT_NAME := MyDevice
235PRODUCT_MANUFACTURER := acme
236PRODUCT_BRAND := acme_us
237PRODUCT_LOCALES := en_GB es_ES fr_FR
238PRODUCT_PACKAGE_OVERLAYS := vendor/acme/overlay
239
240</pre>
241
242
243