编译Android donut

编译 Android 代码

 

Type the following command to install it:

  $ tar -xvzf Android_PlatformRel_Linux_MHLV_2010WW05.tgz -C [installed_directory]

 

Building Android

Download android donut release into [Android_directory]

  $ repo init -u git://android.git.kernel.org/platform/manifest -b donut

  $ repo sync

Notes: please refer manifest file of [installed_directory]/pxa_donut/src/donut/manifest.xml

 

Apply PXA patches by following command

  $ cp [installed_directory]/pxa_donut/src/donut/donut_patches/* [Android_directory]/ -rf

  $ cd [Android_directory]/

  $ ./apply_donut_patches.sh

  $ tar zxvf [installed_directory]/pxa_donut/src/donut/vendor.tgz -C [Android_directory]/

 

如果之前装了 java6 sdk ,但编译 Android 需要 jdk5 ,所以先把 Java6 屏蔽掉。

lua@ubuntu:~$ ls /usr/bin/j*

/usr/bin/java     /usr/bin/javaws    /usr/bin/jexec       /usr/bin/jockey-text

/usr/bin/java_vm  /usr/bin/jcontrol  /usr/bin/jockey-gtk  /usr/bin/join

lua@ubuntu:~$ sudo mv /usr/bin/java /usr/bin/java.bak

lua@ubuntu:~$ sudo mv /usr/bin/javaws /usr/bin/javaws.bak

lua@ubuntu:~$ sudo mv /usr/bin/java_vm /usr/bin/java_vm.bak

lua@ubuntu:~$ ls /usr/bin/j*

/usr/bin/java.bak     /usr/bin/jcontrol    /usr/bin/jockey-text

/usr/bin/java_vm.bak  /usr/bin/jexec       /usr/bin/join

/usr/bin/javaws.bak   /usr/bin/jockey-gtk

 

比如 jdk-1_5_0_21-linux-i586.bin 放到如下目录

/home/lua/Downloads

shell 窗口执行 sh jdk-1_5_0_21-linux-i586.bin

jdk5 将安装到 /home/lua/Downloads/jdk1.5.0_21

/home/lua/Downloads/jdk1.5.0_21/bin 添加到 PATH

lua@ubuntu:~$ echo $PATH

/home/lua/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/lua/arm-marvell-linux-gnueabi/bin:/home/lua/bin:/home/lua/work/android-sdk-linux_86/tools:/home/lua/work/eclipse:/home/lua/Downloads/jdk1.5.0_21/bin

 

测试 Java ,系统能找到 java 且版本正确。

lua@ubuntu:~$ which java

/home/lua/Downloads/jdk1.5.0_21/bin/java

lua@ubuntu:~$ which javac

/home/lua/Downloads/jdk1.5.0_21/bin/javac

lua@ubuntu:~$ java -version

java version "1.5.0_21"

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_21-b01)

Java HotSpot(TM) Client VM (build 1.5.0_21-b01, mixed mode, sharing)

lua@ubuntu:~$ javac -version

javac 1.5.0_21

 

编译 donut 代码

lua@ubuntu:~$ cd donut/

lua@ubuntu:~/donut$ ls

apply_donut_patches.sh   build          external    out         prebuilt

apply_donut_patches.sh~  dalvik         frameworks  packages    system

bionic                   development    hardware    patch.log   vendor

bootable                 donut_patches  Makefile    patch.log~  vendor.tgz

lua@ubuntu:~/donut$ . build/envsetup.sh

lua@ubuntu:~/donut$ choosecombo

Build for the simulator or the device?

     1. Device

     2. Simulator

 

Which would you like? [1]

 

 

Build type choices are:

     1. release

     2. debug

 

Which would you like? [1]

 

 

Which product would you like? [generic] littleton

 

 

Variant choices are:

     1. user

     2. userdebug

     3. eng

Which would you like? [eng] user

 

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

PLATFORM_VERSION_CODENAME=Donut

PLATFORM_VERSION=Donut

TARGET_PRODUCT=littleton

TARGET_BUILD_VARIANT=user

TARGET_SIMULATOR=false

TARGET_BUILD_TYPE=release

TARGET_ARCH=arm

HOST_ARCH=x86

HOST_OS=linux

HOST_BUILD_TYPE=release

BUILD_ID=Donut

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

如果是四核 CPU ,把虚拟机配置为 4 核,效率会提高 ( 需要关闭系统,然后设置 )

lua@ubuntu:~/donut$ make -j4

 

 

<!-- [endif]-->编译 Android Linux 内核

解压 linux kernel

$tar zxvf [installed_directory]/pxa_donut/src/linux-2.6.29-patches/base/linux-2.6.29.tgz -C [Android_directory]

 

打上 marvell patch

$ cd [installed_directory]/pxa_donut/src/linux-2.6.29-patches/patches/

$ ./apply_kernel_patch.sh [Android_directory]/linux-2.6.29

 

进入 linux kernel 目录

$ cd [Android_directory]/linux-2.6.29

$ cp [Android_directory]/out/target/product/littleton/root root –a

 

要先将 arm-eabi-gcc 的路径添加到环境变量 PATH ,如果 Platform 的版本为: Android_PlatformRel_Linux_MHLV_2010WW05 则其 arm-eabi-gcc 的路径为 /donut/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin

$ export ARCH=arm

$ export CROSS_COMPILE=arm-eabi-

 

配置编译选项

$ make pxa3xx_android_defconfig

 

编译

$ make zImage

 

最终产生目标文件

After a short while, the binaries will be generated under arch/arm/boot/zImage

 

你可能感兴趣的:(java,android,linux,ubuntu,lua)