Miqipi/build Android51
Contents
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 25GB space.
- Install OpenJDK 7:
To initialize compiling environment, please reference http://source.android.com/source/initializing.html .
$sudo apt-get install openjdk-7-jdk
Tips: After installing openjdk-7-jdk, you might need to fix JDK's default link:
$ sudo update-alternatives --config java $ sudo update-alternatives --config javac
To switch JDK version. SDK will switch to internal JDK path once the default one cannot be found. Therefore, in order to compile Android 5.1 and before, removing the JDK7 link is more preferable:
$ sudo /var/lib/dpkg/info/openjdk-7-jdk:amd64.prerm remove
- 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 \ lzop libssl1.0.0 libssl-dev
- Ubuntu 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 \ libssl1.0.0 libssl-dev
if your system is ubuntu14.04 server add to install:
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 x11proto-core-dev libx11-dev lib32z-dev ccache \ libgl1-mesa-dev libxml2-utils xsltproc unzip
Download Android SDK
The size of SDK is huge. Please download from one of the following cloud storage:
Download all packages
Check MD5
$ md5sum /path/to/miqi-rk3288_android5.1_git_20150910.tar 83a07f127abe57482047a417f29e3115 miqi-rk3288_android5.1_git_20150910.tar
unzip the file
mkdir -p ~/proj/miqi-rk3288-lollipop cd ~/proj/miqi-rk3288-lollipop tar xf /path/to/miqi-rk3288_android5.1_git_20150910.tar git reset --hard
Compiling Kernel
To compile Linux kernel, run:
cd ~/proj/miqi-rk3288-lollipop/kernel make rk3288-miqi_defconfig make modules make -j8 rk3288-miqi.img
Compiling Android
Compiling Android:
cd ~/proj/miqi-rk3288-lollipop source build/envsetup.sh lunch (select the 'rk3288_miqi-userdebug') make -j8 ./mkimage.sh
TARGET_BUILD_VARIANT defaults to userdebug. There are three variants: user, userdebug and eng. The main differences are:
User
- Only install modules with user tag
- Set property ro.secure=1, to turn on security check.
- Set property ro.debuggable=0, to close application debugging function.
- Turn off adb by default.
- Enable Proguard.
- Enable DEXPREOPT to optimize applcation.
userdebug
- Only install modules with userdebug tag
- Set property ro.secure=1, to turn on security check.
- Set property ro.debuggable=1, to turn on application debugging function.
- Turn on adb by default.
- Enable Proguard.
- Enable DEXPREOPT to optimize applcation.
eng
- Install modules with user, debug or eng tag.
- Set property ro.secure=0, to turn off security check.
- Set property ro.debuggable=1, to turn on application debugging fucntion.
- Turn on adb by default.
- Disable Proguard.
- Disable DEXPREOPT, not optimizing applcation.
If TARGET_BUILD_VARIANT is user, adb can not gain root permission. To switch target build variant, add parameter to the make command line:
make -j8 PRODUCT-rk3288_box-user make -j8 PRODUCT-rk3288_box-userdebug make -j8 PRODUCT-rk3288_box-eng
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_box/ 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. copy the files as below :
android_for_miqi\rockdev\Image-rk3288_miqi
boot.img misc.img pcba_small_misc.img pcba_whole_misc.img recovery.img system.img
android_for_miqi/kernel
kernel.img resource.img
to the directory : AndroidTool_Release_v2.39\rockdev\Image
Then run the batch file mkupdate.bat in rockdev directory, which will create update.img under rockdev.
update.img is convenient to distribute to end users to upgrade the system, while partition images are more frequently used during development.