ROC-RK3328-CC Buy Spec

Firefly first ultra-small open-source main board, unique USB3.0 and DDR4 to make its performance faster and more stable. The ultra-affordable ROC-RK3328-CC is your first choice for exploring the programming world.

Compile Android 7.1 Firmware

Update time:2018-01-03 Views:2688


The configuration requirements of compiling Android machine are higher:

  • 64 bit CPU

  • 16GB Physical memory + Swap memory

  • 30GB Free disk space is used for building, and the source tree takes about 8GB

Google official  recommends 64-bit Ubuntu 12.04 operating system, but in fact you can also  use the updated 64-bit operating system version, only need to meet the  hardware and software configuration of

Initialization of the compiler environment refers to

  • install JDK 8:

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
  • Ubuntu 12.04 install packages:

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 install 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
  • Install ARM Cross-Compile Toolchain and Compile Kernel Related Packages:

sudo apt-get install gcc-arm-linux-gnueabihf \
lzop libncurses5-dev \
libssl1.0.0 libssl-dev

Download Android SDK

Due to the larger SDK, please select one of the following cloud disk downloads ROC-RK3328-CC_Android7.1.2_git_20171204.7z :

After the download completed, verify the MD5 code:

$ md5sum /path/to/ROC-RK3328-CC_Android7.1.2_git_20171204.7z

6d34e51fd7d26e9e141e91b0c564cd1f  ROC-RK3328-CC_Android7.1.2_git_20171204.7z

Confirm the correct, you can extract:

mkdir -p ~/proj/roc-rk3328-cc
cd ~/proj/roc-rk3328-cc
7z x /path/to/ROC-RK3328-CC_Android7.1.2_git_20171204.7z
git reset --hard

Note: After decompression you need to update the remote repositary.

Here's how to update from gitlab:

git remote rm origin 
git remote add gitlab
git pull gitlab roc-rk3328-cc:roc-rk3328-cc

you can also view online source code from 

Use Firefly Official Script to Compile

  • Compiled separately kernel:

cd ~/proj/roc-rk3328-cc/
./FFTools/ -k -j8
  • Compiled separately uboot:

cd ~/proj/roc-rk3328-cc/
./FFTools/ -u -j8
  • Compiled separately android upper:

cd ~/proj/roc-rk3328-cc/
./FFTools/ -a -j8
  • Compile ubooot、kernel、android at the same time

cd ~/proj/roc-rk3328-cc/
./FFTools/ -j8

Compile Manually

Before compilation, execute the following command 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
  • compile kernel:

cd ~/proj/roc-rk3328-cc/kernel/
make ARCH=arm64 firefly_defconfig
make -j8 ARCH=arm64 rk3328-roc-cc.img
  • compile uboot:

cd ~/proj/roc-rk3328-cc/u-boot/
make rk3328_box_defconfig
make ARCHV=aarch64 -j8
  • compile android:

cd ~/proj/roc-rk3328-cc/
source build/
lunch roc_rk3328_cc_box-userdebug
make installclean
make -j8

Packaging Unified Firmware update.img

After compiling you can use Firefly official script to package partition files into unified firmware, execute the following command:

./FFTools/mkupdate/ update

After the package process has been finished, a unified firmware will be generated under rockdev/Image-rk3328_firefly_box/: update.img

Packaging the uniform firmware  update.img under Windows is also very simple, copy the compiled file to the AndroidTool rockdev\Image directory, and then  run the mkupdate.bat batch file in the rockdev directory to create  update.img, and then it will be stored in rockdev\Image directory.

Burning Partition Image

Eexecute ./  among compiling, this script will re-package boot.img and system.img, and other related  image files will be copied to the directory rockdev/Image-rk3328_firefly_box/. The following is a list of the firmware files:

  • boot.img :Android initial file image, responsible for initializing and loading the system partition.

  • kernel.img :kernel image.

  • misc.img :misc partition image, is responsible for starting the mode switch and first aid mode parameter transfer.

  • parameter.txt :the partition information of eMMC

  • recovery.img :Emergency mode image.

  • resource.img :Resource image, containing boot imge and kernel device tree information.

  • system.img :Android system partition image, ext4 file system format.

  • trust.img :Sleep wake up related files

  • rk3328_loader_v1.08.244.bin :Loader files

  • uboot.img :uboot files

Please refer to 《Flash Image》 to burn a partition image file.
Also you can refer to 《Make Android SD Card to Startup System》, 《Make Linux SD Card to Startup System》 article to make system boot card.
If  you are using a Windows system, you can copy the above image files to the rockdev\Image directory of AndroidTool (Windows firmware upgrade  tool), then refer to the upgrade document to write partition  image, which the advantage is that you can just use the default configuration, and need not to modify the file's path.
update.img is a image that it is convenient for releasing firmware for the end user to upgrade the system. Generally when developing the use of partitioned images will be more convenient.