[Samsung Galaxy Nexus] osm0sis:
Happy holidays! Here's the fruit of my labors - the pitfix.sh script altered to become a flashable zip that now only modifies a copy of the PIT backup!

UPDATE-GN.PIT.Editor.zip/META-INF/com/google/android/update-binary:

#!/sbin/sh
# PIT Editor for Galaxy Nexus: Recovery Flashable Zip
# osm0sis @ xda-developers
#
# Dumps the current PIT as a backup (if data is the original size) then produces a modified version,
# altering cache to the preset length in MB, adding the difference to system

# flashable zip functions and banner
OUTFD=/proc/self/fd/$2;
ZIP="$3";
ui_print() { echo -e "ui_print $1\nui_print" > $OUTFD; }
abort() { ui_print " "; ui_print "$*"; exit 1; }

ui_print "PIT Editor for Galaxy Nexus";
ui_print "osm0sis @ xda-developers";
ui_print " ";

# new cache block count (length) in MB
cacheMB=128;

# base cacheMB on zip name if present
zipname=$(basename "$ZIP" .zip);
case $zipname in
*MB) testMB=$(echo $zipname | rev | cut -c 3-5 | rev);
if [ $testMB -ge 100 -a $testMB -lt 432 ]; then
cacheMB=$testMB;
fi;;
esac;
ui_print "using new cache size: $cacheMB MB";

# block device containing the PIT
block=/dev/block/mmcblk0;

# offset of the PIT in the block device, and partition size offsets within the PIT; count offsets are size offset + 4
pit=17408;
sysOffset=1500;
cacheOffset=1632;
dataOffset=1764;

# functions for dumping then converting the little endian hexadecimal into decimal for calculations and converting then writing back to file
dump_hex2dec() { echo "$(printf '%d\n' 0x$(dd ibs=1 count=4 skip=$(($1+pit)) obs=1 if=$block 2>/dev/null | od -hv | head -n 1 | awk '{ print $3$2 }'))"; }
write_dec2hex() { echo -ne "$(printf '%08x\n' $2 | sed 's/.\{2\}/& /g' | awk '{ print "\\x"$4"\\x"$3"\\x"$2"\\x"$1 }')" | dd conv=notrunc obs=1 count=4 seek=$1 of=$3; }

# check the PIT against known values for userdata to ensure it is an original PIT for the device
dataSize=`dump_hex2dec $dataOffset`;
dataCount=`dump_hex2dec $((dataOffset+4))`;
if [ "$dataSize" != 2379776 ]; then
abort "non-standard userdata size (start offset) detected... aborting.";
fi;
case $dataCount in
28397534|59944926) ;;
*) abort "non-standard userdata count (length) detected... aborting.";;
esac;

# create a backup of the existing, untouched PIT with a timestamped filename
date=$(date +%Y-%m-%d.%H%M%S);
dd if=$block of=/sdcard/backup-$date.pit bs=1 count=4096 skip=$pit;

# calculate new block counts (lengths) for cache and system; 1 MB is 2048 blocks
sysCount=`dump_hex2dec $((sysOffset+4))`;
cacheCount=`dump_hex2dec $((cacheOffset+4))`;
cacheCountNew=$((cacheMB*2048));
sysCountNew=$((sysCount+cacheCount-cacheCountNew));

# report new system block count (length) in MB
ui_print "new system size: $((sysCountNew/2048)) MB";

# calculate new block size (start offset) for cache; the sum of the previous partition (system)'s block size and block count
sysSize=`dump_hex2dec $sysOffset`;
cacheSizeNew=$((sysSize+sysCountNew));

# abort if cache has already been altered
if [ "$cacheCount" == "$cacheCountNew" ]; then
abort "cache count (length) already matches target amount... aborting.";
fi;

# copy untouched PIT and write back the updated values
target=/sdcard/modified-$date-"$cacheMB"MB.pit;
cp -f /sdcard/backup-$date.pit $target;
write_dec2hex $cacheOffset $cacheSizeNew $target;
write_dec2hex $((cacheOffset+4)) $cacheCountNew $target;
write_dec2hex $((sysOffset+4)) $sysCountNew $target;

# zero minor gpt/efs areas of the PIT file to mimic external editing
for i in 200 596 632; do
echo -ne "\x00\x00\x00" | dd conv=notrunc obs=1 count=3 seek=$i of=$target;
done;

# instruct user to flash new PIT via Odin and format
ui_print " ";
ui_print "modified .pit created in /sdcard";
ui_print "flash via odin mode then format system+cache in recovery";

ui_print " ";
ui_print "Done!";
exit 0;

The script is pretty well documented so I recommend people read through, but I do want to emphasize that the new size of cache is user variable now! It defaults to 128MB, but if a user renames the zip with the suffix -xxxMB where xxx is between 100 (a reasonable minimum) and 432 (the default size of cache), then that number is used instead (e.g. UPDATE-GN.PIT.Editor-256MB.zip will reduce cache to 256MB and adds the difference to system).

In case there are people who altered their PITs to steal space from data and didn't have a backup handy, attached is the default PIT file for maguro (i9250)/toro 16gb (i516), and the default PIT file for toro 32gb (i515)/toroplus (l700) - (rename from .txt to only .pit). These were confirmed to match from all the dumps people sent me. Also, the great thing about only taking from cache is that data remains completely intact and in my testing did not require a reformat afterwards!

The resulting modified-*-xxxMB.pit file is identical, byte-for-byte to one produced by the PIT Magic tool mentioned earlier in the thread, and is output to /sdcard. From there it needs to be copied to PC and flashed to the device in Odin Mode (Power+VolDwn when off) using the Odin3 or Heimdall tools (your PC should install a Samsung MODEM driver when connected via USB while in Odin Mode), then simply reboot to recovery and format system and cache. I am currently enjoying a sizable GApps package installed on my 958MB system partition resulting from the default reduction to a 128MB cache. :cool::cowboy:

Enjoy!

[MENTION=2633638]Ziyan[/MENTION] [MENTION=4608636]bsmitty83[/MENTION] [MENTION=3390093]MWisBest[/MENTION] [MENTION=4022928]Carlos_Manuel[/MENTION] [MENTION=1048318]zzpianoman[/MENTION] [MENTION=6140342]Fenix46[/MENTION] [MENTION=5773568]theBlackEnd[/MENTION] [MENTION=4920940]sgspluss[/MENTION] [MENTION=2838735]aosp[/MENTION] [MENTION=4545566]bamtan2[/MENTION] [MENTION=4531957]musical_chairs[/MENTION]

Edit: Reuploaded zip to add the -xxxMB suffix to the resulting modified .pit filename.

Edit 2: Reuploaded one more time to fix the previous fix.