tihmstar / img4tool

A tool for manipulating IMG4, IM4M and IM4P files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

img4tool doesn't properly handle the kernel when converting back to im4p from raw

Cryptiiiic opened this issue · comments

img4tool version: 0.162-d514ce57f4a104aebe4ba8c20cd7c45f33cf3a68

I run these two im4tool commands.
~/Downloads/img4tool -c kern.im4p -t rkrn -d KernelCacheBuilder-1469.260.15 kern.patched
~/Downloads/img4tool -c kern.img4 -s blob.shsh2 -p kern.im4p
And then boot the kern img4.
(Yes it boots fine for a compressed kernel)
(I have a DEVELOPMENT iBEC so it prints the error)

iRecovery> bootx
USB command: "bootx"
Attempting to validate kernelcache @ 0x800000000
Unable to validate kernelcache payload
error booting kernelcache -4
iRecovery>

In theory it should work but it doesn't. I'm not entirely sure what's causing this. The iBEC does have uncompressed kernel support. It fails on the validating macho probably. But it should be valid since 0x0 of kern.patched = bswap(0xFEEDFACF).

From my understanding iBoot does not support uncompressed kernels.
One of the reasons compression is desireable is USB transfer times.
Compressing kernels (and other files) is a planned feature

@tihmstar I looked in iBEC and it had uncompressed kernel handling. But it was checking for a different macho magic than usual. I changed the kernel's to it but it still didn't work, there probably other specific header checks. Probably apple custom built kernel to be loaded uncompressed from iBoot.

should be fixed now in version 174 d91d5e8