冒著白磚風險, 以及數日不眠不休的努力, 帶給大家 G Pro 2 D838 Root 新方法. (同步發文於 xda, 要補眠去, 沒精神打字了)
adb 的功能是由 kernel 負責, 所以找方法先燒 F350 系列舊核心, 再用 ioroot24 類似的方法即可取得 root access. 最後再還原回原來的 kernel. 驗證平台是台版 16GB. 其他平台(港 or 32GB)應可行, 但須取得對應韌體, 對比一些 offset / size 資料.
For those who own G Pro 2 D838 that cannot enter stock recovery to run adb sideload option (ioroot25), this tutorial teaches you hot to grant root access through normal adb (ioroot24).
After long time investigating LG TOT file structure, I've found the way to partially flash a partition. And if you flash, for example, F350K kernel into a D838, you can run modified ioroot24 batch file by adding LG-D838 in the model option list.
The steps are as follows:
0. Backup your critical data. Flash TOT will do factory reset automatically.
1. Find and download the firmware exactly matching your D838 (16GB or 32GB model, HK or TW model), and the DLL file (or extract from KDZ).
2. Find and download old version F350 firmware such as F350K 10d version (only old versions are compatible with ioroot24 method).
3. Download my sample TOT header file below (myboothdr.bin). This file is verified on D838 16GB Taiwan. May not work for 32GB version.
4. Download any KDZ/TOT extractor you like.
5. Download any CRC32 checksum program you like. I use HashMyFiles.
6. Download any hex editor.
6. Extract D838 firmware to get PrimaryGPT.bin (partition table), boot.bin (kernel) and the DLL file if KDZ.
7. Extract F350 firmware to get boot.bin. Rename it as boot350.bin
8. In Windows command prompt, combine PrimaryGPT.bin and boot.bin into d838body.bin by the following command:
copy /b PrimaryGPT.bin+boot.bin d838body.bin
9. Calculate d838body.bin CRC32 checksum.
10. In sample header file "myboothdr.bin", Fill the CRC32 value at file offset 0x08.
11. Combine header and body by the following command (the result file must be in "tot" file extension):
copy /b mybootheader.bin+d838body.bin d838kernel.tot
12. Repeat steps 8~11 but replace boot.bin with boot350.bin and d838kernel.tot with f350k4d848.tot.
Now you have two kernel TOT files for your D838.
13. Use LG Flash Tool to flash f350k4d838.tot.
14. Manually run adb command similar with ioroot24 for F350. However, unplug and plug USB cable did not work for me. Switching between "Changing Only" and "MTP" works.
15. Use LG Flash Tool to flash back d838kernel.tot.
The file "myboothdr.bin" contains some offset / size values which may not work for other region and/or 32GB D838. Make sure the size of boot.bin is 12058624 bytes. And try to investigate your partition table file PrimaryGPT.bin to make sure "boot" partition starting at 0x40000.
*** 中文操作說明 *********************************************************
步驟詳細解說 (以台版 16GB 為例)
0. 請備份重要資料, 經過 Flash TOT 動作後, 除外接記憶卡外, 其餘user資料全部清空.
1. 請至 http://www.lg-phones.org/stock-lg-g-pro-2-d838-kdz-firmware-rom.html 下載台版 16GB 檔案 (KDZ 格式).
2. 請至 http://www.lg-phones.org/official-stock-lg-g-pro-2-tot-firmware-rom.html 下載 F350K 檔案 (ZIP 解壓縮可得 TOT 格式韌體).
3. 下載我的附件, 內有 TOT 表頭 (header) 樣本檔案, 裡面已經針對台版 16GB 寫好基本結構, 可能也適用於港版 16GB, 至於 32GB 可能適用, 但需參考 32GB 之 partition table (PrimaryGPT 檔案), 以及kernel 檔 (boot.bin) 大小才能確定.
4. 請至 http://forum.xda-developers.com/showthread.php?t=2600575 下載 WindowsLGFirmwareExtract-ver.1.2.1.0, 這是提取 KDZ 和 TOT 檔案的工具.
5. 搜尋下載可以計算CRC32 的工具, 我用過 HashMyFiles, 但最後用自己寫的命令列工具 lgchk (請參閱附件2).
5a. 搜尋下載任何 Hex Editor 工具程式, 我使用的是 xvi32.
6. 以 WindowsLGFirmwareExtract 提取台版 KDZ 韌體的內容, 第一步取出 DZ 檔和 DLL 檔 (LGUP_8974.dll, 後面燒錄會用到). 第二部拆解 DZ 檔, 請注意, 我們只需要 PrimaryGPT_0.bin 和 boot_nnnnnn.bin 兩個檔案 (nnnnnn 是一串數字), 可以只勾選這兩個, 或者處理到一半時中斷, 以節省時間.
7. 以 WindowsLGFirmwareExtract 提取F350K 的 TOT 韌體的內容, 只需第一部拆解 TOT 提取出 bin 檔案即可, 此外, 我們只需要其中 kernel 檔案 boot.bin, 不要保留 F350K 的 PriamryGPT.bin, 這個 partition table 與台版有差異, 而且是 32GB 的, 千萬不可誤用. 另外請將 F350K 的 boot.bin 重新命名為 boot350.bin 以資識別.
8. 接下來要合併 bin 檔案主體的內容, 先處理台版的 kernel, 請在命令提是字元下輸入以下命令:
copy /b PrimaryGPT_0.bin+boot_nnnnnn.bin d838body.bin
請注意千萬別遺漏 copy 命令後面的 /b 參數, 這是指定使用 binary 模式.
9. 計算 d838body.bin 的 CRC32 checksum, 並記錄之. 例如台版 16G 應該會算出 30252AC8.
10. 以 HexEditor 修改 myboothdr.bin 的 offset 8 開始的4個 bytes, 填入剛剛算出的 CRC32 sum, 方式是兩兩一組再倒著填, 30252AC8 的組數字應該填成 C8 2A 25 30, 例如原檔案從頭開始的內容應該填成這樣 44 DD 55 AA FF FF FF FF C8 2A 25 30 FF FF FF FF.
11. 再組合 header file 與主體檔案, 命令是
copy /b myboothdr.bin+d838body.bin d838kernel.tot
這是還原成原始台版 kernel 所需的 TOT 檔, 注意副檔名一定要是 .tot 的名稱.
12. 接下來要合併 F350K 核心的 bin 檔案主體的內容, 請注意 partition 一樣要使用台版的 PrimaryGPT_0.bin, 命令如下:
copy /b PrimaryGPT_0.bin+boot350.bin f350body.bin
13. 計算 f350body.bin 的 CRC32 checksum, 並記錄之. 應該會算出 E5ED3232.
14. 以 HexEditor 修改 myboothdr.bin 的 offset 8 開始的4個 bytes, 填入剛剛算出的 CRC32 sum, 方式是兩兩一組再倒著填, E5ED3232的組數字應該填成 32 32 ED E5, 例如原檔案從頭開始的內容應該填成這樣 44 DD 55 AA FF FF FF FF 32 32 ED E5 FF FF FF FF.
15. 再組合 header file 與主體檔案, 命令是
copy /b myboothdr.bin+f350body.bin f350k4d838.tot
這是燒錄F350K kernel 所需的 TOT 檔, 注意副檔名一定要是 .tot 的名稱.
以上是製作台版16GB 專用的台版 kernel 及韓版 kernel 之TOT 檔案的方法, 上述方法也可適用於其它 D838, 只是必須比對 header 的內容是否匹配. 但方法雖相同, 做出的檔案卻不可以互通, 因為這個 TOT 檔案內含 partition table, 即使台版16 GB 和 32GB 的 kernel 相同, 但 partition table 不會一樣, 不可混用.
另外請注意, 到這一部, 製作出來的兩個檔案大小應該都是 13,631,488. bytes, 請核對一下.
16. 再來是以 LG Flash Tool (我用的是 1.5 的版本, 沒試過其它的), 先燒錄 f350k4d838.tot, 請查網路上的教學.
17. 手動進行 ioroot 24 的動作, 或者先修改 ioroot 24 的 batch file, 讓辨識出 LG-D838 時, 進行與 F350K 相同的處理. 這裡額外說明一點, ioroot 24 裡面有一段進行 USB toggle 的動作, 內文指出針對 F350 需拔插一次 USB, 我沒試成功, 反而是另一種在手機上選擇切換 "僅充電 -> MTP -> 僅充電" 這個做法成功.
18. 最後以 LG Flash Tool 燒錄 d838kernel.tot 回復 kernel.
網友來訊糾正, 我補充說明中文步驟的第9步 checksum 寫錯了, 已修正為 30252AC8. 看來補眠時間不足不該亂寫.
*****2014/04/17 補充********************************************
有鑑於網友來訊詢問其他版本如何檢查 partition table, 故再補充說明如下:
其他版本若要直接使用這個 header file, 需注意 kernel 所在的 boot partition 必須位於 sector offset 0x40000 的位置, 以及 boot.bin 的大小必須是 12058624 bytes, 否則需修改 header file.
1. sector offset 是否為 0x40000, 請搜尋 PrimaryGPT.bin 的內容, 這是 GPT partition 格式, 由 0x400 開始是 partition entries, 每個 entry 有 0x80 bytes, 每個 entry 的第 0x20 是32-bit sector offset value, 而 0x38 位置是 partition name (以 UTF16-LE 編碼). 以台版16GB為例, 在 0x700 這個 entry 可以看到 0x738 是0x62,0x00,0x6F,0x00,0x6F,0x00, 0x74,0x00 這串 UTF16-LE 編碼的 "boot" 字串, 這就是我們要找的項目, 而 offset 0x720 就是我們要找的 sector offset, 內容若是 0x00, 0x00, 0x04, 0x00 (也就是 32-bit 數值 0x40000), 則不需修改 header file 關於 offset 的部分. 若不同, 則必須把這個數值填到 header file 0x2020 的位置.
2. boot.bin 的 file size 確認, 必須同時確認 boot.bin 與 boot350.bin 都是 12058624 bytes, 若任一者有不同, 則建議停止, 因為這牽涉到何者大何者小, 修改 header file 的要點不同, 建議上網求助.
額外還有一點, 若你要處理的 LG 其他型號, 則請注意需修改 header file 0x6014 位置, 這是 model name. 不過這風險比較高, 主因是擔心不同年代的 LG model 其 TOT 格式可能不同.
針對 G Pro 2, 實務上, 台16GB, 韓32GB版本的 boot 位置與 file size 都相同. 幾乎可以推論所有 G Pro 2 的 boot 可能都在相同位置. 但我還是必須請大家確認清楚, 以免白磚.
另外, header file 可共用, 並不代表製作出的成品檔案可共用. 例如我們推論 台版 16GB 和 32GB 的 kernel 應該一模一樣, 位置也非常可能相同, 但 PrimaryGPT.bin 針對 data partition 一定不同, cache partition 大小可能也不同, 所以每個版本必須用自己的檔案. 還有, 針對台韓的比對, 可以發現有其他與容量不同造成的差異. 所以若無法取得 D838 32GB 韌體, 也千萬不可拿 F350 系列 32GB 的 partition table 來替代, 風險極高. 但 D838 32GB 各版 (TW, HK, SG) 之間 partition 相同可能性很高, 但是還是注意, 風險自負.
*************************************************
附加壓縮檔 (myboothdr): 201404/mobile01-668c3196009dc3f96887e46fa3e28067.zip
附加壓縮檔 (lgchk): 201404/mobile01-f341c795fd808f56ef93cd761ca643eb.zip
關閉廣告