Initial device tree

This commit is contained in:
Mohammad Afaneh 2021-06-12 02:34:33 +03:00
commit 65e9ee832c
18 changed files with 764 additions and 0 deletions

23
Android.mk Executable file
View file

@ -0,0 +1,23 @@
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
ifneq ($(filter a32x, $(TARGET_DEVICE)),)
LOCAL_PATH := $(call my-dir)
include $(call all-makefiles-under,$(LOCAL_PATH))
endif

20
AndroidProducts.mk Executable file
View file

@ -0,0 +1,20 @@
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/twrp_a32x.mk
COMMON_LUNCH_CHOICES := twrp_a32x-eng

141
BoardConfig.mk Executable file
View file

@ -0,0 +1,141 @@
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Bootloader
BOARD_VENDOR := samsung
TARGET_SOC := k6853v1_64_titan
TARGET_BOOTLOADER_BOARD_NAME := mt6853
TARGET_NO_BOOTLOADER := true
TARGET_NO_RADIOIMAGE := true
TARGET_USES_UEFI := true
# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-2a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := cortex-a55
TARGET_CPU_VARIANT_RUNTIME := cortex-a55
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-2a
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a55
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a55
TARGET_USES_64_BIT_BINDER := true
TARGET_CPU_SMP := true
ENABLE_CPUSETS := true
ENABLE_SCHEDBOOST := true
ALLOW_MISSING_DEPENDENCIES := true
# File systems
TARGET_USERIMAGES_USE_F2FS := true
# Platform
TARGET_BOARD_PLATFORM := mt6853
TARGET_BOARD_PLATFORM_GPU := mali-g57
# Kernel
TARGET_PREBUILT_KERNEL := device/samsung/a32x/prebuilt/Image.gz
TARGET_PREBUILT_DTB := device/samsung/a32x/prebuilt/dtb
BOARD_PREBUILT_DTBOIMAGE := device/samsung/a32x/prebuilt/recoverydtbo
#BOARD_INCLUDE_DTB_IN_BOOTIMG := true
BOARD_INCLUDE_RECOVERY_DTBO := true
TARGET_KERNEL_ARCH := arm64
# Boot
BOARD_BOOT_HEADER_VERSION := 2
BOARD_KERNEL_BASE := 0x40078000
BOARD_KERNEL_CMDLINE := bootopt=64S3,32N2,64N2 androidboot.selinux=permissive
BOARD_KERNEL_IMAGE_NAME := Image
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_OFFSET := 0x00008000
BOARD_RAMDISK_OFFSET := 0x07c08000
BOARD_KERNEL_SECOND_OFFSET := 0xbff88000
BOARD_KERNEL_TAGS_OFFSET := 0x0bc08000
BOARD_DTB_OFFSET := 0x0bc08000
BOARD_MKBOOTIMG_ARGS := --kernel_offset $(BOARD_KERNEL_OFFSET) --ramdisk_offset $(BOARD_RAMDISK_OFFSET)
BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_KERNEL_TAGS_OFFSET) --second_offset $(BOARD_KERNEL_SECOND_OFFSET)
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION) --pagesize $(BOARD_KERNEL_PAGESIZE) --board "SRPTK17B001"
BOARD_MKBOOTIMG_ARGS += --dtb $(TARGET_PREBUILT_DTB) --dtb_offset $(BOARD_DTB_OFFSET)
BOARD_CUSTOM_BOOTIMG_MK := device/samsung/a32x/bootimg.mk
# Recovery
BOARD_HAS_LARGE_FILESYSTEM := true
BOARD_HAS_NO_SELECT_BUTTON := true
# Partitions
BOARD_FLASH_BLOCK_SIZE := 131072
BOARD_BOOTIMAGE_PARTITION_SIZE := 33554432
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 41943040
# Dynamic Partitions
BOARD_SUPER_PARTITION_SIZE := 8539602944
BOARD_SUPER_PARTITION_GROUPS := samsung_dynamic_partitions
BOARD_SAMSUNG_DYNAMIC_PARTITIONS_SIZE := 8535408640
BOARD_SAMSUNG_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product odm
# System as root
BOARD_ROOT_EXTRA_FOLDERS := cache carrier data_mirror efs keyrefuge linkerconfig metadata omr optics prism spu
BOARD_SUPPRESS_SECURE_ERASE := true
# Workaround for error copying vendor files to recovery ramdisk
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
TARGET_COPY_OUT_VENDOR := vendor
# Android Verified Boot
BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_RECOVERY_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_RECOVERY_ALGORITHM := SHA256_RSA4096
BOARD_AVB_RECOVERY_ROLLBACK_INDEX := 1
BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION := 1
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
# Crypto
PLATFORM_SECURITY_PATCH := 2025-12-31
VENDOR_SECURITY_PATCH := 2025-12-31
PLATFORM_VERSION := 11
TW_INCLUDE_CRYPTO := false
TW_INCLUDE_CRYPTO_FBE := false
TW_INCLUDE_FBE_METADATA_DECRYPT := false
BOARD_USES_METADATA_PARTITION := true
# TWRP specific build flags
TW_DEVICE_VERSION := 1_afaneh92
TW_THEME := portrait_hdpi
RECOVERY_SDCARD_ON_DATA := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TW_BRIGHTNESS_PATH := "/sys/class/backlight/panel/brightness"
TW_MAX_BRIGHTNESS := 306
TW_DEFAULT_BRIGHTNESS := 200
TW_Y_OFFSET := 50
TW_H_OFFSET := -50
TW_NO_REBOOT_BOOTLOADER := true
TW_HAS_DOWNLOAD_MODE := true
TW_INCLUDE_NTFS_3G := true
TW_USE_NEW_MINADBD := true
TW_INPUT_BLACKLIST := "hbtp_vm"
TW_EXCLUDE_DEFAULT_USB_INIT := true
TW_USE_TOOLBOX := true
TARGET_USES_MKE2FS := true
TW_NO_LEGACY_PROPS := true
TW_NO_BIND_SYSTEM := true
TW_NO_SCREEN_BLANK := true
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true

13
README.md Executable file
View file

@ -0,0 +1,13 @@
## Recovery Device Tree for the Samsung Galaxy A32 5G (MTK)
## How-to compile it:
```sh
export ALLOW_MISSING_DEPENDENCIES=true
. build/envsetup.sh
lunch twrp_a32x-eng
make recoveryimage
```
Kernel source:
https://github.com/mohammad92/android_kernel_samsung_a32x

18
bootimg.mk Executable file
View file

@ -0,0 +1,18 @@
MKBOOTIMG := device/samsung/a32x/mkbootimg
FLASH_IMAGE_TARGET ?= $(PRODUCT_OUT)/recovery.tar
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) echo -n "SEANDROIDENFORCE" >> $@
@echo "Made boot image: $@"
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS)
@echo "----- Making recovery image ------"
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
@echo "----- Lying about SEAndroid state to Samsung bootloader ------"
$(hide) echo -n "SEANDROIDENFORCE" >> $@
@echo "Made recovery image: $@"
$(hide) tar -C $(PRODUCT_OUT) -H ustar -c recovery.img > $(FLASH_IMAGE_TARGET)
@echo "Made flashable $(FLASH_IMAGE_TARGET): $@"

23
device.mk Normal file
View file

@ -0,0 +1,23 @@
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Dynamic partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
# fastbootd
PRODUCT_PACKAGES += \
android.hardware.fastboot@1.0-impl-mock \
fastbootd

BIN
mkbootimg Executable file

Binary file not shown.

BIN
prebuilt/Image.gz Normal file

Binary file not shown.

BIN
prebuilt/dtb Normal file

Binary file not shown.

BIN
prebuilt/recoverydtbo Normal file

Binary file not shown.

View file

@ -0,0 +1,60 @@
# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
on init
setprop sys.usb.configfs 1
setprop sys.usb.ffs.aio_compat 1
on fs && property:ro.debuggable=0
# distinguish USB shoulde connect or not, i.e. CDP vs SDP
write /sys/class/udc/musb-hdrc/device/cmode 2
# set charging free due to it wait for USB activation
start adbd
on post-fs
# Support A/B feature for EMMC and UFS boot region
wait /dev/block/mmcblk0boot0 2
symlink /dev/block/sda /dev/block/mmcblk0boot0
symlink /dev/block/sdb /dev/block/mmcblk0boot1
symlink /dev/block/mmcblk0boot0 /dev/block/platform/bootdevice/by-name/preloader_a
symlink /dev/block/mmcblk0boot1 /dev/block/platform/bootdevice/by-name/preloader_b
# Support A/B feature for combo emmc and ufs OTA update
symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/platform/bootdevice/by-name/preloader_emmc_a
symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/platform/bootdevice/by-name/preloader_emmc_b
symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/platform/bootdevice/by-name/preloader_ufs_a
symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/platform/bootdevice/by-name/preloader_ufs_b
# Support A/B feature for combo emmc and ufs OTA update
symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/by-name/preloader_emmc_a
symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/by-name/preloader_emmc_b
symlink /dev/block/platform/bootdevice/by-name/preloader_a /dev/block/by-name/preloader_ufs_a
symlink /dev/block/platform/bootdevice/by-name/preloader_b /dev/block/by-name/preloader_ufs_b
exec u:r:update_engine:s0 root root -- /system/bin/mtk_plpath_utils
export ANDROID_ROOT /system_root

View file

@ -0,0 +1,128 @@
# Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Linux Foundation nor
# the names of its contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
on fs && property:sys.usb.configfs=1
mount configfs none /config
mkdir /config/usb_gadget/g1 0770 shell shell
write /config/usb_gadget/g1/idVendor 0x18D1
mkdir /config/usb_gadget/g1/strings/0x409 0770
write /config/usb_gadget/g1/strings/0x409/serialnumber ${ro.serialno}
write /config/usb_gadget/g1/strings/0x409/manufacturer ${ro.product.manufacturer}
write /config/usb_gadget/g1/strings/0x409/product ${ro.product.model}
mkdir /config/usb_gadget/g1/functions/ffs.adb
mkdir /config/usb_gadget/g1/functions/ffs.fastboot
mkdir /config/usb_gadget/g1/functions/ffs.mtp
mkdir /config/usb_gadget/g1/configs/b.1 0777 shell shell
mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell
on fs && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/f_ffs/aliases adb,fastboot
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
on fs
mount pstore pstore /sys/fs/pstore
mkdir /dev/usb-ffs 0770 shell shell
mkdir /dev/usb-ffs/adb 0770 shell shell
mkdir /dev/usb-ffs/mtp 0770 mtp mtp
mount functionfs adb /dev/usb-ffs/adb uid=2000,gid=2000
mkdir /dev/usb-ffs/fastboot 0770 system system
mount functionfs fastboot /dev/usb-ffs/fastboot rmode=0770,fmode=0660,uid=1000,gid=1000
mount functionfs mtp /dev/usb-ffs/mtp uid=2000,gid=2000
on property:sys.usb.config=adb
start adbd
on property:sys.usb.config=mtp,adb
start adbd
on property:sys.usb.config=fastboot
start fastbootd
on property:sys.usb.config=none && property:sys.usb.configfs=0
stop adbd
stop fastboot
write /sys/class/android_usb/android0/enable 0
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=adb && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/idProduct D001
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=sideload && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/idProduct D001
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=fastboot && property:sys.usb.configfs=0
write /sys/class/android_usb/android0/idProduct 4EE0
write /sys/class/android_usb/android0/functions fastboot
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}
# Configfs triggers
on property:sys.usb.config=none && property:sys.usb.configfs=1
write /config/usb_gadget/g1/UDC "none"
stop adbd
stop fastbootd
setprop sys.usb.ffs.ready 0
rm /config/usb_gadget/g1/configs/b.1/f1
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=sideload && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0xD001
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0xD001
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "adb"
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=mtp,adb && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x6860
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "mtp,adb"
symlink /config/usb_gadget/g1/functions/ffs.adb /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ffs.mtp /config/usb_gadget/g1/configs/b.1/ffs.mtp
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}
on property:sys.usb.config=fastboot && property:sys.usb.ffs.ready=1 && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4EE0
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "fastboot"
symlink /config/usb_gadget/g1/functions/ffs.fastboot /config/usb_gadget/g1/configs/b.1/f1
write /config/usb_gadget/g1/UDC ${sys.usb.controller}
setprop sys.usb.state ${sys.usb.config}

View file

@ -0,0 +1,189 @@
#!/system/bin/sh
#
# A simple Samsung services disabler by Ian Macdonald.
#
# Use this to prime your device after installing TWRP.
md5() {
md5sum -b "$1"
}
file_changed() {
local file="$1"
local old_md5="$2"
local new_md5=$( md5 "$file" )
if [ $new_md5 != $old_md5 ]; then
echo " - ...modified."
else
echo " - ...unchanged."
fi
}
resize_vendor() {
local dm_block=$(df -k | cat | grep "/vendor" | cut -d' ' -f1)
local old_blocks=$(df -k | cat | grep "/vendor" | cut -d' ' -f6)
local new_blocks=$(($old_blocks + 102400))
echo " - Unmounting /vendor..."
umount /vendor
echo " - Checking vendor block parition before resizing..."
e2fsck -f $dm_block
echo " - Resize - Recommended size (old size+100MB)..."
resize2fs $dm_block $new_blocksK
echo " - Make the partition R/W by unsharing its blocks..."
e2fsck -E unshare_blocks $dm_block
echo " - Run multidisabler again!"
exit 1
}
vendor_free_size_check() {
echo " - Checking vendor free size..."
if dd if=/dev/zero of=/vendor/test bs=1 count=1 2>/dev/null; then
echo " - ...succeeded."
rm -f /vendor/test
else
echo " - ...No free space left on vendor, attempt to resizing vendor..."
echo " "
rm -f /vendor/test
resize_vendor
exit 1
fi
}
disable_fbe() {
local md5
local i
echo " - Disabling file-based encryption (FBE) for /data..."
# S20/N20 range = fstab.exynos990.
# S10 range = fstab.exynos9820.
# Note 10 range = fstab.exynos9825.
# A[124]0 range = fstab.exynos7885.
# A50 = fstab.exynos9610.
# Tab A 10.1 range = fstab.exynos7885.
# Snapdragon devices = fstab.qcom.
#
for i in /vendor/etc/fstab.exynos* \
/vendor/etc/fstab.qcom*; do
if [ -f $i ]; then
echo " - Found $i."
md5=$( md5 $i )
# This comments out the offending line and adds an edited one.
sed -i -e 's/^\([^#].*\)fileencryption=[^,]*\(.*\)$/# &\n\1encryptable\2/g' $i
file_changed $i $md5
fi
done
}
disable_recovery_restoration() {
local r=recovery-from-boot.p
local found
local i
echo " - Disabling restoration of stock recovery..."
for i in $ANDROID_ROOT $ANDROID_ROOT/system; do
if [ -f $i/$r~ ]; then
echo " - ...already disabled."
found=true
break
fi
if [ -f $i/$r ]; then
echo " - Found $i/$r. Disabling..."
mv $i/$r $i/$r~
if [ -f $i/$r~ ]; then
echo " - ...succeeded."
else
echo " - ...failed."
fi
found=true
break
fi
done
[ -z "$found" ] && echo " - Found no stock recovery. Pfft."
}
echo " "
echo "Multi-disabler v3.1 for Samsung devices"
echo "running Android 9 or later."
echo "by Ian Macdonald, enhanced by afaneh92"
echo
echo " "
os=$(getprop ro.build.version.release)
major=${os%%.*}
bl=$(getprop ro.boot.bootloader)
dp=$(getprop ro.boot.dynamic_partitions)
# Firmware version starts at either 8th or 9th character, depending on length
# of bootloader string (12 or 13).
#
fw=${bl:$((${#bl} - 4)):4}
# Device is first 5 characters of bootloader string.
#
device=${bl:0:$((${#bl} - 8))}
mft=$(getprop ro.product.manufacturer | tr '[A-Z]' '[a-z]')
if [ "$mft" != samsung ]; then
echo " - Device appears not to be made by Samsung."
fatal=true
elif [ -z "$device" ]; then
echo " - Could not determine device model."
fatal=true
elif [ $major -lt 9 ]; then
echo " - This software is incompatible with Android $major."
fatal=true
fi
if [ -n "$fatal" ]; then
echo " - Installation aborted."
echo " "
exit 1
fi
echo " - Detected a $device device with a $fw bootloader."
echo " - The environment appears to be Android $major."
echo " "
echo " - Mounting $ANDROID_ROOT..."
mount $ANDROID_ROOT 2>/dev/null
mount -o remount,rw $ANDROID_ROOT 2>/dev/null
if ! mount | grep $ANDROID_ROOT >/dev/null; then
ANDROID_ROOT=/system_root
echo " - Attempt failed. Mounting at $ANDROID_ROOT..."
mount -o rw $ANDROID_ROOT
if ! mount | grep $ANDROID_ROOT >/dev/null; then
echo " - Even that attempt failed. Aborting..."
exit 2
fi
fi
echo " - Mounting /vendor..."
mount /vendor
mount -o remount,rw /vendor
if ! mount | grep /vendor >/dev/null; then
echo " - Mount failed. Aborting..."
exit 3
fi
vendor_free_size_check
disable_fbe
disable_recovery_restoration
echo " - Unmounting /vendor..."
umount /vendor
echo " - Unmounting $ANDROID_ROOT..."
umount $ANDROID_ROOT
echo " "
echo " - Finished."
echo " "

View file

@ -0,0 +1,65 @@
# Copyright (c) 2013, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
system /system ext4 ro,barrier=1,discard avb=vbmeta,logical,first_stage_mount
vendor /vendor ext4 ro,barrier=1,discard avb,logical,first_stage_mount
product /product ext4 ro,barrier=1,discard avb,logical,first_stage_mount
odm /odm ext4 ro,barrier=1,discard avb,logical,first_stage_mount
/dev/block/platform/bootdevice/by-name/boot /boot emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/recovery /recovery emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,usrquota,grpquota,fsync_mode=nobarrier,reserve_root=32768,resgid=5678 wait,length=-16384
/dev/block/platform/bootdevice/by-name/cache /cache ext4 defaults recoveryonly
/dev/block/platform/bootdevice/by-name/sec_efs /efs ext4 defaults recoveryonly
/dev/block/platform/bootdevice/by-name/carrier /carrier ext4 defaults recoveryonly
/dev/block/platform/bootdevice/by-name/hidden /preload ext4 defaults recoveryonly
/dev/block/platform/bootdevice/by-name/misc /misc emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/metadata /metadata ext4 defaults wait,first_stage_mount
# external SD card
/dev/block/mmcblk1p1 /sdcard sdfat defaults recoveryonly
# FOTA
/dev/block/platform/bootdevice/by-name/apnhlos /modem emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/modem /mdm emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/dsp /dsp emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/dtbo /dtbo emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/md1img /md1img emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/spmfw /spmfw emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/scp1 /scp1 emmc defaults recoveryonly
/dev/block/platform/bootdevice/by-name/sspm_1 /sspm_1 emmc defaults recoveryonly
#Auto-generated code by FOTA Portal
/dev/block/platform/bootdevice/by-name/gz1 /gz1 emmc default recoveryonly
/dev/block/platform/bootdevice/by-name/optics /optics ext4 default recoveryonly
/dev/block/platform/bootdevice/by-name/prism /prism ext4 default recoveryonly
#Auto-generated code by FOTA Portal
/dev/block/platform/bootdevice/by-name/cam_vpu1 /cam_vpu1 emmc default recoveryonly
/dev/block/platform/bootdevice/by-name/cam_vpu2 /cam_vpu2 emmc default recoveryonly
/dev/block/platform/bootdevice/by-name/cam_vpu3 /cam_vpu3 emmc default recoveryonly
/dev/block/platform/bootdevice/by-name/pi_img /pi_img emmc default recoveryonly

View file

@ -0,0 +1,34 @@
# mount point fstype device device2 flags
# Logical partitions
system /system ext4
vendor /vendor ext4
product /product ext4
odm /odm ext4
# Physical partitions
/metadata ext4 /dev/block/platform/bootdevice/by-name/metadata flags=backup=1;display="Metadata";wipeingui
/boot emmc /dev/block/platform/bootdevice/by-name/boot flags=backup=1;display="Boot";flashimg=1
/recovery emmc /dev/block/platform/bootdevice/by-name/recovery flags=backup=1;display="Recovery";flashimg=1
/data f2fs /dev/block/platform/bootdevice/by-name/userdata flags=length=-16384
/cache ext4 /dev/block/platform/bootdevice/by-name/cache flags=backup=1;display="Cache"
/dtbo emmc /dev/block/platform/bootdevice/by-name/dtbo flags=backup=1;display="Dtbo"
/param emmc /dev/block/platform/bootdevice/by-name/param flags=backup=1;display="Param"
/optics ext4 /dev/block/platform/bootdevice/by-name/optics flags=backup=1;display="Optics"
/optics_image emmc /dev/block/platform/bootdevice/by-name/optics flags=backup=1;flashimg;display="Optics Image"
/prism ext4 /dev/block/platform/bootdevice/by-name/prism flags=backup=1;display="Prism"
/prism_image emmc /dev/block/platform/bootdevice/by-name/prism flags=backup=1;flashimg;display="Prism Image"
/gz1 emmc /dev/block/platform/bootdevice/by-name/gz1
/misc emmc /dev/block/platform/bootdevice/by-name/misc flags=backup=1;display="Misc"
/efs ext4 /dev/block/platform/bootdevice/by-name/sec_efs flags=backup=1;display="EFS"
/modem emmc /dev/block/platform/bootdevice/by-name/apnhlos flags=backup=1;display="Modem"
/mdm emmc /dev/block/platform/bootdevice/by-name/modem
/dsp emmc /dev/block/platform/bootdevice/by-name/dsp
/dtbo emmc /dev/block/platform/bootdevice/by-name/dtbo
/md1img emmc /dev/block/platform/bootdevice/by-name/md1img
/spmfw emmc /dev/block/platform/bootdevice/by-name/spmfw
/scp1 emmc /dev/block/platform/bootdevice/by-name/scp1
/sspm_1 emmc /dev/block/platform/bootdevice/by-name/sspm_1
# Removable storage
/external_sd vfat /dev/block/mmcblk0p1 /dev/block/mmcblk0 flags=storage;wipeingui;removable
/usb-otg auto /dev/block/sdf1 /dev/block/sdf flags=display="USB-OTG";storage;wipeingui;removable

7
system.prop Normal file
View file

@ -0,0 +1,7 @@
ro.display.series=Samsung A32 5G
ro.product.board=k6853v1_64_titan
ro.board.platform=mt6853
sys.usb.controller=musb-hdrc
ro.boot.dynamic_partitions=true
#fbe.metadata.wrappedkey=true
ro.boot.boot_devices=bootdevice,soc/11230000.mmc,11230000.mmc,soc/11270000.ufshci,11270000.ufshci

2
twrp.dependencies Executable file
View file

@ -0,0 +1,2 @@
[
]

41
twrp_a32x.mk Executable file
View file

@ -0,0 +1,41 @@
#
# Copyright (C) 2020 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Release name
PRODUCT_RELEASE_NAME := a32x
# Inherit from common AOSP config
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
# Inherit some common TWRP stuff.
$(call inherit-product, vendor/twrp/config/common.mk)
# Inherit device configuration
$(call inherit-product, device/samsung/a32x/device.mk)
# Charger
PRODUCT_PACKAGES += \
charger_res_images
PRODUCT_COPY_FILES += $(call find-copy-subdir-files,*,device/samsung/a32x/recovery/root,recovery/root)
## Device identifier. This must come after all inclusions
PRODUCT_NAME := twrp_a32x
PRODUCT_DEVICE := a32x
PRODUCT_MODEL := SM-A326U
PRODUCT_BRAND := samsung
PRODUCT_MANUFACTURER := samsung
PRODUCT_GMS_CLIENTID_BASE := android-samsung