Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
This branch is 2 commits ahead of glandium:master.

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


When working on Android, I found it useful to be able to unpack a boot image, replace a few files and repack it. unbootimg is the perfect complement to the mkbootimg tool that is used to create boot images.

unbootimg takes a boot image and produces all that is necessary in order to create a new image using mkbootimg. In particular it extracts the kernel command line and the addresses of the image parts, and creates a command line for mkbootimg to regenerate the image as close to the original one. It even verifies the SHA1 checks!

unpack and repack and are trivial shell wrappers for unbootimg that also take care of the ramdisk packaging: cpio and gzip. They are designed to complement, so that this would simply recreate boot.img without changes: boot.img boot.img


If you already have the AOSP repo and managed to build mkbootimg, adding unbootimg is easy.

  • Clone this repository under AOSP/repo/external/unbootimg

  • Build it:

      cd AOSP/repo
      . build/
      make mkbootimg unbootimg
      # sadly that can't install and so we need:
      mmm external/unbootimg
  • Put AOSP/repo/out/host/linux-x86/bin in your path. Easiest way to do this is:

      setpaths  # this is defined by Android build system: . build/

unbootimg depends (like mkbootimg) on libmincrypt for computing the SHA1, but this can easily be disabled in the source code.


# on the phone: copy the boot or recovery image, for example
dd if=/dev/mtd/mtd3 of=/sdcard/recovery-backup.img
# on the host: pull the backup
adb pull /sdcard/recovery-backup.img .
# unpack it recovery-backup.img
# edit as you wish:
# cmdline: recovery-backup.img-mk
# kernel:  recovery-backup.img-kernel
# ramdisk: recovery-backup.img-ramdisk/
# repack it recovery-backup.img
# send to phone
adb push recovery-backup.img /sdcard
# flash it using flash_image


DEPRECATED - The complement to Android's mkbootimg







No packages published


  • C 88.6%
  • Shell 11.4%