Android Vendor Blob Extraction гаргаж авах
Instruction 1
This is the updated instructions, and an update-to-date (as of writing) how-to guide for vendor blob extraction
Unlike the earlier guide, you won’t need the full rom synced. Huge kudos to the guys at LineageOS for making this possible!
What you would need:
- Around like 20GB of disk space (just to be safe)
- Dump or OEM zip whichever is available
- A Popular GNU/Linux Distro
Download the concerned OEM zip (like MIUI, OneUI, or whatever)
Dumpyara is a universal dumper script compatible with almost all OEM zips
git clone https://github.com/AndroidDumps/dumpyara cd dumpyara
If you have Arch Linux or Ubuntu, then simply run,
bash setup.sh
else, you have to poke into that script and match accordingly with the deps for your distro.
With the setup part done, Let’s get to the dumping part.
bash dumpyara.sh ./zipname.zip
Let it run for a while, and your dump should be at the `working/zipname` folder of dumpyara
Once you have the dump, let’s start to extract from it.
git clone https://github.com/LineageOS/android_tools_extract-utils -b lineage-18.1 android/tools/extract-utils git clone https://github.com/LineageOS/android_prebuilts_extract-tools -b lineage-18.1 android/prebuilts/extract-tools
cd to the android folder and,
git clone your dt to the usual path like you would while building, like `device/brand/codename`
Clone the common tree also, if it exists
Check if your extract-files.sh is updated to track `tools/extract-utils`, if it’s not, or the file itself doesn’t exist, you need to get it from GitHub, it’s almost on every tree.
bash extract-files.sh /path/to/dumpyara/working/zipname/
Wait and watch it do its thing
Once that is done, you just need to go to `vendor/brand/codename` and,
git init, commit and push it up!
This should be done for the common tree also which would be `vendor/brand/smxx-common`
Instruction 2
I got asked this question a lot, so I’ll post it here. Its gonna just be steps on how to do it.
⚠️ Note that you need a fully synced rom source for this.
- Place the Device Tree with the extract-files.sh inside.
- If your device tree doesn’t have an extract-files script, get it from github, its almost on every tree.
- Grab the stock rom for your device, MIUI/OOS or OneUI whatever.
- Create a new folder named dump and extract it there.
- Now see if it has a payload.bin or system.dat.br and vendor.dat.br
If it has a payload.bin, then, your device is A/B, and the job is actually very easy, #
- Use this tool and run the python file in it.
- You will now have img files ready.
You are unlucky and have br files inside. #
So what? We can still extract them, a bit of more work, but yes we can.
- Install brotli from your package manager
- Run the following commands, it will decompress the brotli compression of your images
brotli --decompress system.new.dat.br brotli --decompress vendor.new.dat.br
- Now we to convert the dat files to img, run these commands on terminal, to convert it
curl -sLo sdat2img.py https://raw.githubusercontent.com/xpirt/sdat2img/master/sdat2img.py python3 sdat2img.py system.transfer.list system.new.dat python3 sdat2img.py vendor.transfer.list vendor.new.dat vendor.img
- Now you would have both the images ready for extracting.
Final Step #
Lets Extract the img files we have!
- Create folders for extracting.
mkdir -p system mkdir -p vendor
- Install P7-Zip from your package manager
- Now the extraction.
7z x system.img -y -osystem 7z x vendor.img -y -ovendor
In your folder, there would be two folders system and vendor, with many files now. Pulling blobs #
- The work directory which had the system and vendor folders is assumed to be at ~/dump for now.
- cd to the device tree, and run the command
bash extract-files.sh ~/dump
- Your vendor blobs would be at vendor/brand/device
Эх сурвалж: