首页 > 代码库 > cygwin配置个人环境,android模拟器root和Babun
cygwin配置个人环境,android模拟器root和Babun
# base-files version 4.1-1# /etc/profile: executed by the command interpreter for login shells.
your home directory (~)
- .profile
- .vimrc
alias emulator=‘/cygdrive/d/Developer/sdk/tools/emulator.exe‘alias ..=‘cd ..‘alias ...=‘cd ../..‘alias adb=‘/cygdrive/d/Developer/sdk/platform-tools/adb.exe‘
alias agdb=‘/cygdrive/d/Developer/ndk/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gdb.exe‘
- .profile
# base-files version 4.1-1# ~/.profile: executed by the command interpreter for login shells.#The copy in your home directory (~/.profile) is yours, please feel# free to customise it to create a shell environment to your liking. # User dependent .profile file# This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login exists.
# base-files version 4.1-1# ~/.bashrc: executed by bash(1) for interactive shells.
- .vimrc
set nocompatiblefiletype onfiletype indent onsyntax onset backspace=2set showmatchset matchtime=5set autoindentset smartindentset cindentset tabstop=4set softtabstop=4set shiftwidth=4set noexpandtabset numbercolorscheme desert
更好的Cygwin
一、让ubuntu支持GBK编码
Ubuntu默认对中文只支持UTF-8编码,可以通过一些修改让Ubuntu支持GBK编码。
首先用gedit /var/lib/locales/supported.d/local来修改 /var/lib/locales/supported.d/local文件,在文件中添加如下内容:
zh_CN.UTF- 8 UTF- 8
en_US.UTF- 8 UTF- 8
zh_CN.GBK GBK
zh_CN.GB2312 GB2312
接着用sudo dpkg-reconfigure --force locales强制更新设置
二、设置Vimrc支持GBK
set fileencodings=utf-8,gbk,gb2312
ROOT模拟器
cygwin
- emulator -avd AVD_for_Galaxy_Nexus_by_Google -qemu -nand system,size=0x1f400000,file=D:/Developer/sdk/system-images/android-17/default/armeabi-v7a/system_rooted.img
其中,-avd <name> ;0x1f400000是指给/system分区500MB的空间。
- 系统启动后 adb shell mount | grep system
/dev/block/mtdblock0 /system yaffs2 ro 0 0
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mount -o remount /dev/block/mtdblock3 /system
/dev/block/mtdblock0 /system yaffs2 rw 0 0
- 修改前
$ adb shell ls -l /system/xbin/su
-rwsr-sr-x root root 67080 2013-02-13 15:24 su
- 下载Chainfire的SuperSU的UPDATE zip包,并解压缩
$ adb push d:/Developer/sdk/su /system/xbin/
247 KB/s (75364 bytes in 0.297s)
user@pc ~
$ adb shell ls -l /system/xbin/su
-rw-rw-rw- root root 75364 2008-02-29 03:33 su
$ adb shell ls -ld /system/
drwxr-xr-x root root 2013-02-13 15:24
$ adb shell chmod 06755 /system
$ adb shell chmod 06755 /system/xbin/su
$ adb install d:/Developer/sdk/Superuser.apk
- 在模拟器里,进入SuperSu,会提示更新二进制文件,选择常规方法即可。
- 以后通过这个启动
emulator -avd AVD_for_Galaxy_Nexus_by_Google -qemu -nand system,size=0x1f400000,file=D:/Developer/sdk/system-images/android-17/default/armeabi-v7a/system_rooted.img
修改配置文件从AVD Manager.exe启动还是恢复成system.img。
.android\avd\
AVD_for_Galaxy_Nexus_by_Google.ini
avd.ini.encoding=UTF-8
path=C:\Users\Sansan\.android\avd\AVD_for_Galaxy_Nexus_by_Google.avd
path.rel=avd\AVD_for_Galaxy_Nexus_by_Google.avd
target=android-17
.android\avd\AVD_for_Galaxy_Nexus_by_Google.avd
- hardware-qemu.ini文件
disk.systemPartition.initPath = D:\Developer\sdk/system-images\android-17\default\armeabi-v7a\/system.img
- config.ini文件
image.sysdir.1=system-images\android-17\default\armeabi-v7a\
而把产生的某些image文件: .android\avd\AVD_for_Galaxy_Nexus_by_Google.avd\下的userdata-qemu.img, userdata.img, cache.img删除掉类似恢复出厂。
增强 find_java.bat的容错性(F:\Android\sdk\tools\lib\find_java.bat)
@echo offrem Copyright (C) 2007 The Android Open Source Projectremrem Licensed under the Apache License, Version 2.0 (the "License");rem you may not use this file except in compliance with the License.rem You may obtain a copy of the License atremrem http://www.apache.org/licenses/LICENSE-2.0remrem Unless required by applicable law or agreed to in writing, softwarerem distributed under the License is distributed on an "AS IS" BASIS,rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.rem See the License for the specific language governing permissions andrem limitations under the License.rem This script is called by the other batch files to find a suitable Java.exerem to use. The script changes the "java_exe" env variable. The variablerem is left unset if Java.exe was not found.rem Useful links:rem Command-line reference:rem http://technet.microsoft.com/en-us/library/bb490890.aspxrem Query whether this system is 32-bit or 64-bitrem See also: http://stackoverflow.com/a/24590583/1299302reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | findstr /i "x86" > NUL && set "arch_ext=32" || set "arch_ext=64"::DEBUG PRINT arch_ext::echo %%arch_ext%% = "%arch_ext%"rem Check we have a valid Java.exe in the path. The return code willrem be 0 if the command worked or 1 if the exec failed (program not found).for /f "delims=" %%a in (‘"%~dps0\find_java%arch_ext%.exe" -s‘) do set java_exe=%%aif not defined java_exe goto :CheckFailed:SearchJavaWrem Check if we can find a javaw.exe at the same location than java.exe.rem If that doesn‘t work, just fall back on the java.exe we just found.for /f "delims=" %%a in (‘"%~dps0\find_java%arch_ext%.exe" -s -w‘) do set javaw_exe=%%aif not exist "%javaw_exe%" set javaw_exe=%java_exe%::DEBUG PRINT java_exe javaw_exe::echo %%java_exe%% = "%java_exe%" %%javaw_exe%% = "%javaw_exe%"goto :EOF:CheckFailedecho.echo ERROR: No suitable Java found. In order to properly use the Android Developerecho Tools, you need a suitable version of Java JDK installed on your system.echo We recommend that you install the JDK version of JavaSE, available here:echo http://www.oracle.com/technetwork/java/javase/downloadsecho.echo If you already have Java installed, you can define the JAVA_HOME environmentecho variable in Control Panel / System / Avanced System Settings to point to theecho JDK folder.echo.echo You can find the complete Android SDK requirements here:echo http://developer.android.com/sdk/requirements.htmlecho.goto :EOF
cygwin配置个人环境,android模拟器root和Babun