Skip to content

A collection of miscelaneous tools for working with Android development / ROM development

Notifications You must be signed in to change notification settings

TonyStark/android_misc_tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

system.img

Adapted from: http://forum.xda-developers.com/showthread.php?t=2501219

The following sections outline the necessary steps to build a Moto X (ghost) SafeStrap compatible OTA from a carrier OTA

System image mounting as a loopback under linux

  1. dd if=system.img of=simg bs=131072 skip=1 # Strip the custom Motorola header from the image
  2. simg2img.py simg raw.img # Convert from sparse filesystem to full filesystem
  3. mount -o loop raw.img /mnt/system.img # Mount the image as a loopback

Patching files

  1. Build imgdiff/imgpatch/bsdiff/bspatch from aosp/bootable/recovery/applypatch
  2. Install sha1sum
  3. Run process_updater-script.py with the necessary arguments. NOTE: This is a Python 3 application, it will NOT run under Python 2

Building diff/patch apps

You really don't want to do this. Use the pre-compiled packages in this repo

  1. Install libbz2-dev, libbz2-1.0, zlib-dev packages
  2. Copy libmincrypt, mincrypt, minelf, mtdutils from bootable/recovery and system/core to the local source dir
  3. Compile applypatch: gcc -lbz2 -lz -o imgpatch utils.c imgpatch.c bsdiff.c libmincrypt/sha.c libmincrypt/sha256.c libmincrypt/rsa.c minelf/Retouch.c edify/expr.c applypatch.c mtdutils/mtdutils.c freecache.c bspatch.c main.c

Misc Notes

Suggested folder layout

xxx_sbf xx_img logs ota tools

updater-script Commands

  • apply_patch_check(File to patch, Patched file sha1sum, Pre-patched file sha1sum)
  • apply_patch(original file path relative to booted android root, ??? likely non-patched file size, patched file sha1sum, patched file size, original file sha1sum, patch path relative to ota root);

imagepatch Usage

applypatch source_file target_file target_sha1 target_size source_file_sha1:patch_file Example: ./tools_notes/applypatch/applypatch ./44_repack/system/app/Books.apk ./44_repack/system/app/Books.apk aec0e4c42c51d2bc7860f018245bed5325cb53cb 5519762 a03d64e4db2a1ffa9eb5e9d53716f06c47984134:./patch/system/app/Books.apk.p

About

A collection of miscelaneous tools for working with Android development / ROM development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 84.9%
  • Shell 5.4%
  • Python 3.3%
  • Java 1.9%
  • Makefile 1.9%
  • Yacc 1.1%
  • Other 1.5%