From 5f32f03697511e54e24526abb8658e57d813c776 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Tue, 5 Nov 2024 14:34:12 +0530 Subject: [PATCH 1/3] Fix permission for Gallery3d app --- config/permissions/eos-permissions.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/permissions/eos-permissions.xml b/config/permissions/eos-permissions.xml index a451931..d871c4f 100644 --- a/config/permissions/eos-permissions.xml +++ b/config/permissions/eos-permissions.xml @@ -204,6 +204,9 @@ + + + -- GitLab From c3b1b525961453c7aae3e410a2ac30be64c3c642 Mon Sep 17 00:00:00 2001 From: Rohit Sekhar Date: Mon, 4 Nov 2024 18:32:06 +0530 Subject: [PATCH 2/3] otter: Setup IMG Package support --- flash/otter/config.mk | 6 + flash/otter/flash_otter_factory.sh | 197 +++++++++++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 flash/otter/config.mk create mode 100755 flash/otter/flash_otter_factory.sh diff --git a/flash/otter/config.mk b/flash/otter/config.mk new file mode 100644 index 0000000..20b5cb5 --- /dev/null +++ b/flash/otter/config.mk @@ -0,0 +1,6 @@ +HLOS_IMAGES_TARGET := boot.img \ + dtbo.img \ + vendor_boot.img \ + vbmeta_system.img \ + vbmeta.img \ + super.img diff --git a/flash/otter/flash_otter_factory.sh b/flash/otter/flash_otter_factory.sh new file mode 100755 index 0000000..091dbd4 --- /dev/null +++ b/flash/otter/flash_otter_factory.sh @@ -0,0 +1,197 @@ +#!/usr/bin/env bash + +########## +# This script is created and maintained by +# Bharath(@teamb58).org +# Feel free to connect for any queries or suggestions. +########## + +########## +# This script flashes a software release and complete wipes the device. +# +########## + +set -e +set -u + +# Target device info +PRODUCT="SHIFTphone 8" +PRODUCT_ID="otter" + +# Paths/files +ROOT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +IMAGES_DIR="${ROOT_DIR}" + +# Abort the script (and wait for a key to be pressed). +abort_now() { + echo "" + read -rp "ERROR: Aborting now (press Enter to terminate)." a + exit 1 +} + +# Check for connected phone +find_device() { + echo "INFO: Looking for connected device(s)..." + DEVICE_FOUND="false" + while [ ${DEVICE_FOUND} = "false" ] + do + serial_numbers= + + for sn in $("${FASTBOOT_BIN}" devices | grep fastboot | grep -oE '^[[:alnum:]]+') + do + # Checking the product ID + PRODUCT_STRING=$("${FASTBOOT_BIN}" -s "${sn}" getvar product 2>&1) + # Add serial, if product matches + if [[ ${PRODUCT_STRING} == *"${PRODUCT_ID}"* ]] || [[ ${PRODUCT_STRING} == *"${PRODUCT_ID_OLD}"* ]] + then + serial_numbers="${serial_numbers} $sn" + fi + done + + case $(echo "${serial_numbers}" | wc -w | grep -oE '[0-9]+') in + 0) + echo "" + echo "WARNING: No ${PRODUCT} found in fastboot mode." + echo "WARNING: Make sure that a ${PRODUCT} is connected." + ;; + 1) + echo "INFO: One ${PRODUCT} in fastboot mode found (serial number: ${sn})." + + DEVICE_FOUND="true" + break + ;; + *) + echo "" + echo "WARNING: Several ${PRODUCT}'s in fastboot mode connected." + echo "WARNING: Please connect only one ${PRODUCT}." + ;; + esac + + echo "" + while true + do + read -rp "Do you want to look for a ${PRODUCT} again? [(Y)es/(n)o]: " a + if [ -z "${a}" ] || [ "${a}" = 'y' ] || [ "${a}" = 'Y' ] + then + break + elif [ "${a}" = 'n' ] || [ "${a}" = 'N' ] + then + exit 0 + fi + done + done +} + +# Flash (or manipulate) relevant partitions +flash_device() { + + flash_image_ab_or_abort "${sn}" bluetooth "${IMAGES_DIR}/bluetooth.img" + flash_image_ab_or_abort "${sn}" devcfg "${IMAGES_DIR}/devcfg.img" + flash_image_ab_or_abort "${sn}" dsp "${IMAGES_DIR}/dsp.img" + flash_image_ab_or_abort "${sn}" modem "${IMAGES_DIR}/modem.img" + flash_image_ab_or_abort "${sn}" xbl "${IMAGES_DIR}/xbl.img" + flash_image_ab_or_abort "${sn}" tz "${IMAGES_DIR}/tz.img" + flash_image_ab_or_abort "${sn}" hyp "${IMAGES_DIR}/hyp.img" + flash_image_ab_or_abort "${sn}" keymaster "${IMAGES_DIR}/keymaster.img" + + flash_image_ab_or_abort "${sn}" abl "${IMAGES_DIR}/abl.img" + flash_image_ab_or_abort "${sn}" boot "${IMAGES_DIR}/boot.img" + flash_image_ab_or_abort "${sn}" dtbo "${IMAGES_DIR}/dtbo.img" + flash_image_ab_or_abort "${sn}" vendor_boot "${IMAGES_DIR}/vendor_boot.img" + flash_image_ab_or_abort "${sn}" vbmeta_system "${IMAGES_DIR}/vbmeta_system.img" + flash_image_ab_or_abort "${sn}" vbmeta "${IMAGES_DIR}/vbmeta.img" + flash_image_or_abort "${sn}" super "${IMAGES_DIR}/super.img" + + flash_image_ab_or_abort "${sn}" aop "${IMAGES_DIR}/aop.img" + flash_image_ab_or_abort "${sn}" featenabler "${IMAGES_DIR}/featenabler.img" + flash_image_ab_or_abort "${sn}" imagefv "${IMAGES_DIR}/imagefv.img" + flash_image_ab_or_abort "${sn}" multiimgoem "${IMAGES_DIR}/multiimgoem.img" + flash_image_ab_or_abort "${sn}" qupfw "${IMAGES_DIR}/qupfw.img" + flash_image_ab_or_abort "${sn}" qweslicstore "${IMAGES_DIR}/qweslicstore.img" + flash_image_ab_or_abort "${sn}" uefisecapp "${IMAGES_DIR}/uefisecapp.img" + flash_image_ab_or_abort "${sn}" xbl_config "${IMAGES_DIR}/xbl_config.img" + + flash_image_ab_or_abort "${sn}" cpucp "${IMAGES_DIR}/cpucp.img" + flash_image_ab_or_abort "${sn}" shrm "${IMAGES_DIR}/shrm.img" + + "$FASTBOOT_BIN" -s "${sn}" erase userdata + "$FASTBOOT_BIN" -s "${sn}" erase metadata + + "$FASTBOOT_BIN" -s "${sn}" --set-active=a + +} + +# Flash an image to a partition. Abort on failure. +# Arguments: +flash_image_or_abort() { + local retval=0 + "$FASTBOOT_BIN" -s "${1}" flash "${2}" "${3}" || retval=$? + + if [ "${retval}" -ne 0 ] + then + echo "" + echo "ERROR: Could not flash the ${2} partition on device ${1}." + echo "" + echo "ERROR: Please unplug the phone, take the battery out, boot the device into" + echo "ERROR: fastboot mode, and start this script again." + echo "ERROR: (To get to fastboot mode, press Volume-Down and plug in the USB-C)" + echo "ERROR: (cable until the fastboot menu appears.)" + abort_now + fi +} + +# Flash an image to both A and B slot of partition. Abort on failure. +# Arguments: +flash_image_ab_or_abort() { + flash_image_or_abort "${1}" "${2}_a" "${3}" + flash_image_or_abort "${1}" "${2}_b" "${3}" +} + +# Operating system checks and variable definition +os_checks() { + case "$(uname -s 2> /dev/null)" in + Linux|GNU/Linux) + echo "INFO: You are using a Linux distribution." + FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + ;; + msys|MINGW*) + echo "INFO: You are using MinGW on Windows" + FASTBOOT_BIN="${ROOT_DIR}/bin-msys/fastboot.exe" + ;; + *) + echo "ERROR: Unsupported operating system (${OSTYPE})." + echo "ERROR: Only GNU/Linux, and MinGW on Windows are currently supported." + abort_now + ;; + esac +} + +# Control the reboot sequence +reboot_device() { + echo "-----------" + echo "" + echo "INFO: Done. The device will reboot now." + "${FASTBOOT_BIN}" -s "${sn}" reboot + echo "" + echo "INFO: You can unplug the USB cable now." + echo "" +} + +echo "" +echo "*** ${PRODUCT} flashing script ***" +echo "" +echo "INFO: The procedure will start soon. Please wait..." +echo "Note that this will detect and flash only on ${PRODUCT} device." +sleep 2 + +# Begin with some OS checks and variable definition +os_checks + +# Call function to look for device(s) +# If only one device is found $sn will store its serial number +find_device + +# Flash the device +flash_device +# Reboot device +reboot_device -- GitLab From e46b1ab88379344e25a1a745cdbb875849af1b15 Mon Sep 17 00:00:00 2001 From: Rohit Sekhar Date: Thu, 24 Oct 2024 16:45:42 +0530 Subject: [PATCH 3/3] tetris: Build IMG package --- flash/tetris/config.mk | 8 + flash/tetris/flash_tetris_factory.sh | 230 +++++++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 flash/tetris/config.mk create mode 100755 flash/tetris/flash_tetris_factory.sh diff --git a/flash/tetris/config.mk b/flash/tetris/config.mk new file mode 100644 index 0000000..2b717e0 --- /dev/null +++ b/flash/tetris/config.mk @@ -0,0 +1,8 @@ +HLOS_IMAGES_TARGET := boot.img \ + dtbo.img \ + init_boot.img \ + vendor_boot.img \ + vbmeta_system.img \ + vbmeta_vendor.img \ + vbmeta.img \ + super.img diff --git a/flash/tetris/flash_tetris_factory.sh b/flash/tetris/flash_tetris_factory.sh new file mode 100755 index 0000000..9ab0777 --- /dev/null +++ b/flash/tetris/flash_tetris_factory.sh @@ -0,0 +1,230 @@ +#!/usr/bin/env bash + +########## +# This script is created and maintained by +# Bharath(@teamb58).org +# Feel free to connect for any queries or suggestions. +########## + +########## +# This script flashes a software release and complete wipes the device. +# +########## + +set -e +set -u + +CLEAN_FLASH="true" # Control data wipe behavior. Default is "true". + +# Target device info +PRODUCT="CMF Phone 1" +PRODUCT_ID="k6878v1_64" + +# Paths/files +ROOT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" +IMAGES_DIR="${ROOT_DIR}" + +# Abort the script (and wait for a key to be pressed). +abort_now() { + echo "" + read -rp "ERROR: Aborting now (press Enter to terminate)." a + exit 1 +} + +# Check for connected phone +find_device() { + echo "INFO: Looking for connected device(s)..." + DEVICE_FOUND="false" + while [ ${DEVICE_FOUND} = "false" ] + do + serial_numbers= + + for sn in $("${FASTBOOT_BIN}" devices | grep fastboot | grep -oE '^[[:alnum:]]+') + do + # Checking the product ID + PRODUCT_STRING=$("${FASTBOOT_BIN}" -s "${sn}" getvar product 2>&1) + # Add serial, if product matches + if [[ ${PRODUCT_STRING} == *"${PRODUCT_ID}"* ]] || [[ ${PRODUCT_STRING} == *"${PRODUCT_ID_OLD}"* ]] + then + serial_numbers="${serial_numbers} $sn" + fi + done + + case $(echo "${serial_numbers}" | wc -w | grep -oE '[0-9]+') in + 0) + echo "" + echo "WARNING: No ${PRODUCT} found in fastboot mode." + echo "WARNING: Make sure that a ${PRODUCT} is connected." + ;; + 1) + echo "INFO: One ${PRODUCT} in fastboot mode found (serial number: ${sn})." + + DEVICE_FOUND="true" + break + ;; + *) + echo "" + echo "WARNING: Several ${PRODUCT}'s in fastboot mode connected." + echo "WARNING: Please connect only one ${PRODUCT}." + ;; + esac + + echo "" + while true + do + read -rp "Do you want to look for a ${PRODUCT} again? [(Y)es/(n)o]: " a + if [ -z "${a}" ] || [ "${a}" = 'y' ] || [ "${a}" = 'Y' ] + then + break + elif [ "${a}" = 'n' ] || [ "${a}" = 'N' ] + then + exit 0 + fi + done + done +} + +# Flash (or manipulate) relevant partitions +flash_device() { + flash_image_ab_or_abort ${sn} apusys apusys.img + flash_image_ab_or_abort ${sn} boot boot.img + flash_image_ab_or_abort ${sn} ccu ccu.img + flash_image_ab_or_abort ${sn} connsys_bt connsys_bt.img + flash_image_ab_or_abort ${sn} connsys_gnss connsys_gnss.img + flash_image_ab_or_abort ${sn} connsys_wifi connsys_wifi.img + flash_image_ab_or_abort ${sn} dpm dpm.img + flash_image_ab_or_abort ${sn} dtbo dtbo.img + flash_image_ab_or_abort ${sn} gpueb gpueb.img + flash_image_ab_or_abort ${sn} gz gz.img + flash_image_ab_or_abort ${sn} init_boot init_boot.img + flash_image_ab_or_abort ${sn} lk lk.img + flash_image_ab_or_abort ${sn} logo logo.img + flash_image_ab_or_abort ${sn} mcf_ota mcf_ota.img + flash_image_ab_or_abort ${sn} mcupm mcupm.img + flash_image_ab_or_abort ${sn} modem modem.img + flash_image_ab_or_abort ${sn} pi_img pi_img.img + flash_image_ab_or_abort ${sn} preloader preloader_raw.img + flash_image_ab_or_abort ${sn} scp scp.img + flash_image_ab_or_abort ${sn} spmfw spmfw.img + flash_image_ab_or_abort ${sn} sspm sspm.img + flash_image_or_abort ${sn} super super.img + flash_image_ab_or_abort ${sn} tee tee.img + flash_image_ab_or_abort ${sn} vbmeta vbmeta.img + flash_image_ab_or_abort ${sn} vbmeta_system vbmeta_system.img + flash_image_ab_or_abort ${sn} vbmeta_vendor vbmeta_vendor.img + flash_image_ab_or_abort ${sn} vcp vcp.img + flash_image_ab_or_abort ${sn} vendor_boot vendor_boot.img + + if [ "${CLEAN_FLASH}" = "true" ] + then + "$FASTBOOT_BIN" -s "${sn}" erase userdata + "$FASTBOOT_BIN" -s "${sn}" erase metadata + fi + + "$FASTBOOT_BIN" -s "${sn}" --set-active=a + +} + +# Flash an image to a partition. Abort on failure. +# Arguments: +flash_image_or_abort() { + local retval=0 + "$FASTBOOT_BIN" -s "${1}" flash "${2}" "${IMAGES_DIR}"/"${3}" || retval=$? + + if [ "${retval}" -ne 0 ] + then + echo "" + echo "ERROR: Could not flash the ${2} partition on device ${1}." + echo "" + echo "ERROR: Please unplug the phone and boot the device into" + echo "ERROR: fastboot mode, and start this script again." + echo "ERROR: (To get to fastboot mode, press Volume-Down and plug in the USB-C)" + echo "ERROR: (cable until the fastboot menu appears.)" + abort_now + fi +} + +# Flash an image to both A and B slot of partition. Abort on failure. +# Arguments: +flash_image_ab_or_abort() { + flash_image_or_abort "${1}" "${2}_a" "${3}" + flash_image_or_abort "${1}" "${2}_b" "${3}" +} + +# Operating system checks and variable definition +os_checks() { + case "$(uname -s 2> /dev/null)" in + Linux|GNU/Linux) + echo "INFO: You are using a Linux distribution." + FASTBOOT_BIN="${ROOT_DIR}/bin-linux-x86/fastboot" + ;; + msys|MINGW*) + echo "INFO: You are using MinGW on Windows" + FASTBOOT_BIN="${ROOT_DIR}/bin-msys/fastboot.exe" + ;; + *) + echo "ERROR: Unsupported operating system (${OSTYPE})." + echo "ERROR: Only GNU/Linux, and MinGW on Windows are currently supported." + abort_now + ;; + esac +} + +# Control the reboot sequence +reboot_device() { + echo "-----------" + echo "" + echo "INFO: Done. The device will reboot now." + "${FASTBOOT_BIN}" -s "${sn}" reboot + echo "" + echo "INFO: You can unplug the USB cable now." + echo "" +} + +# Warn about data wipe, and ask for confirmation +data_wipe_check() { + if [ "${CLEAN_FLASH}" = "true" ] + then + echo "" + echo "WARNING: Flashing this image wipes all user data and settings on the phone." + echo " Are you sure you want to wipe data and continue?" + echo "" + # Read user's input + read -rp " Type \"Yes\" (case sensitive) and press enter to wipe data and continue. Else, just press enter: " a + echo "" + if [ "_${a:-"No"}" != '_Yes' ] + # NOTE: $a is being set by the read command above, + # so the check for a to be set is mostly redundant + then + echo "WARNING: You DID NOT type \"Yes\", proceeding without data wipe." + echo "" + CLEAN_FLASH="false" + else + echo "WARNING: You typed \"Yes\", proceeding with data wipe." + CLEAN_FLASH="true" + fi + fi +} + +echo "" +echo "*** ${PRODUCT} flashing script ***" +echo "" +echo "INFO: The procedure will start soon. Please wait..." +echo "Note that this will detect and flash only on ${PRODUCT} device." +sleep 2 + +# Begin with some OS checks and variable definition +os_checks + +# Call function to look for device(s) +# If only one device is found $sn will store its serial number +find_device + +# Call function to look for data wipe check +data_wipe_check + +# Flash the device +flash_device + +# Reboot device +reboot_device -- GitLab