Rayeager PX2的源码 采用目前最新的Android 4.4.2_r1系统,系统编译环境搭建参考本章相关章节,请开发板用户尤其注意,PX2的编译与固件烧写等使用方法。
Rayeager 提供的Android源码是在Google原生Android的基础上加入PX2平台相关的优化后整合出来的。 Google Android源码的获取、编译,在谷歌官网上有比较详细的介绍,开发板用户可以直接参考谷歌官网的相关说明,搭建系统环境,获取和编译代码。
谷歌官网关于源码下载、编译的地址: https://source.android.com/source/building.html(需翻墙)
【为了方便国内同学,小编复制了原文内容: Downloading and Building
The Android build is routinely tested in-house on recent versions of Ubuntu LTS (14.04), but most distributions should have the required build tools available. We welcome reports of successes or failures on other distributions.
Before you download and build the Android source, ensure your system meets the following requirements:
A Linux or Mac system. It is also possible to build Android in a virtual machine on unsupported systems such as Windows. If you are running Linux in a virtual machine, you need at least 16GB of RAM/swap and 50GB or more of disk space in order to build the Android tree. See disk size requirements below. A 64-bit environment is required for Gingerbread (2.3.x) and newer versions, including the master branch. You can compile older versions on 32-bit systems. At least 50GB of free disk space for a checkout, 100GB for a single build, and 150GB or more for multiple builds. If you employ ccache, you will need even more space. Python 2.6 -- 2.7, which you can download from python.org. GNU Make 3.81 -- 3.82, which you can download from gnu.org, JDK 7 to build the master branch of Android in the Android Open Source Project (AOSP); JDK 6 to build Gingerbread through KitKat; JDK 5 for Cupcake through Froyo. See Initializing a Build Environment for installation instructions by operating system. Git 1.7 or newer. You can find it at git-scm.com.】
对于Rayeager提供的Android代码,请参考《PX2开发板开源代码获取》中的描述获取。
下载、编译Android源码,需要满足如下基本要求:
一台Linux或Mac主机。或者,window系统或其它OS中安装虚拟机也可以。如果在虚拟机中运行Linux,至少需要16G交换分区空间,30G或更多的磁盘空间来编译Android。
编译Gingerbread (2.3.x)或更新系统版本,需要64位系统;2.3之前的系统可以使用32位系统编译。
Android源码大小接近8.5G,单次编译需要约30G磁盘空间,完整编译需要100G或者更多。
Python 2.6或更新版本,可从python.org网站下载安装。
GNU Make 3.81或更新,可从gnu.org网站下载安装。
Git 1.7或更新。
谷歌推荐使用Ubuntu系统。Ubuntu 12.04系统,安装完后,可以查看如下版本信息:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.3 LTS
Release: 12.04
Codename: precise
2,编译代码
直接在工程根目录下执行make即可,可用-j参数指定多线程编译,加快编译速度。
先编译产品kernel,见如下命令: $ cd kernel
$ make rkpx2_4.4_lcd_defconfig //支持屏幕的内核镜像
$ make kernel.img
如果要编译带VGA功能的内核镜像,请配置
$ make rkpx2_4.4_vga_defconfig
在kerne/目录下生成kernel.img 上面的两个defconfig文件可以通过make help命令查看