Skip to content

Instantly share code, notes, and snippets.

@mthierry
Created April 14, 2016 12:19
Show Gist options
  • Save mthierry/bf9bf004e2072fdf60fa7e6832edd57a to your computer and use it in GitHub Desktop.
Save mthierry/bf9bf004e2072fdf60fa7e6832edd57a to your computer and use it in GitHub Desktop.
#!/bin/sh
ARCH=x86_64
# Extract boot parameters from an existing boot.img if availavle
if [ -e $ANDROID_PRODUCT_OUT/boot.img ];
then
OLD_PARAMS=`strings $ANDROID_PRODUCT_OUT/boot.img | head -2 | tail -1`
# The boot hardware should match our target product
# If it doesn't we don't use the params
OLD_HW=`echo "$OLD_PARAMS" | grep "androidboot.hardware=" | sed 's/^.*androidboot.hardware=\(.[^ $]*\).*$/\1/'`
if [ "${OLD_HW}" = "${TARGET_PRODUCT}" ] || [ "${OLD_HW}" = cht_rvp ] ;
then
echo "Old boot image specifies kernel parms: $OLD_PARAMS"
BOOT_PARAMS="$OLD_PARAMS"
else
echo "No boot parameters found in existing $ANDROID_PRODUCT_OUT/boot.img"
echo "Please rebuild the boot image from scratch (e.g. \"make bootimage\")"
exit
fi
else
echo "No existing boot image found at $ANDROID_PRODUCT_OUT/boot.img"
echo "Please rebuild the boot image from scratch (e.g. \"make bootimage\")"
exit
fi
#if [ "$DRM_DEBUG" != "" ];
#then
BOOT_PARAMS="${BOOT_PARAMS} loglevel=7 drm.debug=0xe"
#fi
echo
echo "Building boot image with kernel params: ${BOOT_PARAMS}..."
$ANDROID_HOST_OUT/bin/mkbootimg --kernel $ANDROID_BUILD_TOP/device/intel/cht-kernel/x86_64/bzImage --ramdisk $ANDROID_PRODUCT_OUT/ramdisk.img --cmdline "$BOOT_PARAMS" --output boot.img
echo
echo "Now install the new boot image with \"fastboot flash boot boot.img\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment