cygwin配置個人環境,android模擬器root和Babun

來源:互聯網
上載者:User

標籤:

# 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  Babun是一個基於Cygwin改造的Shell,具有更完整的軟體包,更豐富的色彩,使用起來要比Cygwin更方便一些,為“https://github.com/babun/babun”。  Babun內建Git,Python等軟體包,VIM也更符合一般的使用習慣,Shell的資訊很豐富,提示功能很強大,另外還內建了一個“pact”命令用於管理軟體包,非常貼心。

 

一、讓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)

[email protected] ~
$ 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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.