#!/usr/bin/perl
######################################################################
#
# File : split_bootimg.pl
# Author(s) : William Enck
# Description : Split appart an Android boot image created
# with mkbootimg. The format can be found in
# android-src/system/core/mkbootimg/bootimg.h
#
# Thanks to alansj on xda-developers.com for
# identifying the format in bootimg.h and
# describing initial instructions for splitting
# the boot.img file.
#
# Last Modified : Tue Dec 2 23:36:25 EST 2008
# By : William Enck
#
# Copyright (c) 2008 William Enck
#
######################################################################
usestrict;usewarnings;#Turn on print flushing
$|++;######################################################################
## Global Variables and Constants
my $SCRIPT = __FILE__;my $IMAGE_FN = undef;#Constants (from bootimg.h)
use constant BOOT_MAGIC => 'ANDROID!';use constant BOOT_MAGIC_SIZE => 8;use constant BOOT_NAME_SIZE => 16;use constant BOOT_ARGS_SIZE => 512;#Unsigned integers a