129 lines
5.8 KiB
Plaintext
Executable File
129 lines
5.8 KiB
Plaintext
Executable File
page.title=Building Android for a new Mobile Device
|
|
pdk.version=1.0
|
|
@jd:body
|
|
|
|
|
|
|
|
<a name="toc"/>
|
|
<div style="padding:10px">
|
|
<a href="#androidOHDPortingDeviceBuildingProcess">Detailed Instructions</a><br/>
|
|
<a href="#androidBuildNewFileTree">New Product File Tree</a><br/></div></font></div>
|
|
|
|
<a name="androidOHDPortingDeviceBuildingProcess"></a><h2>Detailed Instructions</h2>
|
|
|
|
<p>The directions below describe how to configure make files for new mobile devices and products.</p>
|
|
<ol>
|
|
<li>Create a company directory in <code>//vendor/</code>.<br/>
|
|
<pre class="prettyprint">
|
|
mkdir vendor/<company_name></pre></li>
|
|
<li>Create a <code>products</code> directory beneath the company directory you created in step 1.<BR>
|
|
<pre class="prettyprint">
|
|
mkdir vendor/<company_name>/products/</pre></li>
|
|
<li>Create a product-specific make file, called <code>vendor/<company_name>/products/<first_product_name>.mk</code>, that includes the following code:<BR>
|
|
<pre class="prettyprint">
|
|
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
|
|
#
|
|
# Overrides
|
|
PRODUCT_NAME := <first_product_name>
|
|
PRODUCT_DEVICE := <board_name></pre></li>
|
|
<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>
|
|
<pre class="prettypring">
|
|
#
|
|
# This file should set PRODUCT_MAKEFILES to a list of product makefiles
|
|
# to expose to the build system. LOCAL_DIR will already be set to
|
|
# the directory containing this file.
|
|
#
|
|
# This file may not rely on the value of any variable other than
|
|
# LOCAL_DIR; do not use any conditionals, and do not look up the
|
|
# value of any variable that isn't set in this file or in a file that
|
|
# it includes.
|
|
#
|
|
|
|
PRODUCT_MAKEFILES := \
|
|
$(LOCAL_DIR)/first_product_name.mk \</pre></li>
|
|
<li>Create a board-specific directory beneath your company directory that matches the <code>PRODUCT_DEVICE</code> variable <code><board_name></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>
|
|
<pre class="prettyprint">
|
|
mkdir vendor/<company_name>/<board_name></pre></li>
|
|
<li>Create a <code>product_config.mk</code> file in the directory created in the previous step (<code>vendor/<company_name>/<board_name></code>). If this directory does not include a <code>product_config.mk</code> file, the build will fail.<BR>
|
|
<pre class="prettyprint">
|
|
# These definitions override the defaults in config/config.make for <board_name>
|
|
#
|
|
# TARGET_NO_BOOTLOADER := false
|
|
# TARGET_HARDWARE_3D := false
|
|
#
|
|
TARGET_USE_GENERIC_AUDIO := true</pre></li>
|
|
<li>If you wish to modify system properties, create a <code>system.prop</code> file in your <code><board_name></code> directory(<code>vendor/<company_name>/<board_name></code>).<BR>
|
|
<pre class="prettyprint">
|
|
# system.prop for <board_name>
|
|
# This overrides settings in the products/generic/system.prop file
|
|
#
|
|
# rild.libpath=/system/lib/libreference-ril.so
|
|
# rild.libargs=-d /dev/ttyS0</pre></li>
|
|
<li>Add a pointer to <code><second_product_name>.mk</code> within <code>products/AndroidProducts.mk</code>.<BR>
|
|
<pre class="prettypring">
|
|
PRODUCT_MAKEFILES := \
|
|
$(LOCAL_DIR)/first_product_name.mk \
|
|
$(LOCAL_DIR)/second_product_name.mk</pre></li>
|
|
<li><code>vendor/<company_name>/<board_name></code> must include an <code>Android.mk</code> file with at least the following code:<BR><BR>
|
|
<pre class="prettyprint">
|
|
# make file for new hardware <board_name> from <company_name>
|
|
#
|
|
LOCAL_PATH := $(call my-dir)
|
|
#
|
|
# this is here to use the pre-built kernel
|
|
ifeq ($(TARGET_PREBUILT_KERNEL),)
|
|
TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/kernel
|
|
endif
|
|
#
|
|
file := $(INSTALLED_KERNEL_TARGET)
|
|
ALL_PREBUILT += $(file)
|
|
$(file): $(TARGET_PREBUILT_KERNEL) | $(ACP)
|
|
$(transform-prebuilt-to-target)
|
|
#
|
|
# no boot loader, so we don't need any of that stuff..
|
|
#
|
|
LOCAL_PATH := vendor/<company_name>/<board_name>
|
|
#
|
|
include $(CLEAR_VARS)
|
|
#
|
|
# include more board specific stuff here? Such as Audio parameters.
|
|
#</pre></li>
|
|
<li>To create a second product for the same board, create a second product-specific make file called <code>vendor/company_name/products/<second_product_name>.mk</code> that includes:<BR>
|
|
<pre class="prettyprint">
|
|
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
|
|
#
|
|
# Overrides
|
|
PRODUCT_NAME := <second_product_name>
|
|
PRODUCT_DEVICE := <board_name></pre></li>
|
|
</ol>
|
|
<p>By now, you should have two new products, called <code><first_product_name></code> and <code><second_product_name></code> associated with <code><company_name></code>. To verify that a product is properly configured (<code><first_product_name></code>, for example), execute the following:<BR>
|
|
<pre class="prettyprint">
|
|
. build/envsetup.sh
|
|
make PRODUCT-<first_product_name>-user
|
|
</pre>
|
|
<p>You should find new build binaries located in <code>/out/target/product/<board_name></code>.
|
|
|
|
|
|
<a name="androidBuildNewFileTree"></a><h2>New Product File Tree</h2>
|
|
|
|
<p>The file tree below illustrates what your own system should look like after completing the steps above.</p>
|
|
<p>
|
|
<ul>
|
|
<li><code><company_name></code></li>
|
|
<ul>
|
|
<li><code><board_name></code></li>
|
|
<ul>
|
|
<li><code>Android.mk</code></li>
|
|
<li><code>product_config.mk</code></li>
|
|
<li><code>system.prop</code></li>
|
|
</ul>
|
|
<li><code>products</code></li>
|
|
<ul>
|
|
<li><code>AndroidProducts.mk</code></li>
|
|
<li><code><first_product_name>.mk</code></li>
|
|
<li><code><second_product_name>.mk</code></li>
|
|
</ul>
|
|
</ul>
|
|
</ul>
|
|
</p>
|