Friday, 9 October 2015

[HOW TO] Convert back Qualcomm's DTB to DTS file, extract kernel config



I assume you are a ROM builder. When your device vendor continue violate the GPL, refuse to open the device kernel source, let's we reverse engineering our device stock kernel.

Dedicated to ex Google Hugo Barra. Ends up as a GPL violator a pretty miserable.

Tools:
  1. Python tool csplitb https://github.com/mypalmike/csplitb

  2. dtc binary from out/target/product/<device>/obj/KERNEL_OBJ/scripts/dtc

  3. unpackbootimg from out/host/linux-x86/bin

  4. extract-ikconfig from kernel/<vendor>/<device>/scripts

Copy all needed tools to your PATH, $HOME/bin/

Steps:
  1. Unpack stock boot.img using unpackbootimg:

    Code:


    $ mkdir boot
    $ cd boot
    $ unpackbootimg -i ../boot.img -o .



  2. Split DT image to DTB files, for MSM8916 in this example:

    Code:


    $ mkdir dtb
    $ cd dtb
    $ csplitb.py --prefix msm8916- --suffix .dtb --number 4 D00DFEED ../boot.img-dt



  3. Find proper DTB file for your device, device model "Qualcomm Technologies, Inc. MSM 8916 QRD SKUM" string from my device dmesg output in this example:

    Code:


    $ grep -r "QRD SKUM"
    Binary file msm8916-0011.dtb matches



  4. Convert DTB to DTS files:

    Code:


    $ dtc -I dtb -O dts -o ../msm8916-0011.dts msm8916-0011.dtb
    $ cd ../



  5. Extract kernel config

    Code:


    extract-ikconfig boot.img-zImage > msm8916_defconfig



This how to success story: http://forum.xda-developers.com/andr...uilds-t3200883



No comments:

Post a Comment