Building Android

来自Firefly wiki
跳转至: 导航搜索

Preparation

To compile Android, requirement of PC is:

  • 64 bit CPU
  • 16GB physical memory + swap memory
  • 30GB free disk space to build. The source code tree take another 8GB space.

64 bit Ubuntu 12.04 is officially recommended. Yet newer 64 bit Linux OS is also supported, providing the requirements of software and hardware in http://source.android.com/source/building.html are met.

To initialize compiling environment, please reference http://source.android.com/source/initializing.html .

  • Install JDK 6:
   sudo add-apt-repository ppa:webupd8team/java
   sudo apt-get update
   sudo apt-get install oracle-java6-installer
  • Ubuntu 12.04 packages install:
sudo apt-get install git gnupg flex bison gperf build-essential \
 zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
 libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
 g++-multilib mingw32 tofrodos gcc-multilib ia32-libs \
 python-markdown libxml2-utils xsltproc zlib1g-dev:i386
  • Ubuntu 13.10/14.04 packages install:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev \
 libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl \
 libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils  \
 xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev \
 lib32readline-gplv2-dev gcc-multilib libswitch-perl
  • Install ARM cross compiling toolchain and related package to compile Linux kernel:
sudo apt-get install gcc-arm-linux-gnueabihf \
 lzop libncurses5-dev \
 libssl1.0.0 libssl-dev

Download Default Android SDK

WARNING: If you have downloaded the SDK before Dec 11, 2014, please download again from the cloud drive and make it uptodate.

The size of SDK is huge. Please download firefly-rk3288_android4.4_git_20141211.tar.gz from one of the following cloud storage:

Please check the md5 checksum before proceeding:

$ md5sum /path/to/firefly-rk3288_android4.4_git_20141211.tar.gz
8fe99f519d487ff40c8bc7b5ded62887  firefly-rk3288_android4.4_git_20141211.tar.gz

If it is correct, uncompress it:

mkdir -p ~/proj/firefly-rk3288
cd ~/proj/firefly-rk3288
tar xf /path/to/firefly-rk3288_android4.4_git_20141211.tar.gz
git reset --hard
git remote add bitbucket https://bitbucket.org/T-Firefly/firefly-rk3288.git

From now on, you can pull from bitbucket:

git pull bitbucket master:master

You can also browse the source codes online at https://bitbucket.org/T-Firefly/firefly-rk3288/commits/branch/master .

Moreover,linux-rockchip community kindly builds some git mirror servers. Please visit here for detail. Download the source code using following command (May chooose other mirrors):

git clone -b firefly/master git://git.us.linux-rockchip.org/rk3288_r-box_android4.4.2_sdk.git

Download PAD Android SDK

PAD SDK is a PAD feature can be used to debug the screen , TP, support horizontal and vertical screen display.
The size of SDK is huge. Please download firefly-rk3288_pad_android4.4_git_20141218.tar.gz from one of the following cloud storage:

Please check the md5 checksum before proceeding:

$ md5sum /path/to/firefly-rk3288_pad_android4.4_git_20141218.tar.gz
4ba44765fa649bc5cddadd8b349aa8af  firefly-rk3288_pad_android4.4_git_20141218.tar.gz

If it is correct, uncompress it:

mkdir -p ~/proj/firefly-rk3288_pad
cd ~/proj/firefly-rk3288_pad
tar xf /path/to/firefly-rk3288_pad_android4.4_git_20141218.tar.gz
git reset --hard
git remote add bitbucket https://bitbucket.org/T-Firefly/firefly-rk3288.git

From now on, you can pull from bitbucket:

git pull bitbucket pad:pad

You can also browse the source codes online at https://bitbucket.org/T-Firefly/firefly-rk3288/commits/branch/pad .

Compiling Kernel

To compile Linux kernel of the mass produced development board (0930), run:

cd ~/proj/firefly-rk3288/kernel
make firefly-rk3288_defconfig
make -j8 firefly-rk3288.img

To compile Linux kernel of the public test development board (0809), run:

cd ~/proj/firefly-rk3288/kernel
make firefly-rk3288_beta_defconfig
make -j8 firefly-rk3288_beta.img

Compiling Android

Compiling Android:

cd ~/proj/firefly-rk3288
make -j8
./mkimage.sh

Flashing partition images

./mkimage.sh at previous step will repack boot.img and system.img, and copy other related image files to the rockdev/Image-rk3288/ directory. The common image files are listed below:

  • boot.img : Android's initramfs, to initialize and mount system partition.
  • kernel.img : Kernel image.
  • misc.img : Misc partition image, to switch boot mode and pass parameter in recovery mode.
  • recovery.img : Recovery mode image.
  • resource.img : Resource image, containing boot logo and kernel's device tree info.
  • system.img : System partition image with ext4 filesystem format.

Please flash the image according to Flash image.

If you are using Windows system to flash the images, please copy the image files mentioned above to rockdev\Image directory in AndroidTool (Image flash tool in Windows). Then follow instructions in the flash image guide. This is the easy way, using default configuration, no need to modify image file's path.

Create update.img

Create update.img in Windows is simple. Just copy the files to AndroidTool's rockdev\Image directory as previous step. Then run the batch file mkupdate.bat in rockdev directory, which will create update.img under rockdev\Image.

update.img is convenient to distribute to end users to upgrade the system, while partition images are more frequently used during development.