Patches for kexec-tools --load-hardboot support


There are two ways to build the "kexec" userspace tool, with hardboot
support, for Android: as dynamically-linked and statically-linked
executables.  The dynamically-linked version may be build with the Android
NDK, but requires that /system is mounted (read-only) when running kexec.
The statically-linked version has no /system dependency, but must be build
in an Android source tree (e.g., android-2.3.5_r1).


To build dynamically-linked with the Android NDK:

mkdir jni
tar -xjC jni --strip-components=1 -f kexec-tools-2.0.2.tar.bz2
patch -p 1 < bionic_fixes.diff
patch -p 1 < build_ndk.diff
patch -p 1 < hardboot.diff
patch -p 1 < print_debug.diff
"$NDK_ROOT/ndk-build" # V=1

with the resulting tool in "libs/armeabi/kexec".


To build statically-linked with an Android source tree:

mkdir external/kexec-tools
cd external/kexec-tools
tar -xj --strip-components=1 -f ~/tar/epic/kexec-tools-2.0.2.tar.bz2
patch -p 2 < bionic_fixes.diff
patch -p 1 < build_static.diff
patch -p 2 < hardboot.diff
patch -p 2 < print_debug.diff
cd ../..
make out/target/product/generic/system/bin/kexec_

with the resulting tool in "out/target/product/generic/system/bin/kexec_",
which should be renamed to "kexec".


bionic_fixes.diff:
    Add Bionic libc compatibility fixes.

    The main compatibility bug is that bionic doesn't support "%L" in format
    strings for type "long long".  Use "%ll" instead.


build_ndk.diff (use only for Android NDK builds):
    Add Android NDK build support.


build_static.diff (use only for Android source tree builds):
    Add Android statically-linked build support.


hardboot.diff:
    Add --load-hardboot option and support KEXEC_HARDBOOT flag.


print_debug.diff:
    Print optional (but useful) debugging information.
