【android】使用repo下载aosp镜像和板厂开发包

搭建android开发环境,首先需要下载google的aosp包,以及开发板的vendor开发包。
在khadas项目中,分别是从tsinghua镜像源和github上同步的。所以要修改manifest清单的fetch地址,告诉repo从哪抓取。

https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/
https://docs.khadas.com/vim3/DownloadAndroidSourceCode.html

### 下载repo索引工具 ###
chase@giga:~$ curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 29829  100 29829    0     0  21185      0  0:00:01  0:00:01 --:--:-- 21170

chase@giga:~$ chmod a+rx repo
chase@giga:~$ vi repo
### REPO_URL 替换成国内源 'https://mirrors.tuna.tsinghua.edu.cn/git/git-repo' ###

chase@giga:~$ vi .bashrc
### 永久环境变量 最后一行添加 export PATH=$PATH:~/ 将当前路径加入PATH###
### 刷新立即生效 ###
chase@giga:~$ source .bashrc  
chase@giga:~$ echo $PATH
/home/chase/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/chase/

### 从开发板指定地址下载manifest清单以及repo工具, 都在.repo目录下###
chase@giga:~$ cd ~/projects/khadas-vims-pie/
chase@giga:~/projects/khadas-vims-pie$ repo init -u https://github.com/khadas/android_manifest.git -b khadas-vims-pie
Get https://gerrit-googlesource.proxy.ustclug.org/git-repo/clone.bundle
Get https://gerrit-googlesource.proxy.ustclug.org/git-repo
Get https://github.com/khadas/android_manifest.git
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.
remote: Enumerating objects: 9, done.        
remote: Counting objects: 100% (9/9), done.        
remote: Compressing objects: 100% (5/5), done.        
remote: Total 201 (delta 2), reused 7 (delta 1), pack-reused 192        
Receiving objects: 100% (201/201), 253.52 KiB | 377.00 KiB/s, done.
Resolving deltas: 100% (63/63), done.
From https://github.com/khadas/android_manifest
 * [new tag]         V180622            -> V180622
 * [new branch]      Mmallow            -> origin/Mmallow
 * [new branch]      Nougat             -> origin/Nougat
 * [new branch]      Oreo               -> origin/Oreo
 * [new branch]      khadas-edge-nougat -> origin/khadas-edge-nougat
 * [new branch]      khadas-edge-pie    -> origin/khadas-edge-pie
 * [new branch]      khadas-vim3-pie    -> origin/khadas-vim3-pie
 * [new branch]      khadas-vims-nougat -> origin/khadas-vims-nougat
 * [new branch]      khadas-vims-pie    -> origin/khadas-vims-pie
 * [new branch]      master             -> origin/master
 * [new branch]      test               -> origin/test

Your identity is: chase <xxxxxx@hotmail.com>
If you want to change this, please re-run 'repo init' with --config-name

repo has been initialized in /home/chase/projects/khadas-vims-pie

 

###这时会在文件夹下出现一个.repo的隐藏文件夹###

chase@giga:~/projects/khadas-vims-pie$  ls .repo
manifests  manifests.git  manifest.xml  repo


chase@giga:~/projects/khadas-vims-pie$ cd .repo/manifests
chase@giga:~/projects/khadas-vims-pie/.repo/manifests$ vi default.xml
### remote中的fetch和review都替换成国内镜像源 https://aosp.tuna.tsinghua.edu.cn ###

### 可以查看下远程服务器的分支版本 ###
chase@giga:~/projects/khadas-vims-pie/.repo/manifests$ git branch -av
* default                           17f19da Pie: V200103
  remotes/origin/Mmallow            856410c update download link of svox repository to google
  remotes/origin/Nougat             2f08215 Set function key adc value for VIM2 different versions
  remotes/origin/Oreo               b75302d fixup! Oreo: V171229
  remotes/origin/khadas-edge-nougat 402b195 update to Edge_Nougat_V191115
  remotes/origin/khadas-edge-pie    16f0d2b Fix compile error
  remotes/origin/khadas-vim3-pie    33144e9 fixup! Pie: V190823
  remotes/origin/khadas-vims-nougat 2f08215 Set function key adc value for VIM2 different versions
  remotes/origin/khadas-vims-pie    17f19da Pie: V200103
  remotes/origin/master             f351208 fixup! update: V161211
  remotes/origin/test               3142359 fixup! Pie: V190704

### 从服务器同步aosp和vendor源码, -j表示并行下载的git包数量 ###
chase@giga:~/projects/khadas-vims-pie$ repo sync -j4
......
Checking out projects: 100% (687/687), done.

 

###所有git包都在.repo/project-objects里面,大约有100G###

chase@giga:~/projects/khadas-vims-pie$ ls .repo/
manifests      manifest.xml  project-objects  repo
manifests.git  project.list  projects

 

###sync到每个.git包后,会同步提取到khadas-vims-pie目录下###


### 建立新分支 ###
chase@giga:~/projects/khadas-vims-pie$ repo start khadas-vims-pie --all

### 逐步编译参考 ###
https://docs.khadas.com/zh-cn/vim3/BuildAndroid.html

 ***---***---***---***---***

### 一般编译出错都是文件丢失导致的,查找删除或者手动删除 ###
chase@giga:~/projects/khadas-vims-pie$ repo start khadas-vims-pie --all
error: device/khadas/: cannot start khadas-vims-pie

### find并删除 源端版本android_device_khadas.git 本地版本device/khadas.git
chase@giga:~/projects/khadas-vims-pie$ find .repo/ -iname "*khadas.git"
.repo/project-objects/android_device_khadas.git
.repo/projects/device/khadas.git
chase@giga:~/projects/khadas-vims-pie$ rm -rf .repo/project-objects/android_device_khadas.git .repo/projects/device/khadas.git
chase@giga:~/projects/khadas-vims-pie$

### 再单独sync这个包 ###
chase@giga:~/projects/khadas-vims-pie$ repo sync -c device/khadas/

### 有时发现.git包是完整的,但是check out会丢失文件 ###
### 可以用git clone单独下载这个包,然后copy到项目中 ###
chase@giga:~/projects$ git clone https://github.com/khadas/android_device_khadas.git/ -b khadas-vims-pie

posted @ 2020-01-16 09:51  KevinChase  阅读(952)  评论(0编辑  收藏  举报