Extract boot image from payload.bin on Android? - Android Q&A, Help & Troubleshooting

Is there any kind of tool FOR Android that can extract a boot image from a payload.bin? Or do you basically need a PC for the task? I do it all the time from my desktop, but a tool to do it on my phone itself would be super convenient if it exists somewhere. Thanks guys!

H4X0R46 said:
Is there any kind of tool FOR Android that can extract a boot image from a payload.bin? Or do you basically need a PC for the task? I do it all the time from my desktop, but a tool to do it on my phone itself would be super convenient if it exists somewhere. Thanks guys!
Click to expand...
Click to collapse
There's a high likelihood that Termux can do it. If you have a payload.bin that you can link me I'll try it. I think it can run these python scripts assuming there's nothing wrong with them.
https://github.com/cyxx/extract_android_ota_payload

Spaceminer said:
There's a high likelihood that Termux can do it. If you have a payload.bin that you can link me I'll try it. I think it can run these python scripts assuming there's nothing wrong with them.
https://github.com/cyxx/extract_android_ota_payload
Click to expand...
Click to collapse
Here's a download link for the latest OxygenOS build for a OnePlus 7 Pro: https://www.oneplus.com/support/softwareupgrade/details?code=PM1574156267635
I tried to run the python script with Termux, it said it couldn't execute the script, permission was denied. I granted it superuser too. Try it out, I may have done it wrong. Thanks man! [emoji16]
EDIT: You'll have to extract the payload.bin, that link is to a full flashable rom zip.

H4X0R46 said:
Here's a download link for the latest OxygenOS build for a OnePlus 7 Pro: https://www.oneplus.com/support/softwareupgrade/details?code=PM1574156267635
I tried to run the python script with Termux, it said it couldn't execute the script, permission was denied. I granted it superuser too. Try it out, I may have done it wrong. Thanks man! [emoji16]
EDIT: You'll have to extract the payload.bin, that link is to a full flashable rom zip.
Click to expand...
Click to collapse
I think I know what happened. Was the file on an sdcard? Because scripts can't run there, and I totally forgot about that. You normally have to copy the file into termux's home location. /data/data/com.termux/files/home If you get permission denied there, then change the group owner, and user to what's in the screen shot and it'll work. You can avoid that situation entirely though, by downloading the file directly into Termux's home folder using wget. For those scripts to run you'll need to install python and protobuf too. From termux run, (without root), pkg install protobuf & pkg install python.
I'm going to try extracting that. Downloading it now.
Edit: I tried but I can't get it to work. The scripts error out because it's expecting some kind of info from Google. I tried adjusting the metainfo structure to match a pixel device and it got further into the process, but it still gives an error. What do you use on pc? I might be able to port it to Termux.

Spaceminer said:
I think I know what happened. Was the file on an sdcard? Because scripts can't run there, and I totally forgot about that. You normally have to copy the file into termux's home location. /data/data/com.termux/files/home If you get permission denied there, then change the group owner, and user to what's in the screen shot and it'll work. You can avoid that situation entirely though, by downloading the file directly into Termux's home folder using wget. For those scripts to run you'll need to install python and protobuf too. From termux run, (without root), pkg install protobuf & pkg install python.
I'm going to try extracting that. Downloading it now.
Edit: I tried but I can't get it to work. The scripts error out because it's expecting some kind of info from Google. I tried adjusting the metainfo structure to match a pixel device and it got further into the process, but it still gives an error. What do you use on pc? I might be able to port it to Termux.
Click to expand...
Click to collapse
Thanks for testing this out, sorry for the late reply, life's been hectic. The tool I USUALLY use for WIndows is payload dumper 64. I'll link it here.
Link: https://androidfilehost.com/?fid=818070582850510260

Related

Creating .zip files in Android command line

Hi guys,
Couldn't find the answer to this anywhere but I noticed in the newer releases of busybox there's no 'zip' command anymore. I'm running busybox 1.19 on my Incredible.
I have been using this command to create different bootanimation.zip files from my phone but am wondering if there is an alternative command I can use from within Android. I've tried tar -cvzf but I believe tar archives/compresses the files differently and renaming the extensions to .zip does not work.
Any ideas besides using an actual PC to do what I want to do?
Thanks,
Zebdor
Sent from my Incredible using XDA App
There are apps out there such as AndroZip, that essentially creates zip files.
If you are doing this for an app, there are built in zip classes in Java.
java.util.zip.*;
Edit: Just realized you asked for it to be command line. I will keep looking!
Yeah, I used to use 'zip -0r ...' to zip up a folder but for some reason the busyboxes I've tried downloading don't come with the zip command anymore...
I'm looking through the BusyBox source...
Does it have to be .zip? I mean there are plenty of others to choose from such as tar, gz, bz.
I can't find anything on the website why it is left out.
Best of luck
travmanx said:
I'm looking through the BusyBox source...
Does it have to be .zip? I mean there are plenty of others to choose from such as tar, gz, bz.
I can't find anything on the website why it is left out.
Best of luck
Click to expand...
Click to collapse
I was thinking of using tar and gz but every tutorial I've read says Android requires the bootanimation to be in .zip format uncompressed. I even tried tarballing it as bootanimation.tar but it didn't work...
did anyone ever find an answer to this?
im currently trying to find a portable binary for just zip (or something like busybox that includes zip) because im trying to automate creation of a cwm zip ON an android device during the installation of another cwm zip
iXNyNe said:
did anyone ever find an answer to this?
im currently trying to find a portable binary for just zip (or something like busybox that includes zip) because im trying to automate creation of a cwm zip ON an android device during the installation of another cwm zip
Click to expand...
Click to collapse
This seems to work fine: https://code.google.com/p/zip-for-android/people/[email protected]
I thought I was crazy...
I have surely been missing the zip command too... I just got done downloading and about to reboot into recovery to install...
Zarchiver is a free app in the market that i use to.make boot animation zips and any other kind of zip on my Android device.

[Q] how to create .zip using terminal?

hi friends, can any one tell me how to create a .zip file using terminal?
if yes,
can i set compression levels?
Nobody?
sent from my smultron
I don't think you can. The zip command isn't recognized in the terminal emulator. Try typing tar, you can use that, you can then chose which compression method you prefer.
cigognes said:
I don't think you can. The zip command isn't recognized in the terminal emulator. Try typing tar, you can use that, you can then chose which compression method you prefer.
Click to expand...
Click to collapse
ah! getting near to the 10 posts threshold limit eh mate? :good:
anyways,
i tried that but, i only need to create a .zip file.
any ways to add the required binary? or the source for zip applet to compile it with busybox?
ah! getting near to the 10 posts threshold limit eh mate?
Click to expand...
Click to collapse
Yes indeed, and I'll shamelessly add another post to my count.
I couldn't be bothered to try it out myself yet as I haven't really had the time to mess about. But the following seems like a way to get the zip package installed on your phone. First install opkg through the adb shell, then you can get the zip package installed. Once that's done you should at least be able to zip files, no idea if you can change compression parameters.
How to get opkg, well I'm not going to simply copy other people's work.
And unfortunately I'm not allowed to post links yet. However searching google for installing opkg manager on android and or linux tools coming to mcr should do the trick. First results each time.
cigognes said:
Yes indeed, and I'll shamelessly add another post to my count.
I couldn't be bothered to try it out myself yet as I haven't really had the time to mess about. But the following seems like a way to get the zip package installed on your phone. First install opkg through the adb shell, then you can get the zip package installed. Once that's done you should at least be able to zip files, no idea if you can change compression parameters.
How to get opkg, well I'm not going to simply copy other people's work.
And unfortunately I'm not allowed to post links yet. However searching google for installing opkg manager on android and or linux tools coming to mcr should do the trick. First results each time.
Click to expand...
Click to collapse
thanks man! i'll try that!

Sailfish OS on X

Instructions:
https://jolla.com/sailfishxinstall/
Download:
http://images.devaamo.fi/sfe/suzu/
thanks to all the guys that worked on this port.
Kernel source:
https://github.com/mer-hybris/android_kernel_sony_msm
This make_ext4fs works for flashing on macOS
For some reason with this build the system-icons vanish for me after restarting the device once :/
I had much better results using this build.
Also by default (at least with the image I linked) only two of the 6 cpu-cores are enabled. To fix that one must add this under the init-section of the /init.loire.pwr.rc file and reboot (All credit for this go to abranson from the #sailfishos-porters irc).
Thanks for this port! are you planning to continue building for Xperia X or is a test build before official release?
Enviado desde mi F5121 mediante Tapatalk
keep going till then, also ive updated the above link
how flash it?
FuLiterary said:
how flash it?
Click to expand...
Click to collapse
read the first post
FuLiterary said:
how flash it?
Click to expand...
Click to collapse
make sure when you are flashing sailfish support only F5121 and does not support sdxc
Hello, friend! I am a Chinese user, I do not understand the tutorial, there is no mor
Jozinek said:
so only Linux or MacOS too?
Click to expand...
Click to collapse
Flashing works on macOS too. You just need to use the make_ext4fs I linked instead of the one linked on top.
janeliang34 said:
Hello, friend! I am a Chinese user, I do not understand the tutorial, there is no mor
Click to expand...
Click to collapse
extract the tar, open a terminal inside the extracted folder and run ./flash.sh
One question. Zip file with AOSP should be moved intact or only vendor folder from inside it?
Seems it has to be whole .zip.
Jozinek said:
i never make something like this in MacOS (i have Macbook Air, but also with Windows), can you write step by step how to make it. This is something totally new for me (i flashed hundreds of XPERIA smartphones, i have Emma tool, but never try this...)
Click to expand...
Click to collapse
Sure thing
First of all your bootloader needs to be unlocked. I'm assuming you already did that but if not you should read about backuping your drm-keys because otherwise they can't be recovered after unlocking your bootloader unless you do that.
If you don't have fastboot installed yet follow this guide.
After that download the first file linked at the top of this thread.
Unpack the archive (if you can't open it I recommend "the unarchiver" from the app-store).
Place both this file and the zip from the third link at the top in the unpacked folder (in the path where the flash.sh is). Don't unpack the .zip file!
After that open a terminal and navigate to your unpacked folder (if you don't know how to do that google for "terminal tutorial mac").
Run
Code:
chmod +x flash.sh
chmod +x make_ext4fs
to mark the flash-script and the make_ext4fs-file as executable.
Boot your device into fastboot mode (hold volume up while it's turned off and plug in your usb-cable) and finally run
Code:
./flash.sh
to install sailfishOS on the device.
If there is a "hybris-recovery.img" file in the directory (can't quite remember if that's the case with this build) also run
Code:
fastboot flash recovery hybris-recovery.img
to install a sailfishOS specific recovery.
After that you can reboot your device and enjoy Sailfish OS
@Jozinek
You didn't unpack the .tar.bz, inside are all files needed to flash. Than You have to move make_ext4fs, AOSP.zip and flash.fs into created (by unpacking) folder and start/cd Terminal there.
Jozinek said:
Edit3 - it worked now, it was bad make_ext4fs, thanks all of you
Click to expand...
Click to collapse
So that means you are doing a review on YouTube, right?
Friend, is there a tutorial for Windows installation? To be more detailed, this is my first contact
janeliang34 said:
Friend, is there a tutorial for Windows installation? To be more detailed, this is my first contact
Click to expand...
Click to collapse
Right now there is no windows support. The final build (which will be officially sold by Jolla) will make windows-installation possible.
If you know your way around cygwin you could probably get it to flash using windows (other than the flash.sh script there's nothing *nix-exclusive).
Is the rom stable enough for daily use ? and is Alien Dalvik available in this rom to run Android apps ?
no android dalvik or any software that needs license, this version is just community version like aosp without play store.
when flashing there's error make_ext4fs: no such file or directory, when i use the second one there's error: wrong exec format

[TOOL] [Windows] S.U.R v1.3 - Simple Unpack & Repack Tool Deodexer [by JamFlux]

@MikeChannon, please delete this.
Deleted topic because I don't think about giving more support.
Use @SuperR. kitchen.
Reserved
ohhh thanks bro!!! great job
Enviado desde mi POCOPHONE F1 mediante Tapatalk
I want to use Linux. How to use?
Virus??!!
Why my windows 10 security center scaned the virus??!!
ClassiCTR said:
I want to use Linux. How to use?
Click to expand...
Click to collapse
Sorry, it's a Windows tool.
568060545 said:
Why my windows 10 security center scaned the virus??!!
Click to expand...
Click to collapse
Because batch file it's converted to .exe and thats why. Don't worry. It's safe.
Version updated to 1.1
Best performance
https://www.androidfilehost.com/?fid=6006931924117938149
JamFlux said:
Version updated to 1.1
Best performance
https://www.androidfilehost.com/?fid=6006931924117938149
Click to expand...
Click to collapse
hi bro, first thank you for the mighty work you do
i need to repack my rom to other format not to original format
zemzmi said:
hi bro, first thank you for the mighty work you do
i need to repack my rom to other format not to original format
Click to expand...
Click to collapse
Go to 01-Project folder, then temp folder and rename for the format you need: system.img, system.new.dat or system.new.dat.br, then restart application and recover the project.
JamFlux said:
Go to 01-Project folder, then temp folder and rename for the format you need: system.img, system.new.dat or system.new.dat.br, then restart application and recover the project.
Click to expand...
Click to collapse
thanks and good work :good:
possible virus detected
JamFlux said:
Because batch file it's converted to .exe and thats why. Don't worry. It's safe.
Click to expand...
Click to collapse
So then, Why is SUR.exe needed if Sur.bat works ok without it?
Bro, virustotal detects 8/69 threats of SUR.exe file:
https://www.virustotal.com/gui/file/68f8708f5f156caef86535cb132e82527eb08ead3facaf3f09c10ab28618670c/behavior/VirusTotal%20Jujubox
Behaviour of this file does these filesystem actions:
Code:
Processes Tree
2584 - factura.exe
148 - C:\Windows\system32\cmd /c C:\Users\<USER>\AppData\Local\Temp\D751.tmp\D752.bat C:\Users\<USER>\Downloads\factura.exe
2812 - mode con: cols=72 lines=13
WTH is factura.exe?
Similarly, SUR_v1.1u.7z is 13/51 detected by Virustotal.
najabi said:
So then, Why is SUR.exe needed if Sur.bat works ok without it?
Bro, virustotal detects 8/69 threats of SUR.exe file:
https://www.virustotal.com/gui/file/68f8708f5f156caef86535cb132e82527eb08ead3facaf3f09c10ab28618670c/behavior/VirusTotal%20Jujubox
Behaviour of this file does these filesystem actions:
Code:
Processes Tree
2584 - factura.exe
148 - C:\Windows\system32\cmd /c C:\Users\<USER>\AppData\Local\Temp\D751.tmp\D752.bat C:\Users\<USER>\Downloads\factura.exe
2812 - mode con: cols=72 lines=13
WTH is factura.exe?
Similarly, SUR_v1.1u.7z is 13/51 detected by Virustotal.
Click to expand...
Click to collapse
Hi @najabi
I used a tool to compile .bat to .exe, may be its a false positive. I use that program because it can add administrative privileges. But now I put administrative privileges to .bat inside. Just use .bat from here: https://github.com/jamflux/SUR/raw/master/SUR.bat
Can't open?
JamFlux said:
Hi @najabi
I used a tool to compile .bat to .exe, may be its a false positive. I use that program because it can add administrative privileges. But now I put administrative privileges to .bat inside. Just use .bat from here: https://github.com/jamflux/SUR/raw/master/SUR.bat
Click to expand...
Click to collapse
Hi JamFlux,
I tried to unpack a vendor .zip with the utility using the .bat but I got an error anyway.
I think it's best to use scripting commands than .exe binaries when possible, they are easier to spot and analyse. You can use administrative command promt aswell. Which tool do you use to make executables from .bat files? Is it from reputable sources?
najabi said:
Hi JamFlux,
I tried to unpack a vendor .zip with the utility using the .bat but I got an error anyway.
I think it's best to use scripting commands than .exe binaries when possible, they are easier to spot and analyse. You can use administrative command promt aswell. Which tool do you use to make executables from .bat files? Is it from reputable sources?
Click to expand...
Click to collapse
Hi
I'm using this tool:
https://bat-to-exe-converter.uptodown.com/windows
But now I'm using command promt inside .bat
Hope you can unpack vendor.img
Best regards
JamFlux said:
Hi
I'm using this tool:
https://bat-to-exe-converter.uptodown.com/windows
But now I'm using command promt inside .bat
Hope you can unpack vendor.img
Best regards
Click to expand...
Click to collapse
In my opinion, I don't think it's a reputable tool, the developer's webpage doesn't work, and uptodown is not exactly a trusted source.
We must be extra careful these days as they put virus everywhere in executables.
That SUR.exe file is detected as infected by several engines, I think you should consider removing it from the tool.
najabi said:
In my opinion, I don't think it's a reputable tool, the developer's webpage doesn't work, and uptodown is not exactly a trusted source.
We must be extra careful these days as they put virus everywhere in executables.
That SUR.exe file is detected as infected by several engines, I think you should consider removing it from the tool.
Click to expand...
Click to collapse
I remove totally the executable in new version. Thanks.
New version 1.2 supporting deodexing from android 8.0 to android Q.
Download: https://www.androidfilehost.com/?fid=6006931924117945116
@JamFlux mate i have one question. Can I also unpack, edit (removing or adding apps, e.g.) and repack MIUI ROMs? Thx!
Sent from my [device_name] using XDA-Developers Legacy app

How To Guide Automated GSI build script (Linux/WSL)

I've spent last day automating the guide at https://forum.xda-developers.com/t/guide-t220-t225-flash-a-gsi-on-the-a7-lite-without-twrp.4456821/ into a bash script (linux only)!
Here it is releasing it for anyone that needs it
Code:
I am not responsible whatever happens to your device
by using this script, i have tested it on my own device
and it worked but it may or may not work for you.
I will do my best to help you but that may be limited
as i have other responsibilities in life
Before starting read the third post
Usage​Download the your desired firmware from somewhere like samfw.com and extract it
Download your desired GSI image and extract it
Download otatools-mini, gsi-build script and vbmeta image, place them all together inside one directory (extract the otatools-mini next to the script)
Download patched odin
Run this in Linux or WSL!
Code:
$ ./build-gsi.sh <PATH TO YOUR AP FILE .tar.md5> <PATH TO GSI .img>
And let it do the work, may take a while depending on your PC
You may get something like this in the process, ignore it
Code:
Invalid sparse file format at header magic
Then go into download mode (VOLUME UP and DOWN when plugging in USB) and flash the CUSTOM_AP file you got from the script and BL, CSC from the firmware you used, DO NOT USE HOME_CSC
Reboot into recovery and factory reset (VOLUME UP while booting)!
If you are getting dm-verify error then flash the vbmeta_disabled_R (it needs to be .tar, extract it) in odin as AP and try rebooting again into recovery
Downloads​I used to provide one archive but it was large and i couldnt change the script without reuploading it so i am going to use gist for the script and provide other files separately
ota-tools-mini
build-gsi.sh
Getting Help​If you want me to help you ALWAYS post full output from the script, and make sure to use the latest script from the gist
I've spent a lot of time trying to make it work with all GSIs but i could not get it to work consistently
By default it works for all smaller GSIs, if you get the following error
Code:
ERROR: Output image is bigger than original super image, rerun the script with correct super image size
Then you will have to manually provide the new super size which i cannot help you with try to guess but it has to be divisible by 512
Not enough free space to expand partition: vendor
error while repacking
i have a lot of space . but it shows me like that
lpmake E 01-15 23:22:16 100 100 builder.cpp:698] [liblp]Not enough free space to expand partition: vendor
i am using debian wsl
Please post full script log in a spoiler or pastebin
sandorex said:
Please post full script log in a spoiler or pastebin
Click to expand...
Click to collapse
Could you try normal AP file not the magisk patched, i do not know how it modifies it
Also from my experience you do not need to patch whole AP file for magisk, you just need to patch the boot.img, zip it then flash it
OK . i will try
i tried with original ap file but same error
dxsyrz said:
i tried with original ap file but same error
Click to expand...
Click to collapse
It seems for some reason your gsi is too big, i managed to reproduce it, ill see if i can fix it
@dxsyrz can you test this one, it should work now
EDIT: i've updated the gist so you can just use that instead
good util but test more.
tom.android said:
good util but test more.
Click to expand...
Click to collapse
It worked for me, i would not release it if it did not work
sandorex said:
It worked for me, i would not release it if it did not work
Click to expand...
Click to collapse
OK sorry to write that message.
sandorex said:
It worked for me, i would not release it if it did not work
Click to expand...
Click to collapse
Well, something did not work in my case:
:: Uncompressing super image
super.img.lz4 : decoded 5637366988 bytes
:: Running simg2img
./build-gsi.sh: line 79: /mnt/c/Users/Zero/Desktop/otatools-mini/otatools-mini/simg2img: No such file or directory
^ Despite the files actually existing. You tell me cuz I've no idea (do note I do know how to do this manually, was just trying your script to simplify everything).
nirogu325 said:
Well, something did not work in my case:
:: Uncompressing super image
super.img.lz4 : decoded 5637366988 bytes
:: Running simg2img
./build-gsi.sh: line 79: /mnt/c/Users/Zero/Desktop/otatools-mini/otatools-mini/simg2img: No such file or directory
^ Despite the files actually existing. You tell me cuz I've no idea (do note I do know how to do this manually, was just trying your script to simplify everything).
Click to expand...
Click to collapse
You need to place otatools-mini in folder next to the script not together with the script
hi i have this problem
izimen said:
hi i have this problem
View attachment 5814501
Click to expand...
Click to collapse
You havs a space in your path, its actually a bug but you can jist move the files to somewhere without spaces
EDIT: Fixed it on gist
sandorex said:
You havs a space in your path, its actually a bug but you can jist move the files to somewhere without spaces
EDIT: Fixed it on gist
Click to expand...
Click to collapse
ok i try
bro it worked thank you I managed to make it work with a GSI and when I try with another I have this error

Categories

Resources