Skip to content

Commit

Permalink
topaz: Reflect to our devices
Browse files Browse the repository at this point in the history
  • Loading branch information
skena678 committed Jun 17, 2023
1 parent 2c216d4 commit 3e57a00
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 149 deletions.
39 changes: 22 additions & 17 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ AB_OTA_UPDATER := true
AB_OTA_PARTITIONS += \
boot \
dtbo \
init_boot \
odm \
product \
recovery \
system \
system_dlkm \
system_ext \
vbmeta \
vbmeta_system \
Expand All @@ -26,18 +28,16 @@ AB_OTA_PARTITIONS += \

# Architecture
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a-branchprot
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 :=
TARGET_CPU_VARIANT := generic
TARGET_CPU_VARIANT_RUNTIME := kryo300

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv8-2a
TARGET_2ND_ARCH_VARIANT := armv8-a
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a75
TARGET_2ND_CPU_VARIANT := cortex-a9

# Boot control
SOONG_CONFIG_NAMESPACES += ufsbsg
Expand All @@ -48,7 +48,7 @@ SOONG_CONFIG_ufsbsg_ufsframework := bsg
BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := $(DEVICE_PATH)/bluetooth/include

# Bootloader
PRODUCT_PLATFORM := taro
PRODUCT_PLATFORM := bengal
TARGET_BOOTLOADER_BOARD_NAME := topaz
TARGET_NO_BOOTLOADER := true
TARGET_USES_UEFI := true
Expand All @@ -70,23 +70,27 @@ TARGET_KERNEL_HEADER_ARCH := arm64

BOARD_KERNEL_PAGESIZE := 4096
BOARD_KERNEL_BASE := 0x00000000
BOARD_DTB_SIZE := 5725389
BOARD_DTB_SIZE := 1263192
BOARD_DTB_OFFSET :=0x01F00000
BOARD_KERNEL_OFFSET := 0x00008000
BOARD_RAMDISK_OFFSET := 0x01000000

BOARD_KERNEL_CMDLINE := \
video=vfb:640x400,bpp=32,memsize=3072000 \
disable_dma32=on \
bootinfo.fingerprint=$(LINEAGE_VERSION) \
mtdoops.fingerprint=$(LINEAGE_VERSION)
bootinfo.fingerprint=$(EVO_VERSION) \
mtdoops.fingerprint=$(EVO_VERSION)
BOARD_BOOTCONFIG := \
androidboot.hardware=qcom \
androidboot.memcg=1 \
androidboot.usbcontroller=a600000.dwc3
androidboot.usbcontroller=4e00000.dwc3

BOARD_KERNEL_IMAGE_NAME := Image

# Init Boot
BOARD_INIT_BOOT_HEADER_VERSION := 4
BOARD_MKBOOTIMG_INIT_ARGS += --header_version $(BOARD_INIT_BOOT_HEADER_VERSION)

BOARD_BOOT_HEADER_VERSION := 4
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)

Expand All @@ -107,14 +111,15 @@ BOARD_USES_METADATA_PARTITION := true
BOARD_FLASH_BLOCK_SIZE := 262144

BOARD_DTBOIMG_PARTITION_SIZE := 25165824
BOARD_BOOTIMAGE_PARTITION_SIZE := 201326592
BOARD_BOOTIMAGE_PARTITION_SIZE := 134217728
BOARD_INIT_BOOT_IMAGE_PARTITION_SIZE := 8388608
BOARD_RECOVERYIMAGE_PARTITION_SIZE := 104857600
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 100663296

BOARD_SUPER_PARTITION_SIZE := 9663676416
BOARD_SUPER_PARTITION_SIZE := 7516192768
BOARD_SUPER_PARTITION_GROUPS := qti_dynamic_partitions
BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_ext vendor vendor_dlkm
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 9659482112
BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST := odm product system system_dlkm system_ext vendor vendor_dlkm
BOARD_QTI_DYNAMIC_PARTITIONS_SIZE := 7511998464 # (BOARD_SUPER_PARTITION_SIZE - 4194304) 4MiB overhead

BOARD_PARTITION_LIST := $(call to-upper, $(BOARD_QTI_DYNAMIC_PARTITIONS_PARTITION_LIST))
$(foreach p, $(BOARD_PARTITION_LIST), $(eval BOARD_$(p)IMAGE_FILE_SYSTEM_TYPE := erofs))
Expand All @@ -134,9 +139,9 @@ BOARD_USES_VENDOR_DLKMIMAGE := true
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs

# Platform
TARGET_BOARD_PLATFORM := xiaomi_sm7475
TARGET_BOARD_PLATFORM_GPU := qcom-adreno725
QCOM_BOARD_PLATFORMS += xiaomi_sm7475
TARGET_BOARD_PLATFORM := xiaomi_sm6225
TARGET_BOARD_PLATFORM_GPU := qcom-adreno610
QCOM_BOARD_PLATFORMS += xiaomi_sm6225
BOARD_USES_QCOM_HARDWARE := true

# Properties
Expand Down
2 changes: 1 addition & 1 deletion board-info.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
require board=taro|topaz
require board=tapas|topaz
2 changes: 1 addition & 1 deletion bootctrl/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ cc_library_shared {
name: "[email protected]",
stem: "[email protected]",
defaults: ["[email protected]_defaults"],
static_libs: ["libgptutils.xiaomi_sm7475"],
static_libs: ["libgptutils.xiaomi_bengal"],
}
12 changes: 2 additions & 10 deletions dt2w/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ android_app {
},

required: [
"privapp-permissions_org.lineageos.dt2w.Topaz",
"xiaomi-touch"
"privapp-permissions_org.lineageos.dt2w.Topaz"
]
}

Expand All @@ -39,11 +38,4 @@ prebuilt_etc {
sub_dir: "permissions",
src: "privapp-permissions_org.lineageos.dt2w.Topaz.xml",
filename_from_src: true,
}

cc_binary {
name: "xiaomi-touch",
srcs: [
"xiaomi-touch.cpp",
],
}
}
48 changes: 0 additions & 48 deletions dt2w/xiaomi-touch.cpp

This file was deleted.

52 changes: 19 additions & 33 deletions libinit/init_xiaomi_topaz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,36 @@

#include "vendor_init.h"

#define FINGERPRINT_GL "POCO/topaz_global/topaz:13/SKQ1.221022.001/V14.0.1.0.TMRMIXM:user/release-keys"
#define FINGERPRINT_CN "Xiaomi/topaz/topaz:13/SKQ1.221022.001/V14.0.19.0.TMRCNXM:user/release-keys"
#define FINGERPRINT_IN "POCO/topazin/topazin:13/SKQ1.221022.001/V14.0.1.0.TMRMIXM:user/release-keys"
#define FINGERPRINT_M7N "Redmi/topaz_global/topaz:13/TKQ1.221114.001/V14.0.3.0.TMGMIXM:user/release-keys"
#define FINGERPRINT_M7G "Redmi/tapas_global/tapas:13/TKQ1.221114.001/V14.0.9.0.TMTMIXM:user/release-keys"

static const variant_info_t topaz_global_info = {
.hwc_value = "GL",
.sku_value = "",
.hwc_value = "Global",
.sku_value = "m7n",

.brand = "POCO",
.brand = "REDMI",
.device = "topaz",
.marketname = "POCO F5",
.model = "23049PCD8G",
.marketname = "REDMI NOTE 12 4G NFC",
.model = "23021RAA2Y",
.mod_device = "topaz_global",
.build_fingerprint = FINGERPRINT_GL,
.build_fingerprint = FINGERPRINT_M7N,
};

static const variant_info_t topazin_info = {
.hwc_value = "IN",
.sku_value = "",
static const variant_info_t tapas_global_info = {
.hwc_value = "Global",
.sku_value = "m7g",

.brand = "POCO",
.device = "topazin",
.marketname = "POCO F5",
.model = "23049PCD8I",
.mod_device = "topaz_in_global",
.build_fingerprint = FINGERPRINT_IN,
};

static const variant_info_t topaz_info = {
.hwc_value = "",
.sku_value = "",

.brand = "Xiaomi",
.device = "topaz",
.marketname = "Redmi Note 12 Turbo",
.model = "23049RAD8C",
.mod_device = "topaz",
.build_fingerprint = FINGERPRINT_CN,
.brand = "REDMI",
.device = "tapas",
.marketname = "REDMI NOTE 12 4G",
.model = "23021RAAEG",
.mod_device = "tapas_global",
.build_fingerprint = FINGERPRINT_M7G,
};

static const std::vector<variant_info_t> variants = {
topaz_global_info,
topazin_info,
topaz_info,
tapas_global_info,
};

void vendor_load_properties() {
Expand All @@ -62,4 +48,4 @@ void vendor_load_properties() {

// SafetyNet workaround
property_override("ro.boot.verifiedbootstate", "green");
}
}
44 changes: 22 additions & 22 deletions libinit/libinit_dalvik_heap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@

#define GB(b) (b * 1024ull * 1024 * 1024)

static const dalvik_heap_info_t dalvik_heap_info_16384 = {
.heapstartsize = "32m",
.heapgrowthlimit = "448m",
.heapsize = "640m",
.heapminfree = "16m",
.heapmaxfree = "64m",
.heaptargetutilization = "0.4",
static const dalvik_heap_info_t dalvik_heap_info_8192 = {
.heapstartsize = "24m",
.heapgrowthlimit = "256m",
.heapsize = "512m",
.heapminfree = "8m",
.heapmaxfree = "48m",
.heaptargetutilization = "0.46",
};

static const dalvik_heap_info_t dalvik_heap_info_12288 = {
.heapstartsize = "24m",
.heapgrowthlimit = "384m",
static const dalvik_heap_info_t dalvik_heap_info_6144 = {
.heapstartsize = "16m",
.heapgrowthlimit = "256m",
.heapsize = "512m",
.heapminfree = "8m",
.heapmaxfree = "56m",
.heaptargetutilization = "0.42",
.heapmaxfree = "32m",
.heaptargetutilization = "0.5",
};

static const dalvik_heap_info_t dalvik_heap_info_8192 = {
.heapstartsize = "24m",
static const dalvik_heap_info_t dalvik_heap_info_4096 = {
.heapstartsize = "8m",
.heapgrowthlimit = "256m",
.heapsize = "512m",
.heapminfree = "8m",
.heapmaxfree = "48m",
.heaptargetutilization = "0.46",
.heapmaxfree = "16m",
.heaptargetutilization = "0.6",
};

void set_dalvik_heap() {
Expand All @@ -51,17 +51,17 @@ void set_dalvik_heap() {

sysinfo(&sys);

if (sys.totalram > GB(15))
dhi = &dalvik_heap_info_16384;
else if (sys.totalram > GB(11))
dhi = &dalvik_heap_info_12288;
else
if (sys.totalram > GB(7))
dhi = &dalvik_heap_info_8192;
else if (sys.totalram > GB(5))
dhi = &dalvik_heap_info_6144;
else
dhi = &dalvik_heap_info_4096;

property_override(HEAPSTARTSIZE_PROP, dhi->heapstartsize);
property_override(HEAPGROWTHLIMIT_PROP, dhi->heapgrowthlimit);
property_override(HEAPSIZE_PROP, dhi->heapsize);
property_override(HEAPTARGETUTILIZATION_PROP, dhi->heaptargetutilization);
property_override(HEAPMINFREE_PROP, dhi->heapminfree);
property_override(HEAPMAXFREE_PROP, dhi->heapmaxfree);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ index 2f0ce75e47..b35d34a599 100644
// Global Configuration
--
2.25.1

Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ index b35d34a599..456c5a935c 100644
RouteTraits::Collection routes;
--
2.25.1

1 change: 0 additions & 1 deletion patch/frameworks/native/0001-Fix-vibration.patch
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ index c1795f5c32..0cc8a6f3c7 100644
ALOGV("Vibrator HAL service not available.");
--
2.39.2

Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,3 @@ index a2c192f37d..c3d1cf35c2 100644
}
--
2.25.1

3 changes: 1 addition & 2 deletions patch/patch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#!/bin/sh
PATCH_LOC=$PWD/device/xiaomi/marble/patch
PATCH_LOC=$PWD/device/xiaomi/topaz/patch
cd frameworks/native
git am $PATCH_LOC/frameworks/native/0001-Fix-vibration.patch
cd ../av
git am $PATCH_LOC/frameworks/av/0001-APM-Optionally-force-load-audio-policy-for-system-si.patch
git am $PATCH_LOC/frameworks/av/0002-APM-Remove-A2DP-audio-ports-from-the-primary-HAL.patch
cd ../../packages/modules/Bluetooth
git am $PATCH_LOC/packages/modules/Bluetooth/0001-audio_hal_interface-Optionally-use-sysbta-HAL.patch

7 changes: 4 additions & 3 deletions rootdir/etc/fstab.qcom
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ vendor /vendor e
vendor /vendor erofs ro wait,slotselect,avb,logical,first_stage_mount
vendor_dlkm /vendor_dlkm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
vendor_dlkm /vendor_dlkm erofs ro wait,slotselect,avb,logical,first_stage_mount
system_dlkm /system_dlkm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
system_dlkm /system_dlkm erofs ro wait,slotselect,avb,logical,first_stage_mount
odm /odm ext4 ro,barrier=1,discard wait,slotselect,avb,logical,first_stage_mount
odm /odm erofs ro wait,slotselect,avb,logical,first_stage_mount
/dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard wait,check,formattable,first_stage_mount
/dev/block/bootdevice/by-name/persist /mnt/vendor/persist ext4 noatime,nosuid,nodev,barrier=1 wait,check
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier,inlinecrypt,gc_merge,compress_mode=user,compress_cache,age_extent_cache,atgc latemount,wait,check,formattable,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized+wrappedkey_v0,keydirectory=/metadata/vold/metadata_encryption,metadata_encryption=aes-256-xts:wrappedkey_v0,quota,reservedsize=128M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,checkpoint=fs
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/devices/platform/soc/8804000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/devices/platform/soc/4784000.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/devices/platform/soc/*.ssusb/*.dwc3/xhci-hcd.*.auto* /storage/usbotg vfat nosuid,nodev wait,voldmanaged=usbotg:auto
/dev/block/bootdevice/by-name/modem /vendor/firmware_mnt vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait,slotselect
/dev/block/bootdevice/by-name/dsp /vendor/dsp ext4 ro,nosuid,nodev,barrier=1 wait,slotselect
/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect
/dev/block/bootdevice/by-name/qmcs /mnt/vendor/qmcs vfat noatime,nosuid,nodev,context=u:object_r:vendor_qmcs_file:s0 wait,check,formattable
/dev/block/bootdevice/by-name/bluetooth /vendor/bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait,slotselect
Loading

0 comments on commit 3e57a00

Please sign in to comment.