① 如何默認打開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.