repo版本切换

时间:2022-09-22 10:33:55

repo init -u https://android.googlesource.com/platform/manifest

repo sync 之后

这样初始化之后,相当于下载了全部的分支,

本想编译源码烧录到手机Nexus 5,编译时才发现找不到aosp_hammerhead_userdebug,毕竟nexus5明确不支持android-7.0

那么如何切换成自己想要的分支

查看可切换的分支 
cd .repo/manifests 
git branch -a | cut -d / -f 3

以android-6.0.1_r8为例

repo start android-6.0.1_r8 --all  
查看当前的分支 
repo branches

示例如下:

repo版本切换

但最终还是无法完成编译

其实命令repo start android-6.0.1_r8 --all 只是在每个git库上新建一个分支,代码并不会切到指定分支

repo abandon android-6.0.1_r8 清除本地分支

-----------------------------------分割线-------------------------------------------

上面使用每月初始化包的方式没能通过编译,无奈,老老实实下载吧

1、下载

mkdir aosp
cd aosp
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-6.0.1_r3
sh myrepo.sh

myrepo.sh是为避免repo失败过程,对repo sync 重试过程进行的封装,见下方

#!/bin/sh
repo sync -j4
while [ $? -ne ]
do
repo sync -j4
done
同步过程出现 curl: () The requested URL returned error:  Not Found Server does not provide clone.bundle; ignoring. 直接无视即可
下载完整个目录大小为54G
ninjame@ubuntu1604:~$ du -sh aosp/
54G aosp/

2、编译

export USE_CCACHE=
prebuilts/misc/linux-x86/ccache/ccache -M 50G
source build/envsetup.sh ninjame@ubuntu1604:~/aosp$ lunch ------------------------------
You're building on Linux Lunch menu... pick a combo:
. aosp_arm-eng
. aosp_arm64-eng
. aosp_mips-eng
. aosp_mips64-eng
. aosp_x86-eng
. aosp_x86_64-eng
. aosp_deb-userdebug
. aosp_flo-userdebug
. full_fugu-userdebug
. aosp_fugu-userdebug
. mini_emulator_arm64-userdebug
. m_e_arm-userdebug
. mini_emulator_mips-userdebug
. mini_emulator_x86_64-userdebug
. mini_emulator_x86-userdebug
. aosp_flounder-userdebug
. aosp_angler-userdebug
. aosp_bullhead-userdebug
. aosp_hammerhead-userdebug
. aosp_hammerhead_fp-userdebug
. aosp_shamu-userdebug Which would you like? [aosp_arm-eng] ------------------------ make -j8

问题记录:

pp frameworks/base/tools/aidl/aidl_language_y.y
build/core/binary.mk:: recipe for target 'out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp' failed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_y.cpp] 断开的管道
make: *** 正在等待未完成的任务....
Lex: aidl <= frameworks/base/tools/aidl/aidl_language_l.l
frameworks/base/tools/aidl/aidl_language_l.l:: warning, 无法匹配规则
flex-2.5.:严重内部错误,exec of /usr/bin/m4 failed
build/core/binary.mk:: recipe for target 'out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp' failed
make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp] Error
make: *** Deleting file 'out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl_language_l.cpp'
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 解决办法:
sudo apt-get install m4
sudo apt-get install libxml2-utils clang: error: linker command failed with exit code 1 (use -v to see invocation)
build/core/host_shared_library_internal.mk:51: recipe for target 'out/host/linux-x86/obj/lib/libart.so' failed
make: *** [out/host/linux-x86/obj/lib/libart.so] Error 1
make: *** 正在等待未完成的任务....
据说这个错误只在ubuntu16.04 上出现

1 更换软件源为阿里云

为了更快的安装软件,我们需要更换软件源为国内的软件源,这里推荐使用Ubuntu官方指定的国内软件源阿里云,博主之前使用的是网易的软件源,结果发现OpenJDK7装不上去,于是换成了阿里的,具体方法是:

sudo gedit /etc/apt/sources.list 

在文件最前面加入下面代码:

deb http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ quantal-backports main restricted universe multiverse

2 安装依赖

sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install lib32z-dev ccache
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4

Ubuntu 16.04请务必使用上面的依赖,Ubuntu 16.04需要的依赖和Ubuntu 14.04所需要的依赖是不同的

3 修改源码

修改 mydroid/art/build/Android.common_build.mk 文件,定位到75行,将下面的代码:

ifneq ($(WITHOUT_HOST_CLANG),true)

改为:

ifeq ($(WITHOUT_HOST_CLANG),false)

如果不修改这里,会遇到一个比较棘手的编译错误,修改的目的是把CLANG这个编译选项关掉,详见后面的编译记录,百度搜狗都无解,这个错误只会在Ubuntu16.04上遇到,Ubuntu14.04则不存在这个问题,

参考 http://blog.csdn.net/fuchaosz/article/details/51487585

最终编译耗时 1h 22min

Creating filesystem with parameters:
Size:
Block size:
Blocks per group:
Inodes per group:
Inode size:
Journal blocks:
Label: system
Blocks:
Block groups:
Reserved block group size:
Created filesystem with / inodes and / blocks
Install system fs image: out/target/product/hammerhead/system.img
out/target/product/hammerhead/system.img+out/target/product/hammerhead/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize= blocksize= total= reserve= #### make completed successfully (:: (hh:mm:ss)) #### ninjame@ubuntu1604:~/aosp$ du -sh out/
22G out/

3、刷机

刷机过程碰到

fastboot reboot
< waiting for any device > fastboot devices
no permissions (verify udev rules); see [http://developer.android.com/tools/device.html] fastboot fastboot命令一直识别不了手机,一开始以为时fastboot版本的问题,后来发现不是这么回事 需要设置usb权限
因为ubuntu这样的系统都是默认以非root身份在运行的,要使用usb调试,需要sudo支持。
fastboot模式下插入手机
$ lsusb
ninjame@ubuntu1604:~$ lsusb
Bus Device : ID 1d6b: Linux Foundation 3.0 root hub
Bus Device : ID 04d9:a0cd Holtek Semiconductor, Inc.
Bus Device : ID 18d1:4ee0 Google Inc.
Bus Device : ID 093a: Pixart Imaging, Inc. Optical Mouse
Bus Device : ID 1d6b: Linux Foundation 2.0 root hub
$sudo vim /etc/udev/rules.d/-android.rules //60-android.rules为新建的。
加入以下内容:
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="4ee0",MODE="" 其中的idvendor idProduct指的是USB的ID可以使用lsusb查询得到。
比如我的是:
lsusb Bus Device : ID 18d1:4ee0 Google Inc. ID 18d1 就是idVendor ,4ee0就是 idProduct
运行命令,重启udev:
$sudo chmod a+rx /etc/udev/rules.d/-android.rules
$sudo service udev restart
(很重要)拔掉usb重新连上再执行:
fastboot devices ninjame@ubuntu1604:~$ fastboot devices
0779af0143a66640 fastboot 设置环境变量 sudo vim /etc/profile
export ANDROID_PRODUCT_OUT="/home/ninjame/aosp/out/target/product/hammerhead"
source /etc/profile ninjame@ubuntu1604:~/aosp/out/target/product/hammerhead$ fastboot -w flashall
target reported max download size of 1073741824 bytes
wiping userdata...
Creating filesystem with parameters:
    Size: 13725835264
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8144
    Inode size: 256
    Journal blocks: 32768
    Label:
    Blocks: 3351034
    Block groups: 103
    Reserved block group size: 823
Created filesystem with 11/838832 inodes and 93654/3351034 blocks
wiping cache...
Creating filesystem with parameters:
    Size: 734003200
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 7472
    Inode size: 256
    Journal blocks: 2800
    Label:
    Blocks: 179200
    Block groups: 6
    Reserved block group size: 47
Created filesystem with 11/44832 inodes and 5813/179200 blocks
--------------------------------------------
Bootloader Version...: HHZ12k
Baseband Version.....: M8974A-2.0.50.2.28
Serial Number........: 0779af0143a66640
--------------------------------------------
checking product...
OKAY [  0.100s]
sending 'boot' (9160 KB)...
OKAY [  0.500s]
writing 'boot'...
OKAY [  0.785s]
sending 'recovery' (10018 KB)...
OKAY [  0.566s]
writing 'recovery'...
OKAY [  0.825s]
erasing 'system'...
OKAY [  1.066s]
sending 'system' (358584 KB)...
OKAY [ 11.452s]
writing 'system'...
OKAY [ 25.345s]
erasing 'userdata'...
OKAY [  7.935s]
sending 'userdata' (137318 KB)...
OKAY [  4.511s]
writing 'userdata'...
OKAY [  9.139s]
erasing 'cache'...
OKAY [  0.584s]
sending 'cache' (13348 KB)...
OKAY [  0.630s]
writing 'cache'...
OKAY [  1.067s]
rebooting... finished. total time: 65.037s

完成刷机过程

repo版本切换的更多相关文章

  1. &lbrack;连载&rsqb;《C&num;通讯(串口和网络)框架的设计与实现》- 13&period;中英文版本切换设计

    目       录 第十三章     中英文版本切换设计... 2 13.1        不用自带的资源文件的理由... 2 13.2        配置文件... 2 13.3        语言 ...

  2. CentOS 6&period;5移除openJDK及JDK安装环境变量配置及JDK版本切换

    一.查找已经安装的open JDK [root@localhost ~]# rpm -qa|grep jdk java--openjdk-.el6_3.x86_64 java--openjdk-1.7 ...

  3. java&lowbar;jdk&lowbar;JDK版本切换批处理脚本

    我们平时在window上做开发的时候,可能需要同时开发两个甚至多个项目,有时不同的项目对JDK的版本要求有区别,这时候我们可能会在一台电脑上安装多个版本的JDK,如下图所示:

  4. Git Day01,仓库,commit,版本切换

    1st,创建版本库:  2nd,添加文件:  3rd,修改文件,并提交: 4th,版本切换:git log查看版本:版本回退: 又回到原始版本了: 回到“未来”: 今天就到这里,明天继续.Git确实挺 ...

  5. MAC下 JDK环境配置、版本切换以及ADB环境配置

    网上方法,自己总结:亲测可行! 一.JDK环境配置.版本切换: 通过命令’jdk6′, ‘jdk7′,’jdk8’轻松切换到对应的Java版本: 1.首先安装所有的JDk:* Mac自带了的JDK6, ...

  6. windows JDK 版本切换

    windows JDK 版本切换1. HKEY_LOCAL_MACHINE“SOFTWARE“JavaSoft“Java Runtime Environment“CurrentVersion, 把这个 ...

  7. Git版本切换

    前面的话 本文将以一个简单实例的形式来介绍Git版本切换 初始版本 首先,在一个自定义的位置,创建目录a,比如在D盘下 [注意]本文会用到一些常用的Linux的Shell命令,详细信息移步至此 先使用 ...

  8. 关于Linux系统下jdk版本切换问题(alternatives命令的使用)

    [root@danny lib]# cd /usr/lib/jvm [root@danny jvm]# [root@danny jvm]# ls java java--openjdk-.b13.el7 ...

  9. Windows jdk安装以及版本切换

    Windows jdk版本切换 一.安装 1.下载 官网: Java SE Development Kit 8 Downloads Java SE 7 Archive Downloads 1.7之前的 ...

随机推荐

  1. VS2010和opencv-2&period;4&period;10、GDAL

    系统环境:win10 64位 本文只限于学习交流,商业用途请支持正版! 转载请注明:转载请注明http://www.cnblogs.com/mxbs/p/6206060.html       2016 ...

  2. dr&period;wondr博士随笔之某古旧非智能机T6XXX 恢复一例

    大家好!欢迎再次来到dr.Wonde的微博! 今次我给大家带来索尼爱立信古董机T650i的取证工作展示! 首先请出今天我们的主角索尼爱立信 T650i>> 然后在工厂模式下,连接设备,看图 ...

  3. JavaScript之arguments&period;callee

    arguments.callee 在哪一个函数中运行,它就代表哪个函数. 一般用在匿名函数中. 在匿名函数中有时会需要自己调用自己,但是由于是匿名函数,没有名子,无名可调. 这时就可以用argumen ...

  4. Vue(十四)过渡(动画)

    过渡(动画) 1. 简介 Vue 在插入.更新或者移除 DOM 时,提供多种不同方式的应用过渡效果 本质上还是使用CSS3动画:transition.animation 2. 基本用法 使用trans ...

  5. HDU3062&amp&semi;&amp&semi;HDU1814

    Preface 两道2-SAT模板题. HDU3062 看题目就一眼2-SAT.一对夫妻看成一个变量,之间的矛盾可以看成限制. 考虑不同席的限制,相当于选了\(i\)就不选\(j\),即必选\(j'\ ...

  6. MyEclipse10&period;7安装Aptana后重启:An internal error has occurred&period; No more handles &lbrack;Could not detect registered XULRunner to use&rsqb;

    问题描述: 当安装Aptana插件后重启MyEclipse10.7,发生错误: An internal error has occurred. No more handles [Could not d ...

  7. &lbrack;转&rsqb;otunnel:一个和lcx差不多的端口转发的工具

    这是一个采用Golang编写的和lcx差不多的端口转发的工具,用来突破内网环境 项目地址 ooclab/otunnel 下载地址(内涵各大平台) http://dl.ooclab.com/otunne ...

  8. urllib 简介

    (1) urllib 是 Python 内置的 HTTP 请求库,用来向服务器发送 HTTP 请求(2) 在 Python2.x 中,有 urllib 和 urllib2 两个模块:在 Python3 ...

  9. configure&colon; error&colon; newly created file is older than distributed files&excl;

    在linux下安装软件包的时候,有时候提示 configure: error: newly created file is older than distributed files!Check you ...

  10. Python3基础 print 自带换行

             Python : 3.7.0          OS : Ubuntu 18.04.1 LTS         IDE : PyCharm 2018.2.4       Conda ...