通过比对,已经找到了修改zImage中gzip的全部偏移,维独还剩一个偏移量没有找到:
seg000:400080C8 loc_400080C8 ; DATA XREF: start+1E8↓o
seg000:400080C8 ADR R0, dword_40008304
seg000:400080CC LDM R0, {R1-R3,R6,R10-R12}
seg000:400080D0 LDR SP, [R0,#(dword_40008320 - 0x40008304)]
seg000:400080D4 SUB R0, R0, R1
seg000:400080D8 ADD R6, R6, R0
seg000:400080DC ADD R10, R10, R0
seg000:400080E0 LDRB R9, [R10]
seg000:400080E4 LDRB LR, [R10,#1]
seg000:400080E8 ORR R9, R9, LR,LSL#8
seg000:400080EC LDRB LR, [R10,#2]
seg000:400080F0 LDRB R10, [R10,#3]
seg000:400080F4 ORR R9, R9, LR,LSL#16
seg000:400080F8 ORR R9, R9, R10,LSL#24
seg000:400080FC ADD SP, SP, R0
seg000:40008100 ADD R10, SP, #arg_10000
seg000:40008104 MOV R5, #0
seg000:40008108 LDR LR, [R6]
seg000:4000810C LDR R1, =0xEDFE0DD0
seg000:40008110 CMP LR, R1
seg000:40008114 BNE loc_400081C4
seg000:40008118 LDR R5, [R6,#4]
seg000:4000811C EOR R1, R5, R5,ROR#16
seg000:40008120 BIC R1, R1, #0xFF0000
seg000:40008124 MOV R5, R5,ROR#8
seg000:40008128 EOR R5, R5, R1,LSR#8
seg000:4000812C ADD R5, R5, R5,LSR#1
seg000:40008130 ADD R5, R5, #7
seg000:40008134 BIC R5, R5, #7
seg000:40008138 CMP R5, #0x8000
seg000:4000813C MOVCC R5, #0x8000
seg000:40008140 CMP R5, #0x100000
seg000:40008144 MOVHI R5, #0x100000
seg000:40008148 ADD SP, SP, R5
seg000:4000814C PUSH {R0-R3,R12,LR}
seg000:40008150 MOV R0, R8
seg000:40008154 MOV R1, R6
seg000:40008158 MOV R2, R5
seg000:4000815C BL sub_4000D2D4
seg000:40008160 CMP R0, #1
seg000:40008164 SUB R0, R4, #0x8000
seg000:40008168 BIC R0, R0, #1
seg000:4000816C ADD R0, R0, #0x100
seg000:40008170 MOV R1, R6
seg000:40008174 MOV R2, R5
seg000:40008178 BLEQ sub_4000D2D4
seg000:4000817C POP {R0-R3,R12,LR}
seg000:40008180 SUB SP, SP, R5
seg000:40008184 MOV R8, R6
seg000:40008188 LDR R5, =0x2D290
seg000:4000818C ADR R1, loc_4000824C
seg000:40008190 SUB R1, R6, R1
seg000:40008194 SUBS R1, R5, R1
seg000:40008198 ADDHI R9, R9, R1
seg000:4000819C LDR R5, [R6,#4]
seg000:400081A0 EOR R1, R5, R5,ROR#16
seg000:400081A4 BIC R1, R1, #0xFF0000
seg000:400081A8 MOV R5, R5,ROR#8
seg000:400081AC EOR R5, R5, R1,LSR#8
seg000:400081B0 ADD R5, R5, #7
seg000:400081B4 BIC R5, R5, #7
seg000:400081B8 ADD R6, R6, R5
seg000:400081BC ADD R10, R10, R5
seg000:400081C0 ADD SP, SP, R5
seg000:400081C4
seg000:400081C4 loc_400081C4 ; CODE XREF: start+114↑j
目前这段汇编没看明白,即:
seg000:40008188 LDR R5, =0x2D290
这个R5的寄存器,感觉也是一个偏移量的计算,但这个偏移量是如何算的,有什么作用没理明白。
如果这个偏移量找明白了,那么就能实现从Image->zImage的快速转换了,直接通过修改偏移量完成。
片段:
seg000:40008108 LDR LR, [R6]
seg000:4000810C LDR R1, =0xEDFE0DD0
seg000:40008110 CMP LR, R1
seg000:40008114 BNE loc_400081C4
这地方看着是找dtb设备树文件,R1是设备树文件编译后的magic number,如果找到就跳走了。
最后于 2023-5-2 22:59
被XYUU编辑
,原因: