Difference between revisions of "Rock3/Android11"
< Rock3
Line 4: | Line 4: | ||
[[rock3 | ROCK 3]] > [[Rock3/Android11 | Andriod11]] | [[rock3 | ROCK 3]] > [[Rock3/Android11 | Andriod11]] | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | 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> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | In China Download Repo: | ||
+ | <code bash> | ||
+ | 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 | ||
+ | </code> | ||
+ | |||
+ | ==== DockerFile ==== | ||
+ | <code> | ||
+ | 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} android9-docker | ||
+ | |||
+ | USER android11-docker | ||
+ | </code> | ||
+ | |||
+ | Build DockerFile | ||
+ | <code> | ||
+ | radxa$ docker build -t android-builder:11.x --build-arg USER_ID=`id -u` --build-arg GROUP_ID=`id -g` $(which-dir-dockerfile-in) | ||
+ | </code> | ||
+ | |||
+ | ==== Download source code ==== | ||
+ | <code bash> | ||
+ | $ mkdir rock-android11 | ||
+ | $ cd rock-android11 | ||
+ | </code> | ||
+ | Then run: | ||
+ | <code bash> | ||
+ | radxa:rock-android11 $ repo init -u https://github.com/radxa/manifests.git -b Android11_Radxa_rk10.1 -m rockchip-r-release.xml | ||
+ | radxa:rock-android11 $ repo sync -d --no-tags -j4 | ||
+ | </code> | ||
+ | |||
+ | ==== Build All by one step ==== | ||
+ | <code bash> | ||
+ | radxa:rock-android11 $ source build/envsetup.sh | ||
+ | radxa:rock-android11 $ lunch rk3568_rock_3a_r-userdebug | ||
+ | radxa:rock-android11 $ ./build.sh -UACKup | ||
+ | # get images from IMAGE directory | ||
+ | </code> | ||
+ | |||
+ | ==== Parts Build ==== | ||
+ | ===== Build u-boot ===== | ||
+ | <code bash> | ||
+ | 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 radxa_rock_3a_toybrick | ||
+ | radxa:rock-android11 $ cd - | ||
+ | </code> | ||
+ | The generated images are **rk3399_loader_v_xxx.bin** , and **uboot.img** | ||
+ | |||
+ | ===== Building kernel ===== | ||
+ | <code bash> | ||
+ | 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 rockchip_defconfig | ||
+ | radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rk3568-rock-3A-1.2.img -j$(nproc) | ||
+ | radxa:rock-android11 $ cd - | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Building AOSP ===== | ||
+ | <code bash> | ||
+ | radxa:rock-android11 $ source buile/envsetup.sh | ||
+ | radxa:rock-android11 $ lunch rk3568_rock_3a_r-userdebug | ||
+ | radxa:rock-android11 $ make -j$(nproc) | ||
+ | </code> | ||
+ | It takes a long time, take a break and wait... | ||
+ | |||
+ | ===== Generate images ===== | ||
+ | <code bash> | ||
+ | radxa:rock-android11 $ rm -rf rockdev | ||
+ | radxa:rock-android11 $ ln -s RKTools/linux/Linux_Pack_Firmware/rockdev . | ||
+ | radxa:rock-android11 $ ./mkimage.sh | ||
+ | </code> | ||
+ | |||
+ | ===== Generated Image ===== | ||
+ | <code bash> | ||
+ | radxa:rock-android11 $ cd rockdev | ||
+ | radxa:rock-android11/rockdev $ ln -s Image-rk3568_rock_3a_r Image | ||
+ | </code> | ||
+ | |||
+ | 1. RkUpdate Image | ||
+ | <code> | ||
+ | radxa:rock-android11/rockdev $ ./mkupdate_rk368x.sh | ||
+ | </code> | ||
+ | The images under rockdev/ are `update.img` | ||
+ | |||
+ | 2. gpt Image | ||
+ | <code bash> | ||
+ | radxa:rock-android11/rockdev $ ./android-gpt.sh | ||
+ | </code> | ||
+ | |||
+ | ==== Installation ==== | ||
+ | - sdcard | ||
+ | [https://wiki.radxa.com/Rock3/install/microSD Install on MicroSD]<br> | ||
+ | - emmc with reader | ||
+ | [https://wiki.radxa.com/Rock3/install/eMMC Install on eMMC with USB to eMMC Reader]<bt> | ||
+ | - emmc from usb port | ||
+ | [https://wiki.radxa.com/Rock3/dev/usb-install Install on eMMC from USB port] |
Revision as of 08:08, 8 October 2021
ROCK 3 > Andriod11
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} android9-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_rk10.1 -m rockchip-r-release.xml radxa:rock-android11 $ repo sync -d --no-tags -j4
Build All by one step
radxa:rock-android11 $ source build/envsetup.sh radxa:rock-android11 $ lunch rk3568_rock_3a_r-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 radxa:rock-android11/u-boot $ ./make.sh radxa_rock_3a_toybrick radxa:rock-android11 $ cd -
The generated images are **rk3399_loader_v_xxx.bin** , 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 rockchip_defconfig radxa:rock-android11/kernel $ make $ADDON_ARGS ARCH=arm64 rk3568-rock-3A-1.2.img -j$(nproc) radxa:rock-android11 $ cd -
Building AOSP
radxa:rock-android11 $ source buile/envsetup.sh radxa:rock-android11 $ lunch rk3568_rock_3a_r-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 radxa:rock-android11/rockdev $ ln -s Image-rk3568_rock_3a_r Image
1. RkUpdate Image
radxa:rock-android11/rockdev $ ./mkupdate_rk368x.sh
The images under rockdev/ are `update.img`
2. gpt Image
radxa:rock-android11/rockdev $ ./android-gpt.sh
Installation
- sdcard
Install on MicroSD
- emmc with reader
Install on eMMC with USB to eMMC Reader<bt>
- emmc from usb port
Install on eMMC from USB port