android源码编译图文说明

本文详细介绍了如何在Ubuntu 10.04上搭建Android系统的编译环境,并提供了具体的步骤来安装必要的软件和依赖库。此外,还展示了如何配置Java环境、安装相关依赖库以及编译Android源码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

                      android系统编译可以分为两部分:一是Linux内核编译,令一部分是android源码编译。首先我们来搭建编译系统环境。编译系统环境是ubuntu-10.04.4-desktop-amd64.iso。该镜像文件可以从ubuntu的官方网站上去下载。

安装编译依赖库:

          1、安装sun-java6-jkd

从 下载http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html,下载完之后进行安装:      

root@ftips-laptop:/home/ftips# ls tmp/jdk-6u32-linux-x64.bin 
tmp/jdk-6u32-linux-x64.bin

安装

root@ftips-laptop:/home/ftips# ./tmp/jdk-6u32-linux-x64.bin 

         配置Java环境:/ect/environment 文件

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/jdk1.6/bin"

执行

root@ftips-laptop:/home/ftips# source /etc/environment 

测试是否安装成功:

root@ftips-laptop:/home/ftips# javac
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files 
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

说明我们配置是没有问题的,下面继续操作。

安装相关的依赖库:

64位系统:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev 
编译android源码:

    执行source build/envsetup.sh 

root@ftips-laptop:/home/ftips/tmp/Android# source build/envsetup.sh 
including device/htc/passion/vendorsetup.sh
including device/samsung/crespo/vendorsetup.sh
   执行 lunch:

root@ftips-laptop:/home/ftips/tmp/Android# lunch

You're building on Linux

Lunch menu... pick a combo:
     1. generic-eng
     2. simulator
     3. full_passion-userdebug
     4. full_crespo-userdebug

Which would you like? [generic-eng] 1

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=2.3.3
TARGET_PRODUCT=generic
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=GRI40
============================================

开始编译,需要漫长的等待

root@ftips-laptop:/home/ftips/tmp/Android# make -j8

编译成功之后,我们就会看到我们需要的几个文件

root@ftips-laptop:/home/ftips/tmp/Android# ls -la out/target/product/generic/
total 108176
drwxr-xr-x  7 root root     4096 2013-09-14 08:59 .
drwxr-xr-x  3 root root     4096 2013-09-13 15:01 ..
-rw-r--r--  1 root root        7 2013-09-13 15:04 android-info.txt
-rw-r--r--  1 root root     3876 2013-09-14 09:09 clean_steps.mk
drwxr-xr-x  3 root root     4096 2013-09-13 15:45 data
-rw-r--r--  1 root root    16041 2013-09-14 06:58 installed-files.txt
drwxr-xr-x 14 root root     4096 2013-09-14 06:58 obj
-rw-r--r--  1 root root       50 2013-09-14 09:09 previous_build_config.mk
-rw-r--r--  1 root root   146641 2013-09-13 17:22 ramdisk.img
drwxr-xr-x  8 root root     4096 2013-09-13 17:21 root
drwxr-xr-x  5 root root     4096 2013-09-13 17:21 symbols
drwxr-xr-x 10 root root     4096 2013-09-13 17:30 system
-rw-------  1 root root 68536512 2013-09-14 09:11 system.img
-rw-------  1 root root  1482624 2013-09-13 15:46 userdata.img
-rw-------  1 root root 40541916 2013-09-14 08:58 userdata-qemu.img

执行 emulator 就会看到android的模拟器开始运行了

android源码编译部分到此就结束了,有关Linux内核编译请看下一小节。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值