refer: https://www.96boards.org/documentation/consumer/rock/build/aosp.md.html

Build AOSP for ROCK960

Build environment setup

Recommend build host is Ubuntu 16.04 64bit, for other hosts, refer official Android documents Establishing a Build Environment.

$ mkdir -p ~/bin$ wget 'https://storage.googleapis.com/git-repo-downloads/repo' -P ~/bin$ chmod +x ~/bin/repo

Android’s source code primarily consists of Java, C++, and XML files. To compile the source code, you’ll need to install OpenJDK 8, GNU C and C++ compilers, XML parsing libraries, ImageMagick, and several other related packages.

$ sudo apt-get update$ sudo apt-get install openjdk-8-jdk android-tools-adb bc bison build-essential curl flex g++-multilib gcc-multilib gnupg gperf imagemagick lib32ncurses5-dev lib32readline-dev lib32z1-dev libesd0-dev liblz4-tool libncurses5-dev libsdl1.2-dev libssl-dev libwxgtk3.0-dev libxml2 libxml2-utils lzop pngcrush rsync schedtool squashfs-tools xsltproc yasm zip zlib1g-dev

Configure the JAVA environment

$ 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

Download source code

$ mkdir rock960-android$ cd rock960-android

Then run:

$ ~/bin/repo init -u https://github.com/96rocks/manifests.git -b rock960-box-7.1 -m rock960_box_7.1_release.xml$ repo sync -j$(nproc) -c

It might take quite a bit of time to fetch the entire AOSP source code(around 86G)!

Build u-boot

$ cd u-boot$ make rk3399_box_defconfig$ ./mkv8.sh$ cd ..

The generated images are rk3399_loader_v_xxx.bin and uboot.img

Building kernel

$ cd kernel$ make rockchip_defconfig$ make rk3399-rock960-model-ab.img -j$(nproc)$ cd ..

The generated images are kernel.img and resource.img:

  • kernel.img, kernel with rkcrc checksum
  • resource.img, contains dtb and boot logo, Rockchip format resource package

Building AOSP

$ source build/envsetup.sh$ lunch rk3399_box-userdebug$ make -j$(nproc)

源码编译报错

ubuntu 18.04 和 android 8.1

flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertioncnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))' failed.Aborted (core dumped)

解决

export LC_ALL=C

LC_ALL=C 去除所有本地化的设置,或者LC_ALL=en_US.utf-8

It takes a long time, take a break and wait…

Generate images

$ ln -s RKTools/linux/Linux_Pack_Firmware/rockdev/ rockdev$ ./mkimage.sh

The generated images under rockdev/Image-rk3399_box are

boot.img    MiniLoaderAll.bin  parameter.txt        pcba_whole_misc.img  resource.img  trust.imgkernel.img  misc.img           pcba_small_misc.img  recovery.img         system.img    uboot.img

They can be flashed with fastboot or Rockchip upgrade_tool.

Pack all partitions into one image.

$ cd rockdev$ ln -s Image-rk3399_box Image$ ./mkupdate.sh
Start to make update.img...Android Firmware Package Tool v1.62------ PACKAGE ------Add file: ./package-fileAdd file: ./Image/MiniLoaderAll.binAdd file: ./Image/parameter.txtAdd file: ./Image/trust.imgAdd file: ./Image/uboot.imgAdd file: ./Image/misc.imgAdd file: ./Image/resource.imgAdd file: ./Image/kernel.imgAdd file: ./Image/boot.imgAdd file: ./Image/recovery.imgAdd file: ./Image/system.imgAdd CRC...Make firmware OK!------ OK ------********RKImageMaker ver 1.63********Generating new image, please wait...Writing head info...Writing boot file...Writing firmware...Generating MD5 data...MD5 data generated successfully!New image generated successfully!Making update.img OK.

update.img is the packed image with all partitions.

Proceed to Installation Instructions

更多相关文章

  1. android简单计算器源码
  2. Androidの应用源码下载地址
  3. android通讯录解析源码
  4. Android 疯狂足球游戏源码
  5. Android主流三方库源码分析(五、深入理解RxJava源码)
  6. Android 电话博大流程源码分析
  7. android小说阅读、MVP + RxJava + Retrofit项目、证件拍照裁剪、

随机推荐

  1. android 还原短信
  2. Android(安卓)高级面试题及答案
  3. Android(安卓)OOM案例分析
  4. LinearLayout中设置 水平且垂直 居中
  5. 基于xmpp openfire smack开发之Android客
  6. 在Android的Notification中显示进度条
  7. android 实现无限定时循环viewpager
  8. Android的shape的使用
  9. Broadcast Receiver
  10. android 倒影