Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Doesn't work on Redmi 6 boot.img #15

Open
megafon929 opened this issue Jul 4, 2021 · 11 comments
Open

Doesn't work on Redmi 6 boot.img #15

megafon929 opened this issue Jul 4, 2021 · 11 comments
Labels
bug Something isn't working wip fix in progress

Comments

@megafon929
Copy link

megafon929 commented Jul 4, 2021

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>
@megafon929
Copy link
Author

boot.zip
Stock boot Redmi 6

@YaAlex3
Copy link
Owner

YaAlex3 commented Jul 6, 2021

thanks for the file, i will look into it once i have some free time.

@YaAlex3 YaAlex3 changed the title Patching working on Redmi 6A boot.img, but patching not working on Redmi 6 boot.img Doesn't work on Redmi 6 boot.img Jul 6, 2021
@megafon929
Copy link
Author

Okay

@YaAlex3 YaAlex3 added the bug Something isn't working label Jul 6, 2021
@YaAlex3
Copy link
Owner

YaAlex3 commented Jul 6, 2021

cereus is arm32 sar too?
pie boot image?
some recent update?

@megafon929
Copy link
Author

  1. Yes
  2. Yes
  3. 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

@megafon929
Copy link
Author

megafon929 commented Jul 6, 2021

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>

@YaAlex3 YaAlex3 added the wip fix in progress label Jul 7, 2021
@YaAlex3
Copy link
Owner

YaAlex3 commented Jul 7, 2021

boot.zip
tell me if this one boots

@megafon929
Copy link
Author

Not working

@chaosmaster
Copy link

@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?

@YaAlex3
Copy link
Owner

YaAlex3 commented Jul 30, 2021

@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

@chaosmaster
Copy link

chaosmaster commented Jul 31, 2021

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

boot_patched.zip

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wip fix in progress
Projects
None yet
Development

No branches or pull requests

3 participants