Skip to content

Commit

Permalink
ginkgo: Unify dynamic and non-dynamic
Browse files Browse the repository at this point in the history
Signed-off-by: erwinabs <[email protected]>
  • Loading branch information
ZorEl212 authored and erwinabs committed Oct 22, 2024
1 parent 38693e5 commit 398a561
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 62 deletions.
44 changes: 10 additions & 34 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,12 @@ TARGET_BOARD_PLATFORM := trinket
TARGET_BOARD_PLATFORM_GPU := qcom-adreno640

# Kernel
BOARD_KERNEL_CMDLINE := console=ttyMSM0,115200n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 earlycon=msm_geni_serial,0x4a90000 cgroup.memory=nokmem,nosocket androidboot.selinux=permissive androidboot.usbconfigfs=true
BOARD_KERNEL_BASE := 0x00000000
BOARD_KERNEL_CMDLINE := console=ttyMSM0,115200n8 androidboot.hardware=qcom androidboot.console=ttyMSM0 androidboot.memcg=1 lpm_levels.sleep_disabled=1 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 service_locator.enable=1 swiotlb=1 earlycon=msm_geni_serial,0x4a90000 cgroup.memory=nokmem,nosocket androidboot.selinux=permissive androidboot.usbconfigfs=true
BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_TAGS_OFFSET := 0x00000100
BOARD_RAMDISK_OFFSET := 0x01000000
BOARD_KERNEL_IMAGE_NAME := Image.gz
TARGET_KERNEL_ARCH := arm64
TARGET_KERNEL_HEADER_ARCH := arm64
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz
#TARGET_PREBUILT_DTB := $(DEVICE_PATH)/prebuilt/dtb.img
BOARD_PREBUILT_DTBOIMAGE := $(DEVICE_PATH)/prebuilt/dtbo.img
BOARD_INCLUDE_RECOVERY_DTBO := true
BOARD_BOOTIMG_HEADER_VERSION := 2
BOARD_MKBOOTIMG_ARGS := --ramdisk_offset $(BOARD_RAMDISK_OFFSET)
BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_KERNEL_TAGS_OFFSET)
#BOARD_MKBOOTIMG_ARGS += --dtb $(TARGET_PREBUILT_DTB)
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
TARGET_FORCE_PREBUILT_KERNEL := true
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/Image.gz-dtb

# Avb
BOARD_AVB_ENABLE := true
Expand All @@ -82,16 +71,10 @@ BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864
BOARD_USERDATAIMAGE_PARTITION_SIZE := 52554612224
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_ODMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4

TARGET_COPY_OUT_ODM := odm
TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_SYSTEM_EXT := system_ext

TARGET_COPY_OUT_VENDOR := vendor

# Partitions Dynamic
Expand All @@ -101,9 +84,9 @@ BOARD_SUPER_PARTITION_VENDOR_DEVICE_SIZE := 1610612736
BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE := 4831838208
BOARD_SUPER_PARTITION_SIZE := $(shell expr $(BOARD_SUPER_PARTITION_VENDOR_DEVICE_SIZE) + $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE) )

BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions
BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_ext vendor
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := $(shell expr $(BOARD_SUPER_PARTITION_SIZE) - 4194304 )
BOARD_SUPER_PARTITION_GROUPS := ginkgo_dynapart
BOARD_GINKGO_DYNAPART_PARTITION_LIST := odm product system system_ext vendor
BOARD_GINKGO_DYNAPART_SIZE := $(shell expr $(BOARD_SUPER_PARTITION_SIZE) - 4194304 )

# System as root
BOARD_BUILD_SYSTEM_ROOT_IMAGE := false
Expand All @@ -114,8 +97,8 @@ TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true

# Init
TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_ginkgo
TARGET_RECOVERY_DEVICE_MODULES := libinit_ginkgo
#TARGET_INIT_VENDOR_LIB := //$(DEVICE_PATH):libinit_ginkgo
#TARGET_RECOVERY_DEVICE_MODULES := libinit_ginkgo

# Encryption
BOARD_USES_METADATA_PARTITION := true
Expand Down Expand Up @@ -169,7 +152,6 @@ TW_EXCLUDE_APEX := true
TW_FRAMERATE := 60
TW_FORCE_KEYMASTER_VER := true
TW_PREPARE_DATA_MEDIA_EARLY := true
TW_DEVICE_VERSION=FbeV2-A14

#Properties
TW_OVERRIDE_SYSTEM_PROPS := \
Expand All @@ -178,10 +160,4 @@ TW_OVERRIDE_SYSTEM_PROPS := \
# TWRP Debug Flags
TWRP_INCLUDE_LOGCAT := true
TARGET_USES_LOGD := true

# PBRP specific build flags
PB_DISABLE_DEFAULT_DM_VERITY := true
PB_DISABLE_DEFAULT_TREBLE_COMP := true

# PB Torch
PB_TORCH_PATH := "/sys/class/leds/led:torch_0"
10 changes: 0 additions & 10 deletions omni.dependencies

This file was deleted.

Binary file renamed prebuilt/Image.gz → prebuilt/Image.gz-dtb
Binary file not shown.
Binary file removed prebuilt/dtbo.img
Binary file not shown.
7 changes: 5 additions & 2 deletions recovery/root/init.recovery.qcom.rc
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@
import /init.recovery.qcom_decrypt.rc

on init
setprop prepdecrypt.loglevel 2
setprop prepdecrypt.loglevel 2
exec u:r:recovery:s0 -- /system/bin/merge-fstab.sh

on fs
wait /dev/block/platform/soc/${ro.boot.bootdevice}
symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice

mkdir /firmware
mount vfat /dev/block/bootdevice/by-name/modem /firmware ro

on boot
start health-hal-2-0
29 changes: 29 additions & 0 deletions recovery/root/system/bin/merge-fstab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/system/bin/sh
# Determine the filesystem of a block device

FBE=$(getprop ro.crypto.dm_default_key.options_format.version)

# Check if EROFS filesystem is present
dd if=/dev/block/by-name/system bs=256k count=1 | strings | grep -q -E "ginkgo_erofs_dynapart"
ISEROFS=$?

# Dynamic partitions
if dd if=/dev/block/by-name/system bs=256k count=1 | strings | grep -q -E "ginkgo_dynapart|qti_dynamic_partitions|ginkgo_erofs_dynapart"; then
if [ "$ISEROFS" -eq 0 ]; then
cat /system/etc/recovery.fstab.erofs >> /system/etc/recovery.fstab
else
cat /system/etc/recovery.fstab.ext4 >> /system/etc/recovery.fstab
fi

if [ "$FBE" = "2" ]; then
cat /system/etc/recovery.fstab.fbev2 >> /system/etc/recovery.fstab
fi

for p in system vendor; do
echo "/super_${p} emmc /dev/block/bootdevice/by-name/${p} flags=display=\"Super_${p}\";backup=1" >> /system/etc/twrp.flags
done
else
# Non-dynamic partitions
cat /system/etc/twrp.flags.nondynpart >> /system/etc/twrp.flags
cat /system/etc/recovery.fstab.fbev1 >> /system/etc/recovery.fstab
fi
8 changes: 0 additions & 8 deletions recovery/root/system/etc/recovery.fstab
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,8 @@
# Currently we dont have e2fsck compiled. So fs check would failed.

#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
system /system ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_ext /system_ext ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
product /product ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
vendor /vendor ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
odm /odm ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
/dev/block/bootdevice/by-name/cache /cache ext4 nosuid,noatime,nodev,barrier=1 wait
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount

# Add fs_mgr flag - sysfs_path=/sys/devices/platform/soc/xxxx.[ufshc|sdhci] to userdata entry, based on UFS|eMMC device.
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,metadata_encryption=aes-256-xts:wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=128M,checkpoint=fs
# Need to have this entry in here even though the mount point itself is no longer needed.
# The update_engine code looks for this entry in order to determine the boot device address
# and fails if it does not find it.
Expand Down
5 changes: 5 additions & 0 deletions recovery/root/system/etc/recovery.fstab.erofs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
system /system erofs ro wait,avb,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_ext /system_ext erofs ro wait,avb,logical,first_stage_mount
product /product erofs ro wait,avb,logical,first_stage_mount
vendor /vendor erofs ro wait,avb,logical,first_stage_mount
odm /odm erofs ro wait,avb,logical,first_stage_mount
5 changes: 5 additions & 0 deletions recovery/root/system/etc/recovery.fstab.ext4
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
system /system ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount,avb_keys=/avb/q-gsi.avbpubkey:/avb/r-gsi.avbpubkey:/avb/s-gsi.avbpubkey
system_ext /system_ext ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
product /product ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
vendor /vendor ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
odm /odm ext4 ro,barrier=1,discard wait,avb,logical,first_stage_mount
2 changes: 2 additions & 0 deletions recovery/root/system/etc/recovery.fstab.fbev1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dev/block/bootdevice/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,formattable,wrappedkey
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,nodiscard,alloc_mode=reuse,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,fileencryption=ice,wrappedkey,keydirectory=/metadata/vold/metadata_encryption,quota
2 changes: 2 additions & 0 deletions recovery/root/system/etc/recovery.fstab.fbev2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,metadata_encryption=aes-256-xts:wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,quota,reservedsize=128M,checkpoint=fs
8 changes: 0 additions & 8 deletions recovery/root/system/etc/twrp.flags
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@
/dtbo emmc /dev/block/bootdevice/by-name/dtbo flags=backup=1;display="Dtbo";flashimg=1
/cache ext4 /dev/block/bootdevice/by-name/cache
/recovery emmc /dev/block/bootdevice/by-name/recovery flags=backup=1
/system_root ext4 /dev/block/bootdevice/by-name/system flags=display="System";backup=0;wipeingui
/system_ext ext4 /dev/block/bootdevice/by-name/system_ext flags=display="System_ext";backup=0;wipeingui
/vendor ext4 /dev/block/bootdevice/by-name/vendor flags=display="Vendor";backup=0;wipeingui

/system_image emmc /dev/block/bootdevice/by-name/system
/vendor_image emmc /dev/block/bootdevice/by-name/vendor

/firmware vfat /dev/block/bootdevice/by-name/modem flags=display="Firmware";mounttodecrypt
/cust ext4 /dev/block/bootdevice/by-name/cust flags=display="Cust"
/misc emmc /dev/block/bootdevice/by-name/misc
/modem emmc /dev/block/bootdevice/by-name/modem flags=backup=1;display="Modem"
/bluetooth emmc /dev/block/bootdevice/by-name/bluetooth flags=backup=1;subpartitionof=/modem
Expand Down
4 changes: 4 additions & 0 deletions recovery/root/system/etc/twrp.flags.nondynpart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/system_root ext4 /dev/block/bootdevice/by-name/system flags=display="System";backup=0;wipeingui
/vendor ext4 /dev/block/bootdevice/by-name/vendor flags=display="Vendor";backup=0;wipeingui
/system_image emmc /dev/block/bootdevice/by-name/system
/vendor_image emmc /dev/block/bootdevice/by-name/vendor

0 comments on commit 398a561

Please sign in to comment.