① 如何默认打开user版本 debug 选项,默认打开adb 连接
需要修改code。
如下2个属性需要更改为如下默认值。
ro.debuggable=1 //打开debug选项
ro.adb.secure=0//关闭鉴权
recovery.img生成过程
L630-L637 依赖关系
(From: build/core/Makefile)630 $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) /631 $(INSTALLED_RAMDISK_TARGET) /632 $(INSTALLED_BOOTIMAGE_TARGET) /633 $(recovery_binary) /634 $(recovery_initrc) $(recovery_kernel) /635 $(INSTALLED_2NDBOOTLOADER_TARGET) /636 $(recovery_build_prop) $(recovery_resource_deps) /637 $(RECOVERY_INSTALL_OTA_KEYS)
INSTALLED_RECOVERYIMAGE_TARGET 为我们的编译目标:
584 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
它依赖很多其它目标:
1.MKBOOTFS, MINIGZIP, MKBOOTIMG,PC端工具软件:(From build/core/config.mk)265 MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)266 MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)267 MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
2.INSTALLED_RAMDISK_TARGET,标准根文件系统 ramdisk.img:
326 BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img328 # We just build this directly to the install location.329 INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET) 3.INSTALLED_BOOTIMAGE_TARGET, 即boot.img,标准内核及标准根文件系统:362 INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
4. recovery_binary, Recovery可执行程序,源码位于:bootable/recovery
590 recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
5. recovery_initrc,recovery模式的init.rc, 位于 bootable/recovery/etc/init.rc
586 recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
6. recovery_kernel, recovery 模式的kernel, 同标准内核
587 recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
7.INSTALLED_2NDBOOTLOADER_TARGET,我们不用。
8. recovery_build_prop, recovery 模式的build.prop, 同标准模式。589 recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
9. recovery_resource_deps, recovery 模式使用的res, 位于:recovery/custom/{proct_name}/res, 以及设备自定义部分(我们没用到)
591 recovery_resources_common := $(call include-path-for, recovery)/custom/$(TARGET_PRODUCT)/res592 recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))593 recovery_resource_deps := $(shell find $(recovery_resources_common) 594 $(recovery_resources_private) -type f) 10. RECOVERY_INSTALL_OTA_KEYS, ota 密钥:
618 # Generate a file containing the keys that will be read by the619 # recovery binary.620 RECOVERY_INSTALL_OTA_KEYS := /621 $(call intermediates-dir-for,PACKAGING,ota_keys)/keysL638-L655 准备内容
638 @echo ----- Making recovery image ------639 rm -rf $(TARGET_RECOVERY_OUT)640 mkdir -p $(TARGET_RECOVERY_OUT)641 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)642 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc643 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/tmp
准备recovery目录:out/target/proct/{proct_name}/recovery 及其子目录:
./root
./root/etc
./root/tmp644 echo Copying baseline ramdisk...645 cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)646 echo Modifying ramdisk contents...647 rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res
从标准根文件系统拷贝所有文件, 删除其res 目录。
648 cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/649 cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ 拷贝recovery 模式的核心文件 init.rc 及 recovery 650 cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/651 $(foreach item,$(recovery_resources_private), /652 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)653 cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys 拷贝资源文件及密钥文件。 654 cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) /655 > $(TARGET_RECOVERY_ROOT_OUT)/default.prop 生成属性文件 default.prop, 它包含了标准根文件系统的default.prop (out/target/proct/{proct_name}/root/default.prop)以及system分区的build.prop (out/target/proct/{proct_name}/system/build.prop) L656-L661 最终生成recovery.img
656 $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) 压缩recovery根文件系统 657 build/quacomm/mkimage $(PRODUCT_OUT)/ramdisk-recovery.img RECOVERY > $(PRODUCT_OUT)/ramdisk_recovery.img 加一个标识头(RECOVERY) 658 mv $(PRODUCT_OUT)/ramdisk_recovery.img $(PRODUCT_OUT)/ramdisk-recovery.img659 $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) --output $@660 @echo ----- Made recovery image -------- $@661 $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
和内核一起,生成recovery.img附:Recovery 根文件系统目录结构
$ tree
.
├── advanced_meta_init.rc
├── data
├── default.prop
├── dev
├── etc
├── init
├── init.factory.rc
├── init.goldfish.rc
├── init.quacomm.rc
├── init.rc
├── meta_init.rc
├── proc
├── res
│ ├── images
│ │ ├── icon_error.png
│ │ ├── icon_installing.png
│ │ ├── indeterminate1.png
│ │ ├── indeterminate2.png
│ │ ├── indeterminate3.png
│ │ ├── indeterminate4.png
│ │ ├── indeterminate5.png
│ │ ├── indeterminate6.png
│ │ ├── progress_empty.png
│ │ └── progress_fill.png
│ └── keys
├── sbin
│ ├── adbd
│ ├── advanced_meta_init
│ ├── meta_init
│ ├── meta_tst
│ └── recovery
├── sys
├── system
└── tmp
③ 这段代码是什么意思
记录春节离当年元旦的天数,具体请看:
【本程序在DEV C++ 4.9.9.2 下编译通过】
有关农历的东西有以下几篇文章:
计算某天是星期几【C代码】
农历算法简介以及公式
农历中天干地支的计算【C代码】
农历一百年算法(1921~2021)【C语言代码】
农历两百年算法(1901~2100)【C语言代码】
下面是两百年算法,另外网上也流传着一个很有名气的一百年算法。农历一百年算法(1921~2021)【C语言代码】
下面的三个表格是农历数据表 LunarCalendarTable 的结构。总共使用了32位整数的0~23位。
6 5 4 3 2 1 0
表示春节的公历月份 表示春节的公历日期
19 18 17 16 15 14 13 12 11 10 9 8 7
1 2 3 4 5 6 7 8 9 10 11 12 13
农历1-13 月大小 。月份对应位为1,农历月大(30 天),为0 表示小(29 天)
23 22 21 20
表示当年闰月月份,值为0 为则表示当年无闰月。
#include <time.h>
unsigned int LunarCalendarDay;
unsigned int LunarCalendarTable[199] = {
0x04AE53,0x0A5748,0x5526BD,0x0D2650,0x0D9544,0x46AAB9,0x056A4D,0x09AD42,0x24AEB6,0x04AE4A,/*1901-1910*/
0x6A4DBE,0x0A4D52,0x0D2546,0x5D52BA,0x0B544E,0x0D6A43,0x296D37,0x095B4B,0x749BC1,0x049754,/*1911-1920*/
0x0A4B48,0x5B25BC,0x06A550,0x06D445,0x4ADAB8,0x02B64D,0x095742,0x2497B7,0x04974A,0x664B3E,/*1921-1930*/
0x0D4A51,0x0EA546,0x56D4BA,0x05AD4E,0x02B644,0x393738,0x092E4B,0x7C96BF,0x0C9553,0x0D4A48,/*1931-1940*/
0x6DA53B,0x0B554F,0x056A45,0x4AADB9,0x025D4D,0x092D42,0x2C95B6,0x0A954A,0x7B4ABD,0x06CA51,/*1941-1950*/
0x0B5546,0x555ABB,0x04DA4E,0x0A5B43,0x352BB8,0x052B4C,0x8A953F,0x0E9552,0x06AA48,0x6AD53C,/*1951-1960*/
0x0AB54F,0x04B645,0x4A5739,0x0A574D,0x052642,0x3E9335,0x0D9549,0x75AABE,0x056A51,0x096D46,/*1961-1970*/
0x54AEBB,0x04AD4F,0x0A4D43,0x4D26B7,0x0D254B,0x8D52BF,0x0B5452,0x0B6A47,0x696D3C,0x095B50,/*1971-1980*/
0x049B45,0x4A4BB9,0x0A4B4D,0xAB25C2,0x06A554,0x06D449,0x6ADA3D,0x0AB651,0x093746,0x5497BB,/*1981-1990*/
0x04974F,0x064B44,0x36A537,0x0EA54A,0x86B2BF,0x05AC53,0x0AB647,0x5936BC,0x092E50,0x0C9645,/*1991-2000*/
0x4D4AB8,0x0D4A4C,0x0DA541,0x25AAB6,0x056A49,0x7AADBD,0x025D52,0x092D47,0x5C95BA,0x0A954E,/*2001-2010*/
0x0B4A43,0x4B5537,0x0AD54A,0x955ABF,0x04BA53,0x0A5B48,0x652BBC,0x052B50,0x0A9345,0x474AB9,/*2011-2020*/
0x06AA4C,0x0AD541,0x24DAB6,0x04B64A,0x69573D,0x0A4E51,0x0D2646,0x5E933A,0x0D534D,0x05AA43,/*2021-2030*/
0x36B537,0x096D4B,0xB4AEBF,0x04AD53,0x0A4D48,0x6D25BC,0x0D254F,0x0D5244,0x5DAA38,0x0B5A4C,/*2031-2040*/
0x056D41,0x24ADB6,0x049B4A,0x7A4BBE,0x0A4B51,0x0AA546,0x5B52BA,0x06D24E,0x0ADA42,0x355B37,/*2041-2050*/
0x09374B,0x8497C1,0x049753,0x064B48,0x66A53C,0x0EA54F,0x06B244,0x4AB638,0x0AAE4C,0x092E42,/*2051-2060*/
0x3C9735,0x0C9649,0x7D4ABD,0x0D4A51,0x0DA545,0x55AABA,0x056A4E,0x0A6D43,0x452EB7,0x052D4B,/*2061-2070*/
0x8A95BF,0x0A9553,0x0B4A47,0x6B553B,0x0AD54F,0x055A45,0x4A5D38,0x0A5B4C,0x052B42,0x3A93B6,/*2071-2080*/
0x069349,0x7729BD,0x06AA51,0x0AD546,0x54DABA,0x04B64E,0x0A5743,0x452738,0x0D264A,0x8E933E,/*2081-2090*/
0x0D5252,0x0DAA47,0x66B53B,0x056D4F,0x04AE45,0x4A4EB9,0x0A4D4C,0x0D1541,0x2D92B5 /*2091-2099*/
};
int MonthAdd[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
int LunarCalendar(int year,int month,int day)
{
int Spring_NY,Sun_NY,StaticDayCount;
int index,flag;
//Spring_NY 记录春节离当年元旦的天数。
//Sun_NY 记录阳历日离当年元旦的天数。
if( ((LunarCalendarTable[year-1901] & 0x0060) >> 5) == 1)
Spring_NY = (LunarCalendarTable[year-1901] & 0x001F) - 1;
else
Spring_NY = (LunarCalendarTable[year-1901] & 0x001F) - 1 + 31;
Sun_NY = MonthAdd[month-1] + day - 1;
if( (!(year % 4)) && (month > 2))
Sun_NY++;
//StaticDayCount记录大小月的天数 29 或30
//index 记录从哪个月开始来计算。
//flag 是用来对闰月的特殊处理。
//判断阳历日在春节前还是春节后
if (Sun_NY >= Spring_NY)//阳历日在春节后(含春节那天)
{
Sun_NY -= Spring_NY;
month = 1;
index = 1;
flag = 0;
if( ( LunarCalendarTable[year - 1901] & (0x80000 >> (index-1)) ) ==0)
StaticDayCount = 29;
else
StaticDayCount = 30;
while(Sun_NY >= StaticDayCount)
{
Sun_NY -= StaticDayCount;
index++;
if(month == ((LunarCalendarTable[year - 1901] & 0xF00000) >> 20) )
{
flag = ~flag;
if(flag == 0)
month++;
}
else
month++;
if( ( LunarCalendarTable[year - 1901] & (0x80000 >> (index-1)) ) ==0)
StaticDayCount=29;
else
StaticDayCount=30;
}
day = Sun_NY + 1;
}
else//阳历日在春节前
{
Spring_NY -= Sun_NY;
year--;
month = 12;
if ( ((LunarCalendarTable[year - 1901] & 0xF00000) >> 20) == 0)
index = 12;
else
index = 13;
flag = 0;
if( ( LunarCalendarTable[year - 1901] & (0x80000 >> (index-1)) ) ==0)
StaticDayCount = 29;
else
StaticDayCount = 30;
while(Spring_NY > StaticDayCount)
{
Spring_NY -= StaticDayCount;
index--;
if(flag == 0)
month--;
if(month == ((LunarCalendarTable[year - 1901] & 0xF00000) >> 20))
flag = ~flag;
if( ( LunarCalendarTable[year - 1901] & (0x80000 >> (index-1)) ) ==0)
StaticDayCount = 29;
else
StaticDayCount = 30;
}
day = StaticDayCount - Spring_NY + 1;
}
LunarCalendarDay |= day;
LunarCalendarDay |= (month << 6);
if(month == ((LunarCalendarTable[year - 1901] & 0xF00000) >> 20))
return 1;
else
return 0;
}
main()
{
const char *ChDay[] = {"*","初一","初二","初三","初四","初五",
"初六","初七","初八","初九","初十",
"十一","十二","十三","十四","十五",
"十六","十七","十八","十九","二十",
"廿一","廿二","廿三","廿四","廿五",
"廿六","廿七","廿八","廿九","三十"};
const char *ChMonth[] = {"*","正","二","三","四","五","六","七","八","九","十","十一","腊"};
struct tm * Local;
long t;
int year,month,day;
char str[13] = "";
#if 0
t = time(NULL);
Local = localtime(&t);
year = Local->tm_year + 1900;
month = Local->tm_mon + 1;
day = Local-> tm_mday;
#else
year = 2006;
month = 9;
day = 9;
#endif
printf("%d年%d月%d日\t",year,month,day);
if(LunarCalendar(year,month,day))
{
strcat(str,"闰");
strcat(str,ChMonth[(LunarCalendarDay & 0x3C0) >> 6]);
}
else
strcat(str,ChMonth[(LunarCalendarDay & 0x3C0) >> 6]);
strcat(str,"月");
strcat(str,ChDay[LunarCalendarDay & 0x3F]);
puts(str);
system("pause");
}
④ 如何定制android源码的编译选项 后期安装
Android编译过程比较长,配置起来也很麻烦。现仅就工作遇到的问题做个总结。所用硬件平台为amlogic stvm3。---------------------------------------------------------------------------关于版本号:文件build/core/version_defaults.mk用来检查一些跟版本相关的变量是否定义;如果未定义,则使用默认值。这些变量包括 PLATFORM_VERSION # 如 2.2.5 PLATFORM_SDK_VERSION # 8, 对应2.2.5 PLATFORM_VERSION_CODENAME # REL,即发行版 DEFAULT_APP_TARGET_SDK # 同SDK_VERSION或VERSION_CODENAME BUILD_ID # 默认为UNKNOWN BUILD_NUMBER # 默认eng.$(USER).$(shell date +%Y%m%d.%H%M%S)的形式。 version_defaults.mk首先包含进build_id.mk。用户应当配置build_id.mk,而不应该改动version_defaults.mk文件。然后检查上述变量,如未定义则赋值默认值。---------------------------------------------------------------------------关于调试功能(adb)的开启编译android源码之前总是要先运行build/envsetup.sh,以初始化一些常用命令(实际上是bash的函数,如add_lunch_combo)。其中也从以下文件中引入了一些编译设置: device/${CHIPSET_VENDOR}/vendorsetup.sh我们这里使用的CHIPSET_VENDOR为amlogic。比如我们有文件device/amlogic/vendorsetup.sh,内容为"产品名-编译类型(flavor)"列表(称为combo),如下: add_lunch_combo m1ref-eng add_lunch_combo m1ref-user add_lunch_combo m2ref-eng add_lunch_combo m2ref-user add_lunch_combo stvm3-eng add_lunch_combo stvm3-user其中,m1ref和stvm3是产品名(作前缀),后面为编译类型。除此前缀外可选的combo值有: eng, user, userdebug, tests。(参考文件build/core/main.mk中对于变量TARGET_BUILD_VARIANT的筛查条件)我们可以修改vendorsetup.sh文件,来改变为特定设备编译的结果。以下是各个编译类型的特点: eng: 工程模式,用于平台级的调试,是默认的编译类型。 待安装的模块tag有: eng, debug, user, development. 安装不带tag的非APK模块; 所安装应用由产品定义文件给出; 默认属性: ro.secure=0, ro.deuggable=1, ro.kernel.android.checkjni=1 adbd默认开启,adb以root身份运行。 user: 即最终用户版; 待安装的应用tag有: user 安装不带tag的非APK模块; 所安装应用由产品定义文件给出; 默认属性有ro.secure=1, ro.debuggable=0; 默认关闭adbd服务(但可通过应用settings来打开,且adb以shell身份运行); userdebug: 与user类似,除了: 支持有限的调试功能; 待安装的应用tag有:debug;
⑤ Android编译版本eng,user和userdebug的区别
Android编译版本eng、user和userdebug的区别:
一、Android官网的解释
eng This is the default flavor. A plain make is the same as make eng.
* Installs moles tagged with: eng, debug, user, and/or development.
* Installs non-APK moles that have no tags specified.
* Installs APKs according to the proct definition files, in addition to tagged APKs.
* ro.secure=0
* ro.debuggable=1
* ro.kernel.android.checkjni=1
* adb is enabled by default.
* Setupwizard is optional
user make user
This is the flavor intended to be the final release bits.
* Installs moles tagged with user.
* Installs non-APK moles that have no tags specified.
* Installs APKs according to the proct definition files; tags are ignored for APK moles.
* ro.secure=1
* ro.debuggable=0
* adb is disabled by default.
* Enable dex pre-optimization for all TARGET projects in default to speed up device first boot-up
userdebug make userdebug
The same as user, except:
* Also installs moles tagged with debug.
* ro.debuggable=1
* adb is enabled by default.
二、对编译版本MTK的补充说明
MTK 补充说明差异:(
(1) Debug/LOG 方面,原则上user 版本只能抓到有限的资讯,eng 可以抓到更多的资讯,Debug 能力更强,推崇使用eng 版本开发测试
* 因user/eng 版本设置ro.secure不同,导致user 版本adb 只拥有shell 权限,而eng 版本具有root 权限
* MTK System LOG 在ICS 以后,在user 版本默认关闭全部LOG, 在eng 版本中默认打开,以便抓到完整的资讯
* 在eng 版本上,LOG 量 >= user 版本的log 量,一些地方会直接check eng/user 版本来确认是否打印LOG
* user 版本默认关闭uart, eng 版本默认开启uart
* 在eng 版本上,开启ANR 的premp, 会抓取ftrace,可以得到更多ANR的资讯
* 在eng 版本上,可用rtt 抓取backtrace,可开启kdb 进行kernel debug, 可用ftrace 抓取cpu 执行场景
* MTK aee 在ENG 版本抓取更多的异常资讯,比如native exception 会抓取core mp 信息
(2) 性能方面,原则上进行性能测试请使用user 版本测试
* user 版本为提高第一次开机速度,使用了DVM 的预优化,将dex 文件分解成可直接load 运行的odex 文件,ENG 版本不会开启这项优化
* 更少的LOG 打印,uart 的关闭,原则上user 版本的性能要优于eng 版本
(3) 如何确认user/eng 版本
* java 层,check android.os.Build 类中的TYPE 值
* native 层,property_get("ro.build.type", char* value, "eng"); 然后check value 值
* Debug 时, adb shell getprop ro.build.type 返回值如果是user 即user 版本,eng 即eng 版本
* Log 确认, mobile log/Aplog_xxxxx/versions 中查看ro.build.type 属性
(4) 如何编译user/eng 版本
* 默认编译是eng 版本,如果需要编译user 版本,请加入参数 -o=TARGET_BUILD_VARIANT=user 如:
./mk -o=TARGET_BUILD_VARIANT=user mt6577_phone new
default.prop和/system/build.prop
三、编译版本与ADB、root的控制关系
1. root权限:adb.c中与属性ro.kernel.qemu(是否是模拟器)、ro.secure、ro.debuggable、service.adb.root几个相关联。
service.adb.root : services.c -> restart_root_service()中设置
build/core/main.mk的如下地方决定了了ro.secure和ro.debuggable的值
user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT))
enable_target_debugging := true
tags_to_install :=
ifneq (,$(user_variant))
# Target is secure in user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=1
...
else # !user_variant
# Turn on checkjni for non-user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
# Set device insecure for non-user builds.
ADDITIONAL_DEFAULT_PROPERTIES += ro.secure=0
# Allow mock locations by default for non user builds
ADDITIONAL_DEFAULT_PROPERTIES += ro.allow.mock.location=1
endif # !user_variant
ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
# Include the debugging/testing OTA keys in this build.
INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
## eng ##
...
endif
2. 是否开启adbd服务:UsbDeviceManager.java中与属性persist.sys.usb.config、sys.usb.config、persist.service.adb.enable几个相关联
persist.sys.usb.config:/build/tools/post_process_props.py中根据ro.debuggable来设置persist.sys.usb.config的初始值
sys.usb.config:UsbDeviceManager.java -> setUsbConfig
文件init.clippers.usb.rc中监听了sys.usb.config属性变化时的动作
on property:sys.usb.config=adb
⑥ adb环境下的root权限获取
这个是和设备的系统有关系的,一般的debug 版本的系统可以开root,正式出厂的都没有的
adb的root权限是在system/core/adb/adb.c中控制.主要根据ro.secure以及ro.debuggable等systemproperty来控制.默认即档ro.secure为0... 博文 来自: sir_...查看全部2021年1月3日-csdn已为您找到关于adb获得root权限相关内容,包含adb获得root权限相关文档代码介绍、相关教程视频课程,以及相关adb获得root权限问答内容。为您解决当...
2021年7月1日-adb获取root权限----adb命令集合:一、获取root权限,给文件以读写权限 步骤:1、手机进行root; 2、cmd 进入命令行 运行adbshell命令(adb已配置到环境变...
2016年8月10日-当你获取root权限后通过adb访问 /data/data目录: 1、进入shell模式adbshell 2、su 切换到root用户 su 3、修改/data/data目录的权限为 777即可 chmod 777 /...
2013年8月15日-adb里面有个root命令,可以用来获取root权限。Android守护进程adbd启动时,会调用create_local_service_socket()创建socket套接字, fd = service_to_fd(...
⑦ 如何编译 cm12
CN:准备编译
EN:Preparing System for Build
CN:通过APT-GET,安装以下d软件包
EN:Install the following items via apt-get.
Code:
sudo apt-get install bison build-essential curl flex git gnupg gperf libesd0-dev libncurses5-dev libsdl1.2-dev libwxgtk2.8-dev libxml2 libxml2-utils lzop openjdk-6-jdk openjdk-6-jre pngcrush schedtool squashfs-tools xsltproc zip zlib1g-dev g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
CN:如果是32位系统,清不要安装g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev
EN:As per the instructions on the wiki for building CM, if you use a 32bit system, do not install g++-multilib gcc-multilib lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev.
CN:安装最新版本JDK
EN:Install the latest version of Java's development kit using the following.
Code:
sudo apt-get install openjdk-7-jdk
CN:安装ADT
EN:Install the Android Development Kit using the following.
Code:
sudo apt-get install android androidsdk-uiautomatorviewer android-right android-src-vendor android-emulator android-tools-adb android-headers android-tools-adbd androidsdk-ddms android-tools-fastboot androidsdk-hierarchyviewer android-tools-fsutils androidsdk-traceview
CN:执行以下指令
EN:Run the following in terminal.
Code:
mkdir -p ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
CN:重启系统,加载配置文件
EN:reboot your system or use the following in terminal to load the .profile file again.
Code:
. ~/.profile
CN: 获取源码
EN:Getting the source code.
CN:执行以下命令,获取CM12的源码
EN:Now we can get onto grabbing the source code of CM12.
Run the following in terminal.
Code:
mkdir ~/cm
cd ~/cm
repo init -u git://github.com/CyanogenMod/android.git -b cm-12.0
mkdir .repo/local_manifests
nano .repo/local_manifests/local_manifests.xml
CN: 当NANO打开之后,粘贴下面的内容,然后用ctrlx保存
When nano appears, paste the following into it and then exit using ctrl-x and choose to save.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project name="CyanogenMod/android_device_oneplus_bacon" path="device/oneplus/bacon" remote="github" />
<project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="github" />
<project name="CyanogenMod/android_device_oppo_msm8974-common" path="device/oppo/msm8974-common" remote="github" />
<project name="CyanogenMod/android_device_oppo_common" path="device/oppo/common" remote="github" revision="cm-12.0" />
<project name="CyanogenMod/android_kernel_oneplus_msm8974" path="kernel/oneplus/msm8974" remote="github" />
<project name="TheMuppets/proprietary_vendor_oppo" path="vendor/oppo" remote="github" />
<project name="TheMuppets/proprietary_vendor_oneplus" path="vendor/oneplus" remote="github" />
<project name="CyanogenMod/android_frameworks_opt_connectivity" path="frameworks/opt/connectivity" remote="github" revision="cm-11.0" />
</manifest>
CN: 执行以下代码,继续获取代码
EN:Continue getting the code using the following.
Code:
repo sync
cd vendor/cm
./get-prebuilts
cd ../..
CN: 编译 CM12
EN:Building CM12
Run the following commands to build CyanogenMod.
Code:
. build/envsetup.sh
breakfast bacon
brunch bacon
CN: 成功编译,从out/target/proct/bacon/ 获取 cm-12-*-UNOFFICIAL-bacon.zip
EN:After successful build, you should be able to go about ing the built CyanogenMod and installing it into your phone. The CyanogenMod build is located in ~/cm/out/target/proct/bacon/ named something like cm-12-*-UNOFFICIAL-bacon.zip
You can install folllowing: http://forum.xda-developers.com/onep...s-one-t2940091
Re-building to update.
To re-build, you should just be able to run the following (Not yet tested myself, but makes logical sense).
Code:
make clobber
repo sync
cd vendor/cm
./get-prebuilts
cd ../..
. build/envsetup.sh
brunch bacon
Q&A
Q: Recieve error: fatal: plicate path device/qcom/sepolicy in ~/cm/.repo/manifest.xml
A: edit .repo/local_manifests/local_manifests.xml to remove the item which matches the item located in bold.
Q: How big is the repo?
A: 20GB just source code and 40GB when built. Therefore you should aim to have about 60GB free on your system.