CM 出错解决
发布日期:2021-06-29 15:24:46 浏览次数:3 分类:技术文章

本文共 4659 字,大约阅读时间需要 15 分钟。



参考页面: 

1.   

2.  


在下载和编译之前,检查是否符合条件:

1). Linux 或者 Mac 系统 。 如果在Windows 上使用虚拟机,则需要至少16G 的RAM/SWAP 和 30G 的 磁盘。

2). 编译2.3 及以上要64位系统。 (head -n 1 /etc/issue 我使用的 Ubutnu 12.04.4 LTS )

3). 30G 磁盘-- single build ; 100G 磁盘 --full build  (  我的 可用空间有140G)

4). Python 2.6-2.7 (Ubutnu 自带 2.7.3)

5). GNU Make 3.8.1 - 3.8.2  (目前还没有)

6). JDK 7 -- 用来编译最新的 AOSP  (我的 jdk6 7 都有了)

    JDK 6 -- Gingerbread(2.3.x) 到 KitKat(4.4) 

    JDK 5 -- 2.3 以下

7). Git 1.7 或更新


--------------------------------------------------------------------------------------------------------------------------------


1) 安装JDK :

sun jdk :http://www.oracle.com/technetwork/java/javase/archive-139210.html



2) 安装 需要的包(12.04) 

 $ sudo apt-get install git gnupg flex bison gperf build-essential \    zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \    libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \    libgl1-mesa-dev g++-multilib mingw32 tofrodos \    python-markdown libxml2-utils xsltproc zlib1g-dev:i386
 $ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so


3) 配置USB 访问权限 :http://source.android.com/source/initializing.html#setting-up-a-linux-build-environment

插上小米后: lsusb 下面右一行 Bus 001 Device 005: ID 18d1:9025 Google Inc.

       

 $ sudo touch /etc/udev/rules.d/51-android-rules

 $ sudo gedit /etc/udev/rules.d/51-android-rules

添加 : 

      SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="9025", MODE="0600", OWNER="hanly"


4) 设置ccache (加快编译速度尤其是 有多个编译时)

 在 .bashrc 中添加

 $ export USE_CCACHE=1
 

--------

5 下载源码:

要安装有 repo

$ mkdir ~/bin$ PATH=~/bin:$PATH  ;这个最好是加入到~/.bashrc 中,然后重新开一个终端
$ [错误1]curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo   ;【20140508】这个又可以了 $ chmod a+x ~/bin/repo


[错误1] 

curl 那条行不通,报错  0curl: (7) couldn't connect to host 

解法一:  参考: http://www.miui.com/thread-1540431-1-1.html 

  然后执行

$ curl "http://php.webtutor.pl/en/wp-content/uploads/2011/09/repo" > ~/bin/repo $ chmod a+x ~/bin/repo
解法二 : https://code.google.com/p/git-repo/wiki/Source?tm=4
 $ git clone https://gerrit.googlesource.com/git-repo ~/bin/git-repo
 $ cp ~/bin/git-repo/repo ~/bin/repo



--------- 参考 : - ----------

6. 下载源码 :

$ mkdir -p ~/android/system 
$ cd ~/android/system/   ; 先不要执行下面的 $ [错误2]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0  ;


$ repo sync

[错误2] :

在这个地方纠结了2天,最后是看到这个帖子,受到启发 

具体的解决方法是: 使用 https 初始化 repo

1.  直接使用 https 初始化,如下,然后看 修改 manifest.xml 文件

$ repo init -u https://github.com/CyanogenMod/android.git -b cm-11.0

2.  如果已经使用 如下语句 初始化,并下载了部分代码,可以修改 manifest.xml 文件和 manifests.git/config 文件 后再 repo sync

$ repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0


修改: 

然后检查并修改 .repo/manifest.xml : 

           fetch="https://android.googlesource.com"    
           review="android-review.googlesource.com" />  


  <remote  name="github"
           fetch="https://github.com"
           review="review.cyanogenmod.org" />  


  <remote  name="private"
           fetch="ssh://git@github.com" />


  <default revision="refs/heads/cm-11.0"
           remote="github"
           sync-c="true"
           sync-j="4" /> 

如果是用第二种初始化方法,还需要将 .repo/manifests.git/config 中的git:改成https: 


然后再 repo sync 就很顺畅了, 另外还可一加参数,-j10 ,即同时开10个线程下载。




---------------------------------------------------------------------------------------------------------------------------------

下面是之前遇到的一些错误,如果 可以同步代码就不用看了。

1.  android.googlesource.com  

Initializing project platform/cts ...

error: Failed to connect to 2404:6800:4005:c00::52:Network is unreachable while accessinghttps://android.googlesource.com/platform/cts.git/info/refs

Fetching projects:   1% (5/456)  error: The requested URL returned error: 406 while accessing https://android.googlesource.com/platform/cts.git/info/refs

fatal: HTTP request failed

error: Cannot fetch platform/cts


ping  android.googlesource.com 得到 ip 加入到hosts (sudo gedit /etc/hosts )

74.125.128.82  android.googlesource.com



2 . 这个不算错误,因为源码比较大,而中途不知到会出现什么网络问题一部小心就断了, 所以可以写个脚本使失败的时候自动重新执行。


#!/bin/bash

echo " ************************************************************** “

echo  "                              start sync source code " 

repo sync 

while  [  $? = 1 ]  ;  do 

echo   " ----------------------- restart sync ------------------ "

repo sync

done


3 .  

Initializing project CyanogenMod/android_abi_cpp ...

fatal: '../CyanogenMod/android_abi_cpp.git' does not appear to be a git repository

fatal: Could not read from remote repository.

Please make sure you have the correct access rights

and the repository exists.

error: Cannot fetch CyanogenMod/android_abi_cpp

编辑 ~/android/system/.repo中的 manifest.xml 文件,找到

 <remote  name="github" <="" span="" style="word-wrap: break-word;">

           fetch=".."

           review="review.cyanogenmod.org" />

将 其中的 fetch=".."  改成  fetch="https://github.com" ,因为 ../CyanogenMod/android_abi_cpp.git 实际想找的是 https://github.com/CyanogenMod/android_abi_cpp.git

转载地址:https://codegg.blog.csdn.net/article/details/50412902 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:repo sync 出错解决
下一篇:cm下载

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月16日 14时11分15秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章