zoukankan      html  css  js  c++  java
  • 第四章

    第四章

    本章主要介绍了如何下载和编译Android源代码和Linux内核源代码。

    下载、编译和测试Android源代码:

    1)配置Android源代码下载环境:

    创建用于存放脚本文件的目录

    # mkdir ~/bin

    # PATH=~/bin:$PATH

    下载repo脚本文件

    # curl http://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~bin/repo

    # chmod a+x ~/bin/repo

    创建用于存放Android源代码的目录

    # mkdir android_source

    #cd android_source

    初始化

    # repo init -u https://android.googlesource.com/platform/mainfest 

    开始下载Android源代码

    # repo sync

    (2)Android源代码目录结构解析

    这些目录分别存放了Android源代码的不同子项目

    (3)下载Android源代码中的一部分

    下载Android源代码中的某个子项目有两种方法:

    repo sync命令# repo sync platform/bootable/recovery

    git clone命令git clone http://android.googlesource.com/<project name> 

    (4)编译Android源代码 

    初始化编译环境

    # source build/envsetup.sh

    选择目标

    # lunch full-eng

    编译Android源代码

    # make

    # make -j4

    (5)out目录结构分析

    (6)将自己的APK作为Android内置程序发布

    (7)用模拟器测试system.img文件

    下载和编译Linux内核源代码

    (1)下载Linux内核源代码

    # git clone https://android.googlesource.com/kernel/common.git 

    # git branch -a 

    # git checkout -b android-3.0 remotes/origin/android-3.0

    # git clone https://android.googlesource.com/kernel/goldfish.git

    # git checkout -b android-goldfish-2.6.29 remotes/origin/android-goldfish-2.6.29

    (2)Linux内核源代码的目录结构

    (3)安装Android内核的编译环境

    安装交叉编译器

    准备工作:

    arm-linux-gcc-4.3.2.tgz文件和arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2文件复制到工作目录

    解压编译器:

    # tar zxvf arm-linux-gcc-4.3.2.tgz -C /

    # tar jxvf arm-none-linux-gnueabi-arm-2008q3-72-for-linux.tar.bz2 -C/

    验证交叉编译器是否安装成功:

    # ls /usr/local/arm -l

    安装libncurses5

    # apt-get install libncurses5 -dev

    (4)配置和编译Linux内核

    #export PATH=/root/comppilers/arm-none-linux-gnueabi/bin:$PATH

  • 相关阅读:
    Notes of the scrum meeting(12.7)
    Notes of the scrum meeting(12.5)
    事后分析报告(M1阶段)
    锁屏软件发布说明
    Android 锁屏软件MemoryDebris测试报告
    锁屏软件功能介绍
    Notes of the scrum meeting(11/4)
    Notes of the scrum meeting(11/3)
    Notes of the scrum meeting(11/2)
    SCRUM 12.17
  • 原文地址:https://www.cnblogs.com/BJBLOG/p/5439107.html
Copyright © 2011-2022 走看看