編譯 Android 原始碼

下載 Android Source Code

http://source.android.com/source/download.html

在 Setting up your machine 這裡
有教你怎麼設定好你的環境

假設大家都下載安裝好 ubuntu10.10 了
還沒下載請到這

http://www.ubuntu-tw.org/modules/tinyd0/

但是在新的版本中,預設 apt 都是裝 JDK6
但是我們看到 google 說要用 JDK5 來編

所以增加一下其他的位址
編輯 sources.list

vi /etc/apt/sources.list

加入以下兩行

deb http://us.archive.ubuntu.com/ubuntu jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu jaunty-updates multiverse

讓apt更新一下

apt-get update

現在可以裝 JDK5 了

apt-get install sun-java5-jdk sun-java5-plugin

接下來我們在按造 google 步驟

apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev

你有可能用 valgrind 來找安全性問題,我們有裝一下

apt-get install valgrind

接下來請把載回來的 android 原始碼解壓縮
進去 make,今天如果你的電腦是多 CPU 記得加個 j,如範例 -j 雙核心

make -j(核心數)

make -j2

編譯 Android Source Code

等等等…,現在一般的個人電腦大概要編 4 小時
差一點的可能會多很多我用舊筆電跑 12 小時
完以後在 /android_22/out/target/product/generic
會看到以下三個檔案

ramdisk.img
system.img
userdata.img

請將這3個檔案複製到你的 Android SDK
像我自己從android-8複製了一個 android-9
在把以下路徑的3個img換掉

C:\Labs\Android\AndroidSDK\platforms\android-9\images

你在開發時就可以使用自己編的 android 了
切來切去有點煩,全部改 Linux 開發好了

62 comments

  1. Hey! This is my first visit to your blog!
    We are a team of volunteers and starting a new project in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done
    a wonderful job!

  2. Appreciating the commitment you put into your website and in depth information you offer.
    It’s great to come across a blog every once in a while that isn’t the same old rehashed
    information. Excellent read! I’ve saved your site and I’m adding
    your RSS feeds to my Google account.

  3. Great blog! Do you have any tips for aspiring writers?
    I’m planning to start my own site soon but I’m a little
    lost on everything. Would you suggest starting with a free
    platform like WordPress or go for a paid option? There are so many choices out there that I’m totally confused ..
    Any recommendations? Thanks a lot!

  4. My developer is trying to persuade me to move to .net from PHP.
    I have always disliked the idea because of the costs.
    But he’s tryiong none the less. I’ve been using Movable-type on various websites for about a year and am anxious about switching to another platform.

    I have heard great things about blogengine.net. Is there a
    way I can transfer all my wordpress content into it?
    Any help would be really appreciated!

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

*