Difference between revisions of "Rock3/Android11"
< Rock3
(→Setup board environment) |
|||
(17 intermediate revisions by 3 users not shown) | |||
Line 7: | Line 7: | ||
+ | This page is a step-by-step tutorial how to build Rock 3 serail board Android11 image. Including: | ||
+ | |||
+ | * 3A<br> | ||
+ | * 3B<br> | ||
+ | * CM3IO<br> | ||
Recommend build host is Ubuntu 20.04 64bit, for other hosts, refer official Android documents [https://source.android.com/setup/build/initializing Establishing a Build Environment]. | Recommend build host is Ubuntu 20.04 64bit, for other hosts, refer official Android documents [https://source.android.com/setup/build/initializing Establishing a Build Environment]. | ||
− | + | ||
+ | |||
+ | === Repo === | ||
<code bash> | <code bash> | ||
radxa$ wget 'https://storage.googleapis.com/git-repo-downloads/repo' -P /tmp/ | radxa$ wget 'https://storage.googleapis.com/git-repo-downloads/repo' -P /tmp/ | ||
Line 26: | Line 33: | ||
</code> | </code> | ||
− | + | === DockerFile === | |
<code> | <code> | ||
FROM ubuntu:xenial | FROM ubuntu:xenial | ||
Line 48: | Line 55: | ||
ARG USER_ID=0 | ARG USER_ID=0 | ||
ARG GROUP_ID=0 | ARG GROUP_ID=0 | ||
− | RUN groupadd -g ${GROUP_ID} jenkins-docker && useradd -m -g jenkins-docker -u ${USER_ID} | + | RUN groupadd -g ${GROUP_ID} jenkins-docker && useradd -m -g jenkins-docker -u ${USER_ID} android11-docker |
USER android11-docker | USER android11-docker | ||
Line 58: | Line 65: | ||
</code> | </code> | ||
− | + | === Download source code === | |
<code bash> | <code bash> | ||
$ mkdir rock-android11 | $ mkdir rock-android11 | ||
Line 65: | Line 72: | ||
Then run: | Then run: | ||
<code bash> | <code bash> | ||
− | radxa:rock-android11 $ repo init -u https://github.com/radxa/manifests.git -b | + | 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 | radxa:rock-android11 $ repo sync -d --no-tags -j4 | ||
</code> | </code> | ||
− | + | === Build === | |
− | ==== | + | ==== Use all-in-one build script ==== |
+ | |||
<code bash> | <code bash> | ||
radxa:rock-android11 $ source build/envsetup.sh | radxa:rock-android11 $ source build/envsetup.sh | ||
− | radxa:rock-android11 $ lunch | + | |
+ | # for Rock 3A | ||
+ | radxa:rock-android11 $ lunch rk356x_rock_3a_r-userdebug | ||
+ | # for Rock 3A if you want a box software | ||
+ | radxa:rock-android11 $ lunch rk356x_rock_3a_box-userdebug | ||
+ | # for Rock 3B | ||
+ | radxa:rock-android11 $ lunch rk356x_rock_3b_r-userdebug | ||
+ | # for Rock 3C | ||
+ | radxa:rock-android11 $ lunch rk356x_rock_3c_r-userdebug | ||
+ | # for Rock CM3 IO | ||
+ | radxa:rock-android11 $ lunch rk356x_rock_cm3_r-userdebug | ||
+ | |||
radxa:rock-android11 $ ./build.sh -UACKup | radxa:rock-android11 $ ./build.sh -UACKup | ||
# get images from IMAGE directory | # get images from IMAGE directory | ||
</code> | </code> | ||
− | ==== | + | ==== Step by step Build ==== |
− | ====== Build u-boot | + | 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 ===== | ||
+ | <code bash> | ||
+ | # for Rock 3A | ||
+ | radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3a_r" | ||
+ | radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3a" | ||
+ | |||
+ | # for Rock 3A box software | ||
+ | radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3a_box" | ||
+ | radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3a" | ||
+ | |||
+ | # for Rock 3B | ||
+ | radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3b_r" | ||
+ | radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rock_3b.config" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3c" | ||
+ | |||
+ | # for Rock 3C | ||
+ | radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3c_r" | ||
+ | radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rockcm3io.config" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3566-rock-3c" | ||
+ | |||
+ | # for Rock CM3 IO | ||
+ | radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_cm3_r" | ||
+ | radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="rk3566" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rockcm3io.config" | ||
+ | radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3566-rock-cm3io" | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ===== Build u-boot ===== | ||
<code bash> | <code bash> | ||
radxa:rock-android11 $ cd u-boot | radxa:rock-android11 $ cd u-boot | ||
Line 85: | Line 140: | ||
radxa:rock-android11/u-boot $ make mrproper | radxa:rock-android11/u-boot $ make mrproper | ||
radxa:rock-android11/u-boot $ make distclean | radxa:rock-android11/u-boot $ make distclean | ||
− | radxa:rock-android11/u-boot $ ./make.sh | + | radxa:rock-android11/u-boot $ ./make.sh ${PRODUCT_UBOOT_CONFIG} |
radxa:rock-android11 $ cd - | radxa:rock-android11 $ cd - | ||
</code> | </code> | ||
− | The generated images are | + | The generated images are '''idbloader.img''' , and '''uboot.img''' |
− | + | ===== Building kernel ===== | |
− | + | ||
<code bash> | <code bash> | ||
radxa:rock-android11 $ cd 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 $ 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 | radxa:rock-android11/kernel $ make clean | ||
− | radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 | + | radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_CONFIG} |
− | radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 | + | radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_DTS}.img -j$(nproc) |
+ | |||
radxa:rock-android11 $ cd - | radxa:rock-android11 $ cd - | ||
</code> | </code> | ||
− | + | ===== Building AOSP ===== | |
<code bash> | <code bash> | ||
− | radxa:rock-android11 $ source | + | radxa:rock-android11 $ source build/envsetup.sh |
− | radxa:rock-android11 $ lunch | + | radxa:rock-android11 $ lunch ${PRODUCT_NAME}-userdebug |
radxa:rock-android11 $ make -j$(nproc) | radxa:rock-android11 $ make -j$(nproc) | ||
</code> | </code> | ||
It takes a long time, take a break and wait... | It takes a long time, take a break and wait... | ||
− | + | ||
+ | ===== Make images ===== | ||
<code bash> | <code bash> | ||
radxa:rock-android11 $ rm -rf rockdev | radxa:rock-android11 $ rm -rf rockdev | ||
Line 116: | Line 172: | ||
</code> | </code> | ||
− | ===== | + | |
+ | ===== Pack Image ===== | ||
<code bash> | <code bash> | ||
radxa:rock-android11 $ cd rockdev | radxa:rock-android11 $ cd rockdev | ||
− | radxa:rock-android11/rockdev $ ln -s Image- | + | radxa:rock-android11/rockdev $ rm -rf Image |
+ | radxa:rock-android11/rockdev $ ln -s Image-${PRODUCT_NAME} Image | ||
+ | |||
</code> | </code> | ||
1. RkUpdate Image | 1. RkUpdate Image | ||
<code> | <code> | ||
− | radxa:rock-android11/rockdev $ ./ | + | radxa:rock-android11/rockdev $ ./mkupdate_rk356x.sh |
</code> | </code> | ||
The images under rockdev/ are `update.img` | The images under rockdev/ are `update.img` | ||
Line 133: | Line 192: | ||
</code> | </code> | ||
− | + | === Installation === | |
* sdcard<br> | * sdcard<br> | ||
[https://wiki.radxa.com/Rock3/install/microSD Install on MicroSD]<br> | [https://wiki.radxa.com/Rock3/install/microSD Install on MicroSD]<br> |
Latest revision as of 09:28, 26 January 2024
ROCK 3 > Andriod11
This page is a step-by-step tutorial how to build Rock 3 serail board Android11 image. Including:
- 3A
- 3B
- CM3IO
Recommend build host is Ubuntu 20.04 64bit, for other hosts, refer official Android documents Establishing a Build Environment.
Contents
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=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:11.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
Use all-in-one build script
radxa:rock-android11 $ source build/envsetup.sh # for Rock 3A radxa:rock-android11 $ lunch rk356x_rock_3a_r-userdebug # for Rock 3A if you want a box software radxa:rock-android11 $ lunch rk356x_rock_3a_box-userdebug # for Rock 3B radxa:rock-android11 $ lunch rk356x_rock_3b_r-userdebug # for Rock 3C radxa:rock-android11 $ lunch rk356x_rock_3c_r-userdebug # for Rock CM3 IO radxa:rock-android11 $ lunch rk356x_rock_cm3_r-userdebug radxa:rock-android11 $ ./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 3A radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3a_r" radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig" radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3a" # for Rock 3A box software radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3a_box" radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig" radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3a" # for Rock 3B radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3b_r" radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rock_3b.config" radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3568-rock-3c"
# for Rock 3C radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_3c_r" radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="radxa_rock_3a_toybrick" radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rockcm3io.config" radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3566-rock-3c" # for Rock CM3 IO radxa:rock-android11 $ export PRODUCT_NAME="rk356x_rock_cm3_r" radxa:rock-android11 $ export PRODUCT_UBOOT_CONFIG="rk3566" radxa:rock-android11 $ export PRODUCT_KERNEL_CONFIG="rockchip_defconfig android-11.config rockcm3io.config" radxa:rock-android11 $ export PRODUCT_KERNEL_DTS="rk3566-rock-cm3io"
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 radxa:rock-android11/u-boot $ ./make.sh ${PRODUCT_UBOOT_CONFIG} radxa:rock-android11 $ cd -
The generated images are idbloader.img , and uboot.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 radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_CONFIG} radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 ${PRODUCT_KERNEL_DTS}.img -j$(nproc) radxa:rock-android11 $ cd -
Building AOSP
radxa:rock-android11 $ source build/envsetup.sh radxa:rock-android11 $ lunch ${PRODUCT_NAME}-userdebug radxa:rock-android11 $ make -j$(nproc)
It takes a long time, take a break and wait...
Make images
radxa:rock-android11 $ rm -rf rockdev radxa:rock-android11 $ ln -s RKTools/linux/Linux_Pack_Firmware/rockdev . radxa:rock-android11 $ ./mkimage.sh
Pack Image
radxa:rock-android11 $ cd rockdev radxa:rock-android11/rockdev $ rm -rf Image radxa:rock-android11/rockdev $ ln -s Image-${PRODUCT_NAME} Image
1. RkUpdate Image
radxa:rock-android11/rockdev $ ./mkupdate_rk356x.sh
The images under rockdev/ are `update.img`
2. gpt Image
radxa:rock-android11/rockdev $ ./android-gpt.sh
Installation
- sdcard
- emmc with reader
Install on eMMC with USB to eMMC Reader
- emmc from usb port