FORUMS
Remove All Ads from XDA

[GUIDE] Extracting proprietary files from OTA updates easily

390 posts
Thanks Meter: 366
 
By nysadev, Senior Member on 10th March 2019, 12:02 AM
Post Reply Email Thread
Hi all
I thought I'd try and write an easy and simple guide on how I extract blobs from vendor updates, cause I couldn't find a guide online myself.

A few things first:
- I will be writing this guide on Windows. You will need to find the Linux/MacOS tools yourself cause this is what I use.
- I use Windows Subsystem for Linux in this guide. It's not needed, but will make your life a lot easier. Follow this guide if you haven't got it installed already.
- This will assume you know how to build a ROM, know what device/vendor trees are, have some slight knowledge of the command line and know how to use basic Git.

First, we need to grab an OTA. I own a MI 8 Lite, so I usually use xiaomi.eu to update my blobs as it's easy to capture the zips. Depends on your device.

Now you've captured your OTA, you need to get the blobs extracted out. I use UR-Tool on Windows 10 but it's completely your choice. I will be proceeding this tutorial with UR-Tool.

Extract your zip into the UR-Tool build environment. Run the tool and choose your zip, extract it, like here: https://i.imgur.com/Y50Y3IZ.png

Okay, so now we have two directories, system and vendor (I'm fairly sure if you're non-treble you'll have one folder which means you can skip this next step.)

Go into system, and remove the symlink named vendor. You can then copy in the vendor folder into system.

In my device tree, I also had /sbin/charge needed in my proprietary-files.txt. I needed to extract my boot.img and put this folder into the system folder. Just check your device tree's needed files.

Copy the entire folder to somewhere easy to find and preferably a path which doesn't contain any spaces. We will be using it later.

Okay, so now we've done all this, we are going to move to the vendor and Git side of things. I will be using WSL from here!

So, now we have our fully ready to go blobs... but what now?
Well we need to prepare our vendor of course!

Like I said above I'll be using WSL from here as I needed "patchelf" for mlipay blobs. You will need something that can execute .sh files and using WSL is probably the easier option. If you're on Linux you don't need to do anything really.

We need 3 things to clone in. I've taken the liberty of stripping down Lineage's vendor to just the critical stuff for extracting blobs. You can find my repository here.

Lets make a new directory. We will clone in our trees like this:
Code:
git clone (device tree link) device/(vendor)/(codename)
git clone (vendor tree link) vendor/(vendor)/(codename)
git clone https://github.com/nysadev/extract_blobs_vendor vendor/lineage
This will create a directory that looks like a ROM, but severely stripped down. The reason we do the folders like this is because the scripts in device tree will point to a structure like this. This will help us avoid script location errors later. Make sure in your device tree that extract-files.sh points to vendor/lineage (should be in the first few lines).

Your root directory now should look like this: https://i.imgur.com/YiqMaDJ.png

Now go to your device tree. This is where all the good stuff happens. You need to know the path here of your extracted blobs from earlier.
Run these two commands:
Code:
chmod +x setup-makefiles.sh
./extract-files.sh (path/to/your/extracted/system)
Hopefully if all goes well you should see this with no "file missing in source errors": https://i.imgur.com/jErpyCv.png

Just to be sure, at the end of when it extracts, run "./extract-files.sh" again, just to prepare your vendor.

Now you're done! You'll hopefully see a few good modified libs, changes to Android.mk and your device-vendor.mk.

You're probably going to want to use git here to upload your changes. Just run:
Code:
git add .
git commit -m "(codename): update to (ota-version)"
git push -f
or something of the sort.

Well done! You're now done! Feel free to reply with any errors you get.
My Telegram is @nysadev; you're maybe better off catching me there.
I hope my guide helped you. Drop a like or something, idek.
The Following 2 Users Say Thank You to nysadev For This Useful Post: [ View ] Gift nysadev Ad-Free
 
 
10th March 2019, 12:15 AM |#2  
Melvin Garcia's Avatar
Member
Flag Guatemala
Thanks Meter: 50
 
More
It will be very useful
The Following User Says Thank You to Melvin Garcia For This Useful Post: [ View ] Gift Melvin Garcia Ad-Free
10th March 2019, 12:28 AM |#3  
Immortal0907's Avatar
Senior Member
Thanks Meter: 156
 
More
You rock! Love ya
The Following User Says Thank You to Immortal0907 For This Useful Post: [ View ] Gift Immortal0907 Ad-Free
Post Reply Subscribe to Thread

Tags
blobs, rom, vendor

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes