[Samsung Galaxy S10/S10+/S10 5G/E Cross Device Deve] Dn7o/:
I noticed some people fail to prepare their firmware dumps from Frija, etc. Also I wanted to speed up my own workflow to upgrade my S10e, so I wrote a small bash script to repack the firmware for use with heimdall.

Please read the script first and use at your own risk. Although it worked the last two times when I upgraded the firmware on my S10e.

The script assumes you used Frija to download the firmware. Further you need to have some small tools installed on your Linux machine: "md5sum", "unzip", "tar" and "lz4". Also the script will not flash the firmware via heimdall, but only unpack the needed files to one folder, so the heimdall-command can be run like this:

heimdall flash \
--BOOTLOADER sboot.bin \
--PARAM param.bin \
--UP_PARAM up_param.bin \
--CM cm.bin \
--KEYSTORAGE keystorage.bin \
--UH uh.bin \
--DTB dt.img \
--RADIO modem.bin \
--CP_DEBUG modem_debug.bin

The script itself:

#!/bin/bash

#### This scripts assumes you have the Samsung firmware as one zip containing: ####
#### AP_*.tar.md5, BL_G*.tar.md5, CP_*.tar.md5, CSC_*.tar.md5, HOME_CSC*.tar.md5 ####
#### Start the Script and give it the path to the zip file ####

### FILES TO EXTRACT
declare -a FILES=("sboot.bin" "param.bin" "up_param.bin" "cm.bin" "keystorage.bin" "uh.bin" "dt.img" "modem.bin" "modem_debug.bin")

### FUNCTION "check_tar_md5" TAKEN FROM: https://stackoverflow.com/a/9255420
check_tar_md5 ()
{
local file="${1:?Required: file to check}"
[[ ! -f "$file" ]] && {
echo "File not found: $file" >&2
return 1
}
local filename="$(basename "$file")"
if [ "${filename##*.}" = md5 ]; then filename="${filename%.*}"; fi;
local md5_line_length=$(printf "%032d *%s\n" 0 "$filename" | wc -c)
local embedded_md5=$(tail -c $md5_line_length "$file" | ( read md5 rest; echo $md5 ) )
local actual_md5=$(head -c -$md5_line_length "$file" | md5sum | ( read md5 rest; echo $md5 ) )
if [ $embedded_md5 = $actual_md5 ]; then
echo "$file: OK"
else
echo "$file: FAILED"
return 1
fi
}

main ()
{
if [ "$1" == "" ]; then
echo "ERROR: Invalid syntax. Try: \"./flash_samfw.sh <firmware.zip>\""
exit 1
fi

if [ ! -e "$1" ]; then
echo "ERROR: firmware-zipfile \"$1\" does not exit."
exit 1
fi

FIRMWARE_PATH_ABS="$(cd "$(dirname "$1")"; pwd -P)"
FIRMWARE_NAME="$(basename "$1" ".zip")"

echo -e "\n--------------- UNZIP ----------------"
unzip "${FIRMWARE_PATH_ABS}/${FIRMWARE_NAME}.zip" -d "${FIRMWARE_PATH_ABS}/${FIRMWARE_NAME}/" || exit 1
cd ${FIRMWARE_PATH_ABS}/${FIRMWARE_NAME}/ || exit 1

echo -e "\n---------- CHECK MD5 HASHES ----------"
for f in *.tar.md5; do
check_tar_md5 $f || exit 1
done

echo -e "\n-------- DECOMPRESS TAR-FILES --------"
ls *.tar.md5 | xargs -n1 tar -xvf || exit 1

echo -e "\n-------- DECOMPRESS LZ4-Files --------"
echo " Destination Dir: \"OUTPUT/\""
if [ -e "OUTPUT/" ]; then
rm -rf OUTPUT/
fi
mkdir OUTPUT || exit 1
for f in "${FILES[@]}"
do
cp "$f.lz4" "OUTPUT/$f.lz4" || exit 1
lz4 -v -m -d "OUTPUT/$f.lz4" --rm || exit 1
done

echo -e "\nSUCESS! Run heimdall from \"OUTPUT/\" dir"
# cd OUTPUT/
# heimdall flash \
# --BOOTLOADER sboot.bin \
# --PARAM param.bin \
# --UP_PARAM up_param.bin \
# --CM cm.bin \
# --KEYSTORAGE keystorage.bin \
# --UH uh.bin \
# --DTB dt.img \
# --RADIO modem.bin \
# --CP_DEBUG modem_debug.bin

exit 0
}

main $1