Git Product home page Git Product logo

aosp-missing-blobs's Introduction

aosp-missing-blobs

aosp-missing-blobs is a nifty tool to identify required blobs (.so) that are missing from AOSP ROM builds, and to show which existing blobs rely on them. This will be particularly useful for ROM developers who want to ensure that they have not missed out any required proprietary OEM blobs.

Concept

Blobs (.so) and compiled binaries in Android need other blobs to work. It is possible to identify the dependencies for each blob by inspecting their ELF information:

$ readelf -d <name_of_blob.so> | grep "\(NEEDED\)" | sed -r "s/.*\[(.*)\]/\1/"

Example (finding the dependencies of libqti_performance.so):

$ readelf -d libqti_performance.so | grep "\(NEEDED\)" | sed -r "s/.*\[(.*)\]/\1/"
libnativehelper.so
liblog.so
libcutils.so
libutils.so
libbase.so
[email protected]
libhidlbase.so
libhidltransport.so
libqti-perfd-client_system.so
libhwui.so
libc++.so
libc.so
libm.so
libdl.so

From the example, we can see that libqti_performance.so depends on libqti-perfd-client_system.so and [email protected].

aosp-missing-blobs uses this idea to identify all the dependencies of a given list of blobs, and to check whether any of these dependencies are not present.

Installation

Cargo

You can install with cargo after setting up Rust:

cargo install aosp-missing-blobs

Building

aosp-missing-blobs is written in Rust, hence you'll need Rust to be installed to build the project.

In the root directory of the repo, execute:

$ git clone https://github.com/joshchoo/aosp-missing-blobs
$ cd aosp-missing-blobs
$ cargo build --release

$ ./target/release/aosp-missing-blobs

A runnable aosp-missing-blobs binary will be produced.

Usage

This program takes as arguments a list of directories that contain compiled binaries and blobs (.so).

$ aosp-missing-blobs <blob directory1> <blob directory2> <blob directory3> <blob directoryN>

Search blob directories recursively:

$ aosp-missing-blobs -r <blob root directory>

Example

Assuming you have extracted the ROM's system.img and vendor.img to ~/system and ~/vendor, respectively, run the following:

$ aosp-missing-blobs ~/system/lib ~/vendor/lib

The program does the following:

  1. Search ~/system/lib and ~/vendor/lib directories for blobs.
  2. Identify dependencies of each blob found.
  3. Checks if required dependencies exist in ~/system/lib and ~/vendor/lib.
  4. Output a list of missing dependencies and existing blobs that need them.

Depending on how wide your search scope is, the program may flag out missing dependencies 'incorrectly'. Some dependencies may exist in other directories besides what the examples have shown. Other directories with blobs include the following:

  • /system/bin
  • /system/lib[64]
  • /system/lib[64]/vndk-28
  • /system/lib[64]/vndk-sp-28
  • /vendor/bin
  • /vendor/lib[64]
  • /vendor/lib[64]/vndk
  • Etc.

Take note that the more directories you specify as arguments, the longer the program will run for!

aosp-missing-blobs's People

Contributors

dhina17 avatar joshchoo avatar sebaubuntu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aosp-missing-blobs's Issues

can this tool be made recursive ?

its very hard to get all folders to be detected , maybe can this tool be made recursive so you can just set vendor and system as paths and the tool will recursivly scan folders

Question

Is it possible if we search recursively but only for specific blobs?
Eg. I only want to print out what's needed by [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.