-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mkbootimg: Add the hability to use the files generated by unpackbootimg #18
base: master
Are you sure you want to change the base?
Conversation
Added the parameter --from-unpackbootimg-files <preffix> in order to use the files generated by the tool instead of typing each parameter one by one
Thanks! I had planned something similar using a directory as the input arg to read things from. Not sure when I'll have time to review this since I'm working full time and have a 2 month old baby at home I need to help out with, but I'll take a look when I can! |
I understand. Thank you for your time. |
hi @osvcos, I fetched your PR and when run unpack and repack. ➜ redmi_cactus git:(master) ✗ ./mkbootimg/unpackbootimg -i boot.img -o boot2
ANDROID! magic found at: 0
BOARD_KERNEL_CMDLINE bootopt=64S3,32S1,32S1 buildvariant=user
BOARD_KERNEL_BASE 0x40000000
BOARD_NAME
BOARD_PAGE_SIZE 2048
BOARD_HASH_TYPE sha1
BOARD_KERNEL_OFFSET 0x00008000
BOARD_RAMDISK_OFFSET 0x11b00000
BOARD_SECOND_OFFSET 0x00f00000
BOARD_TAGS_OFFSET 0x07880000
BOARD_OS_VERSION 9.0.0
BOARD_OS_PATCH_LEVEL 2020-08
BOARD_HEADER_VERSION 1
BOARD_HEADER_SIZE 1648
➜ redmi_cactus git:(master) ✗ ./mkbootimg/mkbootimg --from-unpackbootimg-files boot2/boot.img -o booty.img
error: could not load second 'boot2/boot.img-second' There is no ➜ redmi_cactus git:(master) ✗ tree boot2/
boot2/
├── boot.img-base
├── boot.img-board
├── boot.img-cmdline
├── boot.img-hashtype
├── boot.img-header_version
├── boot.img-kernel
├── boot.img-kernel_offset
├── boot.img-os_patch_level
├── boot.img-os_version
├── boot.img-pagesize
├── boot.img-ramdisk
├── boot.img-ramdisk_offset
├── boot.img-second_offset
└── boot.img-tags_offset
0 directories, 14 files How to skip not exists file? Sorry to raise issue in here. |
Hi @yetnelson, thank you. I assumed that second stage should exists. |
Thanks @osvcos , It works now;) I noticed the size of output file is smaller than original file. ➜ redmi_cactus git:(master) ✗ ls -l *.img
-rw-r--r--@ 1 Nelson staff 67108864 5 5 09:16 boot.img
-rw-r--r-- 1 Nelson staff 9078784 5 5 20:08 booty.img Im worry about to flash the new img. Could u give some suggest or help check it? The original img uploaded at Google Driver |
To test my changes I downloaded a patched image of your device, and the sizes are very similar. You don't have to flash it to your device, you could test it with |
Pass test with |
Hello. Great work guys. The binary is very easy to compile even for beginners like myself ;) It works great on most boot.imgs that I've tested it with but unfortunately I ran into a problem with one particular Xiaomi device (Poco X3 NFC). I tried to unpack its boot.img and repack it using mkbootimg binary but sadly it throws this error when trying to repack everything. error: unsupported page size 0 This is how I am calling the mkbootimg binary
Here is the stock boot.img in question: I'm not expert but I have reasons to believe that 0x00001000 is actually equivalent to 2048 and not 0. Then why is mkbootimg complaining about a pagesize value of 0 ? Thanks for your assistance! Kind regards |
Hello @lebigmac1. The --pagesize parameters expects a base 10 number. You provided a hexadecimal number (base 16). The correct form would be: |
WORKS! Thank you very much! @osvcos do you have any idea how to run the mkbootimg in a bash script? I always get I guess I am searching for something like this: Do you think that old bash script could still work with this latest mkbootimg binary? Or do you have something similar in your repository that I could try? Thanks! I originally wanted to use AIK-mobile by the very talented Mr. Osm0sis to unpack and repack the boot.img dynamically on the fly but sadly I failed at installing it systemfully on my Android device :( |
Nevermind I fixed it by coming up with my own RepackBoot program :D More info here: (for some reason the credits don't show up in the program itself?! - need to update that...) |
Added the parameter --from-unpackbootimg-files in order to use the files generated by the tool instead of typing each parameter one by one