[Paid Software Announcement and Discussion] osm0sis:
Here we are! :D

/su/bin/logohack.sh:

#!/system/bin/sh
# GN Bootloader Image Replacement Hack Script
# osm0sis @ xda-developers
#
# Original version-locked method by Ezekeel @ xda-developers

# ensure we use a known busybox since dd, ob, strings, and truncate need to work as expected
bb=busybox;
bbver=$($bb 2>/dev/null | grep 'BusyBox v' | cut -d ' ' -f 2);
bbrev=$(echo $bbver | cut -c 2-7 | tr -d '.');
bbvar=$(echo $bbver | cut -d - -f 2);
if [ ! "$($bb 2>/dev/null)" -o "$bbrev" -lt 1251 ]; then
echo "Busybox 1.25.1-osm0sis (or newer) installation required!";
return 1;
elif [ "$bbrev" -lt 1260 -a "$bbvar" != "osm0sis" ]; then
echo "Busybox 1.25.1-osm0sis (or newer) installation required!";
return 1;
fi;

# sbl bootloader partition contains the images
block=/dev/block/platform/omap/omap_hsmmc.0/by-name/sbl;
if [ ! -e "$block" ]; then
echo "Partition not found!";
return 1;
fi;

# loop through commandline arguments
case $1 in
--help|"")
echo "usage: logohack.sh [--logo [logo.jpg]] [--lock [lock.jpg]]";
return 1;
;;
--logo|--lock)
echo -e "\nGN Bootloader Image Replacement Hack Script";
echo "by osm0sis @ xda-developers";
;;
esac;
until [ ! "$1" ]; do
# image order has logo at #11, and lock at #16, stored as JPEG
case $1 in
--logo) num=11; len=12126;;
--lock) num=16; len=2215;;
*) echo "Invalid \"$1\" option!"; return 1;;
esac;
type=$(echo $1 | $bb cut -c 3-);

# search for JFIF magic and -6 to get to beginning of the image
echo -e "\nSearching for \"$type\" offset ...";
count=1;
for i in $($bb strings -t d $block | $bb grep 'JFIF$' | $bb tr -d ' ' | $bb cut -d J -f 1); do
test "$count" == "$num" && offset=$((i - 6));
count=$((count + 1));
done;
if [ "$offset" ]; then
echo "Found offset: $offset";
else
echo "Offset not found!";
return 1;
fi;

case $2 in
--logo|--lock|"")
# if no filename is specified, dump the requested current image
echo -e "\nDumping $type to \"/sdcard/$type.jpg\" ...";
$bb dd ibs=1 obs=1 count=$len skip=$offset if=$block of=/sdcard/$type.jpg;

# trim off trailing zeros from dump
echo -e "\nTrimming \"/sdcard/$type.jpg\" ...";
trim=$($bb od -A d -t x8 /sdcard/$type.jpg | $bb tail -n 4 | $bb head -n 2 | $bb grep -v '*');
if [ "$(echo $trim | $bb awk '{ print $2 $3 }')" == "00000000000000000000000000000000" ]; then
$bb truncate -s "$(echo $trim | $bb awk '{ print $1 }')" /sdcard/$type.jpg;
elif [ "$(echo $trim | $bb awk '{ print $5 $6 }')" == "00000000000000000000000000000000" ]; then
$bb truncate -s "$(echo $trim | $bb awk '{ print $4 }')" /sdcard/$type.jpg;
fi;
shift;
;;
*)
# if there is a file specified (and it meets the requirements), write it to sbl
if [ ! -f "$2" ]; then
echo "File \"$2\" not found!";
else
# ensure file will fit in the target image section
if [ "$($bb wc -c < "$2")" -gt "$len" ]; then
echo "File \"$2\" is too large; >$len bytes!";
else
# get short name of bootloader for backup name
blname=$(getprop ro.boot.bootloader | tr '[A-Z]' '[a-z]' | cut -c 6-);

# backup current sbl before making changes
backup=/sdcard/sbl-$blname-$(date +%Y-%m-%d_%H%M%S).img;
echo -e "\nBacking up \"$block\" to \"$backup\" ...";
$bb dd if=$block of=$backup;

# zero the section prior to writing new image
echo -e "\nZeroing \"$type\" image area of sbl partition ...";
$bb dd ibs=1 obs=1 count=$len seek=$offset conv=notrunc if=/dev/zero of=$block;

# write the image to sbl
echo -e "\nWriting \"$2\" to sbl partition ...";
$bb dd ibs=1 obs=1 count=$len seek=$offset conv=notrunc if=$2 of=$block;

# write FF to the 4 trailing bytes
echo -ne "\xFF\xFF\xFF\xFF" | dd obs=1 count=4 seek=$((offset + len)) of=$block;
fi;
fi;
shift 2;
;;
esac;
done;
echo -e "\nDone!";
return 0;

There were some crazy complications with the strings command, and I discovered that none currently worked as advertisted; the toybox version has all the offsets wrong by 1 byte, and busybox outputs all the offsets in octal despite stating they're in decimal in the help. This is present in busybox pretty much forever as far as I can tell, and is present in Stericson (1.24.2-Stericson uClibc), and TWRP/Omni (1.22.1-jb bionic), so basically everywhere.

Long story short I fixed the busybox bug and so the script can only be used with my latest patched BusyBox (1.25.0-osm0sis or later). It's available in my Odds and Ends thread.

Attached is the script, and the images I prepped (with an editor to resize and TinyJPG.com to optimize) to update the bootloader to the current Google look.

Rename the script to logohack.sh and place it in /su/bin/ or /system/bin/ with root:root ownership and 755 executable permissions. The arguments can be supplied in any combination; without a filename they dump, and with they write. You can just type "logohack.sh" to get started though. :cowboy:

Edit

: Just bumped the required busybox version to 1.25.1-osm0sis since I've applied some patches from the master branch (added after my prodding ;)) that give proper strings -t radix support to get the decimal offsets, and the script has been updated accordingly. I've also lifted the restriction of using my variant for busybox 1.26.0 and above since it should have the required changes when it gets released as well. :good:

I'm going to unsubscribe from this thread. If anyone needs help with my script, @ mention me or post in my Odds and Ends thread.