Android 9 system compilation

Hardware configuration

Recommended hardware configuration for compiling Android 9 development environment:

  • 64-bit CPU

  • Ubuntu20.04 system

  • 16GB RAM

  • 250GB of free space for compilation

  • Compile with normal users, don’t compile with root

In addition, please refer to the official Google documentation for hardware and software configurations:

Software configuration

Install the environment package

sudo apt update
sudo apt-get install git-core gnupg flex bison build-essential zip curl \
  zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev \
  x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip \
  fontconfig liblz4-tool libxml2-utils libssl-dev

Obtain the SDK

Send an email to support@neardi.com to get the relevant development materials

After the download is complete, check whether the MD5 code is the same as that in the LPA3399Pro-SDK-Android-V1.0.tar.gz.md5sum before unzipping:

$ md5sum LPA3399Pro-SDK-Android-V1.0-split.tar.gz*
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzaa
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzab
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzac
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzad
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzae
********************************  LPA3399Pro-SDK-Android-V1.0-split.tar.gzaf

Merge and decompress:

$ cat LPA3399Pro-SDK-Android-V1.0-split.tar.gz* > LPA3399Pro-SDK-Android-V1.0.tar.gz
$ tar -zxf LPA3399Pro-SDK-Android-V1.0.tar.gz

Extract:

cd LPA3399Pro-SDK-Android-V1.0
git reset --hard

Switch branches:

branch explain
lz11000001 Neardi master branch
git checkout lz11000001

Compile the firmware

Compile U-Boot

./build.sh -U

Compile the kernel

./build.sh -K

Compile Android

make installclean
./build.sh -A

Package the firmware

After the compilation is complete, all partition images are packaged into the RK firmware format for burning:

./build.sh -u

Fully automatic compilation

Fully automated compilation performs all compilation, packaging, and directly generates RK firmware.

./build.sh -AKUpu

The script will copy the compiled firmware to the IMAGE/RK3399PRO-SIGMA-**********/IMAGES directory, and the specific path is subject to the actual generation. Each compilation will create a new directory to save it, automatically back up the firmware version of the debugging development process, and store all kinds of information about the firmware version. The update.img in this directory can be directly used to download updates from Android development tools and factory programming tools.

Partition image

update.img is a firmware that is released to end users to facilitate the upgrade of the development board. In actual development, it is more common to modify and burn a single partition image file, which greatly saves development time.

Image file list:

  • boot.img: Android’s initramfs image, which contains the underlying file system of the Android root, is responsible for initializing and loading the system partition.

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

  • kernel.img: Kernel image.

  • resource.img: Resource image, containing the boot picture and kernel device tree.

  • misc.img: Misc partition image, which is responsible for switching the boot mode and passing the rescue mode parameters.

  • recovery.img: Recovery mode image.

  • rk3568_loader_xxx.bin: Loader file.

  • uboot.img: U-Boot image file.

  • trust.img: Arm trusted file (ATF) image file.

  • parameter.txt: Partition layout and kernel command line.