Skip to content

Instantly share code, notes, and snippets.

View Linux4's full-sized avatar

Tim Zimmermann Linux4

  • Germany
  • 02:54 (UTC +02:00)
View GitHub Profile
@Linux4
Linux4 / pixel_gsi.sh
Last active February 16, 2024 19:42
A script to create bootable "generic" system images from a pixel factory image package (Device must have /product and /system_ext in fstab)
#!/bin/bash
set -e
SUPPORTED_VNDK_VERSIONS="34"
FLASHABLE_PARTITIONS="product system system_ext"
SUPPORTED_PARTITIONS="$FLASHABLE_PARTITIONS vendor"
if [ $UID != 0 ]; then
echo "$0: Must be run as root"
@Linux4
Linux4 / gsi_tool_flasher.sh
Last active February 9, 2024 10:46
Flash GSIs or even full ROMs as DSU (full ROM only works if it is compatible with currently installed ROM's kernel)
#!/bin/bash
set -e
function unsparse_if_needed() {
if [ "$(file -b $1 | cut -f1 -d ',')" = "Android sparse image" ]; then
echo "Unsparsing..."
simg2img "$1" "$1".raw
mv "$1".raw "$1"
fi
}
@Linux4
Linux4 / factory_flash.sh
Last active January 23, 2025 10:28
Flash Samsung factory image packages on Linux
#!/bin/bash
if [ -z "$1" ] || [ ! -f "$1" ]; then
echo "Usage: $0 <zip> <wipe y/n>"
exit 1
fi
REQUIREMENTS="git g++ heimdall lz4 make unzip"
for REQUIREMENT in $REQUIREMENTS; do
[ -z "$(command -v $REQUIREMENT)" ] && echo "Error: Please install $REQUIREMENTS" && exit 1