前 提:
有root權限
打開手機的USB調式模式
bootloader模式下用fastboot刷機經常不成功:
C:\tmp\fastboot>adb reboot bootloader
C:\tmp\fastboot>fastboot flash boot C:\tmp\gionee-f103_SV16\boot.img
Sending 'boot' (7004 KB) OKAY [ 0.689s]
Writing 'boot' FAILED (remote: 'download for partition 'boot' is not allowed
')
fastboot: error: Command failed
此時可用flash_image命令刷入試試(成功率低)。
将flash_image和将要刷入的boot.img傳到手機sdcard目錄下:
c:\tmp\fastboot>adb push c:/tmp/fastboot/flash_image11 /sdcard/flash_image
c:/tmp/fastboot/flash_image11: 1 file pushed. 0.2 MB/s (26172 bytes in 0.133s)
C:\tmp\fastboot>adb push C:\tmp\gionee-f103_SV16\boot.img /sdcard
C:\tmp\gionee-f103_SV16\boot.img: 1 fil...hed. 5.6 MB/s (7172096 bytes in 1.220s)
移動flash_image到/system/bin,改變屬性和用戶組:
1|root@GiONEE_GBL7319:/ # mount -rw -o remount /system
root@GiONEE_GBL7319:/sdcard # mv flash_image /system/bin/
root@GiONEE_GBL7319:/sdcard # chmod 755 /system/bin/flash_image
root@GiONEE_GBL7319:/sdcard # chown root.shell /system/bin/flash_image
root@GiONEE_GBL7319:/sdcard # ls -l /system/bin/fla*
-rwxr-xr-x root shell 26172 2022-02-23 15:00 flash_image
-rwxr-xr-x root shell 13968 2022-02-22 22:43 flash_image22
手機正常開機狀态下刷機:
255|root@GiONEE_GBL7319:/sdcard # flash_image boot boot.img
刷recovery用:
255|root@GiONEE_GBL7319:/sdcard # flash_image recovery recovery.img
flash_image刷機時會遇到問題:
only position independent executables (PIE) are supported
root@GiONEE_GBL7319:/sdcard # flash_image boot boot.img
error: only position independent executables (PIE) are supported.
解決方法:
将/system/bin/linker從手機裡下載到電腦:
C:\tmp\fastboot>adb pull /system/bin/linker c:/tmp/
/system/bin/linker: 1 file pulled. 5.2 MB/s (86664 bytes in 0.016s)
下載、安裝、打開IDA反彙編軟件,打開linker - 右鍵 - 選擇“Text View” :
點擊 “Text search” - 輸入問題描述:
鼠标放在方框位置時會提示調用處的相關彙編命令:
相關内容上雙擊或右鍵 - 選擇“Jump to Operand” 會跳到調用處:
觸發錯誤信息的相關命令:
先了解幾個彙編命令:
.text:00002F4C CMP R2, #3
.text:00002F4E BEQ loc_2F60
.text:00002F50 LDR R1, =(aErrorOnlyPosit - 0x2F58) ; "error: only position independent execut"...
.text:00002F52 MOVS R0, #2
.text:00002F54 ADD R1, PC ; "error: only position independent execut"...
.text:00002F56 BL __dl___libc_format_fd
.text:00002F5A MOV R0, R5
.text:00002F5C
.text:00002F5C loc_2F5C ; CODE XREF: __dl___linker_init 230↑j
.text:00002F5C BL __dl_exit
.text:00002F60
.text:00002F60 loc_2F60 ; CODE XREF: __dl___linker_init 38E↑j
.text:00002F60 LDR R1, =(asc_96C7 - 0x2F6C) ; ":"
.text:00002F62 MOV R0, R10
.text:00002F64 LDR R2, =(__dl__ZL18g_ld_library_paths - 0x2F6E)
上面第1行:命令 CMP R2, #3
上面第2行:命令 BEQ loc_2F60
我們的目的是無條件跳轉到loc_2F60處繼續執行,用“B”彙編指令替換“BEQ”。
鼠标點到BEQ上,然後切換到“Hex View - 1" :
将07D0修改為07E0: “E”是跳轉指令“B”的機器碼編碼格式的第28-31位
右擊 - 選擇“Edit...”:
右擊 - 選擇“Apply chages”:
Edit - Patch program - Apply Patches to input file... :
修改保存後再上傳linker到手機的/system/bin/目錄下,修改一下屬性.
,更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!