diff --git a/README.md b/README.md index f0927eef4bca3deed8206b4da7da1e6e7efdaa30..db6d7ee1ce8371d213f993101ce08cce412e1385 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,16 @@ This is the meta repo for the AOSP for RISC-V Project. General tasks and issues If you are interested in runnning Android on RISC-V hardware, please join us! +The code of AOSP-RISCV is open source, and everyone is welcome to contribute. All repositories are in duplicate on Github and Gitee, which are mirror backups of each other. + +- Github: +- Gitee: + +You can choose a code repository for development according to your own preferences, and use similar development processes on both sides: + +- [Development Process based on Github](./docs/dev-github.md) +- [Development Process based on Gitee(in Chinese)](./docs/zh/dev-gitee.md) + ## Status Currently we are in a very early stage, trying to cross compile the AOSP codebase diff --git a/README_zh.md b/README_zh.md index 6240e4f7182caddfd9c154626f43b22f46083cec..cd4bfdd161a6ad26fbd5f919eddaf69105c31eb5 100644 --- a/README_zh.md +++ b/README_zh.md @@ -2,7 +2,17 @@ 本仓库适用于为 AOSP for RISC-V 项目组归档除代码外的其他相关资料和讯息。 -如果您对在基于 RISC-V 架构的硬件上运行 Android,欢迎加入我们! +如果您对在基于 RISC-V 架构的硬件上运行 Android 感兴趣,欢迎加入我们! + +AOSP-RISCV 的代码开源,欢迎大家参与贡献。所有仓库在 Github 和 Gitee 上一式两份,互为镜像备份。 + +- Github 仓库地址: +- Gitee 仓库地址: + +大家可以根据自己的喜好选择代码仓库进行开发,两边采用类似的开发流程: + +- [基于 Github 开发的流程说明](./docs/dev-github.md) +- [基于 Gitee 开发的流程说明](./docs/zh/dev-gitee.md) ## 项目状态 diff --git a/docs/dev-github.md b/docs/dev-github.md new file mode 100644 index 0000000000000000000000000000000000000000..31600093130c61c4d58ae896f363b5ddfe5d3c69 --- /dev/null +++ b/docs/dev-github.md @@ -0,0 +1,40 @@ +**How to participate in development based on Github** + +Suppose the address of the warehouse you need to modify is: + +The general steps are as follows: + +- First fork a development repository of your own from this repository, refer to online document [**"Fork a repo"**](https://docs.github.com/en/get-started/quickstart/fork-a-repo)。 + +- After the fork is completed, you can download your own repository to the local for modification and development. It is recommended to add `upstream` to remote in the local repository, pointing to the address of the upstream repository, in preparation for the update and synchronization in the future. The reference operation steps are as follows, assuming that your account is `robot`: + + ``` + $ git clone git@github.com:robot/platform_bionic.git + $ cd platform_bionic/ + $ git remote -v + origin git@github.com:robot/platform_bionic.git (fetch) + origin git@github.com:robot/platform_bionic.git (push) + $ git remote add upstream git@github.com:aosp-riscv/platform_bionic.git + $ git remote -v + origin git@github.com:robot/platform_bionic.git (fetch) + origin git@github.com:robot/platform_bionic.git (push) + upstream git@github.com:aosp-riscv/platform_bionic.git (fetch) + upstream git@github.com:aosp-riscv/platform_bionic.git (push) + $ git fetch --all + ``` + +- Then create a development branch for your own repository, such as `develop`, pay attention to create based on the latest integration branch `riscv64-android-12.0.0_dev`. Keep the development branch updated and synchronized with the integration branch before your changes are merged into `riscv64-android-12.0.0_dev`. + +- We follow-up the standard **Github "Fork + PullRequest"** procedure for development. After completing the modification, please submit a PullRequest and notify the repository adminitrator for review and merge. When submitting the PullRequest, pay attention to setting up the **compare branch** (here: `develop`) and the **base branch** (here: `riscv64-android-12.0.0_dev`). For specific PullRequest operations, please refer to online document [**"Collaborating with pull requests"**](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests). + + +- After the merge is completed, pay attention to timely syncronize the local and `origin`'s `riscv64-android-12.0.0_dev` branches in the local repository with upstream, as well as your own development branch, to ensure that they are based on the latest version. Here is an example of the steps to update the `riscv64-android-12.0.0_dev` branch (based on the above operation of adding upstream to remote): + + ``` + $ git fetch --all + $ git checkout riscv64-android-12.0.0_dev + $ git rebase --onto upstream/riscv64-android-12.0.0_dev --root + $ git push origin riscv64-android-12.0.0_dev + ``` + + After the update is complete, you can enter the next development cycle. \ No newline at end of file diff --git a/docs/howto-setup-build-env.md b/docs/howto-setup-build-env.md new file mode 100644 index 0000000000000000000000000000000000000000..25cd59f99f9a57da064a161745c79717ee6510ca --- /dev/null +++ b/docs/howto-setup-build-env.md @@ -0,0 +1,88 @@ +**How to build aosp-riscv** + + + +- [1. Hardware environment](#1-hardware-environment) +- [2. Install dependent software](#2-install-dependent-software) +- [3. Install repo](#3-install-repo) +- [4. Download source code](#4-download-source-code) +- [5. Build](#5-build) + + + +# 1. Hardware environment + +All operations in this article have been verified under the following system environment: + +``` +$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 18.04.6 LTS +Release: 18.04 +Codename: bionic +``` + +# 2. Install dependent software + +``` +$ sudo apt install git-core gnupg flex bison build-essential zip curl zlib1g-dev \ + gcc-multilib g++-multilib libc6-dev-i386 libncurses5 \ + lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev \ + libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig python +``` + +# 3. Install repo + +``` +$ mkdir ~/bin +$ export PATH=~/bin:$PATH +$ export REPO=$(mktemp /tmp/repo.XXXXXXXXX) +$ curl -o ${REPO} https://storage.googleapis.com/git-repo-downloads/repo +$ gpg --keyserver keyserver.ubuntu.com --recv-key 8BB9AD793E8E6153AF0F9A4416530D5E920F5C65 +$ curl -s https://storage.googleapis.com/git-repo-downloads/repo.asc | gpg --verify - ${REPO} && install -m 755 ${REPO} ~/bin/repo +``` + +`PATH` can be written into `~/.bashrc` to avoid definition everytime. + +After the installation is complete, you can run `repo version` to check the effect. An output similar to the following shows that the installation is successful. The repo version needs to be 2.15 or higher. + +``` +$ repo version + +repo launcher version 2.17 + (from /home/wangchen/bin/repo) +git 2.17.1 +Python 3.6.9 (default, Jan 26 2021, 15:33:00) +[GCC 8.4.0] +OS Linux 4.15.0-144-generic (#148-Ubuntu SMP Sat May 8 02:33:43 UTC 2021) +CPU x86_64 (x86_64) +Bug reports: https://bugs.chromium.org/p/gerrit/issues/entry?template=Repo+tool+issue +``` + +# 4. Download source code + +Create an AOSP source code build directory, here assume it is `/home/u/aosp`, and then enter the aosp directory. + +``` +$ mkdir -p /home/u/aosp +$ cd /home/u/aosp +``` + +After entering the AOSP build directory, execute the following command to download the source code of AOSP + +``` +$ repo init -u git@github.com:aosp-riscv/platform_manifest.git -b riscv64-android-12.0.0_dev +$ repo sync -j8 +``` + +# 5. Build + +Note: Because it is still in the development process, full compilation of `m` is not currently supported. + +``` +$ cd /home/u/aosp +$ source ./build/envsetup.sh +$ lunch aosp_riscv64-eng +$ m --skip-ninja --skip-soong-tests +``` diff --git a/docs/zh/dev-gitee.md b/docs/zh/dev-gitee.md new file mode 100644 index 0000000000000000000000000000000000000000..769bcfff4d99df91ca610b78887148bbdfcf4630 --- /dev/null +++ b/docs/zh/dev-gitee.md @@ -0,0 +1,39 @@ +**如何基于 Gitee 参与开发** + +假设你需要修改的仓库地址是: + +大致的步骤如下: + +- 首先从这个仓库上 fork 一个你自己的开发仓库,具体操作参考文档 [**“如何 fork 仓库”**](https://gitee.com/help/articles/4128#2%E5%A6%82%E4%BD%95-fork-%E4%BB%93%E5%BA%93)。 + +- fork 完成后,就可以将自己的仓库下载到本地进行修改开发了。建议在本地仓库里为 remote 添加 upstream,指向上游仓库的地址,为以后更新同步做准备。参考操作步骤如下,假设自己的账号是 robot: + + ``` + $ git clone git@gitee.com:robot/platform_bionic.git + $ cd platform_bionic/ + $ git remote -v + origin git@gitee.com:robot/platform_bionic.git (fetch) + origin git@gitee.com:robot/platform_bionic.git (push) + $ git remote add upstream git@gitee.com:aosp-riscv/platform_bionic.git + $ git remote -v + origin git@gitee.com:robot/platform_bionic.git (fetch) + origin git@gitee.com:robot/platform_bionic.git (push) + upstream git@gitee.com:aosp-riscv/platform_bionic.git (fetch) + upstream git@gitee.com:aosp-riscv/platform_bionic.git (push) + $ git fetch --all + ``` + +- 然后就为自己的仓库创建开发分支,譬如 `develop` ,注意基于最新的集成分支 `riscv64-android-12.0.0_dev` 创建,并在自己的代码没有被合入 `riscv64-android-12.0.0_dev` 之前时刻保持对开发分支的更新和同步。 + +- 我们采用标准的 **Gitee “Fork + PullRequest”** 方式进行开发,完成修改后请提交 PullRequest 并通知仓库管理员审核和合并。提交 PullRequest 时注意设置好 **源分支**(这里为 `develop`) 和 **目标分支**(这里为 `riscv64-android-12.0.0_dev`)。具体 PullRequest 的操作参考文档 [**“Fork + PullRequest 模式”**](https://gitee.com/help/articles/4128#article-header0)。 + +- 合并完成后注意在本地仓库中及时地将本地和 `origin` 的 `riscv64-android-12.0.0_dev` 分支和 `upstream` 进行同步,包括自己的开发分支,确保自己的工作基于最新的版本。下面给一个更新 `riscv64-android-12.0.0_dev` 分支的步骤例子(基于上面为 remote 添加 upstream 的操作): + + ``` + $ git fetch --all + $ git checkout riscv64-android-12.0.0_dev + $ git rebase --onto upstream/riscv64-android-12.0.0_dev --root + $ git push origin riscv64-android-12.0.0_dev + ``` + + 更新完成后就可以进入下一个开发周期了。 \ No newline at end of file diff --git a/articles/20211029-howto-setup-build-env.md b/docs/zh/howto-setup-build-env.md similarity index 75% rename from articles/20211029-howto-setup-build-env.md rename to docs/zh/howto-setup-build-env.md index eff8730f741fd8ed7fbb147df12beeb8b347dcda..a39a03f44f3cbd3369f22cf3d912959e8b1b0e80 100644 --- a/articles/20211029-howto-setup-build-env.md +++ b/docs/zh/howto-setup-build-env.md @@ -1,12 +1,14 @@ **如何编译 aosp-riscv** + +注:提供此文档为方便国内参与小伙伴。 + - [1. 硬件环境](#1-硬件环境) - [2. 安装依赖软件](#2-安装依赖软件) - [3. 安装 repo](#3-安装-repo) - [4. 下载源码](#4-下载源码) -- [5. 下载 patch 并打补丁](#5-下载-patch-并打补丁) -- [6. 编译](#6-编译) +- [5. 编译](#5-编译) @@ -71,28 +73,17 @@ $ cd /home/u/aosp ``` 进入 AOSP 构建目录后执行以下命令下载 AOSP 的源码 -``` -$ repo init -u git@gitee.com:aosp-riscv/platform_manifest.git -b riscv64-android-12.0.0_dev -$ repo sync -j8 -``` -# 5. 下载 patch 并打补丁 - -由于部分 AOSP 仓库整体体积过大或者部分文件体积过大,超过 gitee/github 限制的,目前无法在 gitee/github 上新建仓库,所以目前采用补丁方式保存修改,这些补丁单独存放在一个仓库 中。 - -**注意请将这个仓库下载在 AOSP 的构建目录(譬如这里是 `/home/u/aosp`)之外。**, 这里假设下载到 `/home/u` 下。 - -执行如下命令下载额外的补丁并执行脚本文件应用补丁。 +注:由于采用的是 Gitee 上的 aosp-riscv 开发仓库,以及采用国内清华源的 AOSP 镜像作为缺省 remote,将大大方便国内用户下载代码。 ``` -$ cd /home/u -$ git clone git@gitee.com:aosp-riscv/patches_aosp_riscv.git -$ cd patches_aosp_riscv/ -$ git checkout riscv64-android-12.0.0_dev -$ ./apply_patches.sh /home/u/aosp +$ repo init -u git@gitee.com:aosp-riscv/platform_manifest.git -b riscv64-android-12.0.0_dev_cn +$ repo sync -j8 ``` -# 6. 编译 +# 5. 编译 + +注意:因为还在开发过程中,当前还不支持完整的编译 `m`。 ``` $ cd /home/u/aosp