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

Rock5/guide/android12

< Rock5‎ | guide
Revision as of 08:56, 8 October 2022 by Yanw (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This page is a step-by-step tutorial how to build Rock 5 serail board Android12 image.

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

   RUN apt-get update -y && apt-get install -y openjdk-8-jdk python git-core gnupg flex bison gperf build-essential \
       zip curl liblz4-tool zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
       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 python3 python-pip lzop swig

   #### 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=android12-docker
   ARG USER_ID=0
   ARG GROUP_ID=0
   RUN groupadd -g ${GROUP_ID} jenkins-docker && useradd -m -g jenkins-docker -u ${USER_ID} android12-docker

   USER android12-docker

Build DockerFile

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

Download source code

   $ mkdir rock-android12
   $ cd rock-android12

Then run:

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

Build

Use all-in-one build script

  radxa:rock-android12 $ source build/envsetup.sh
  radxa:rock-android12 $ lunch RadxaRock5B-userdebug
  radxa:rock-android12 $ ./build.sh -UACKup
  # get images from IMAGE directory

Step by step Build

If you dont' want to use "Use all-in-one build script", you can follow this way to build image step by step.

Setup board environment

  # for Rock 5B
  radxa:rock-android12 $ export PRODUCT_NAME="RadxaRock5B"
  radxa:rock-android12 $ export PRODUCT_UBOOT_CONFIG="rk3588"
  radxa:rock-android12 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig"
  radxa:rock-android12 $ export PRODUCT_KERNEL_DTS="rk3588-rock-5b"

Build u-boot

  radxa:rock-android12 $ cd u-boot
  radxa:rock-android12/u-boot $ make clean
  radxa:rock-android12/u-boot $ make mrproper
  radxa:rock-android12/u-boot $ make distclean
  radxa:rock-android12/u-boot $ ./make.sh ${PRODUCT_UBOOT_CONFIG}
  radxa:rock-android12 $ cd -

The generated images are idbloader.img , and uboot.img

Building kernel

  radxa:rock-android12 $ cd kernel-5.10
  radxa:rock-android12/kernel-5.10 $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_CONFIG}
  radxa:rock-android12/kernel-5.10 $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_DTS}.img -j$(nproc)
 
  radxa:rock-android12 $ cd -


Building AOSP

  radxa:rock-android12 $ source build/envsetup.sh
  radxa:rock-android12 $ lunch ${PRODUCT_NAME}-userdebug
  radxa:rock-android12 $ make -j$(nproc)

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


Make images

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


Pack Image

  radxa:rock-android12 $ cd rockdev
  radxa:rock-android12/rockdev $ rm -rf Image
  radxa:rock-android12/rockdev $ ln -s Image-${PRODUCT_NAME} Image

1. RkUpdate Image

  radxa:rock-android12/rockdev $ ./mkupdate.sh rk3588 Image

The images under rockdev/ are `update.img`

2. gpt Image

  radxa:rock-android12/rockdev $ ./android-gpt.sh