Просмотр исходного кода

Work-in-progress! Port to OrangeFox for klte

Darth9 6 лет назад
Родитель
Сommit
5d2dc8f79a
10 измененных файлов с 136 добавлено и 64 удалено
  1. 28 9
      BoardConfig.mk
  2. 3 10
      README.md
  3. 0 21
      bootimg.mk
  4. 6 2
      init/Android.mk
  5. 16 7
      init/init_klte.cpp
  6. 6 6
      omni.dependencies
  7. 0 0
      prebuilt/dtb.img
  8. 0 0
      prebuilt/zImage
  9. 11 7
      recovery.fstab
  10. 66 2
      vendorsetup.sh

+ 28 - 9
BoardConfig.mk

@@ -1,3 +1,22 @@
+#
+# Copyright (C) 2015-2017 The Teamwin Recovery Project
+#
+# Copyright (C) 2020 OrangeFox Recovery 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.
+#
+#
+
 USE_CAMERA_STUB := true
 USE_CAMERA_STUB := true
 
 
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_BOOTLOADER := true
@@ -8,8 +27,8 @@ TARGET_BOARD_PLATFORM := msm8974
 TARGET_BOARD_PLATFORM_GPU := qcom-adreno330
 TARGET_BOARD_PLATFORM_GPU := qcom-adreno330
 
 
 # Flags
 # Flags
-TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
-TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp
+#TARGET_GLOBAL_CFLAGS += -mfpu=neon -mfloat-abi=softfp
+#TARGET_GLOBAL_CPPFLAGS += -mfpu=neon -mfloat-abi=softfp
 COMMON_GLOBAL_CFLAGS += -DREFRESH_RATE=60 -DQCOM_HARDWARE -DNO_SECURE_DISCARD
 COMMON_GLOBAL_CFLAGS += -DREFRESH_RATE=60 -DQCOM_HARDWARE -DNO_SECURE_DISCARD
 
 
 # Architecture
 # Architecture
@@ -33,15 +52,16 @@ BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x2E59F7C00 # 0x2E59FBC00 - 16384 (footer)
 BOARD_CACHEIMAGE_PARTITION_SIZE    := 0x00C800000
 BOARD_CACHEIMAGE_PARTITION_SIZE    := 0x00C800000
 BOARD_FLASH_BLOCK_SIZE := 131072
 BOARD_FLASH_BLOCK_SIZE := 131072
 
 
-TARGET_PREBUILT_KERNEL := device/samsung/klte/zImage
-TARGET_PREBUILT_DTB := device/samsung/klte/dtb.img
+TARGET_PREBUILT_KERNEL := device/samsung/klte/prebuilt/zImage
+TARGET_PREBUILT_DTB := device/samsung/klte/prebuilt/dtb.img
 
 
 # Use this flag if the board has a ext4 partition larger than 2gb
 # Use this flag if the board has a ext4 partition larger than 2gb
 BOARD_HAS_LARGE_FILESYSTEM := true
 BOARD_HAS_LARGE_FILESYSTEM := true
 TARGET_USERIMAGES_USE_EXT4 := true
 TARGET_USERIMAGES_USE_EXT4 := true
 TARGET_USERIMAGES_USE_F2FS := true
 TARGET_USERIMAGES_USE_F2FS := true
 BOARD_SUPPRESS_SECURE_ERASE := true
 BOARD_SUPPRESS_SECURE_ERASE := true
-BOARD_CUSTOM_BOOTIMG_MK :=  device/samsung/klte/bootimg.mk
+
+#BOARD_CUSTOM_BOOTIMG_MK :=  device/samsung/klte/bootimg.mk
 
 
 # TWRP specific build flags
 # TWRP specific build flags
 TW_THEME := portrait_hdpi
 TW_THEME := portrait_hdpi
@@ -56,20 +76,19 @@ TW_DEFAULT_BRIGHTNESS := 162
 TW_NO_REBOOT_BOOTLOADER := true
 TW_NO_REBOOT_BOOTLOADER := true
 TW_HAS_DOWNLOAD_MODE := true
 TW_HAS_DOWNLOAD_MODE := true
 TW_NO_EXFAT_FUSE := true
 TW_NO_EXFAT_FUSE := true
-#TW_INCLUDE_NTFS_3G := true
 TW_MTP_DEVICE := "/dev/mtp_usb"
 TW_MTP_DEVICE := "/dev/mtp_usb"
 TW_EXCLUDE_SUPERSU := true
 TW_EXCLUDE_SUPERSU := true
 
 
 # Encryption support
 # Encryption support
 TW_INCLUDE_CRYPTO := true
 TW_INCLUDE_CRYPTO := true
-#TW_INCLUDE_CRYPTO_SAMSUNG := true
 TARGET_HW_DISK_ENCRYPTION := true
 TARGET_HW_DISK_ENCRYPTION := true
 TARGET_KEYMASTER_WAIT_FOR_QSEE := true
 TARGET_KEYMASTER_WAIT_FOR_QSEE := true
-#TWRP_INCLUDE_LOGCAT := true
-#TARGET_USES_LOGD := true
 
 
 # Init properties from bootloader version, ex. model info
 # Init properties from bootloader version, ex. model info
 TARGET_UNIFIED_DEVICE := true
 TARGET_UNIFIED_DEVICE := true
 TARGET_INIT_VENDOR_LIB := libinit_klte
 TARGET_INIT_VENDOR_LIB := libinit_klte
 TARGET_RECOVERY_DEVICE_MODULES := libinit_klte
 TARGET_RECOVERY_DEVICE_MODULES := libinit_klte
 TARGET_LIBINIT_DEFINES_FILE := $(DEVICE_TREE)/init/init_klte.cpp
 TARGET_LIBINIT_DEFINES_FILE := $(DEVICE_TREE)/init/init_klte.cpp
+#
+LZMA_RAMDISK_TARGETS := recovery
+#

+ 3 - 10
README.md

@@ -1,15 +1,8 @@
 ## TWRP device tree for Galaxy S5 (International Qualcomm, Americas, and Oceanic)
 ## TWRP device tree for Galaxy S5 (International Qualcomm, Americas, and Oceanic)
 
 
-Add to `.repo/local_manifests/klte.xml`:
-
-```xml
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest>
-	<project path="device/samsung/klte" name="android_device_samsung_klte" remote="TeamWin" revision="android-6.0" />
-</manifest>
-```
-
-Then run `repo sync` to check it out.
+## This device tree is work-in-progress for OrangeFox!
 
 
 Kernel sources are available at: https://github.com/jcadduono/nethunter_kernel_klte/tree/twrp-6.0
 Kernel sources are available at: https://github.com/jcadduono/nethunter_kernel_klte/tree/twrp-6.0
 
 
+If you get errors about incompatible declarations when busybox is being built, then open "external/busybox/networking/arp.c" and remove the line that says: "#include <arpa/inet.h>"
+

+ 0 - 21
bootimg.mk

@@ -1,21 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-FLASH_IMAGE_TARGET ?= $(PRODUCT_OUT)/recovery.tar
-
-ifdef TARGET_PREBUILT_DTB
-	BOARD_MKBOOTIMG_ARGS += --dt $(TARGET_PREBUILT_DTB)
-endif
-
-$(recovery_ramdisk): $(recovery_uncompressed_ramdisk)
-	@echo -e ${CL_GRN}"----- Compressing recovery ramdisk (xz) ------"${CL_RST}
-	$(hide) xz -9c --format=lzma --lzma1=dict=16MiB $< > $@
-
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DTIMAGE_TARGET) $(recovery_kernel) $(recovery_ramdisk)
-	@echo -e ${CL_GRN}"----- Making recovery image ------"${CL_RST}
-	$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --ramdisk $(recovery_ramdisk)
-	@echo -e ${CL_CYN}"Made recovery image: $@"${CL_RST}
-	@echo -e ${CL_GRN}"----- Lying about SEAndroid state to Samsung bootloader ------"${CL_RST}
-	$(hide) echo -n "SEANDROIDENFORCE" >> $(INSTALLED_RECOVERYIMAGE_TARGET)
-	$(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw)
-	$(hide) tar -C $(PRODUCT_OUT) -H ustar -c recovery.img > $(FLASH_IMAGE_TARGET)
-	@echo -e ${CL_CYN}"Made Odin flashable recovery tar: ${FLASH_IMAGE_TARGET}"${CL_RST}

+ 6 - 2
init/Android.mk

@@ -1,9 +1,13 @@
 LOCAL_PATH := $(call my-dir)
 LOCAL_PATH := $(call my-dir)
-
 include $(CLEAR_VARS)
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES := system/core/init
+LOCAL_C_INCLUDES := \
+    system/core/base/include \
+    system/core/init \
+    external/selinux/libselinux/include
 LOCAL_CFLAGS := -Wall
 LOCAL_CFLAGS := -Wall
 LOCAL_SRC_FILES := init_klte.cpp
 LOCAL_SRC_FILES := init_klte.cpp
 LOCAL_MODULE := libinit_klte
 LOCAL_MODULE := libinit_klte
+LOCAL_STATIC_LIBRARIES := \
+    libselinux
 include $(BUILD_STATIC_LIBRARY)
 include $(BUILD_STATIC_LIBRARY)

+ 16 - 7
init/init_klte.cpp

@@ -1,6 +1,8 @@
 /*
 /*
    Copyright (c) 2013, The Linux Foundation. All rights reserved.
    Copyright (c) 2013, The Linux Foundation. All rights reserved.
 
 
+   Copyright (C) 2020 OrangeFox Recovery Project
+
    Redistribution and use in source and binary forms, with or without
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are
    modification, are permitted provided that the following conditions are
    met:
    met:
@@ -27,17 +29,21 @@
    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 
 
-#include <stdlib.h>
-
-#include "vendor_init.h"
+#include <android-base/properties.h>
 #include "property_service.h"
 #include "property_service.h"
-#include "util.h"
+#include <android-base/logging.h>
+
+using android::base::GetProperty;
+using android::init::property_set;
+
+namespace android {
+namespace init {
 
 
 void vendor_load_properties()
 void vendor_load_properties()
 {
 {
-	char bootloader[PROP_VALUE_MAX];
-
-	property_get("ro.bootloader", bootloader);
+	char bootloader[92];
+	std::string BL = GetProperty("ro.bootloader", "");
+	strcpy (bootloader, BL.c_str());
 
 
 	if (strstr(bootloader, "G900A")) {
 	if (strstr(bootloader, "G900A")) {
 		/* klteatt */
 		/* klteatt */
@@ -126,3 +132,6 @@ void vendor_load_properties()
 	}
 	}
 	property_set("ro.product.device", "klte");
 	property_set("ro.product.device", "klte");
 }
 }
+
+}  // namespace init
+}  // namespace android

+ 6 - 6
omni.dependencies

@@ -1,8 +1,8 @@
 [
 [
-	{
-		"remote":"github",
-		"repository":"CyanogenMod/android_device_qcom_common",
-		"target_path":"device/qcom/common",
-		"revision":"cm-13.0"
-	}
+  {
+    "remote":"github",
+    "repository": "TeamWin/android_device_qcom_common",
+    "target_path": "device/qcom/common",
+    "revision":"android-8.1"
+  }
 ]
 ]

+ 0 - 0
dtb.img → prebuilt/dtb.img


+ 0 - 0
zImage → prebuilt/zImage


+ 11 - 7
recovery.fstab

@@ -1,13 +1,17 @@
+#
 /modem		vfat		/dev/block/platform/msm_sdcc.1/by-name/modem /dev/block/platform/msm_sdcc.1/by-name/mdm	flags=backup=1;display="Modem";fsflags=ro,context=u:object_r:firmware_file:s0
 /modem		vfat		/dev/block/platform/msm_sdcc.1/by-name/modem /dev/block/platform/msm_sdcc.1/by-name/mdm	flags=backup=1;display="Modem";fsflags=ro,context=u:object_r:firmware_file:s0
-/firmware		vfat		/dev/block/platform/msm_sdcc.1/by-name/apnhlos	flags=backup=1;subpartitionof=/modem;mounttodecrypt;fsflags=ro,context=u:object_r:firmware_file:s0
+/firmware	vfat		/dev/block/platform/msm_sdcc.1/by-name/apnhlos	flags=backup=1;subpartitionof=/modem;mounttodecrypt;fsflags=ro,context=u:object_r:firmware_file:s0
 /boot		emmc		/dev/block/platform/msm_sdcc.1/by-name/boot
 /boot		emmc		/dev/block/platform/msm_sdcc.1/by-name/boot
-/recovery		emmc		/dev/block/platform/msm_sdcc.1/by-name/recovery
+/recovery	emmc		/dev/block/platform/msm_sdcc.1/by-name/recovery
 /system		ext4		/dev/block/platform/msm_sdcc.1/by-name/system
 /system		ext4		/dev/block/platform/msm_sdcc.1/by-name/system
 /data		ext4		/dev/block/platform/msm_sdcc.1/by-name/userdata	flags=encryptable=footer;length=-16384
 /data		ext4		/dev/block/platform/msm_sdcc.1/by-name/userdata	flags=encryptable=footer;length=-16384
+#/system_image   emmc      	/dev/block/platform/msm_sdcc.1/by-name/system   flags=backup=1;flashimg=1
+#/storage        ext4      	/data/media/0                  		     	flags=display="Internal Storage";usermrf;backup=1;fsflags="bind";removable
 /cache		ext4		/dev/block/platform/msm_sdcc.1/by-name/cache
 /cache		ext4		/dev/block/platform/msm_sdcc.1/by-name/cache
-/efs			ext4		/dev/block/platform/msm_sdcc.1/by-name/efs		flags=backup=1;display="EFS"
-/modemst1		emmc		/dev/block/platform/msm_sdcc.1/by-name/modemst1	flags=backup=1;subpartitionof=/efs
-/modemst2		emmc		/dev/block/platform/msm_sdcc.1/by-name/modemst2	flags=backup=1;subpartitionof=/efs
-/external_sd	vfat		/dev/block/mmcblk1p1 /dev/block/mmcblk1			flags=display="Micro SDcard";storage;wipeingui;removable
-/usbstorage	vfat		/dev/block/sda1 /dev/block/sda				flags=display="USB Storage";storage;wipeingui;removable
+/efs		ext4		/dev/block/platform/msm_sdcc.1/by-name/efs	flags=backup=1;display="EFS"
+/modemst1	emmc		/dev/block/platform/msm_sdcc.1/by-name/modemst1	flags=backup=1;subpartitionof=/efs
+/modemst2	emmc		/dev/block/platform/msm_sdcc.1/by-name/modemst2	flags=backup=1;subpartitionof=/efs
+/sdcard1	vfat		/dev/block/mmcblk1p1 /dev/block/mmcblk1		flags=display="MicroSD";storage;wipeingui;removable
+/usb-otg	vfat		/dev/block/sda1 /dev/block/sda			flags=display="USB Storage";storage;wipeingui;removable
 /misc		emmc		/dev/block/platform/msm_sdcc.1/by-name/fota
 /misc		emmc		/dev/block/platform/msm_sdcc.1/by-name/fota
+#

+ 66 - 2
vendorsetup.sh

@@ -1,2 +1,66 @@
-add_lunch_combo omni_klte-eng
-add_lunch_combo omni_klte-userdebug
+#
+#	This file is part of the OrangeFox Recovery Project
+# 	Copyright (C) 2020 The OrangeFox Recovery Project
+#	
+#	OrangeFox is free software: you can redistribute it and/or modify
+#	it under the terms of the GNU General Public License as published by
+#	the Free Software Foundation, either version 3 of the License, or
+#	any later version.
+#
+#	OrangeFox is distributed in the hope that it will be useful,
+#	but WITHOUT ANY WARRANTY; without even the implied warranty of
+#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#	GNU General Public License for more details.
+#
+# 	This software is released under GPL version 3 or any later version.
+#	See <http://www.gnu.org/licenses/>.
+# 	
+# 	Please maintain this if you use this script or any part of it
+#
+FDEVICE="klte"
+if [ "$1" = "$FDEVICE" -o "$FOX_BUILD_DEVICE" = "$FDEVICE" ]; then
+	export TARGET_ARCH=arm
+	export FOX_RECOVERY_INSTALL_PARTITION=/dev/block/platform/msm_sdcc.1/by-name/recovery
+        export OF_VANILLA_BUILD=1
+    	export OF_SKIP_ORANGEFOX_PROCESS=1
+    	export OF_DISABLE_MIUI_SPECIFIC_FEATURES=1
+    	export OF_DONT_PATCH_ON_FRESH_INSTALLATION=1
+    	export OF_DONT_PATCH_ENCRYPTED_DEVICE=1
+    	export OF_KEEP_DM_VERITY_FORCED_ENCRYPTION=1
+	export FOX_REMOVE_AAPT=1
+	unset FOX_REPLACE_BUSYBOX_PS
+	#
+        export PLATFORM_VERSION="16.1.0"
+   	export PLATFORM_SECURITY_PATCH="2099-12-31"
+	export TW_DEFAULT_LANGUAGE="en"
+	export FOX_USE_TWRP_RECOVERY_IMAGE_BUILDER=1
+	export OF_USE_MAGISKBOOT=1
+	export OF_USE_MAGISKBOOT_FOR_ALL_PATCHES=1
+	export OF_NO_TREBLE_COMPATIBILITY_CHECK=1
+	export OF_DONT_PATCH_ENCRYPTED_DEVICE=1	
+	
+	#
+	export FOX_USE_BASH_SHELL=0
+	export FOX_ASH_IS_BASH=0
+	export FOX_USE_ZIP_BINARY=0
+	export FOX_USE_NANO_EDITOR=0
+	export FOX_USE_TAR_BINARY=0
+	#
+
+        # -- add settings for R11 --
+        export FOX_R11=1
+        export FOX_ADVANCED_SECURITY=1
+        export OF_QUICK_BACKUP_LIST="/boot;/data;/system;"
+        # -- end R11 settings --
+
+	# let's see what are our build VARs
+	if [ -n "$FOX_BUILD_LOG_FILE" -a -f "$FOX_BUILD_LOG_FILE" ]; then
+  	   export | grep "FOX" >> $FOX_BUILD_LOG_FILE
+  	   export | grep "OF_" >> $FOX_BUILD_LOG_FILE
+  	   export | grep "TW_" >> $FOX_BUILD_LOG_FILE
+  	   export | grep "TARGET_" >> $FOX_BUILD_LOG_FILE
+  	fi
+	add_lunch_combo omni_"$FDEVICE"-eng
+	add_lunch_combo omni_"$FDEVICE"-userdebug
+fi
+#