Compile the Android5.1 firmware

Download the Android SDK

The source code package of the Android SDK is large (approximately 6.3G), and the source code package can be obtained by:

verify the MD5 code when the download is complete:

$ md5sum /path/to/firefly-rk3288_android5.1_git_20180126.tar.gz
dad080373115053de3367c21289562d2  firefly-rk3288_android5.1_git_20180126.tar.gz

Once confirmed, you will be able to extract:

mkdir -p ~/proj/firefly-rk3288-lollipop
cd ~/proj/firefly-rk3288-lollipop
tar xzf /path/to/firefly-rk3288_android5.1_git_20180126.tar.gz
git reset --hard
git remote add gitlab git@gitlab.com:T-Firefly/firenow-lollipop.git

You can update directly from gitlab in the future

git pull gitlab Firefly-RK3288:Firefly-RK3288

You can also browse the source code online at https://gitlab.com/T-Firefly/firenow-lollipop/-/commits/Firefly-RK3288.

Complie

Official script compilation

  • AIO-3288C

./FFTools/make.sh -d firefly-rk3288-aio-3288c -j8 -l rk3288_aio_3288c_box-userdebug
./FFTools/mkupdate/mkupdate.sh -l rk3288_aio_3288c_box-userdebug

Partial compilation

  • uboot

cd ~/proj/firefly-rk3288-lollipop/u-boot
make rk3288_defconfig
make -j8
  • AIO-3288C kernel

cd ~/proj/firefly-rk3288-lollipop/kernel
make firefly_defconfig
make -j8 firefly-rk3288-aio-3288c.img
  • Android

cd ~/proj/firefly-rk3288-lollipop
source build.sh
lunch rk3288_aio_3288c_box-userdebug
make -j8
./mkimage.sh

Build variation

The default target build variation (TARGET_BUILD_VARIANT) is userdebug. There are three common variations, user, userdebug and eng, their differences are:

  • user

    • Only install the modules whose label is user

    • Set the property ro.secure=1, and turn on the security check function

    • Set the property ro.debuggable=0, and turn off the application debugging function

    • Turn off the adb function by default

    • Turn on the Proguard obfuscator

    • Turn on the DEXPREOPT pre-compilation optimization

  • userdebug

    • Install the modules whose label is user or debug

    • Set the property ro.secure=1, and turn on the security check function

    • Set the property ro.debuggable=1, and turn on the application debugging function

    • Turn on the ADB function by default

    • Turn on the Proguard obfuscator

    • Turn on the DEXPREOPT pre-compilation optimization

  • eng

    • Install the modules whose label is user, debug or eng

    • Set the property ro.secure=0, and turn off the security check function

    • Set the property ro.debuggable=1, and turn on the application debugging function

    • Set the property ro.kernel.android.checkjni=1, and enable the JNI call checking

    • Turn on the adb function by default

    • Turn off the Proguard obfuscator

    • Turn off the DEXPREOPT pre-compilation optimization

If the target build variation is user, the adb cannot get the root privileges.If you want to select a target build variation, you can add the parameters at the make command line, for example:

make -j8 PRODUCT-rk3288_aio_3288c_box-user
make -j8 PRODUCT-rk3288_aio_3288c_box-userdebug
make -j8 PRODUCT-rk3288_aio_3288c_box-eng

Flash the partition image

The ./mkimage.sh from the previous step will repack the boot.img and system.img and copy other related image files to the rockdev/Image-rk3288_aio_3288c_box/ directory. The following lists the image files used by the general firmware:

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

  • kernel.img :kernel image.

  • misc.img :misc partition image is responsible for initiating the mode switching and passing the parameter in the emergency mode.

  • recovery.img :image in the emergency mode.

  • resource.img :resource image, which contains the boot image and the device tree blob information of the kernel.

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

Please refer to upgrade_firmware to flash the partition image file.If the Windows system is used, you can copy the image file above to the rockdev\Image directory of the AndroidTool (firmware upgrade tool under Windows), and then refer to the upgrade document to flash the partition image, the benefit is to use the default configuration without modifying the path of the file.

Pack into a unified firmware update.img

After compiling, you can use the script of Firefly to pack into the unified firmware, the command is:

./FFTools/mkupdate/mkupdate.sh -l rk3288_aio_3288c_box-userdebug

The firmware is generated in the rockdev/Image-rk3288_aio_3288c_box/ directory after packing.

It is easy to pack the unified firmware update.img under Windows, you can copy the file to the rockdev\Image directory of the AndroidTool by following the previous steps, and then run the mkupdate.bat batch file in the rockdev directory to create the update.img and save it to the rockdev\Image directory.

The update.img is easy to release the firmware and is used for upgrading the system by the end user. It is convenient to use a partition image for general development.