From: Simon Sickle Date: Thu, 7 Dec 2017 05:56:19 +0000 (-0600) Subject: Final cleanup before primetime X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=caf657633a0d497ee474c930dd11c54dee5bcd3f;p=GitHub%2Fmoto-9609%2Ftwrp_device_motorola_troika.git Final cleanup before primetime Signed-off-by: Simon Sickle --- diff --git a/BoardConfig.mk b/BoardConfig.mk index dd21e92..92b96bd 100755 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -29,7 +29,6 @@ TARGET_ARCH_VARIANT := armv8-a TARGET_CPU_ABI := arm64-v8a TARGET_CPU_ABI2 := TARGET_CPU_VARIANT := generic - TARGET_2ND_ARCH := arm TARGET_2ND_ARCH_VARIANT := armv7-a-neon TARGET_2ND_CPU_ABI := armeabi-v7a @@ -44,57 +43,60 @@ TARGET_BOOTLOADER_BOARD_NAME := msm8998 TARGET_NO_BOOTLOADER := true TARGET_USES_UEFI := true +# Platform +TARGET_BOARD_PLATFORM := msm8998 +TARGET_BOARD_PLATFORM_GPU := qcom-adreno540 + # Kernel BOARD_KERNEL_BASE := 0x00000000 -BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 sched_enable_power_aware=1 service_locator.enable=1 swiotlb=2048 androidboot.usbcontroller=a800000.dwc3 +BOARD_KERNEL_CMDLINE := androidboot.hardware=qcom user_debug=31 msm_rtb.filter=0x237 +BOARD_KERNEL_CMDLINE += ehci-hcd.park=3 lpm_levels.sleep_disabled=1 sched_enable_hmp=1 +BOARD_KERNEL_CMDLINE += sched_enable_power_aware=1 service_locator.enable=1 swiotlb=2048 androidboot.usbcontroller=a800000.dwc3 BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive BOARD_KERNEL_PAGESIZE := 4096 -BOARD_KERNEL_TAGS_OFFSET := 0x00000100 -BOARD_RAMDISK_OFFSET := 0x01000000 +BOARD_KERNEL_TAGS_OFFSET := 0x01E00000 +BOARD_RAMDISK_OFFSET := 0x02000000 TARGET_PREBUILT_KERNEL := device/oneplus/dumpling/prebuilt/Image.gz-dtb -# Platform -TARGET_BOARD_PLATFORM := msm8998 -TARGET_BOARD_PLATFORM_GPU := qcom-adreno540 - # Partitions -BOARD_BOOTIMAGE_PARTITION_SIZE := 67108864 -BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456 +BOARD_BOOTIMAGE_PARTITION_SIZE := 0x04000000 BOARD_RECOVERYIMAGE_PARTITION_SIZE := 67108864 BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472 -BOARD_USERDATAIMAGE_PARTITION_SIZE := 56908316672 -BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := f2fs -BOARD_FLASH_BLOCK_SIZE := 262144 # (BOARD_KERNEL_PAGESIZE * 64) + +BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456 +BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_PERSISTIMAGE_PARTITION_SIZE := 33554432 +BOARD_PERSISTIMAGE_FILE_SYSTEM_TYPE := ext4 +BOARD_USERDATAIMAGE_PARTITION_SIZE := 32212254720 +BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4 +TARGET_USERIMAGES_USE_EXT4 := true +TARGET_USERIMAGES_USE_F2FS := true +BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 +TARGET_COPY_OUT_VENDOR := vendor +BOARD_FLASH_BLOCK_SIZE := 131072 # Recovery BOARD_HAS_LARGE_FILESYSTEM := true -BOARD_HAS_NO_SELECT_BUTTON := true TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888" -TARGET_USERIMAGES_USE_EXT4 := true -TARGET_USERIMAGES_USE_F2FS := true +TARGET_RECOVERY_QCOM_RTC_FIX := true +BOARD_SUPPRESS_SECURE_ERASE := true # Crypto TARGET_HW_DISK_ENCRYPTION = true -TARGET_CRYPTFS_HW_PATH := device/oneplus/dumpling/cryptfs_hw -TW_INCLUDE_CRYPTO := true -TARGET_KEYMASTER_WAIT_FOR_QSEE := true # TWRP specific build flags +TW_THEME := portrait_hdpi +TW_SCREEN_BLANK_ON_BOOT := true +TW_INCLUDE_CRYPTO := true BOARD_HAS_NO_REAL_SDCARD := true RECOVERY_SDCARD_ON_DATA := true -TARGET_RECOVERY_QCOM_RTC_FIX := true -TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness" -TW_EXCLUDE_DEFAULT_USB_INIT := true -TW_EXCLUDE_SUPERSU := true -TW_EXTRA_LANGUAGES := true TW_INCLUDE_NTFS_3G := true TW_INPUT_BLACKLIST := "hbtp_vm" +TW_BRIGHTNESS_PATH := "/sys/class/leds/lcd-backlight/brightness" TW_MAX_BRIGHTNESS := 255 TW_DEFAULT_BRIGHTNESS := 140 TW_NO_USB_STORAGE := true -TW_SCREEN_BLANK_ON_BOOT := true -TW_THEME := portrait_hdpi -# Workaround for error copying vendor files to recovery ramdisk -BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 -TARGET_COPY_OUT_VENDOR := vendor -TW_IGNORE_MISC_WIPE_DATA := true +TW_EXCLUDE_DEFAULT_USB_INIT := true +TW_EXCLUDE_SUPERSU := true +TW_EXTRA_LANGUAGES := true +TW_IGNORE_MISC_WIPE_DATA := true \ No newline at end of file diff --git a/cryptfs_hw/Android.mk b/cryptfs_hw/Android.mk deleted file mode 100755 index 353e5f4..0000000 --- a/cryptfs_hw/Android.mk +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This contains the module build definitions for the hardware-specific -# components for this device. -# -# As much as possible, those components should be built unconditionally, -# with device-specific names to avoid collisions, to avoid device-specific -# bitrot and build breakages. Building a component unconditionally does -# *not* include it on all devices, so it is safe even with hardware-specific -# components. - -ifeq ($(TARGET_HW_DISK_ENCRYPTION),true) -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PROPRIETARY_MODULE := true - -sourceFiles := \ - cryptfs_hw.c - -commonSharedLibraries := \ - libcutils \ - libutils \ - libdl \ - libhardware -commonIncludes := \ - hardware/libhardware/include/hardware/ - -LOCAL_C_INCLUDES := $(commonIncludes) -LOCAL_SRC_FILES := $(sourceFiles) - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE:= libcryptfs_hw -LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib -LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64 -LOCAL_SHARED_LIBRARIES := $(commonSharedLibraries) - -LOCAL_MODULE_OWNER := qcom - -# USE_ICE_FOR_STORAGE_ENCRYPTION would be true in future if -# TARGET_USE_EMMC_USE_ICE is set -ifeq ($(TARGET_USE_UFS_ICE),true) -LOCAL_CFLAGS += -DUSE_ICE_FOR_STORAGE_ENCRYPTION -endif - -include $(BUILD_SHARED_LIBRARY) -endif \ No newline at end of file diff --git a/cryptfs_hw/cryptfs_hw.c b/cryptfs_hw/cryptfs_hw.c deleted file mode 100755 index c633e57..0000000 --- a/cryptfs_hw/cryptfs_hw.c +++ /dev/null @@ -1,284 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cutils/log.h" -#include "cutils/properties.h" -#include "cutils/android_reboot.h" -#include "keymaster_common.h" -#include "hardware.h" - -#if defined(__LP64__) -#define QSEECOM_LIBRARY_PATH "/vendor/lib64/libQSEEComAPI.so" -#else -#define QSEECOM_LIBRARY_PATH "/vendor/lib/libQSEEComAPI.so" -#endif - - -// When device comes up or when user tries to change the password, user can -// try wrong password upto a certain number of times. If user enters wrong -// password further, HW would wipe all disk encryption related crypto data -// and would return an error ERR_MAX_PASSWORD_ATTEMPTS to VOLD. VOLD would -// wipe userdata partition once this error is received. -#define ERR_MAX_PASSWORD_ATTEMPTS -10 -#define QSEECOM_DISK_ENCRYPTION 1 -#define QSEECOM_UFS_ICE_DISK_ENCRYPTION 3 -#define QSEECOM_SDCC_ICE_DISK_ENCRYPTION 4 -#define MAX_PASSWORD_LEN 32 -#define QCOM_ICE_STORAGE_UFS 1 -#define QCOM_ICE_STORAGE_SDCC 2 - -/* Operations that be performed on HW based device encryption key */ -#define SET_HW_DISK_ENC_KEY 1 -#define UPDATE_HW_DISK_ENC_KEY 2 - -#define QSEECOM_UP_CHECK_COUNT 10 - -static int loaded_library = 0; -static int (*qseecom_create_key)(int, void*); -static int (*qseecom_update_key)(int, void*, void*); -static int (*qseecom_wipe_key)(int); - -inline void* secure_memset(void* v, int c , size_t n) { - volatile unsigned char* p = (volatile unsigned char* )v; - while (n--) *p++ = c; - return v; -} - - -static int map_usage(int usage) -{ - int storage_type = is_ice_enabled(); - if (usage == QSEECOM_DISK_ENCRYPTION) { - if (storage_type == QCOM_ICE_STORAGE_UFS) { - return QSEECOM_UFS_ICE_DISK_ENCRYPTION; - } - else if (storage_type == QCOM_ICE_STORAGE_SDCC) { - return QSEECOM_SDCC_ICE_DISK_ENCRYPTION ; - } - } - return usage; -} - -static unsigned char* get_tmp_passwd(const char* passwd) -{ - int passwd_len = 0; - unsigned char * tmp_passwd = NULL; - if(passwd) { - tmp_passwd = (unsigned char*)malloc(MAX_PASSWORD_LEN); - if(tmp_passwd) { - memset(tmp_passwd, 0, MAX_PASSWORD_LEN); - passwd_len = strnlen(passwd, MAX_PASSWORD_LEN); - memcpy(tmp_passwd, passwd, passwd_len); - } else { - SLOGE("%s: Failed to allocate memory for tmp passwd \n", __func__); - } - } else { - SLOGE("%s: Passed argument is NULL \n", __func__); - } - return tmp_passwd; -} - -static int is_qseecom_up() -{ - int i = 0; - char value[PROPERTY_VALUE_MAX] = {0}; - - for (; imodule_api_version; -} - -int should_use_keymaster() -{ - /* HW FDE key would be tied to keymaster only if: - * New Keymaster is available - * keymaster partition exists on the device - */ - int rc = 0; - if (get_keymaster_version() != KEYMASTER_MODULE_API_VERSION_1_0) { - SLOGI("Keymaster version is not 1.0"); - return rc; - } - - return 1; -} diff --git a/cryptfs_hw/cryptfs_hw.h b/cryptfs_hw/cryptfs_hw.h deleted file mode 100755 index 9862212..0000000 --- a/cryptfs_hw/cryptfs_hw.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (c) 2014, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __CRYPTFS_HW_H_ -#define __CRYPTFS_HW_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int set_hw_device_encryption_key(const char*, const char*); -int update_hw_device_encryption_key(const char*, const char*, const char*); -int clear_hw_device_encryption_key(); -unsigned int is_hw_disk_encryption(const char*); -unsigned int is_hw_fde_enabled(void); -int is_ice_enabled(void); -int should_use_keymaster(); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/recovery/root/init.recovery.qcom.rc b/recovery/root/init.recovery.qcom.rc index 8a5092e..833b66c 100755 --- a/recovery/root/init.recovery.qcom.rc +++ b/recovery/root/init.recovery.qcom.rc @@ -32,6 +32,7 @@ on fs chown system drmrpc /dev/qseecom chmod 0664 /dev/ion chown system system /dev/ion + # Requires patch https://review.lineageos.org/#/c/176691/ to install_keyring install_keyring # Separate copy needed to use /sbin/linker64 instead of /system/bin/linker64 @@ -42,4 +43,4 @@ service sbinqseecomd /sbin/qseecomd seclabel u:r:recovery:s0 on boot - start sbinqseecomd + start sbinqseecomd \ No newline at end of file diff --git a/untitled.make b/untitled.make deleted file mode 100644 index b9e4b8d..0000000 --- a/untitled.make +++ /dev/null @@ -1,35 +0,0 @@ - -# -# Copyright 2014 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This contains the module build definitions for the hardware-specific -# components for this device. -# -# As much as possible, those components should be built unconditionally, -# with device-specific names to avoid collisions, to avoid device-specific -# bitrot and build breakages. Building a component unconditionally does -# *not* include it on all devices, so it is safe even with hardware-specific -# components. - -LOCAL_PATH := $(call my-dir) - -ifneq ($(filter mata, $(TARGET_DEVICE)),) - -include $(call all-makefiles-under,$(LOCAL_PATH)) - -include $(CLEAR_VARS) - -endif \ No newline at end of file