Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs radxa main new #432

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/rock5/rock5b/other-os/android/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ sidebar_position: 5
## 操作系统镜像

[ROCK 5B Android 12](https://github.com/radxa/manifests/releases/download/Android12_rkr14_20240419/Rock5B_Android12_rkr14_20240419-gpt.zip)
[ROCK 5B Plus Android 12](https://github.com/radxa/manifests/releases/download/android12-radxa-20240708/Rock5BPlus-Android12-rkr14-SD-or-eMMC-20240705-gpt.zip)
peterwang2050 marked this conversation as resolved.
Show resolved Hide resolved

## 质量认证
139 changes: 27 additions & 112 deletions docs/rock5/rock5b/other-os/android/low-level-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,60 +8,7 @@ sidebar_position: 4

## 环境配置

为了规避 Android 编译过程中因为环境配置出问题,提高开发效率,我们引入了Docker这一工具。

### Docker

Docker是一个开源的应用容器引擎,可以帮助开发者更有效地构建、部署和管理应用程序。

Dockerfile 是一个构建 Docker 镜像的文本文件,可以根据以下内容构建编译 Android 所需环境。

```
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

```

#### 构建 Docker 镜像

```bash

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

```

### Repo

Repo 是 Android 开发中用于管理多个 Git 仓库的工具,它是一个Python脚本,方便开发者对多个 Git 库进行版本控制和管理。

#### Repo下载

```bash

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

```
建议使用 Ubuntu 20.04 及以上版本

## 源码下载

Expand All @@ -74,11 +21,11 @@ $ repo sync -d -c -j4

## 镜像编译

镜像编译可以使用两种方法
### 全部编译

### 方法一 (**推荐**)
适合第一次编译

使用 SDK 编译脚本方式编译
Rock5B

```bash
radxa:rock-android12 $ source build/envsetup.sh
Expand All @@ -87,80 +34,48 @@ radxa:rock-android12 $ ./build.sh -UACKup
# get images from IMAGE directory
```

等待编译完成就可以在 IMAGE 目录找到镜像

### 方法二

可以根据这个方法一步一步编译镜像

1. 设置编译项目的环境
Rpck5BPlus
peterwang2050 marked this conversation as resolved.
Show resolved Hide resolved

```bash
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"
radxa:rock-android12 $ source build/envsetup.sh
radxa:rock-android12 $ lunch RadxaRock5BGen2-userdebug
radxa:rock-android12 $ ./build.sh -UACKup
# get images from IMAGE directory
```

2. 编译 U-boot
等待编译完成就可以在 IMAGE 目录找到镜像

```bash
android12 $ cd u-boot
android12/u-boot $ make clean
android12/u-boot $ make mrproper
android12/u-boot $ make distclean
android12/u-boot $ ./make.sh ${PRODUCT_UBOOT_CONFIG}
android12 $ cd -
```
### 单独编译

3. 编译内核
适合小修改后编译

```bash
radxa:rock-android12 $ cd kernel-5.10
radxa:rock-android12/kernel-5.10 $ export PATH=../prebuilts/clang/host/linux-x86/clang-r416183b/bin:$PATH
radxa:rock-android12/kernel-5.10 $ alias msk='make CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 LLVM_IAS=1'
radxa:rock-android12/kernel-5.10 $ msk ARCH=arm64 rockchip_defconfig android-11.config rock5b.config
radxa:rock-android12/kernel-5.10 $ msk ARCH=arm64 BOOT_IMG=../rockdev/Image-RadxaRock5B/boot.img rk3588-rock-5b.img
例如,只修改过

radxa:rock-android12 $ cd -
```

4. 编译AOSP
U-boot

```bash
android12 $ source build/envsetup.sh
android12 $ lunch ${PRODUCT_NAME}-userdebug
android12 $ make -j$(nproc)
```

5. 制作 Images
radxa:rock-android12 $ source build/envsetup.sh
radxa:rock-android12 $ lunch RadxaRock5B-userdebug
radxa:rock-android12 $ ./build.sh -AUup

```bash
android12 $ rm -rf rockdev
android12 $ ln -s RKTools/linux/Linux_Pack_Firmware/rockdev .
android12 $ ./mkimage.sh
```

6. 打包 Image
Kernel

```bash
android12 $ cd rockdev
android12/rockdev $ rm -rf Image
android12/rockdev $ ln -s Image-${PRODUCT_NAME} Image
radxa:rock-android12 $ source build/envsetup.sh
radxa:rock-android12 $ lunch RadxaRock5B-userdebug
radxa:rock-android12 $ ./build.sh -ACKup
```

- 打包成 RK update 格式镜像
AOSP

```bash
radxa:rock-android12 $ source build/envsetup.sh
radxa:rock-android12 $ lunch RadxaRock5B-userdebug
radxa:rock-android12 $ ./build.sh -Aup
```
radxa:rock-android12/rockdev $ ./mkupdate.sh rk3588 Image
```

在 rockdev/ 目录下生成了 update.img

- 打包成 GPT 格式镜像

```
android12/rockdev $ ./android-gpt.sh
```
等待编译完成就可以在 IMAGE 目录找到镜像

## 常见问题