Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rockpi4/rockpi-android11


ROCK Pi 4 > Android11


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

Repo

   radxa$ wget 'https://storage.googleapis.com/git-repo-downloads/repo' -P /tmp/
   radxa$ sudo cp /tmp/repo /usr/local/bin/repo
   radxa$ sudo chmod +x /usr/local/bin/repo

In China Download Repo:

   radxa$ echo "export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'" >> ~/.bashrc
   radxa$ source ~/.bashrc
   radxa$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o /tmp/repo
   radxa$ sudo cp /tmp/repo /usr/local/bin/repo
   radxa$ sudo chmod +x /usr/local/bin/repo

DockerFile

   FROM ubuntu:xenial

   #### for China 
   RUN rm /etc/apt/sources.list
   RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse" | tee /etc/apt/sources.list
   RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list
   RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list
   RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list
   #### for Chine end

   ENV DEBIAN_FRONTEND noninteractive

   RUN apt-get update -y && apt-get install -y software-properties-common
   RUN add-apt-repository -y ppa:deadsnakes/ppa
   RUN apt-get update -y && apt-get install -y python3.8
   RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 150
   RUN apt-get install -y python-pip && pip install pycrypto

   RUN apt-get update -y && apt-get install -y openjdk-8-jdk python git-core gnupg flex bison gperf build-essential \
   zip curl gawk liblz4-tool zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
   lib32ncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
   libgl1-mesa-dev libxml2-utils xsltproc unzip mtools u-boot-tools \
   htop iotop sysstat iftop pigz bc device-tree-compiler lunzip \
   dosfstools vim-common parted udev libssl-dev  sudo rsync python3-pyelftools cpio

   #### For China
   RUN curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > /usr/local/bin/repo && \
   chmod +x /usr/local/bin/repo && \
   which repo

   ENV REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'
   #### For China End

   RUN pip install pycrypto
   ENV USER=android11-docker
   ARG USER_ID=0
   ARG GROUP_ID=0
   RUN groupadd -g ${GROUP_ID} jenkins-docker && useradd -m -g jenkins-docker -u ${USER_ID} android11-docker

   USER android11-docker

Build DockerFile

   radxa$ docker build -t android-builder:10.x --build-arg USER_ID=`id -u` --build-arg GROUP_ID=`id -g` $(which-dir-dockerfile-in)

Download source code

   $ mkdir rock-android11
   $ cd rock-android11

Then run:

  radxa:rock-android11 $ repo init -u https://github.com/radxa/manifests.git -b Android11_Radxa_rk11 -m rockchip-r-release.xml
  radxa:rock-android11 $ repo sync -d --no-tags -j4

Build

One Step build

  radxa:rock-android11 $ source build/envsetup.sh

- if build Rock PI 4AB

  radxa:rock-android11 $ lunch rk3399_ROCKPI4B_Android11-userdebug

- if build Rock PI 4C

  radxa:rock-android11 $ lunch rk3399_ROCKPI4C_Android11-userdebug

- if build Rock PI 4C Plus

  radxa:rock-android11 $ lunch rk3399_ROCKPI4C_Plus_Android11-userdebug

- if build Rock Fuhai

  radxa:rock-android11 $ lunch rk3399_ROCKPIFuhai_Android11-userdebug
  radxa:rock-android11 $ ./build.sh -UACKup
  # get images from IMAGE directory

Parts Build

Build u-boot

  radxa:rock-android11 $ cd u-boot
  radxa:rock-android11/u-boot $ make clean
  radxa:rock-android11/u-boot $ make mrproper
  radxa:rock-android11/u-boot $ make distclean

- if build Rock PI 4AB or Rock Fuhai

  radxa:rock-android11/u-boot $ ./make.sh rockpi4b

- else if build Rock PI 4C

  radxa:rock-android11/u-boot $ ./make.sh rockpi4c
  radxa:rock-android11 $ cd -

The generated images are **idbloader.img**

Building kernel

  radxa:rock-android11 $ cd kernel
  radxa:rock-android11/kernel $ ADDON_ARGS="CC=../prebuilts/clang/host/linux-x86/clang-r383902b/bin/clang LD=../prebuilts/clang/host/linux-x86/clang-r383902b/bin/ld.lld"
  radxa:rock-android11/kernel $ make clean

- Rock PI 4AB

  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rockchip_defconfig android-11.config rockpi_4b.config
  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rk3399-rockpi-4b.img -j$(nproc)

- Rock PI 4C

  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rockchip_defconfig android-11.config rockpi_4c.config
  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rk3399-rockpi-4c.img -j$(nproc)

- Rock Fuhai

  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rockchip_defconfig android-11.config rockpi_4b.config
  radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rk3399-fuhai-evb.img -j$(nproc)
  radxa:rock-android11 $ cd -

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

  1. kernel.img, kernel with rkcrc checksum
  2. resource.img, contains dtb and boot logo, Rockchip format resource package
Building AOSP

  radxa:rock-android11 $ source buile/envsetup.sh

- Rock PI 4AB

  radxa:rock-android11 $ lunch rk3399_ROCKPI4B_Android11-userdebug
  radxa:rock-android11 $ make -j$(nproc)

- Rock PI 4C

  radxa:rock-android11 $ lunch rk3399_ROCKPI4C_Android11-userdebug
  radxa:rock-android11 $ make -j$(nproc)

- Rock Fuhai

  radxa:rock-android11 $ lunch rk3399_ROCKPIFuhai_Android11-userdebug
  radxa:rock-android11 $ make -j$(nproc)

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


Generate images

  radxa:rock-android11 $ rm -rf rockdev
  radxa:rock-android11 $ ln -s RKTools/linux/Linux_Pack_Firmware/rockdev .
  radxa:rock-android11 $ ./mkimage.sh

Generated Image

  radxa:rock-android11 $ cd rockdev

- Rock PI 4AB

  radxa:rock-android11/rockdev $ ln -s Image-rk3399_ROCKPI4B_Android11 Image

- Rock PI 4C

  radxa:rock-android11/rockdev $ ln -s Image-rk3399_ROCKPI4C_Android11 Image

- Rock Fuhai

  radxa:rock-android11/rockdev $ ln -s Image-rk3399_ROCKPIFuhai_Android11 Image

1. RkUpdate Image

   radxa:rockpi4-android11/rockdev$ ./mkupdate_rk3399.sh

get `update.img` from `Image` directroy

2. GPT image

   radxa:rockpi4-android11/rockdev$ ./android-gpt.sh

get `gpt.img` from `Image` directroy

Installation

RkUpdate Image Install on eMMC module