patcher-oss
patcher-oss copied to clipboard
Doesn't work on Redmi 6 boot.img
Hello. I ran into a strange problem. Patcher works with Redmi 6A boot.img, but does not work with Redmi 6 boot.img. I'm trying to understand the reason. The log is attached
C:\Users\yarpopkov\Desktop\patcher-oss-main>python main.py boot.img
INFO: Found 7-Zip at: C:\Program Files\7-Zip\7z.exe
INFO: Unpacking kernel data...
INFO: Patching kernel data...
INFO: Packing kernel data...
Traceback (most recent call last):
File "C:\Users\yarpopkov\Desktop\patcher-oss-main\main.py", line 192, in <module>
main()
File "C:\Users\yarpopkov\Desktop\patcher-oss-main\main.py", line 53, in main
BootWork(in_fn)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main\main.py", line 82, in init
p = Patch(zimg_fobj)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main\main.py", line 102, in init
self.split_zimg(zimg_file)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main\main.py", line 138, in split_zimg
raise Exception(
Exception: ERROR: Can't find offset of orig GZIP size field
C:\Users\yarpopkov\Desktop\patcher-oss-main>
boot.zip Stock boot Redmi 6
thanks for the file, i will look into it once i have some free time.
Okay
cereus is arm32 sar too? pie boot image? some recent update?
- Yes
- Yes
- Yes, I used the latest version of patcher. Redmi 6 and 6A are almost identical, but for some reason the tool cannot patch boot.img for Redmi 6. I provide boot.img from Redmi 6A boot.zip
Log with boot.img for Redmi 6A
C:\Users\yarpopkov\Desktop\patcher-oss-main-1>python main.py boot.img
INFO: Found 7-Zip at: C:\Program Files\7-Zip\7z.exe
INFO: Unpacking kernel data...
INFO: Patching kernel data...
INFO: Packing kernel data...
INFO: Getting all back together...
C:\Users\yarpopkov\Desktop\patcher-oss-main-1>
Log with boot.img for Redmi 6
C:\Users\yarpopkov\Desktop\patcher-oss-main-2>python main.py boot.img
INFO: Found 7-Zip at: C:\Program Files\7-Zip\7z.exe
INFO: Unpacking kernel data...
INFO: Patching kernel data...
INFO: Packing kernel data...
Traceback (most recent call last):
File "C:\Users\yarpopkov\Desktop\patcher-oss-main-2\main.py", line 192, in <module>
main()
File "C:\Users\yarpopkov\Desktop\patcher-oss-main-2\main.py", line 53, in main
BootWork(in_fn)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main-2\main.py", line 82, in __init__
p = Patch(zimg_fobj)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main-2\main.py", line 102, in __init__
self.split_zimg(zimg_file)
File "C:\Users\yarpopkov\Desktop\patcher-oss-main-2\main.py", line 138, in split_zimg
raise Exception(
Exception: ERROR: Can't find offset of orig GZIP size field
C:\Users\yarpopkov\Desktop\patcher-oss-main-2>
boot.zip tell me if this one boots
Not working
@YaAlex3 There should be no need to patch the pointer to the original size, you could just leave/replace the size field in it's original location. I've added Magisk-Support for zImages in topjohnwu/Magisk#4526 and topjohnwu/Magisk#4527 doing it this way, though who knows when/if that will ever be merged. Other than that the attached boot.img has another issue, the specified dtb-size exceeds the kernel-size specified in it's header, maybe that image was modified previously?
@chaosmaster i have found out already that the sizes dont match, for the record, all of the factory redmi 6 (cereus) images have this same issue, i couldn't get anything to boot and tried many things thank you for working on this though, im impressed to see someone finally do it, but im unsure if this will get any support from magisk developers
I have only looked at one other boot.img for cereus, that didn't seem to have the size mismatch. For your script that shouldn't be an issue though, since you are just copying all of it anyway. Magisk however will truncate the dtb according to the size specified in the header.
I have attached two boot images patched with magiskboot, one is truncated because of the size mismatch. The other one has the complete dtb and the header size fixed.
I would be interested to know if either of these images (or both) boot. The bootloader should only load the size specified in the header anyway, so if the stock-image worked, I would expect both of them to work as well.
NOTE: These images only have the skip_initramfs -> want_initramfs change and do not include a Magisk ramdisk