Skip to content

Commit

Permalink
rova: Support Retrofit Dynamic Partitions
Browse files Browse the repository at this point in the history
iusmac: adapt for ORFX
Signed-off-by: iusmac <iusico.maxim@libero.it>
  • Loading branch information
me-cafebabe authored and iusmac committed Apr 16, 2024
1 parent cea7cd9 commit 64d60e4
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
13 changes: 12 additions & 1 deletion BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ BOARD_KERNEL_CMDLINE := console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 an
BOARD_KERNEL_CMDLINE += androidboot.usbconfigfs=true
BOARD_KERNEL_CMDLINE += androidboot.mode=recovery
BOARD_KERNEL_CMDLINE += audit=0
BOARD_KERNEL_CMDLINE += androidboot.android_dt_dir=/non-existent androidboot.boot_devices=soc/7824900.sdhci
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_TAGS_OFFSET := 0x00000100
BOARD_RAMDISK_OFFSET := 0x01000000
Expand Down Expand Up @@ -79,12 +80,22 @@ BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_VENDORIMAGE_PARTITION_SIZE := 872415232

BOARD_USES_METADATA_PARTITION := true
BOARD_BUILD_SYSTEM_ROOT_IMAGE := true

# Workaround for error copying vendor files to recovery ramdisk
TARGET_COPY_OUT_VENDOR := vendor
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4

# Partitions - dynamic
BOARD_SUPER_PARTITION_BLOCK_DEVICES := cust system
BOARD_SUPER_PARTITION_METADATA_DEVICE := system
BOARD_SUPER_PARTITION_CUST_DEVICE_SIZE := 536870912
BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE := 3221225472
BOARD_SUPER_PARTITION_SIZE := $(shell expr $(BOARD_SUPER_PARTITION_CUST_DEVICE_SIZE) + $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE) )

BOARD_SUPER_PARTITION_GROUPS := mi8937_dynpart
BOARD_MI8937_DYNPART_SIZE := $(shell expr $(BOARD_SUPER_PARTITION_SIZE) - 4194304 )
BOARD_MI8937_DYNPART_PARTITION_LIST := system system_ext product vendor odm

# Properties
TARGET_VENDOR_PROP += device/xiaomi/rova/vendor.prop

Expand Down
4 changes: 4 additions & 0 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# limitations under the License.
#

# Dynamic Partitions
PRODUCT_USE_DYNAMIC_PARTITIONS := true
PRODUCT_RETROFIT_DYNAMIC_PARTITIONS := true

# Emulated storage
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)

Expand Down
3 changes: 3 additions & 0 deletions recovery/root/init.recovery.qcom.rc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ on init
# DT2W
write /proc/sys/dev/xiaomi_msm8937_touchscreen/enable_dt2w 1

# Retrofit Dynamic Partitions
on init
exec u:r:recovery:s0 -- /system/bin/rdp.sh

on boot
write /sys/bus/cpu/devices/cpu0/cpufreq/scaling_governor conservative
Expand Down
11 changes: 11 additions & 0 deletions recovery/root/system/bin/rdp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/system/bin/sh

if dd if=/dev/block/by-name/system bs=256k count=1|strings|grep mi8937_dynpart > /dev/null; then
echo >> /system/etc/recovery.fstab
for p in system system_ext product vendor odm; do
echo "${p} /${p} ext4 rw,barrier=1,discard wait,logical" >> /system/etc/recovery.fstab
done
else
echo >> /system/etc/twrp.flags
cat /system/etc/twrp.flags.nondynpart >> /system/etc/twrp.flags
fi
5 changes: 0 additions & 5 deletions recovery/root/system/etc/twrp.flags
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# mount point fstype device device2 flags
/system_root ext4 /dev/block/bootdevice/by-name/system flags=backup=0;display="System";wipeingui
/system_image emmc /dev/block/bootdevice/by-name/system flags=backup=1;flashimg=1
/vendor ext4 /dev/block/bootdevice/by-name/cust flags=slotselect;display="Vendor";backup=1;wipeingui
/vendor_image emmc /dev/block/bootdevice/by-name/cust flags=backup=1;flashimg=1

/data ext4 /dev/block/bootdevice/by-name/userdata flags=fileencryption=aes-256-xts:aes-256-cts;metadata_encryption=aes-256-xts;fsflags="discard"
/metadata ext4 /dev/block/bootdevice/by-name/oem flags=display="Metadata";fsflags="discard"
/cache ext4 /dev/block/bootdevice/by-name/cache flags=display="Cache"
Expand Down
5 changes: 5 additions & 0 deletions recovery/root/system/etc/twrp.flags.nondynpart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# mount point fstype device device2 flags
/system_root ext4 /dev/block/bootdevice/by-name/system flags=backup=0;display="System";wipeingui
/system_image emmc /dev/block/bootdevice/by-name/system flags=backup=1;flashimg=1
/vendor ext4 /dev/block/bootdevice/by-name/cust flags=slotselect;display="Vendor";backup=1;wipeingui
/vendor_image emmc /dev/block/bootdevice/by-name/cust flags=backup=1;flashimg=1

0 comments on commit 64d60e4

Please sign in to comment.