diff --git a/flash/fastboot/bin-linux-x86/e2fsdroid b/flash/fastboot/bin-linux-x86/e2fsdroid new file mode 100755 index 0000000000000000000000000000000000000000..c0dc7ea6036a898e8fca34da588581dff256e9d3 Binary files /dev/null and b/flash/fastboot/bin-linux-x86/e2fsdroid differ diff --git a/flash/fastboot/bin-linux-x86/fastboot b/flash/fastboot/bin-linux-x86/fastboot index 1141b12acb92a5de0646c3ced04beee5cde32966..4e3217e4760ee4a394e1a940bcf9dc0546b0229a 100755 Binary files a/flash/fastboot/bin-linux-x86/fastboot and b/flash/fastboot/bin-linux-x86/fastboot differ diff --git a/flash/fastboot/bin-linux-x86/lib64/libc++.so b/flash/fastboot/bin-linux-x86/lib64/libc++.so new file mode 100755 index 0000000000000000000000000000000000000000..a253152369bf37521a04e432af2fc9a633c9a942 Binary files /dev/null and b/flash/fastboot/bin-linux-x86/lib64/libc++.so differ diff --git a/flash/fastboot/bin-linux-x86/make_f2fs b/flash/fastboot/bin-linux-x86/make_f2fs new file mode 100755 index 0000000000000000000000000000000000000000..fba0e4eb696fba123a166a51d6d60a4cbb819648 Binary files /dev/null and b/flash/fastboot/bin-linux-x86/make_f2fs differ diff --git a/flash/fastboot/bin-linux-x86/make_f2fs_casefold b/flash/fastboot/bin-linux-x86/make_f2fs_casefold new file mode 100755 index 0000000000000000000000000000000000000000..7d55e8a25a166e63a5ebbbef14807e3ef5a1acf1 Binary files /dev/null and b/flash/fastboot/bin-linux-x86/make_f2fs_casefold differ diff --git a/flash/fastboot/bin-linux-x86/mke2fs b/flash/fastboot/bin-linux-x86/mke2fs new file mode 100755 index 0000000000000000000000000000000000000000..fb99286c8e7856ea21dc60ed5f2e7d294bbe90fc Binary files /dev/null and b/flash/fastboot/bin-linux-x86/mke2fs differ diff --git a/flash/fastboot/bin-linux-x86/mke2fs.conf b/flash/fastboot/bin-linux-x86/mke2fs.conf new file mode 100755 index 0000000000000000000000000000000000000000..8ea960da6f2ee25e2e6bb591ed12e61a432cd808 --- /dev/null +++ b/flash/fastboot/bin-linux-x86/mke2fs.conf @@ -0,0 +1,53 @@ +[defaults] + base_features = sparse_super,large_file,filetype,dir_index,ext_attr + default_mntopts = acl,user_xattr + enable_periodic_fsck = 0 + blocksize = 4096 + inode_size = 256 + inode_ratio = 16384 + reserved_ratio = 1.0 + +[fs_types] + ext3 = { + features = has_journal + } + ext4 = { + features = has_journal,extent,huge_file,dir_nlink,extra_isize,uninit_bg + inode_size = 256 + } + ext4dev = { + features = has_journal,extent,huge_file,flex_bg,inline_data,64bit,dir_nlink,extra_isize + inode_size = 256 + options = test_fs=1 + } + small = { + blocksize = 1024 + inode_size = 128 + inode_ratio = 4096 + } + floppy = { + blocksize = 1024 + inode_size = 128 + inode_ratio = 8192 + } + big = { + inode_ratio = 32768 + } + huge = { + inode_ratio = 65536 + } + news = { + inode_ratio = 4096 + } + largefile = { + inode_ratio = 1048576 + blocksize = -1 + } + largefile4 = { + inode_ratio = 4194304 + blocksize = -1 + } + hurd = { + blocksize = 4096 + inode_size = 128 + } diff --git a/flash/fastboot/bin-linux-x86/sload_f2fs b/flash/fastboot/bin-linux-x86/sload_f2fs new file mode 100755 index 0000000000000000000000000000000000000000..e640a2abfc72b795180b76800522b986c65eb451 Binary files /dev/null and b/flash/fastboot/bin-linux-x86/sload_f2fs differ diff --git a/flash/fastboot/bin-linux-x86/source.properties b/flash/fastboot/bin-linux-x86/source.properties new file mode 100644 index 0000000000000000000000000000000000000000..5c45f1a909852b244fc0377953a068944c0ed41c --- /dev/null +++ b/flash/fastboot/bin-linux-x86/source.properties @@ -0,0 +1,2 @@ +Pkg.UserSrc=false +Pkg.Revision=30.0.5 diff --git a/flash/fastboot/bin-msys/AdbWinApi.dll b/flash/fastboot/bin-msys/AdbWinApi.dll old mode 100644 new mode 100755 diff --git a/flash/fastboot/bin-msys/AdbWinUsbApi.dll b/flash/fastboot/bin-msys/AdbWinUsbApi.dll old mode 100644 new mode 100755 diff --git a/flash/fastboot/bin-msys/adb.exe b/flash/fastboot/bin-msys/adb.exe deleted file mode 100644 index dd233d84d4af0fcbd7933b7bc93c02ac75f103ce..0000000000000000000000000000000000000000 Binary files a/flash/fastboot/bin-msys/adb.exe and /dev/null differ diff --git a/flash/fastboot/bin-msys/fastboot.exe b/flash/fastboot/bin-msys/fastboot.exe old mode 100644 new mode 100755 index 51d620dee8a3fe51dc5ce4dae18b2ae138466cde..d70dacd07fdb7798220a3fec32a27c243503ad64 Binary files a/flash/fastboot/bin-msys/fastboot.exe and b/flash/fastboot/bin-msys/fastboot.exe differ diff --git a/flash/fastboot/bin-msys/lib64/libc++.so b/flash/fastboot/bin-msys/lib64/libc++.so new file mode 100755 index 0000000000000000000000000000000000000000..a253152369bf37521a04e432af2fc9a633c9a942 Binary files /dev/null and b/flash/fastboot/bin-msys/lib64/libc++.so differ diff --git a/flash/fastboot/bin-msys/make_f2fs.exe b/flash/fastboot/bin-msys/make_f2fs.exe new file mode 100755 index 0000000000000000000000000000000000000000..ecde537b3fbb9f634174e79aee631b0837e45724 Binary files /dev/null and b/flash/fastboot/bin-msys/make_f2fs.exe differ diff --git a/flash/fastboot/bin-msys/make_f2fs_casefold.exe b/flash/fastboot/bin-msys/make_f2fs_casefold.exe new file mode 100755 index 0000000000000000000000000000000000000000..0cad9f371a921df4b0d3b310c95849676e5ea2b7 Binary files /dev/null and b/flash/fastboot/bin-msys/make_f2fs_casefold.exe differ diff --git a/flash/fastboot/bin-msys/mke2fs.conf b/flash/fastboot/bin-msys/mke2fs.conf new file mode 100755 index 0000000000000000000000000000000000000000..8ea960da6f2ee25e2e6bb591ed12e61a432cd808 --- /dev/null +++ b/flash/fastboot/bin-msys/mke2fs.conf @@ -0,0 +1,53 @@ +[defaults] + base_features = sparse_super,large_file,filetype,dir_index,ext_attr + default_mntopts = acl,user_xattr + enable_periodic_fsck = 0 + blocksize = 4096 + inode_size = 256 + inode_ratio = 16384 + reserved_ratio = 1.0 + +[fs_types] + ext3 = { + features = has_journal + } + ext4 = { + features = has_journal,extent,huge_file,dir_nlink,extra_isize,uninit_bg + inode_size = 256 + } + ext4dev = { + features = has_journal,extent,huge_file,flex_bg,inline_data,64bit,dir_nlink,extra_isize + inode_size = 256 + options = test_fs=1 + } + small = { + blocksize = 1024 + inode_size = 128 + inode_ratio = 4096 + } + floppy = { + blocksize = 1024 + inode_size = 128 + inode_ratio = 8192 + } + big = { + inode_ratio = 32768 + } + huge = { + inode_ratio = 65536 + } + news = { + inode_ratio = 4096 + } + largefile = { + inode_ratio = 1048576 + blocksize = -1 + } + largefile4 = { + inode_ratio = 4194304 + blocksize = -1 + } + hurd = { + blocksize = 4096 + inode_size = 128 + } diff --git a/flash/fastboot/bin-msys/mke2fs.exe b/flash/fastboot/bin-msys/mke2fs.exe new file mode 100755 index 0000000000000000000000000000000000000000..58803f78bb9e1fd3a84c9d8f13b2b1e6db094efd Binary files /dev/null and b/flash/fastboot/bin-msys/mke2fs.exe differ diff --git a/flash/fastboot/bin-msys/source.properties b/flash/fastboot/bin-msys/source.properties new file mode 100644 index 0000000000000000000000000000000000000000..5c45f1a909852b244fc0377953a068944c0ed41c --- /dev/null +++ b/flash/fastboot/bin-msys/source.properties @@ -0,0 +1,2 @@ +Pkg.UserSrc=false +Pkg.Revision=30.0.5 diff --git a/flash/one/config.mk b/flash/one/config.mk new file mode 100644 index 0000000000000000000000000000000000000000..66690f12a907d5621122ecfff80fe31fd986c367 --- /dev/null +++ b/flash/one/config.mk @@ -0,0 +1,8 @@ +HLOS_IMAGES_TARGET := boot.img \ + recovery.img \ + dtbo.img \ + vbmeta_system.img \ + vbmeta_vendor.img \ + vbmeta.img \ + super.img \ + userdata.img diff --git a/flash/one/flash_one_factory.sh b/flash/one/flash_one_factory.sh new file mode 100755 index 0000000000000000000000000000000000000000..0c297ccff5da20ec00986b10a4351db5f899d763 --- /dev/null +++ b/flash/one/flash_one_factory.sh @@ -0,0 +1,193 @@ +#!/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="Murena One" +PRODUCT_ID="g1970upt_v2_gk_p60c_oj_r" + +# 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_or_abort "${sn}" boot boot.img + flash_image_or_abort "${sn}" cache cache.img + flash_image_or_abort "${sn}" cam_vpu1 cam_vpu1.img + flash_image_or_abort "${sn}" cam_vpu2 cam_vpu2.img + flash_image_or_abort "${sn}" cam_vpu3 cam_vpu3.img + flash_image_or_abort "${sn}" dtbo dtbo.img + flash_image_or_abort "${sn}" gz1 gz.img + flash_image_or_abort "${sn}" gz2 gz.img + flash_image_or_abort "${sn}" lk2 lk.img + flash_image_or_abort "${sn}" lk lk.img + flash_image_or_abort "${sn}" logo logo.bin + flash_image_or_abort "${sn}" md1img md1img.img + flash_image_or_abort "${sn}" preloader preloader_g1970upt_v2_gk_p60c_oj_r.bin + flash_image_or_abort "${sn}" recovery recovery.img + flash_image_or_abort "${sn}" scp2 scp.img + flash_image_or_abort "${sn}" scp1 scp.img + flash_image_or_abort "${sn}" spmfw spmfw.img + flash_image_or_abort "${sn}" sspm_2 sspm.img + flash_image_or_abort "${sn}" sspm_1 sspm.img + flash_image_or_abort "${sn}" super super.img + flash_image_or_abort "${sn}" tee2 tee.img + flash_image_or_abort "${sn}" tee1 tee.img + flash_image_or_abort "${sn}" teksunhw teksunhw.bin + flash_image_or_abort "${sn}" vbmeta_vendor vbmeta_vendor.img + flash_image_or_abort "${sn}" vbmeta_system vbmeta_system.img + flash_image_or_abort "${sn}" vbmeta vbmeta.img + + "$FASTBOOT_BIN" -s "${sn}" erase userdata + "$FASTBOOT_BIN" -s "${sn}" format md_udc + flash_image_or_abort "${sn}" userdata userdata.img +} + +# 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 "" +} + +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