[Galaxy S 4 Developer Discussion [Developers-Only]] broodplank1337:
This morning I was coding this script, but didn't feel like extending it further. it basically just dumps all known partitions to the chosen dir and then makes a (compressed) odin rom from it, if chosen.

if anyone wants to use this, feel free to do whatever you want with it. I will occasionally dump some items on this forum that I find share worthy. just to share some inside stuff that will never get released when I don't share it here :)

#!/system/bin/sh

# Complete backup for Galaxy S4 (i9505)
# Created by broodplank1337
# Developer Sample (free for all kinds of use)
# www.broodplank.net

MAKEODIN="n";
ODINUSECOMPRESS="n";
BACKUPNONODIN="n";
OUTPATH="/storage/sdcard1/backup/";

echo "Starting backup..."
echo "Overall process may take upto 30 minutes"
echo
echo "BACKUP MODEM"
echo
echo "1. NON-HLOS.bin"
busybox dd if=/dev/block/mmcblk0p1 of=${OUTPATH}NON-HLOS.bin
echo "2. modem.bin"
busybox dd if=/dev/block/mmcblk0p2 of=${OUTPATH}modem.bin
echo
echo "BACKUP BOOTLOADER"
echo
echo "1. sbl1.mbn"
busybox dd if=/dev/block/mmcblk0p3 of=${OUTPATH}sbl1.mbn
echo "2. sbl2.mbn"
busybox dd if=/dev/block/mmcblk0p4 of=${OUTPATH}sbl2.mbn
echo "3. sbl3.mbn"
busybox dd if=/dev/block/mmcblk0p5 of=${OUTPATH}sbl3.mbn
echo "4. aboot.mbn"
busybox dd if=/dev/block/mmcblk0p6 of=${OUTPATH}aboot.mbn
echo "5. rpm.mbn"
busybox dd if=/dev/block/mmcblk0p7 of=${OUTPATH}rpm.mbn
echo "6. tz.mbn"
busybox dd if=/dev/block/mmcblk0p8 of=${OUTPATH}tz.mbn
echo
echo "BACKUP PLATFORM"
echo
echo "1. system.img.ext4"
busybox dd if=/dev/block/mmcblk0p16 of=${OUTPATH}system.img.ext4
echo "2. recovery.img"
busybox dd if=/dev/block/mmcblk0p21 of=${OUTPATH}recovery.img
echo "3. boot.img"
busybox dd if=/dev/block/mmcblk0p20 of=${OUTPATH}boot.img
echo
echo "BACKUP CSC"
echo
echo "1. cache.img.ext4"
busybox dd if=/dev/block/mmcblk0p18 of=${OUTPATH}cache.img.ext4

if [[ $MAKEODIN != "n" ]]; then
echo
echo "Making odin package, this may take a while"
echo
cd ${OUTPATH}
GETDATE=`busybox date -I`;
if [[ $ODINUSECOMPRESS != "n" ]]; then
echo "Making compressed tar ball"
busybox tar -cz NON-HLOS.bin modem.bin sbl1.mbn sbl2.mbn sbl3.mbn aboot.mbn rpm.mbn tz.mbn system.img.ext4 recovery.img boot.img cache.img.ext4 > odin-${GETDATE}.tar.gz
echo "Writing MD5 sums..."
busybox md5sum -t odin-${GETDATE}.tar.gz >> odin-${GETDATE}.tar.gz
echo "Renaming..."
busybox mv odin-${GETDATE}.tar.gz odin-${GETDATE}.tar.md5.gz
else
echo "Making tar ball"
busybox tar -c NON-HLOS.bin modem.bin sbl1.mbn sbl2.mbn sbl3.mbn aboot.mbn rpm.mbn tz.mbn system.img.ext4 recovery.img boot.img cache.img.ext4 > odin-${GETDATE}.tar
echo "Writing MD5 sums..."
busybox md5sum -t odin-${GETDATE}.tar >> odin-${GETDATE}.tar
echo "Renaming..."
busybox mv odin-${GETDATE}.tar odin-${GETDATE}.tar.md5
fi;
echo
echo "Odin package has been created"
echo
fi;

if [[ ${BACKUPNONODIN} != "n" ]]; then
echo
echo "backup non odin (others).."
echo
busybox dd if=/dev/block/mmcblk0p9 of=${OUTPATH}PAD
busybox dd if=/dev/block/mmcblk0p10 of=${OUTPATH}efs.img.ext4
busybox dd if=/dev/block/mmcblk0p11 of=${OUTPATH}nvrebuild1.bin
busybox dd if=/dev/block/mmcblk0p12 of=${OUTPATH}nvrebuild2.bin
busybox dd if=/dev/block/mmcblk0p13 of=${OUTPATH}m9kefs1.bin
busybox dd if=/dev/block/mmcblk0p14 of=${OUTPATH}m9kefs2.bin
busybox dd if=/dev/block/mmcblk0p15 of=${OUTPATH}m9kefs3.bin
busybox dd if=/dev/block/mmcblk0p17 of=${OUTPATH}PERSIST
busybox dd if=/dev/block/mmcblk0p19 of=${OUTPATH}param.lfs
busybox dd if=/dev/block/mmcblk0p22 of=${OUTPATH}FOTA
busybox dd if=/dev/block/mmcblk0p23 of=${OUTPATH}BACKUP
busybox dd if=/dev/block/mmcblk0p24 of=${OUTPATH}FSG
busybox dd if=/dev/block/mmcblk0p25 of=${OUTPATH}SSD
busybox dd if=/dev/block/mmcblk0p26 of=${OUTPATH}persdata.img.ext4
busybox dd if=/dev/block/mmcblk0p27 of=${OUTPATH}hidden.img.ext4
busybox dd if=/dev/block/mmcblk0p29 of=${OUTPATH}userdata.img.ext4
busybox dd if=/dev/block/mmcblk0p28 of=${OUTPATH}carrier.img.ext4
fi;

echo
echo "BACKUP COMPLETED!"
echo