step by step guide to building a custom android device

7
Step by Step Guide to Building a Custom Android Device In this document we will try explain how to build a custom android device. We assume that you already download the latest version of android. We used Ice Cream Sandwich ( 4.0.3 ) for this tutorial. 0. Create a working directory ics and download the latest source code to this directory. If you don’t know how to do that please check this page. 1. First of all we need a vendor directory in the ics directory. If it doesn't exists in the source directory you have to make it manually. droidos@ubuntu:~$ cd ics/ droidos@ubuntu:~/ics$ droidos@ubuntu:~/ics$ mkdir vendor 2. Now it's time to choose a company name. In this tutorial the company name will be ankara- gtug. mkdir vendor/<company_name> droidos@ubuntu:~/ics$ mkdir vendor/ankara-gtug 3. Create a “products” directory under the <company_name> directory. mkdir vendor/<company_name>/products droidos@ubuntu:~/ics$ mkdir vendor/ankara-gtug/products 4. In the vendor/<company_name>/products directory we have to create at least two file AndroidProducts.mk and <product-name>.mk. Let's create these two files. We chose droidos as a product name. touch vendor/<company_name>/products/A ndroidProducts.mk touch vendor/<company_name>/products/<produc t-name>.mk Gtug-Ankara Droidos Team - http ://www .ank ar a -gtug .org 1

Upload: ahmet-oguz-mermerkaya

Post on 06-Apr-2018

238 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 1/7

Step by Step Guide to Building a Custom Android Device

In this document we will try explain how to build a custom android device. We assume that you

already download the latest version of android.

We used Ice Cream Sandwich ( 4.0.3 ) for this tutorial.

0. Create a working directory ics and download the latest source code to this directory. If youdon’t know how to do that please check this page.

1. First of all we need a vendor directory in the ics directory. If it doesn't exists in the source

directory you have to make it manually.

droidos@ubuntu:~$ cd ics/

droidos@ubuntu:~/ics$

droidos@ubuntu:~/ics$ mkdir vendor 

2. Now it's time to choose a company name. In this tutorial the company name will be ankara-

gtug.mkdir vendor/<company_name>

droidos@ubuntu:~/ics$ mkdir vendor/ankara-gtug

3. Create a “products” directory under the <company_name> directory.

mkdir vendor/<company_name>/products

droidos@ubuntu:~/ics$ mkdir vendor/ankara-gtug/products

4. In the vendor/<company_name>/products directory we have to create at least two file

AndroidProducts.mk and <product-name>.mk. Let's create these two files. We chose droidos as

a product name.

touch vendor/<company_name>/products/AndroidProducts.mk

touch vendor/<company_name>/products/<product-name>.mk

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 1

Page 2: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 2/7

droidos@ubuntu:~/ics$ touch vendor/ankara-gtug/products/AndroidProducts.mk

droidos@ubuntu:~/ics$ touch vendor/ankara-gtug/products/droidos.mk

5. Edit the product-specific makefile, called <first_product_name>.mk in the

vendor/<company_name>/products directory, that includes at least the following code:

$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)

#

# Overrides

PRODUCT_NAME := <product_name>

PRODUCT_DEVICE := <board_name>

In this tutorial droidos.mk file includes these lines of codes.

$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)

PRODUCT_NAME := droidosPRODUCT_MODEL := droidos_model

PRODUCT_BRAND := droidos_brand

PRODUCT_MANUFACTURER := Ankara-GTUG

Here is the description of the parameters you can see in the <product-name>.mk file.

PRODUCT_NAME : End-user-visible name for the overall product. Appears in the "About the

phone" info.

PRODUCT_MODEL : End-user-visible name for the end product

PRODUCT_BRAND : The brand (e.g., carrier) the software is customized for, if anyPRODUCT_MANUFACTURER : Name of the manufacturer 

PRODUCT_PACKAGES : Lists the APKs to install.

PRODUCT_DEVICE : Name of the industrial design

6. Edit the AndroidProducts.mk file that is responsible for finding the individual product make

files.

#

# 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.

#

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 2

Page 3: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 3/7

PRODUCT_MAKEFILES := \

$(LOCAL_DIR)/<product_name>.mk \

Our product name is droidos. So AndroidProducts.mk file will be like that.

PRODUCT_MAKEFILES := \

$(LOCAL_DIR)/droidos.mk \

7. Check the vendor directory. Be sure that you create all of the sub directories and the required

make files.

droidos@ubuntu:~/ics$ ls -laR vendor/

vendor/:

drwxr-xr-x 3 droidos droidos 4096 2012-01-25 22:26 ankara-gtug

vendor/ankara-gtug:

drwxr-xr-x 2 droidos droidos 4096 2012-01-25 23:10 productsvendor/ankara-gtug/products:

-rw-r--r-- 1 droidos droidos 450 2012-01-25 23:10 AndroidProducts.mk

-rw-r--r-- 1 droidos droidos 185 2012-01-25 23:10 droidos.mk

droidos@ubuntu:~/ics$

8. Initialize the environment with the envsetup.sh script.

droidos@ubuntu:~/ics$ . build/envsetup.sh

9. Now we are ready to build our first android device.

make PRODUCT-<product-name>-user 

droidos@ubuntu:~/ics$ make -j4 PRODUCT-droidos-user 

This will take for a log time from 10 to 30 minutes depends on your computer.

After the building is finished check if the building the new device is successfully finished with

lunch command.

droidos@ubuntu:~/ics$ lunch droidos-user 

============================================

PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=4.0.3

TARGET_PRODUCT=droidos

TARGET_BUILD_VARIANT=user 

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 3

Page 4: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 4/7

HOST_ARCH=x86

HOST_OS=linux

HOST_BUILD_ TYPE=release

BUILD_ ID=IML74K

============================================

Be sure that you can see your <product_name> as TARGET_PRODUCT.

10. Start the emulator with emulator command.

droidos@ubuntu:~/ics$ emulator 

11. Check the model number.

Open the emulator and go to the Settings > About phone page. Check if you can see <model-

name>.

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 4

Page 5: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 5/7

12. We built our first Android device. Now we will add a custom application to our custom build.

Go back to the step 5 and these two lines of codes to the <produc-name>.mk file.

PRODUCT_PACKAGES := \

<Custom-Application-Name>

$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)

#

# Overrides

PRODUCT_NAME := <product_name>

PRODUCT_DEVICE := <board_name>

For this tutorial we created a simple Android application that is name HelloDroidOSAndroid.

This is the latest version of droidos.mk.

PRODUCT_PACKAGES := \HelloDroidOSAndroid

#PRODUCT_PACKAGES must be above the line below

$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)

PRODUCT_NAME := droidos

PRODUCT_MODEL := droidos_model

PRODUCT_BRAND := droidos_brand

PRODUCT_MANUFACTURER := Ankara-GTUG

13. Create an apps directory in the vendor/<company_name> directory.

mkdir vendor/<company_name>/apps

droidos@ubuntu:~/ics$ mkdir vendor/ankara-gtug/apps

14. Copy <Custom-Application-Name> directory to the vendor/<company_name>/apps

directory.

15. Build the devices same as step 9.

droidos@ubuntu:~/ics$ make -j4 PRODUCT-droidos-user 

16. Start the emulator 

droidos@ubuntu:~/ics$ . build/envsetup.sh

droidos@ubuntu:~/ics$ lunch droidos-user 

droidos@ubuntu:~/ics$ emulator 

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 5

Page 6: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 6/7

17. Check the application list and bu sure that your custom application is over there.

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 6

Page 7: Step by Step Guide to Building a Custom Android Device

8/3/2019 Step by Step Guide to Building a Custom Android Device

http://slidepdf.com/reader/full/step-by-step-guide-to-building-a-custom-android-device 7/7

References

1. Building the System

2. <android_source_directory>development/pdk/docs/porting/build_new_device.jd

Writers

A. Oğuz Mermerkaya

Software Engineer 

Olcay Ay

Software Design Engineer 

About GTUG Ankara

Who are we?

We are an Ankara-wide community interested in technology and willing to develop and share

information.

What is our interest in Google?

Google corporation devoted few employees to form a group aimed to discuss GoogleTechnologies; currently website and mailing list is in use. Google requires these technology

groups to make organizations and discuss Google Technologies. In addition, Google may hold

events at the location of group depending on member size. We formed Ankara branch of these

Google Technology User Groups.

What we plan to do?

Our aim is, to organize series of events that spreads current technologies, make participants

communicate with each other effectively and produce something with small working groups.

Furthermore information visit our web site .

Gtug-Ankara Droidos Team - http://www .ankara -gtug.org 7