Skip to content

Commit

Permalink
X6739: Adapt to A14 vendor
Browse files Browse the repository at this point in the history
Credits: @HopeX23
thx to @cd_Crypton @Shivelight @DennisMurimiWachira

Signed-off-by: xoo2001 <[email protected]>
  • Loading branch information
xoo2001 committed Nov 5, 2024
1 parent 1f4b9d3 commit d592e90
Show file tree
Hide file tree
Showing 373 changed files with 2,364 additions and 522 deletions.
174 changes: 96 additions & 78 deletions BoardConfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ ALLOW_MISSING_DEPENDENCIES := true
# A/B
AB_OTA_UPDATER := true
AB_OTA_PARTITIONS += \
product \
vbmeta_vendor \
system_ext \
vendor \
system \
boot \
vbmeta_system \
product \
vbmeta_vendor \
system_ext
BOARD_USES_RECOVERY_AS_BOOT := true
vendor_boot

# Architecture
TARGET_ARCH := arm64
Expand All @@ -37,11 +37,8 @@ TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_VARIANT_RUNTIME := cortex-a55

# APEX
OVERRIDE_TARGET_FLATTEN_APEX := true

# Assert
TARGET_OTA_ASSERT_DEVICE := Infinix-X6739,X6739
TARGET_OTA_ASSERT_DEVICE := X6739

# Bootloader
TARGET_BOOTLOADER_BOARD_NAME := Infinix-X6739
Expand All @@ -51,91 +48,98 @@ TARGET_NO_BOOTLOADER := true
BUILD_BROKEN_DUP_RULES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true

# Crypto
TW_INCLUDE_CRYPTO := true
TW_INCLUDE_CRYPTO_FBE := true
TW_INCLUDE_FBE_METADATA_DECRYPT := true
TW_PREPARE_DATA_MEDIA_EARLY := true
TW_FORCE_KEYMASTER_VER := true

# Display
TARGET_SCREEN_DENSITY := 480

# Kernel
BOARD_BOOTIMG_HEADER_VERSION := 2
BOARD_BOOTIMG_HEADER_VERSION := 4
BOARD_VENDOR_CMDLINE := bootopt=64S3,32N2,64N2
BOARD_PAGE_SIZE := 4096
BOARD_KERNEL_BASE := 0x40078000
BOARD_KERNEL_CMDLINE := bootopt=64S3,32N2,64N2 buildvariant=user
BOARD_KERNEL_PAGESIZE := 2048
BOARD_KERNEL_OFFSET := 0x00008000
BOARD_RAMDISK_OFFSET := 0x11088000
BOARD_KERNEL_TAGS_OFFSET := 0x07c08000
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOTIMG_HEADER_VERSION)
BOARD_TAGS_OFFSET := 0x07c08000
BOARD_DTB_OFFSET := 0x07c08000
BOARD_MKBOOTIMG_ARGS += --vendor_cmdline $(BOARD_VENDOR_CMDLINE)
BOARD_MKBOOTIMG_ARGS += --pagesize $(BOARD_PAGE_SIZE) --board ""
BOARD_MKBOOTIMG_ARGS += --kernel_offset $(BOARD_KERNEL_OFFSET)
BOARD_MKBOOTIMG_ARGS += --ramdisk_offset $(BOARD_RAMDISK_OFFSET)
BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_KERNEL_TAGS_OFFSET)
BOARD_MKBOOTIMG_ARGS += --tags_offset $(BOARD_TAGS_OFFSET)
BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION)
BOARD_MKBOOTIMG_ARGS += --dtb_offset $(BOARD_DTB_OFFSET)
TARGET_KERNEL_CONFIG := zenith_defconfig
TARGET_KERNEL_SOURCE := kernel/infinix/zenith

# Kernel
BOARD_BOOT_HEADER_VERSION := 4
TARGET_NO_KERNEL := true
BOARD_KERNEL_IMAGE_NAME := Image
BOARD_INCLUDE_DTB_IN_BOOTIMG := true
TARGET_KERNEL_CONFIG := Infinix-X6739_defconfig
TARGET_KERNEL_SOURCE := kernel/infinix/Infinix-X6739

# Kernel - prebuilt
TARGET_FORCE_PREBUILT_KERNEL := true
ifeq ($(TARGET_FORCE_PREBUILT_KERNEL),true)
TARGET_PREBUILT_KERNEL := $(DEVICE_PATH)/prebuilt/kernel

# Kernel - source
TARGET_KERNEL_CONFIG := zenith_defconfig
TARGET_KERNEL_SOURCE := kernel/infinix/X6739

# Build Rules
BUILD_BROKEN_DUP_RULES := true
BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES := true

# DTB - prebuild
TARGET_PREBUILT_DTB := $(DEVICE_PATH)/prebuilt/dtb.img
BOARD_MKBOOTIMG_ARGS += --dtb $(TARGET_PREBUILT_DTB)
BOARD_INCLUDE_DTB_IN_BOOTIMG :=
endif

# Metadata
BOARD_USES_METADATA_PARTITION := true

# Partitions
BOARD_FLASH_BLOCK_SIZE := 131072 # (BOARD_KERNEL_PAGESIZE * 64)
BOARD_FLASH_BLOCK_SIZE := 262144
BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_HAS_LARGE_FILESYSTEM := true
BOARD_SYSTEMIMAGE_PARTITION_TYPE := erofs
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs
TARGET_COPY_OUT_VENDOR := vendor

BOARD_SUPER_PARTITION_SIZE := 11780751360
BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 67108864
BOARD_SUPER_PARTITION_SIZE := 9126805504
BOARD_SUPER_PARTITION_GROUPS := infinix_dynamic_partitions
BOARD_INFINIX_DYNAMIC_PARTITIONS_PARTITION_LIST := system vendor product system_ext
BOARD_INFINIX_DYNAMIC_PARTITIONS_SIZE := 11780751360
BOARD_INFINIX_DYNAMIC_PARTITIONS_SIZE := 9122611200

# Partitions - file type
BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE := erofs
BOARD_SYSTEM_DLKMIMAGE_FILE_SYSTEM_TYPE := ext4

# Platform
TARGET_BOARD_PLATFORM := mt6893
PRODUCT_PLATFORM := $(TARGET_BOARD_PLATFORM)

# Recovery
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TARGET_NO_RECOVERY := true
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/recovery.fstab
TARGET_SYSTEM_PROP := $(DEVICE_PATH)/system.prop
TARGET_USES_MKE2FS := true
TARGET_VENDOR_PROP := $(DEVICE_PATH)/vendor.prop

# Metadata
BOARD_USES_METADATA_PARTITION := true

# Recovery - Ramdisk
BOARD_RAMDISK_USE_LZ4 := true

# Crypto
TW_INCLUDE_CRYPTO := true
TW_INCLUDE_CRYPTO_FBE := true
TW_INCLUDE_FBE_METADATA_DECRYPT := true
TW_PREPARE_DATA_MEDIA_EARLY := true

# Security patch level
VENDOR_SECURITY_PATCH := 2021-08-01
# Vendor boot
BOARD_USES_GENERIC_KERNEL_IMAGE := true
BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT := true
BOARD_EXCLUDE_KERNEL_FROM_RECOVERY_IMAGE := true
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT := true

# Verified Boot
BOARD_AVB_ENABLE := true
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flags 3

BOARD_AVB_VBMETA_SYSTEM := system system_ext product
BOARD_AVB_VBMETA_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
BOARD_AVB_VBMETA_SYSTEM_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION := 1

BOARD_AVB_VBMETA_VENDOR := vendor
BOARD_AVB_VBMETA_VENDOR_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
BOARD_AVB_VBMETA_VENDOR_ALGORITHM := SHA256_RSA2048
BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION := 2

BOARD_AVB_RECOVERY_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
BOARD_AVB_RECOVERY_ALGORITHM := SHA256_RSA2048
BOARD_AVB_RECOVERY_ROLLBACK_INDEX := 1
BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_RECOVERY_ALGORITHM := SHA256_RSA4096
BOARD_AVB_RECOVERY_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
BOARD_AVB_RECOVERY_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION := 1

# Hack: prevent anti rollback
Expand All @@ -144,35 +148,49 @@ VENDOR_SECURITY_PATCH := 2099-12-31
PLATFORM_VERSION := 99.87.36
PLATFORM_VERSION_LAST_STABLE := $(PLATFORM_VERSION)

# Vendor Modules
TW_LOAD_VENDOR_MODULES := true
TW_LOAD_VENDOR_BOOT_MODULES := true
TW_LOAD_VENDOR_MODULES_EXCLUDE_GKI := true

# copy_out error
TARGET_COPY_OUT_VENDOR := vendor
TARGET_COPY_OUT_SYSTEM_DLKM := system_dlkm
TARGET_COPY_OUT_PRODUCT := product
TARGET_COPY_OUT_SYSTEM_EXT := system_ext

# Recovery - sdcard ?
RECOVERY_SDCARD_ON_DATA := true

# TWRP Configuration
TW_THEME := portrait_hdpi
TW_EXTRA_LANGUAGES := true
TW_SCREEN_BLANK_ON_BOOT := true
TW_INPUT_BLACKLIST := "hbtp_vm"
TW_USE_TOOLBOX := true
TW_INCLUDE_REPACKTOOLS := true
RECOVERY_SDCARD_ON_DATA := true
TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 511
TW_DEFAULT_BRIGHTNESS := 130
TW_SCREEN_BLANK_ON_BOOT := true
TW_MAX_BRIGHTNESS := 2047
TW_DEFAULT_BRIGHTNESS := 1200
TW_NO_SCREEN_BLANK := true
TW_INCLUDE_RESETPROP := true
TW_FRAMERATE := 60
TW_INCLUDE_LIBRESETPROP :=true
TW_INCLUDE_TZDATA := true
TW_INCLUDE_FASTBOOTD := true
TW_EXCLUDE_DEFAULT_USB_INIT := true
TW_FRAMERATE := 60
TW_HAS_MTP := true
TW_NO_FASTBOOT_BOOT := true
TW_EXCLUDE_APEX := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_HAS_NO_RECOVERY_PARTITION := true
TW_INCLUDE_FASTBOOTD := true

# Debug
TWRP_INCLUDE_LOGCAT := true
TARGET_USES_LOGD := true
TW_EXCLUDE_APEX := true

# StatusBar
TW_STATUS_ICONS_ALIGN := center
TW_CUSTOM_CLOCK_POS := "300"

# Debug
TWRP_INCLUDE_LOGCAT := true
TARGET_USES_LOGD := true

#PBRP_FLAGS
PB_TORCH_PATH := "/sys/devices/virtual/torch/torch/torch_level"
PB_TORCH_MAX_BRIGHTNESS := 1
4 changes: 3 additions & 1 deletion bootctrl/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ cc_library_shared {
recovery_available: true,
srcs: ["BootControl.cpp", "boot_region_control.cpp"],

header_libs: ["device_kernel_headers"],

shared_libs: [
"liblog",
"libhidlbase",
"libhardware",
"libutils",
"[email protected]",
"[email protected]",
"[email protected]"
"[email protected]",
],
static_libs: [
"libboot_control",
Expand Down
6 changes: 4 additions & 2 deletions bootctrl/BootControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cstdint>
#define LOG_TAG "[email protected]"

#include <memory>
Expand Down Expand Up @@ -135,6 +134,7 @@ Return<void> BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) {
return Void();
}

// Methods from ::android::hardware::boot::V1_1::IBootControl follow.
Return<bool> BootControl::setSnapshotMergeStatus(MergeStatus status) {
return impl_.SetSnapshotMergeStatus(status);
}
Expand All @@ -145,7 +145,9 @@ Return<MergeStatus> BootControl::getSnapshotMergeStatus() {

// Methods from ::android::hardware::boot::V1_2::IBootControl follow.
Return<uint32_t> BootControl::getActiveBootSlot() {
if (!impl_.GetActiveBootSlot()) return 0;
if (!impl_.GetActiveBootSlot()) {
return 0;
}
return impl_.GetActiveBootSlot();
}

Expand Down
8 changes: 5 additions & 3 deletions bootctrl/BootControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ namespace implementation {

using ::android::hardware::Return;
using ::android::hardware::Void;
using ::android::hardware::boot::V1_0::BoolResult;
using ::android::hardware::boot::V1_1::MergeStatus;

using ::android::hardware::boot::V1_2::IBootControl;
using ::android::hardware::boot::V1_1::MergeStatus;
using ::android::hardware::boot::V1_0::BoolResult;

class BootControl : public IBootControl {
public:
Expand All @@ -54,6 +55,7 @@ class BootControl : public IBootControl {

// Methods from ::android::hardware::boot::V1_2::IBootControl follow.
Return<uint32_t> getActiveBootSlot() override;

private:
android::bootable::BootControl impl_;
android::bootable::BootControlExt implext_;
Expand All @@ -63,7 +65,7 @@ class BootControl : public IBootControl {
extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name);

} // namespace implementation
} // namespace V1_1
} // namespace V1_2
} // namespace boot
} // namespace hardware
} // namespace android
Loading

0 comments on commit d592e90

Please sign in to comment.