Compiling Android 8.1¶
Prerequisite¶
Hardware requiremnts¶
Recommended hardware requirement of development workstation compiling Android 8.1:
64 bit CPU
16GB Physical memory + Swap memory
30GB Free disk space is used for building, and the source tree takes about 8GB
See also the hardware and software configuration stated in Google official document:
Software requiements¶
Installing JDK 8
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
Installing required packages
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
sudo apt-get install gcc-arm-linux-gnueabihf \
libssl1.0.0 libssl-dev \
p7zip-full
Downloading Android SDK¶
Due to the huge size of the Android SDK, it is not possible to directly host it in Gitlab. Therefore the .git
directory is compressed as a 7z
archive file, uploaded to cloud storage server. The increment update of the SDK is saved in git bundle
and hosted in Gitlab.
Please download firefly_rk3328_android8.1_git_20211221
first:
After the download completes, verify the MD5 checksum before extraction:
$md5sum ~/firefly_rk3328_android8.1_git_20211221.7z.001
$md5sum ~/firefly_rk3328_android8.1_git_20211221.7z.001
$md5sum ~/firefly_rk3328_android8.1_git_20211221.7z.001
fda8c753df5ba4f20cdc9006f316d028 firefly_rk3328_android8.1_git_20211221.7z.001
e78f2bb73fcb2afdcbeece2cf6bc581b firefly_rk3328_android8.1_git_20211221.7z.002
79b889bb5df551c2f69337b8a8cf3bbb firefly_rk3328_android8.1_git_20211221.7z.003
Then extract it:
mkdir -p ~/proj/firefly_rk3328_android8.1
cd ~/proj/firefly_rk3328_android8.1
7z x ~/firefly_rk3328_android8.1_git_20211221.7z.001 -r -o.
git reset --hard
For first and subsequent SDK update, run the following commands:
# Update and apply the git bundle
test -d .bundle || \
git clone \
https://gitlab.com/TeeFirefly/rk3328-android8.1-oreo-bundle.git \
.bundle
.bundle/update
# If the command above prompts "[Info]Already up to date!", it indicates that
# no SDK update is available and nothing need to do here.
# Otherwise, the latest commit of the SDK update is saved to the symbolic-ref
# FETCH_HEAD. Show the relation between the local branch and SDK update first.
git show-branch HEAD FETCH_HEAD
# If there're local commits, choose either rebase or merge to incorporate
# the SDK change:
# To rebase
git rebase FETCH_HEAD
# To merge
git merge FETCH_HEAD
Compiling with Firefly Scripts¶
Automatic compilation¶
./build.sh rk3328-roc-pc
After executing the above command, it will compile the U-Boot, kernel and upper layer of Android, sort out the partition Image and generate unified firmware update.img
, and put it in the directory of rockdev/image-rk3328_roc_pc_box/
.
Modular compilation¶
Compiling configuration file
Note:”Compiling configuration file” is a prerequisite. You must complete this step before proceeding:
./FFTools/make.sh rk3328-roc-pc
Compiling Kernel
./FFTools/make.sh -k -j8
Compiling U-Boot
./FFTools/make.sh -u -j8
Compiling Android
./FFTools/make.sh -a -j8
Compiling all Image
This will compile kernel, U-Boot and Android with a single command:
./FFTools/make.sh -j8
Compiling Without Script¶
Before compilation, execute the following commands to configure environment variables:
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
Compiling Kernel
make ARCH=arm64 rockchip_defconfig
make -j8 ARCH=arm64 rk3328-roc-pc.img
Compiling U-Boot
make rk3328_box_defconfig
make ARCHV=aarch64 -j8
Compiling Android
source build/envsetup.sh
lunch rk3328_roc_pc_box-userdebug
make installclean
make -j8
./mkimage.sh
Packing Rockchp Firmware¶
Packing Fimware in Linux
After compiling you can use Firefly official script to pack all partition image files into the one true Rockchip firmware, by executing the following command:
./FFTools/mkupdate/mkupdate.sh update
The resulting file is rockdev/Image-rk3328_roc_pc_box/update.img
.
The RK firmware needs to use the SD_Firmware_Tool
tool and the function mode to select SD Startup
to create the boot card
Packing Fimware in Windows
It is also very simple in packaging Rockchip firmware update.img
under Windows:
Copy all the compiled files in
rockdev/Image-rk3328_roc_pc_box/
to therockdev\Image
directory of AndroidToolRun the
mkupdate.bat
batch file in therockdev
directory of AndroidTool.update.img
will be created inrockdev\Image
directory.
Flash Image¶
Reference: 《Flash Image》