Skip to content

Commit

Permalink
android: Import remaining from realme-mt6833-T-oss
Browse files Browse the repository at this point in the history
Change-Id: I6ceaabb0c9eb235e966a12ea0d16acd406146ac0
Signed-off-by: techyminati <[email protected]>
  • Loading branch information
techyminati committed Mar 21, 2023
1 parent 4536a48 commit fe265ef
Show file tree
Hide file tree
Showing 17 changed files with 946 additions and 143 deletions.
18 changes: 18 additions & 0 deletions Android.mk
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ KERNEL_MAKE_DEPENDENCIES := $(shell find $(KERNEL_DIR) -name .git -prune -o -typ
$(TARGET_KERNEL_CONFIG): PRIVATE_DIR := $(KERNEL_DIR)
$(TARGET_KERNEL_CONFIG): $(KERNEL_CONFIG_FILE) $(LOCAL_PATH)/Android.mk
$(TARGET_KERNEL_CONFIG): $(KERNEL_MAKE_DEPENDENCIES)
#ifdef OPLUS_FEATURE_FORCE_SELINUX
OBSOLETE_KEEP_ADB_SECURE=$(OBSOLETE_KEEP_ADB_SECURE) \
TARGET_MEMLEAK_DETECT_TEST=$(TARGET_MEMLEAK_DETECT_TEST) \
$(KERNEL_DIR)/tools/changeConfig.sh $(KERNEL_CONFIG_FILE)
#endif OPLUS_FEATURE_FORCE_SELINUX
$(hide) mkdir -p $(dir $@)
$(PREBUILT_MAKE_PREFIX)$(MAKE) -C $(PRIVATE_DIR) $(KERNEL_MAKE_OPTION) $(KERNEL_DEFCONFIG)

Expand Down Expand Up @@ -52,14 +57,27 @@ menuconfig-kernel savedefconfig-kernel:
$(hide) mkdir -p $(KERNEL_OUT)
$(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPTION) $(patsubst %config-kernel,%config,$@)

ifeq ($(OPLUS_VND_ENV_USB_MICRO), yes)
$(shell sed -i 's/CONFIG_TCPC_CLASS=y/# CONFIG_TCPC_CLASS is not set/g' $(KERNEL_CONFIG_FILE))
$(shell sed -i 's/CONFIG_MTK_USB_TYPEC=y/# CONFIG_MTK_USB_TYPEC is not set/g' $(KERNEL_CONFIG_FILE))
$(shell sed -i 's/CONFIG_TCPC_RT1711H=y/# CONFIG_TCPC_RT1711H is not set/g' $(KERNEL_CONFIG_FILE))
endif

clean-kernel:
$(hide) rm -rf $(KERNEL_OUT) $(INSTALLED_KERNEL_TARGET)

### DTB build template
MTK_DTBIMAGE_DTS := $(addsuffix .dts,$(addprefix $(KERNEL_DIR)/arch/$(KERNEL_TARGET_ARCH)/boot/dts/,$(PLATFORM_DTB_NAME)))
include device/mediatek/build/core/build_dtbimage.mk

#ifdef OPLUS_BUG_STABILITY
CUSTOMER_DTBO_PROJECT := $(subst $\",,$(shell grep DTB_OVERLAY_IMAGE_NAMES $(KERNEL_CONFIG_FILE) | sed 's/.*=//' ))
MTK_DTBOIMAGE_DTS := $(addsuffix .dts,$(addprefix $(KERNEL_DIR)/arch/$(KERNEL_TARGET_ARCH)/boot/dts/,$(CUSTOMER_DTBO_PROJECT)))
#else
ifeq ($(MTK_DTBOIMAGE_DTS), )
MTK_DTBOIMAGE_DTS := $(addsuffix .dts,$(addprefix $(KERNEL_DIR)/arch/$(KERNEL_TARGET_ARCH)/boot/dts/,$(PROJECT_DTB_NAMES)))
endif
#endif /*OPLUS_BUG_STABILITY*/
include device/mediatek/build/core/build_dtboimage.mk

endif #TARGET_NO_KERNEL
Expand Down
54 changes: 53 additions & 1 deletion Makefile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXTRAVERSION =
NAME = "People's Front"

# *DOCUMENTATION*
# To see a list of typical targets execute "make help"
#ssss:wqTo see a list of typical targets execute "make help"
# More info can be located in ./README
# Comments in this file are targeted only to the developer, do not
# expect to learn how to build the kernel reading this file.
Expand Down Expand Up @@ -451,6 +451,29 @@ KBUILD_LDFLAGS :=
GCC_PLUGINS_CFLAGS :=
CLANG_FLAGS :=

#ifdef OPLUS_FEATURE_CHG_BASIC
ifeq ($(OPPO_HIGH_TEMP_VERSION),true)
KBUILD_CFLAGS += -DCONFIG_HIGH_TEMP_VERSION
endif
#endif /* OPLUS_FEATURE_CHG_BASIC */

#ifdef OPLUS_FEATURE_MEMLEAK_DETECT
ifeq ($(AGING_DEBUG_MASK),1)
# enable memleak detect daemon
OPLUS_MEMLEAK_DETECT := true
endif

ifeq ($(TARGET_MEMLEAK_DETECT_TEST),0)
# disable memleak detect daemon
OPLUS_MEMLEAK_DETECT := false
else ifeq ($(TARGET_MEMLEAK_DETECT_TEST),1)
# enable memleak detect daemon
OPLUS_MEMLEAK_DETECT := true
endif

export OPLUS_MEMLEAK_DETECT
#endif

export ARCH SRCARCH CONFIG_SHELL HOSTCC KBUILD_HOSTCFLAGS CROSS_COMPILE LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP OBJSIZE READELF KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS
export MAKE LEX YACC AWK GENKSYMS INSTALLKERNEL PERL PYTHON PYTHON2 PYTHON3 UTS_MACHINE
Expand Down Expand Up @@ -519,6 +542,12 @@ KBUILD_AFLAGS += $(CLANG_FLAGS)
export CLANG_FLAGS
endif

# Add for S bringup charger
KBUILD_CFLAGS += -DOPLUS_FEATURE_CHG_BASIC
KBUILD_CPPFLAGS += -DOPLUS_FEATURE_CHG_BASIC
CFLAGS_KERNEL += -DOPLUS_FEATURE_CHG_BASIC
CFLAGS_MODULE += -DOPLUS_FEATURE_CHG_BASIC

RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register
RETPOLINE_VDSO_CFLAGS_GCC := -mindirect-branch=thunk-inline -mindirect-branch-register
RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk
Expand Down Expand Up @@ -593,6 +622,17 @@ endif

export KBUILD_MODULES KBUILD_BUILTIN

#ifdef OPLUS_BUG_STABILITY
KBUILD_CFLAGS += -DOPLUS_BUG_STABILITY
KBUILD_CPPFLAGS += -DOPLUS_BUG_STABILITY
CFLAGS_KERNEL += -DOPLUS_BUG_STABILITY
CFLAGS_MODULE += -DOPLUS_BUG_STABILITY
#endif /* OPLUS_BUG_STABILITY */

#ifdef OPLUS_ARCH_INJECT
-include OplusKernelEnvConfig.mk
#endif /* OPLUS_ARCH_INJECT */

ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit
init-y := init/
Expand Down Expand Up @@ -1180,6 +1220,13 @@ endef
include/config/kernel.release: $(srctree)/Makefile FORCE
$(call filechk,kernel.release)



KBUILD_CFLAGS += -DOPLUS_FEATURE_SENSOR
KBUILD_CFLAGS += -DOPLUS_FEATURE_SENSOR_ALGORITHM
KBUILD_CFLAGS += -DOPLUS_FEATURE_SENSOR_SMEM
KBUILD_CFLAGS += -DOPLUS_FEATURE_SENSOR_WISELIGHT

# Additional helpers built in scripts/
# Carefully list dependencies so we do not try to build scripts twice
# in parallel
Expand Down Expand Up @@ -1367,6 +1414,11 @@ modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
#ifdef OPLUS_FEATURE_SECURITY_COMMON
ifeq ($(CONFIG_MODULE_SIG), y)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
endif
#endif /*OPLUS_FEATURE_SECURITY_COMMON*/

modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
$(Q)$(AWK) '!x[$$0]++' $^ > $(objtree)/modules.builtin
Expand Down
163 changes: 163 additions & 0 deletions OplusKernelEnvConfig.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# Copyright (C), 2008-2030, OPLUS Mobile Comm Corp., Ltd
### All rights reserved.
###
### File: - OplusKernelEnvConfig.mk
### Description:
### you can get the oplus feature variables set in android side in this file
### this file will add global macro for common oplus added feature
### BSP team can do customzation by referring the feature variables
### Version: 1.0
### Date: 2020-03-18
### Author: Liang.Sun
###
### ------------------------------- Revision History: ----------------------------
### <author> <date> <version> <desc>
### ------------------------------------------------------------------------------
##################################################################################

-include oplus_native_features.mk

###ifdef OPLUS_ARCH_INJECT
OPLUS_CONNECTIVITY_NATIVE_FEATURE_SET :=

##Add OPLUS Debug/Feature Macro Support for kernel/driver
##ifeq ($(OPLUS_FEATURE_TEST), yes)
## OPLUS_CONNECTIVITY_NATIVE_FEATURE_SET += OPLUS_FEATURE_TEST
##endif

ifeq ($(OPLUS_FEATURE_WIFI_MTUDETECT), yes)
OPLUS_CONNECTIVITY_NATIVE_FEATURE_SET += OPLUS_FEATURE_WIFI_MTUDETECT
endif


$(foreach myfeature,$(OPLUS_CONNECTIVITY_NATIVE_FEATURE_SET),\
$( \
$(eval KBUILD_CFLAGS += -D$(myfeature)) \
$(eval KBUILD_CPPFLAGS += -D$(myfeature)) \
$(eval CFLAGS_KERNEL += -D$(myfeature)) \
$(eval CFLAGS_MODULE += -D$(myfeature)) \
) \
)
###endif OPLUS_ARCH_INJECT
ALLOWED_MCROS := OPLUS_FEATURE_HANS_FREEZE \
OPLUS_FEATURE_STORAGE_TOOL \
OPLUS_FEATURE_MMC_DRIVER \
OPLUS_FEATURE_UFS_DRIVER \
OPLUS_FEATURE_UFS_SHOW_LATENCY \
OPLUS_FEATURE_AOD \
OPLUS_FEATURE_DC \
OPLUS_FEATURE_ENABLE_MODEM_DB \
OPLUS_FEATURE_ENGINEERTOOLS \
OPLUS_FEATURE_FACERECOGNITION \
OPLUS_FEATURE_FASTBOOT_UNLOCK_VERIFY \
OPLUS_FEATURE_FG_IO_OPT \
OPLUS_FEATURE_SDCARD_INFO \
OPLUS_FEATURE_FINGERPRINT \
OPLUS_FEATURE_HEALTHINFO \
OPLUS_FEATURE_TASK_CPUSTATS \
OPLUS_FEATURE_MIPICLKCHANGE \
OPLUS_FEATURE_MULTI_FREEAREA \
OPLUS_FEATURE_MULTI_KSWAPD \
OPLUS_FEATURE_NFC_CONSOFT \
OPLUS_FEATURE_ONSCREENFINGERPRINT \
OPLUS_FEATURE_OSC \
OPLUS_FEATURE_PHOENIX \
OPLUS_FEATURE_AGINGTEST \
OPLUS_FEATURE_PROCESS_RECLAIM \
OPLUS_FEATURE_RESET_ROLLBACK_INDEX \
OPLUS_FEATURE_SELINUX_CONTROL_LOG \
OPLUS_FEATURE_SENSOR \
OPLUS_FEATURE_SENSOR_ALGORITHM \
OPLUS_FEATURE_SENSOR_SMEM \
OPLUS_FEATURE_SENSOR_WISELIGHT \
OPLUS_FEATURE_IOMONITOR \
OPLUS_FEATURE_SPEAKER_MUTE \
OPLUS_FEATURE_MM_FEEDBACK \
OPLUS_FEATURE_TP_BSPFWUPDATE \
OPLUS_FEATURE_TP_BASIC \
OPLUS_FEATURE_CHG_BASIC \
OPLUS_FEATURE_SCHED_ASSIST \
OPLUS_FEATURE_VIRTUAL_RESERVE_MEMORY \
OPLUS_FEATURE_MEMLEAK_DETECT \
OPLUS_FEATURE_WIFI_MTUDETECT \
OPLUS_FEATURE_WIFI_RUSUPGRADE \
OPLUS_FEATURE_WIFI_SLA \
OPLUS_FEATURE_DATA_EVAL \
OPLUS_FEATURE_ZRAM_OPT \
OPLUS_FEATURE_EXFAT_SUPPORT \
OPLUS_FEATURE_SDCARDFS_SUPPORT \
OPLUS_FEATURE_PERFORMANCE \
OPLUS_BUG_COMPATIBILITY \
OPLUS_BUG_STABILITY \
OPLUS_BUG_DEBUG \
OPLUS_ARCH_INJECT \
OPLUS_ARCH_EXTENDS \
OPLUS_FEATURE_LOWMEM_DBG \
OPLUS_BUG_STABILITY \
OPLUS_FEATURE_POWERINFO_STANDBY \
OPLUS_FEATURE_CAMERA_COMMON \
OPLUS_FEATURE_MTK_ION_SEPARATE_LOCK \
OPLUS_FEATURE_THEIA \
OPLUS_FEATURE_APP_MONITOR \
OPLUS_FEATURE_SCHEDUTIL_USE_TL \
OPLUS_FEATURE_HEALTHINFO \
OPLUS_FEATURE_DISPLAY \
OPLUS_FEATURE_KMSG_WB



$(foreach myfeature,$(ALLOWED_MCROS),\
$(warning myfeature is $(myfeature)) \
$(eval KBUILD_CFLAGS += -D$(myfeature)) \
$(eval KBUILD_CPPFLAGS += -D$(myfeature)) \
$(eval CFLAGS_KERNEL += -D$(myfeature)) \
$(eval CFLAGS_MODULE += -D$(myfeature)) \
)



# BSP team can do customzation by referring the feature variables

ifeq ($(OPLUS_FEATURE_SECURE_GUARD),yes)
export CONFIG_OPLUS_SECURE_GUARD=y
KBUILD_CFLAGS += -DCONFIG_OPLUS_SECURE_GUARD
KBUILD_CPPFLAGS += -DCONFIG_OPLUS_SECURE_GUARD
CFLAGS_KERNEL += -DCONFIG_OPLUS_SECURE_GUARD
CFLAGS_MODULE += -DCONFIG_OPLUS_SECURE_GUARD
endif

ifeq ($(OPLUS_FEATURE_SECURE_ROOTGUARD),yes)
export CONFIG_OPLUS_ROOT_CHECK=y
KBUILD_CFLAGS += -DCONFIG_OPLUS_ROOT_CHECK
KBUILD_CPPFLAGS += -DCONFIG_OPLUS_ROOT_CHECK
CFLAGS_KERNEL += -DCONFIG_OPLUS_ROOT_CHECK
CFLAGS_MODULE += -DCONFIG_OPLUS_ROOT_CHECK
endif

ifeq ($(OPLUS_FEATURE_SECURE_MOUNTGUARD),yes)
export CONFIG_OPLUS_MOUNT_BLOCK=y
KBUILD_CFLAGS += -DCONFIG_OPLUS_MOUNT_BLOCK
endif

ifeq ($(OPLUS_FEATURE_SECURE_EXECGUARD),yes)
export CONFIG_OPLUS_EXECVE_BLOCK=y
KBUILD_CFLAGS += -DCONFIG_OPLUS_EXECVE_BLOCK
KBUILD_CFLAGS += -DCONFIG_OPLUS_EXECVE_REPORT
endif

ifeq ($(OPLUS_FEATURE_SECURE_KEVENTUPLOAD),yes)
export CONFIG_OPLUS_KEVENT_UPLOAD=y
KBUILD_CFLAGS += -DCONFIG_OPLUS_KEVENT_UPLOAD
KBUILD_CPPFLAGS += -DCONFIG_OPLUS_KEVENT_UPLOAD
CFLAGS_KERNEL += -DCONFIG_OPLUS_KEVENT_UPLOAD
CFLAGS_MODULE += -DCONFIG_OPLUS_KEVENT_UPLOAD
endif

ifeq ($(OPLUS_FEATURE_ALARMINFO_STANDBY),yes)
KBUILD_CFLAGS += -DOPLUS_FEATURE_ALARMINFO_STANDBY
CFLAGS_KERNEL += -DOPLUS_FEATURE_ALARMINFO_STANDBY
endif

ifeq ($(OPLUS_FEATURE_SECURE_KEYINTERFACESGUARD),yes)
KBUILD_CFLAGS += -DOPLUS_DISALLOW_KEY_INTERFACES
endif
22 changes: 21 additions & 1 deletion init/Kconfig
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,17 @@ config IRQ_TIME_ACCOUNTING

If in doubt, say N here.

#ifdef OPLUS_FEATURE_SCHED_ASSIST
config SCHED_WALT
bool "Support window based load tracking"
depends on SMP
help
This feature will allow the scheduler to maintain a tunable window
based set of metrics for tasks and runqueues. These metrics can be
used to guide task placement as well as task frequency requirements
for cpufreq governors.
#endif /* OPLUS_FEATURE_SCHED_ASSIST */

config HAVE_SCHED_AVG_IRQ
def_bool y
depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING
Expand Down Expand Up @@ -725,7 +736,10 @@ config UCLAMP_BUCKETS_COUNT
precision.

If in doubt, use the default value.

#ifdef OPLUS_FEATURE_SCHED_ASSIST
source "kernel/sched_assist/Kconfig"
source "kernel/locking/klockopt/Kconfig"
#endif
endmenu

#
Expand Down Expand Up @@ -2171,6 +2185,12 @@ config ASN1

source "kernel/Kconfig.locks"

config OPLUS_FEATURE_EAS_IGNORE_CACHEMISS
bool "EAS: ignore cachemiss"
default n
help
EAS: change function "find_energy_efficient_cpu" as kernel-4.14, ignore cachemiss

config ARCH_HAS_SYNC_CORE_BEFORE_USERMODE
bool

Expand Down
31 changes: 31 additions & 0 deletions init/do_mounts.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,24 @@ static dev_t devt_from_partuuid(const char *uuid_str)
}
return res;
}

/**
* match_dev_by_label - callback for finding a partition using its label
* @dev: device passed in by the caller
* @data: opaque pointer to the label to match
*
* Returns 1 if the device matches, and 0 otherwise.
*/
static int match_dev_by_label(struct device *dev, const void *data)
{
const char *label = data;
struct hd_struct *part = dev_to_part(dev);

if (part->info && !strcmp(label, part->info->volname))
return 1;

return 0;
}
#endif

/*
Expand All @@ -190,6 +208,8 @@ static dev_t devt_from_partuuid(const char *uuid_str)
* a partition with a known unique id.
* 8) <major>:<minor> major and minor number of the device separated by
* a colon.
* 9) PARTLABEL=<name> with name being the GPT partition label.
* MSDOS partitions do not support labels!
*
* If name doesn't have fall into the categories above, we return (0,0).
* block_class is used to check if something is a disk name. If the disk
Expand All @@ -211,6 +231,17 @@ dev_t name_to_dev_t(const char *name)
if (!res)
goto fail;
goto done;
} else if (strncmp(name, "PARTLABEL=", 10) == 0) {
struct device *dev;

dev = class_find_device(&block_class, NULL, name + 10,
&match_dev_by_label);
if (!dev)
goto fail;

res = dev->devt;
put_device(dev);
goto done;
}
#endif

Expand Down
Loading

0 comments on commit fe265ef

Please sign in to comment.