Android應用.三星i9000系列(3).無需刷機輕鬆擷取Root許可權

來源:互聯網
上載者:User

Android應用.三星i9000系列指南(3).無需刷機輕鬆擷取Root許可權

草木瓜 20110403

一、前言

    從購機到現在,也剛幾天,平常忙於工作,沒怎麼搗鼓手機。晚上偶爾想開啟
wifi玩玩,忽然發現連不上了。wifi始終停留在擷取ip地址這個階段。以前都是
好好的,沒任何問題。這時我想起原來一個朋友的摩托羅拉ME811串連wifi也出現
過這樣的問題。
    顯然,這應該是Anriod系統本身的問題。上網google一下,發現很多網友都出
現了類似問題,解決方案有二:一是使用靜態IP,二是刪除/data/misc/dhcp一
些檔案。筆者試了靜態IP,貌似還是不行,只得嘗試第二種方式。而第二種方式
看似“簡單”,然必須要先擷取Root許可權!

二、有關Root許可權

    我們知道Android是基於Linux的,這個作業系統的最高許可權使用者就是root!打個
很簡單比方,沒有root的感覺就像買了個別墅卻只給了車庫的鑰匙!大部分人都
不會答應,所以擷取最高許可權是必須的!

三、擷取Root許可權

    i9000發布已有一年,作業系統都是開源的,估計早就被研究透了,抱著這樣的
思想毫不猶豫地google一下。發現網上資訊還是比較淩亂,很多內容也不靠譜。簡
單整理了一下,主要有如下幾種方式:

    1.使用z4root軟體
    2.使用Android Recovery System更新update.zip
    3.使用SuperOneClick
    4.刷寫已支援root的ROM
   
    下面是簡要過程:
   
    1.z4root
   
        這裡我們下載了z4root(使用版本:z4root1.3.0),進行了一鍵root操作,具
        體細節見:
       
        《使用z4root 裡程碑2擷取Root完全教程》
        http://tech.sina.com.cn/mobile/n/2010-12-24/06381611116.shtml
       
        雖然上面說得是MOTO裡程碑2,對三星i9000也是完全一樣的!選擇Permanent
        Root後,會重啟手機。之後用root explorer(使用版本:rootexplorer_2.14.2)
        瀏覽檔案,發現/data目錄還是為空白。其實判斷root許可權是否擷取成功,也只需要
        關注/data目錄是否為空白。/data顯示為空白即說明root許可權擷取失敗!
       
        之後又換了z4root版本(z4root1.2.1),還是如此!只能說明一點,雖然z4root
        對很多三星i9000都是可用的,但z4root對本機卻行不通!
       
        本機軟體版本資訊:
        型號:GT-I9000
        Android版本:2.2
        基帶版本:I9000ZSJPE
        核心版本:2.6.32.9 root@SE-S506 #3
        版本號碼:FROYO.ZSJPD
       
    2.使用Android Recovery System更新update.zip
   
        z4root行不通,只能嘗試更新update.zip,具體過程可參看:
       
        《三星Galaxy s i9000擷取root許可權詳細教程》的第二種方法
        http://android.sj.91.com/content/2010-07-14/20100714181645219.shtml
   
        依此方法,複製update.zip到SD卡,關機狀態下按下三鍵:音量鍵上(左側),
        HOME鍵和開機鍵(右側),手機會進入Recovery模式。
       
        本機Android Recovery System是3e版本,菜單是藍色的,提示是黃色的。
        通過音量鍵選擇apply sdcard:update.zip,按HOME鍵確認,提示:
        signature verification failed
       
        顯然root再次失敗!要解決這個簽名認證失敗的問題,似乎還要通過刷核心
        把Android Recovery System降為2e版本才可以。
       
       
    3.使用SuperOneClick
   
        兩次碰壁只得準備再嘗試SuperOneClick,一開始並不知道SuperOneClick具體
        什麼原理。只是按以前網友方法操作:
       
        《i9000 2.2 JPD/JPE 簡易root教程》
        http://www.angeeks.com/thread-550165-1-1.html
       
        注意:上文中 <運行壓縮包裡的“SuperOneClick.exe”選擇“shell root”> 應改
        為選擇“root”!
       
        運行SuperOneClick.exe,點擊圖形化介面上的root按鈕,完整提示如下:
       
        Killing ADB Server...
        OK
        Starting ADB Server...
        * daemon not running. starting it now on port 5037 *
        * daemon started successfully *
        OK
        Waiting for device...
        OK
        Pushing rageagainstthecage...
        337 KB/s (0 bytes in 5392.000s)
        OK
        chmod rageagainstthecage...
        OK
        Running rageagainstthecage...
        OK
        ***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***
        Killing ADB Server...
        OK
        Starting ADB Server...
        * daemon not running. starting it now on port 5037 *
        * daemon started successfully *
        OK
        Waiting for device...
        OK
        Running rageagainstthecage...
        ROOTED
        Getting mount path...
        /dev/block/stl6
        OK
        Remounting system with read-write access...
        OK
        Pushing su...
        failed to copy su to '/system/bin/su': No space left on device
        OK
        chmod su...
        Unable to chmod /system/bin/su: No such file or directory
        OK
        Pushing Superuser.apk...
        204 KB/s (0 bytes in 196521.000s)
        OK
        Remounting system with read-only access...
        OK
        Running a SU test...
       
        注意,此時提示No space left on device,很顯然/system目錄已滿。使用
        超級終端(Better Terminal Emulator Pro v3.37),在命令列下輸入df(
        順便說一下,預設的中文鍵盤IME與超級終端相容性很差,經常出現無法
        輸入的情況,如出現這個問題,可以切換到Swype,三星鍵盤或者或搜狗IME):
        $ df
        df
        /dev: 155672K total, 0K used, 155672K available (block size 4096)
        /mnt/.lfs: Function not implemented
        /mnt/asec: 155672K total, 0K used, 155672K available (block size 4096)
        /system: 282432K total, 282432K used, 0K available (block size 4096)
        ...
       
        system沒有可用空間,su無法複製,所以root擷取肯定失敗!
       
       
四、柳暗花明

        三種擷取Root的方法都已經全部嘗試,全部失敗,似乎只有刷機一條路,然而
        就軟體版本來看並無刷機的必要性!本來最靠譜SuperOneClick都由於/system
        目錄無空間也告失敗。/system預設是唯讀,要想remount成可讀寫,還需要
        root許可權,這不是限入矛盾中了?
       
        查看SuperOneClick檔案目錄,發現存在如下檔案:
       
         F:/Own/Phone/Samsung/Tools/SuperOneClick 的目錄

        2010/10/16  22:04           577,335 adb.exe
        2010/10/18  11:27           339,885 adblinux
        2010/10/18  11:26           171,656 adbmac
        2010/10/16  22:04            96,256 AdbWinApi.dll
        2010/10/16  22:04            60,928 AdbWinUsbApi.dll
        2010/10/16  23:29         1,062,992 busybox
        2010/10/16  22:04             5,392 rageagainstthecage
        2010/10/16  22:04            24,120 sqlite3
        2010/10/16  22:04            26,264 su
        2010/11/04  21:21           379,392 SuperOneClick.exe
        2010/10/16  22:04           196,521 Superuser.apk
       
        su與rageagainstthecage是需要複製到手機上啟動並執行,而adb.exe是核心!
        這裡不僅提供的Windows版本的,而且還有adblinux(linux版本),
        adbmac(mac版本)。再查看豌豆莢目錄,發現同樣有adb.exe這樣的檔案。
        終於意識到問題的關鍵了!
       
        命令列(開始運行cmd.exe)下直接找到adb所在目錄並運行:
       
        C:/Users/Administrator>D:
        D:/>cd D:/GreenSoft/wandoujia
        D:/GreenSoft/wandoujia>adb
       
        Android Debug Bridge version 1.0.26
        ...(由於內容過多,省略若干內容)
       
         devices                       - list all connected devices
         connect <host>:<port>         - connect to a device via TCP/IP
         disconnect <host>:<port>      - disconnect from a TCP/IP device
       
        device commands:
          adb push <local> <remote>    - copy file/dir to device
          adb pull <remote> [<local>]  - copy file/dir from device
          adb sync [ <directory> ]     - copy host->device only if changed
                                         (see 'adb help all')
          adb shell                    - run remote shell interactively
          adb shell <command>          - run remote shell command
          adb emu <command>            - run emulator console command
          adb logcat [ <filter-spec> ] - View device log
          ...
          adb install [-l] [-r] [-s] <file> - ...
          adb uninstall [-k] <package> - ...
          adb bugreport                - return all information from the device
                                         that should be included in a bug report.
       
          adb help                     - show this help message
          adb version                  - show version num
            ...
        scripting:
          adb wait-for-device          - block until device is online
          adb start-server             - ensure that there is a server running
          adb kill-server              - kill the server if it is running
          adb get-state                - prints: offline | bootloader | device
          adb get-serialno             - prints: <serial-number>
          adb status-window            - continuously print device status for a specified device
          adb remount                  - remounts the /system partition on the device read-write
          adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program
          adb reboot-bootloader        - reboots the device into the bootloader
          adb root                     - restarts the adbd daemon with root permissions
          adb usb                      - restarts the adbd daemon listening on USB
          adb tcpip <port>             - restarts the adbd daemon listening on TCP on the specified port
            ...
       
        功能實在非常全面,仔細看還有什麼adb root,adb remount。不過放心,這些
        肯定都被限制死了,不能用!否則國外牛人也不至於費這麼多勁去搞個破解程式!
        SuperOneClick其實還是利用adb這個調試介面。我們仔細查看上面SuperOneClick
        失敗的日誌,發現有如下內容:
       
        Running rageagainstthecage...
        ROOTED
       
        這說明已經拿到了Root許可權,只是複製su的過程中出錯了。而rageagainstthecage是
        關鍵的提取許可權程式。拿到root後,緊接著SuperOneClick就對/system進行remount:
       
        Remounting system with read-write access...
        OK
       
        再次強調一遍,執行完rageagainstthecage,通過查看日誌能夠確定成功擷取了root
        許可權!在當時嘗試z4root時,我懷疑也是因為這個磁碟空間滿的問題導致了root失敗。
       

五、擷取Root許可權完整的步驟,寫在最後
       
        我們在《三、擷取Root許可權  3.使用SuperOneClick》之後(不要重啟手機或者拔掉
        USB串連,否則還需要重新運行SuperOneClick點root按鈕),緊接著從命令列進入
        adb shell。提示如下資訊:

        F:/Own/Phone/Samsung/Tools/SuperOneClick>adb shell
        #
       
        這個“#”非常關鍵,表明當前已經是root許可權了!如果是“$”說明SuperOneClick執行
        不成功(也就是說rageagainstthecage執行沒有成功),再次運行SuperOneClick.exe
        點擊root。直到輸入adb shell出現#號!
       
        執行如下命令:
       
        1) 修改 /system 為可讀寫
        # mount -o remount rw /system
        2) 進入內建的應用目錄
        # cd /system/app
        3) 刪除三星內建的天氣時鐘,這樣/system就有一些剩餘空間,當然刪之前也可以
        先複製一份到SD卡上(命令:cp /system/app/SamsungWidget_WeatherClock.apk /mnt/sdcard/.)
        # rm SamsungWidget_WeatherClock.apk
       
        做完以上三步後,再次運行SuperOneClick.exe點擊root,成功!
        然後重啟手機,手機應用會多一個授權管理(專門管理需要使用root許可權的應用,其實
        是SuperOneClick裡的Superuser.apk,完全可以手工安裝)。
       
        然後手機上運行root explorer,會提示是否對當前應用授予root許可權!如果授予的
        話,root explorer就會以最高許可權方式運行,所有目錄內容都可以看到了!寧外授
        權管理裡也可以看到root explorer被授予root許可權。

        另附上root成功的完整SuperOneClick日誌:

        Killing ADB Server...
        OK
        Starting ADB Server...
        * daemon not running. starting it now on port 5037 *
        * daemon started successfully *
        OK
        Waiting for device...
        OK
        Pushing rageagainstthecage...
        337 KB/s (0 bytes in 5392.000s)
        OK
        chmod rageagainstthecage...
        OK
        Running rageagainstthecage...
        OK
        ***IF IT KEEPS LOOPING, TRY DISABLING USB DEBUGGING NOW***
        Killing ADB Server...
        OK
        Starting ADB Server...
        * daemon not running. starting it now on port 5037 *
        * daemon started successfully *
        OK
        Waiting for device...
        OK
        Running rageagainstthecage...
        ROOTED
        Getting mount path...
        /dev/block/stl6
        OK
        Remounting system with read-write access...
        OK
        Pushing su...
        96 KB/s (0 bytes in 26264.000s)
        OK
        chmod su...
        OK
        Pushing Superuser.apk...
        204 KB/s (0 bytes in 196521.000s)
        OK
        Remounting system with read-only access...
        OK
        Running a SU test...

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.