Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ede5bcc5 authored by Swetha Chikkaboraiah's avatar Swetha Chikkaboraiah Committed by Gerrit - the friendly Code Review server
Browse files

AndroidKernel: Disable debugfs for user builds



Debugfs is not needed on user builds, so disabling
same at compile time for ARM 64.

Change-Id: If6708c9de060584ebcba4cac9bad8e85d6a5ab7f
Signed-off-by: default avatarSwetha Chikkaboraiah <schikk@codeaurora.org>
parent 7ef2e3cc
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ ifneq ($(TARGET_KERNEL_APPEND_DTB), true)
$(info Using DTB Image)
INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
endif
MAKE_ARGS := $(strip $(TARGET_KERNEL_MAKE_ARGS))
KERNEL_DISABLE_DEBUGFS := $(TARGET_KERNEL_DISABLE_DEBUGFS)

TARGET_KERNEL_MAKE_ENV := $(strip $(TARGET_KERNEL_MAKE_ENV))
ifeq ($(TARGET_KERNEL_MAKE_ENV),)
@@ -138,6 +140,7 @@ $(info Using appended DTB)
TARGET_PREBUILT_INT_KERNEL := $(TARGET_PREBUILT_INT_KERNEL)-dtb
endif

KERNEL_DEBUGFS := $(KERNEL_OUT)/tmp
KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
KERNEL_MODULES_INSTALL ?= system
KERNEL_MODULES_OUT ?= $(PRODUCT_OUT)/$(KERNEL_MODULES_INSTALL)/lib/modules
@@ -162,6 +165,9 @@ mpath=`dirname $$mdpath`; rm -rf $$mpath;\
fi
endef

$(KERNEL_OUT): $(KERNEL_DEBUGFS)
	mkdir -p $(KERNEL_OUT)

ifneq ($(KERNEL_LEGACY_DIR),true)
$(KERNEL_USR): $(KERNEL_HEADERS_INSTALL)
	rm -rf $(KERNEL_SYMLINK)
@@ -170,9 +176,6 @@ $(KERNEL_USR): $(KERNEL_HEADERS_INSTALL)
$(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_USR)
endif

$(KERNEL_OUT):
	mkdir -p $(KERNEL_OUT)

$(KERNEL_CONFIG): $(KERNEL_OUT)
	$(MAKE) -C $(TARGET_KERNEL_SOURCE) O=$(BUILD_ROOT_LOC)$(KERNEL_OUT) $(KERNEL_MAKE_ENV) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) $(real_cc) $(KERNEL_DEFCONFIG)
	$(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \
@@ -206,6 +209,17 @@ $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_OUT) $(KERNEL_HEADERS_INSTALL)
	$(clean-module-folder)
endif

$(KERNEL_DEBUGFS):
	KERNEL_DIR=$(TARGET_KERNEL_SOURCE) \
	DEFCONFIG=$(KERNEL_DEFCONFIG) \
	OUT_DIR=$(KERNEL_OUT) \
	ARCH=$(KERNEL_ARCH) \
	CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \
	DISABLE_DEBUGFS=$(KERNEL_DISABLE_DEBUGFS) \
	$(TARGET_KERNEL_SOURCE)/disable_dbgfs.sh \
	$(real_cc) \
	$(TARGET_KERNEL_MAKE_ARGS)

$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT)
	$(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \
			rm -f $(BUILD_ROOT_LOC)$(KERNEL_CONFIG) && \

disable_dbgfs.sh

0 → 100755
+29 −0
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

# disable debugfs for user builds
export MAKE_ARGS=$@

if [ ${DISABLE_DEBUGFS} == "true" ]; then
	echo "build variant ${TARGET_BUILD_VARIANT}"
	if [ ${TARGET_BUILD_VARIANT} == "user" ] && \
		[ ${ARCH} == "arm64" ]; then
		echo "combining fragments for user build"
		(cd $KERNEL_DIR && \
		ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE}\
		./scripts/kconfig/merge_config.sh \
		./arch/${ARCH}/configs/$DEFCONFIG \
		./arch/${ARCH}/configs/vendor/debugfs.config
		make ${MAKE_ARGS} ARCH=${ARCH} \
		CROSS_COMPILE=${CROSS_COMPILE} savedefconfig
		mv defconfig ./arch/${ARCH}/configs/$DEFCONFIG
		rm .config)
	else
		if [[ ${DEFCONFIG} == *"perf_defconfig" ]] && \
			[ ${ARCH} == "arm64" ]; then
			echo "resetting perf defconfig"
			(cd ${KERNEL_DIR} && \
			git checkout arch/$ARCH/configs/$DEFCONFIG)
		fi
	fi
fi