Giter Club home page Giter Club logo

snimg's Introduction

snimg - create an sn.img file for Lenovo device


Description

Some OEMs (like Lenovo) limit a user's ability to enable bootloader unlocking. Sometimes a small file called sn.img is required to enable bootloader unlocking. Lenovo does not always make this file available for all their devices.

To enable unlocking, the command is usually: fastboot flash unlock sn.img

The bootloader (LinuxLoader aka abl.elf) takes the sn.img file and passes it to VBVerifyImage( ) for authentication. It fibs to VBVerifyImage( ) and tells it that this is a 0x1000-byte boot image.

If successful, this authorises the command fastboot oem unlock-go to unlock the bootloader.

NOTE: not all Android bootloaders issued by these OEMs contain the "fastboot flash unlock" or "fastboot oem unlock-go" commands. So this sn.img file will be useless in that case.

See snimg.h for information on the format of the sn.img file.


How to use sn.img

usage:     snimg <serialno>

               serialno - serial number of device (mandatory), eg H0H0HEHE

How to build snimg

This program uses CMake and OpenSSL.

Prereqs for Windows

  1. Visual Studio 2022 or later. Community Edition is ok.
  2. in Visual Studio, install Visual Studio 2022 (v143) or later as the Platform Toolset
  3. download and install latest CMake for Windows. It's easiest to use the *.msi installer.
  4. download and install OpenSSL in c:\Program Files\OpenSSL. It's easiest to install the precompiled headers.

Prereqs for Linux

  1. GCC 7.5.0 or later
  2. OpenSSL 1.1.1. Usually pre-installed on Linux (type: openssl version). If not installed, visit: OpenSSL's github repo for instructions.
  3. CMake 3.25.1 or later
    wget https://github.com/Kitware/CMake/releases/download/v3.25.1/cmake-3.25.1.tar.gz
    tar -zxvf cmake-3.25.1.tar.gz
    cd cmake-3.25.1
    ./bootstrap
    make
    sudo make install

Download source

    git clone https://github.com/Yahoo-Mike/snimg.git

Build the source

    cd snimg                                    # change to base directory
    cmake -S . -B build                         # configure the project
    cmake --build build                         # build the project

snimg's People

Contributors

yahoo-mike avatar

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.