diff options
| author | Moyster <oysterized@gmail.com> | 2016-11-06 18:12:33 +0100 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-11-06 18:12:33 +0100 |
| commit | 25121d627a60c3b8e2bda89c5e70c957ff40a406 (patch) | |
| tree | 267bf98d26adf9f8cfaa1717c1b2ba35cde4934c | |
| parent | cf3c811a03728e9b79abc1adf66861a0a3a6c6b9 (diff) | |
remove unused patch fix-boot-for-mtk.patch
| -rw-r--r-- | patches/apply-patch.sh | 3 | ||||
| -rw-r--r-- | patches/system_core/fix-boot-for-mtk.patch | 1137 |
2 files changed, 1 insertions, 1139 deletions
diff --git a/patches/apply-patch.sh b/patches/apply-patch.sh index 3ca7fb8..ae77732 100644 --- a/patches/apply-patch.sh +++ b/patches/apply-patch.sh @@ -31,10 +31,9 @@ cd packages/services/Telephony git apply -v ../../../device/mediatek/mt6753_common/patches/packages_services_telephony/NeedsFakeIccid.patch cd ../../.. cd system/core -#git apply -v ../../device/mediatek/mt6753_common/patches/system_core/fix-boot-for-mtk.patch git apply -v ../../device/mediatek/mt6753_common/patches/system_core/prevent-MTK-audio-and-silead-fingerprint-libs-from-spamming-log.patch cd ../.. cd system/netd git apply -v ../../device/mediatek/mt6753_common/patches/system_netd/hotpost-fix.patch cd ../.. -echo Patches Applied Successfully! +echo -e "Patches Applied Successfully!\n" diff --git a/patches/system_core/fix-boot-for-mtk.patch b/patches/system_core/fix-boot-for-mtk.patch deleted file mode 100644 index d7e71fd..0000000 --- a/patches/system_core/fix-boot-for-mtk.patch +++ /dev/null @@ -1,1137 +0,0 @@ -diff -ur core/healthd/BatteryMonitor.cpp core_mtk/healthd/BatteryMonitor.cpp ---- core/healthd/BatteryMonitor.cpp 2016-01-22 15:55:46.497330000 -0800 -+++ core_mtk/healthd/BatteryMonitor.cpp 2016-01-23 05:28:26.435234000 -0800 -@@ -198,7 +198,11 @@ - props.batteryLevel = mBatteryFixedCapacity ? - mBatteryFixedCapacity : - getIntField(mHealthdConfig->batteryCapacityPath); -+#ifndef MTK_HARDWARE - props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; -+#else -+ props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath); -+#endif - - props.batteryTemperature = mBatteryFixedTemperature ? - mBatteryFixedTemperature : -Only in core_mtk/include/cutils: alelog.h -Only in core_mtk/include/cutils: xlog.h -diff -ur core/include/log/log.h core_mtk/include/log/log.h ---- core/include/log/log.h 2016-01-22 15:55:46.497330000 -0800 -+++ core_mtk/include/log/log.h 2016-01-23 05:28:26.435234000 -0800 -@@ -534,12 +534,6 @@ - #define android_btWriteLog(tag, type, payload, len) \ - __android_log_btwrite(tag, type, payload, len) - --#define android_errorWriteLog(tag, subTag) \ -- __android_log_error_write(tag, subTag, -1, NULL, 0) -- --#define android_errorWriteWithInfoLog(tag, subTag, uid, data, dataLen) \ -- __android_log_error_write(tag, subTag, uid, data, dataLen) -- - // TODO: remove these prototypes and their users - #define android_testLog(prio, tag) (1) - #define android_writevLog(vec,num) do{}while(0) -@@ -563,9 +557,6 @@ - #define sizeof_log_id_t sizeof(typeof_log_id_t) - #define typeof_log_id_t unsigned char - --int __android_log_error_write(int tag, const char *subTag, int32_t uid, const char *data, -- uint32_t dataLen); -- - /* - * Send a simple string to the log. - */ -diff -ur core/init/Android.mk core_mtk/init/Android.mk ---- core/init/Android.mk 2016-01-22 15:55:46.501330000 -0800 -+++ core_mtk/init/Android.mk 2016-01-23 05:28:26.439234000 -0800 -@@ -29,6 +29,11 @@ - LOCAL_CFLAGS += -DALLOW_LOCAL_PROP_OVERRIDE=1 -DALLOW_DISABLE_SELINUX=1 - endif - -+# Enable MTK stuff -+ifeq ($(BOARD_HAS_MTK_HARDWARE), true) -+LOCAL_CFLAGS += -DMTK_HARDWARE -+endif -+ - # Enable ueventd logging - #LOCAL_CFLAGS += -DLOG_UEVENTS=1 - -diff -ur core/init/init.c core_mtk/init/init.c ---- core/init/init.c 2016-01-22 15:55:46.505330000 -0800 -+++ core_mtk/init/init.c 2016-01-23 05:28:26.443234000 -0800 -@@ -57,7 +57,6 @@ - #include "util.h" - #include "ueventd.h" - #include "watchdogd.h" --#include "vendor_init.h" - - struct selabel_handle *sehandle; - struct selabel_handle *sehandle_prop; -@@ -515,9 +514,6 @@ - - void handle_control_message(const char *msg, const char *arg) - { -- if (!vendor_handle_control_message(msg, arg)) -- return; -- - if (!strcmp(msg,"start")) { - msg_start(arg); - } else if (!strcmp(msg,"stop")) { -@@ -927,6 +923,9 @@ - static bool selinux_is_enforcing(void) - { - #ifdef ALLOW_DISABLE_SELINUX -+ /* things are getting hairier... disable during initial porting */ -+ return false; -+ - char tmp[PROP_VALUE_MAX]; - - if (property_get("ro.boot.selinux", tmp) == 0) { -@@ -1010,7 +1009,11 @@ - } - - selinux_init_all_handles(); -+#ifdef MTK_HARDWARE -+ bool is_enforcing = false; // Always making selinux permissive for MTK's rild -+#else - bool is_enforcing = selinux_is_enforcing(); -+#endif - INFO("SELinux: security_setenforce(%d)\n", is_enforcing); - security_setenforce(is_enforcing); - } -diff -ur core/init/vendor_init.c core_mtk/init/vendor_init.c ---- core/init/vendor_init.c 2016-01-22 15:55:46.505330000 -0800 -+++ core_mtk/init/vendor_init.c 2016-01-23 05:28:26.443234000 -0800 -@@ -28,7 +28,6 @@ - */ - - #include "vendor_init.h" --#include <errno.h> - - /* init vendor override stubs */ - -@@ -36,9 +35,3 @@ - void vendor_load_properties() - { - } -- --__attribute__ ((weak)) --int vendor_handle_control_message(const char *msg, const char *arg) --{ -- return -ENOSYS; --} -diff -ur core/init/vendor_init.h core_mtk/init/vendor_init.h ---- core/init/vendor_init.h 2016-01-22 15:55:46.505330000 -0800 -+++ core_mtk/init/vendor_init.h 2016-01-23 05:28:26.443234000 -0800 -@@ -30,5 +30,4 @@ - #ifndef __INIT_VENDOR__H__ - #define __INIT_VENDOR__H__ - extern void vendor_load_properties(void); --extern int vendor_handle_control_message(const char *msg, const char *arg); - #endif /* __INIT_VENDOR__H__ */ -diff -ur core/liblog/Android.mk core_mtk/liblog/Android.mk ---- core/liblog/Android.mk 2016-01-22 15:55:46.513330000 -0800 -+++ core_mtk/liblog/Android.mk 2016-01-23 05:28:26.447234000 -0800 -@@ -17,7 +17,7 @@ - include $(CLEAR_VARS) - - ifneq ($(TARGET_USES_LOGD),false) --liblog_sources := logd_write.c log_event_write.c -+liblog_sources := logd_write.c - else - liblog_sources := logd_write_kern.c - endif -diff -ur core/liblog/tests/liblog_test.cpp core_mtk/liblog/tests/liblog_test.cpp ---- core/liblog/tests/liblog_test.cpp 2016-01-22 15:55:46.513330000 -0800 -+++ core_mtk/liblog/tests/liblog_test.cpp 2016-01-23 05:28:26.447234000 -0800 -@@ -682,398 +682,3 @@ - - android_log_format_free(p_format); - } -- --static inline int32_t get4LE(const char* src) --{ -- return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); --} -- --TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__typical) { -- const int TAG = 123456781; -- const char SUBTAG[] = "test-subtag"; -- const int UID = -1; -- const int DATA_LEN = 200; -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_LT(0, android_errorWriteWithInfoLog( -- TAG, SUBTAG, UID, max_payload_buf, DATA_LEN)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag != TAG) { -- continue; -- } -- -- // List type -- ASSERT_EQ(EVENT_TYPE_LIST, eventData[0]); -- eventData++; -- -- // Number of elements in list -- ASSERT_EQ(3, eventData[0]); -- eventData++; -- -- // Element #1: string type for subtag -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- ASSERT_EQ((int) strlen(SUBTAG), get4LE(eventData)); -- eventData +=4; -- -- if (memcmp(SUBTAG, eventData, strlen(SUBTAG))) { -- continue; -- } -- eventData += strlen(SUBTAG); -- -- // Element #2: int type for uid -- ASSERT_EQ(EVENT_TYPE_INT, eventData[0]); -- eventData++; -- -- ASSERT_EQ(UID, get4LE(eventData)); -- eventData += 4; -- -- // Element #3: string type for data -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- ASSERT_EQ(DATA_LEN, get4LE(eventData)); -- eventData += 4; -- -- if (memcmp(max_payload_buf, eventData, DATA_LEN)) { -- continue; -- } -- -- ++count; -- } -- -- EXPECT_EQ(1, count); -- -- android_logger_list_close(logger_list); --} -- --TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__data_too_large) { -- const int TAG = 123456782; -- const char SUBTAG[] = "test-subtag"; -- const int UID = -1; -- const int DATA_LEN = sizeof(max_payload_buf); -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_LT(0, android_errorWriteWithInfoLog( -- TAG, SUBTAG, UID, max_payload_buf, DATA_LEN)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- char *original = eventData; -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag != TAG) { -- continue; -- } -- -- // List type -- ASSERT_EQ(EVENT_TYPE_LIST, eventData[0]); -- eventData++; -- -- // Number of elements in list -- ASSERT_EQ(3, eventData[0]); -- eventData++; -- -- // Element #1: string type for subtag -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- ASSERT_EQ((int) strlen(SUBTAG), get4LE(eventData)); -- eventData +=4; -- -- if (memcmp(SUBTAG, eventData, strlen(SUBTAG))) { -- continue; -- } -- eventData += strlen(SUBTAG); -- -- // Element #2: int type for uid -- ASSERT_EQ(EVENT_TYPE_INT, eventData[0]); -- eventData++; -- -- ASSERT_EQ(UID, get4LE(eventData)); -- eventData += 4; -- -- // Element #3: string type for data -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- size_t dataLen = get4LE(eventData); -- eventData += 4; -- -- if (memcmp(max_payload_buf, eventData, dataLen)) { -- continue; -- } -- eventData += dataLen; -- -- // 4 bytes for the tag, and 512 bytes for the log since the max_payload_buf should be -- // truncated. -- ASSERT_EQ(4 + 512, eventData - original); -- -- ++count; -- } -- -- EXPECT_EQ(1, count); -- -- android_logger_list_close(logger_list); --} -- --TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__null_data) { -- const int TAG = 123456783; -- const char SUBTAG[] = "test-subtag"; -- const int UID = -1; -- const int DATA_LEN = 200; -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_GT(0, android_errorWriteWithInfoLog( -- TAG, SUBTAG, UID, NULL, DATA_LEN)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag == TAG) { -- // This tag should not have been written because the data was null -- count++; -- break; -- } -- } -- -- EXPECT_EQ(0, count); -- -- android_logger_list_close(logger_list); --} -- --TEST(liblog, android_errorWriteWithInfoLog__android_logger_list_read__subtag_too_long) { -- const int TAG = 123456784; -- const char SUBTAG[] = "abcdefghijklmnopqrstuvwxyz now i know my abc"; -- const int UID = -1; -- const int DATA_LEN = 200; -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_LT(0, android_errorWriteWithInfoLog( -- TAG, SUBTAG, UID, max_payload_buf, DATA_LEN)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag != TAG) { -- continue; -- } -- -- // List type -- ASSERT_EQ(EVENT_TYPE_LIST, eventData[0]); -- eventData++; -- -- // Number of elements in list -- ASSERT_EQ(3, eventData[0]); -- eventData++; -- -- // Element #1: string type for subtag -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- // The subtag is longer than 32 and should be truncated to that. -- ASSERT_EQ(32, get4LE(eventData)); -- eventData +=4; -- -- if (memcmp(SUBTAG, eventData, 32)) { -- continue; -- } -- eventData += 32; -- -- // Element #2: int type for uid -- ASSERT_EQ(EVENT_TYPE_INT, eventData[0]); -- eventData++; -- -- ASSERT_EQ(UID, get4LE(eventData)); -- eventData += 4; -- -- // Element #3: string type for data -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- ASSERT_EQ(DATA_LEN, get4LE(eventData)); -- eventData += 4; -- -- if (memcmp(max_payload_buf, eventData, DATA_LEN)) { -- continue; -- } -- -- ++count; -- } -- -- EXPECT_EQ(1, count); -- -- android_logger_list_close(logger_list); --} -- --TEST(liblog, android_errorWriteLog__android_logger_list_read__success) { -- const int TAG = 123456785; -- const char SUBTAG[] = "test-subtag"; -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_LT(0, android_errorWriteLog(TAG, SUBTAG)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag != TAG) { -- continue; -- } -- -- // List type -- ASSERT_EQ(EVENT_TYPE_LIST, eventData[0]); -- eventData++; -- -- // Number of elements in list -- ASSERT_EQ(3, eventData[0]); -- eventData++; -- -- // Element #1: string type for subtag -- ASSERT_EQ(EVENT_TYPE_STRING, eventData[0]); -- eventData++; -- -- ASSERT_EQ((int) strlen(SUBTAG), get4LE(eventData)); -- eventData +=4; -- -- if (memcmp(SUBTAG, eventData, strlen(SUBTAG))) { -- continue; -- } -- ++count; -- } -- -- EXPECT_EQ(1, count); -- -- android_logger_list_close(logger_list); --} -- --TEST(liblog, android_errorWriteLog__android_logger_list_read__null_subtag) { -- const int TAG = 123456786; -- struct logger_list *logger_list; -- -- pid_t pid = getpid(); -- -- ASSERT_TRUE(NULL != (logger_list = android_logger_list_open( -- LOG_ID_EVENTS, O_RDONLY | O_NDELAY, 1000, pid))); -- -- ASSERT_GT(0, android_errorWriteLog(TAG, NULL)); -- -- sleep(2); -- -- int count = 0; -- -- for (;;) { -- log_msg log_msg; -- if (android_logger_list_read(logger_list, &log_msg) <= 0) { -- break; -- } -- -- char *eventData = log_msg.msg(); -- -- // Tag -- int tag = get4LE(eventData); -- eventData += 4; -- -- if (tag == TAG) { -- // This tag should not have been written because the data was null -- count++; -- break; -- } -- } -- -- EXPECT_EQ(0, count); -- -- android_logger_list_close(logger_list); --} -diff -ur core/libziparchive/zip_archive.cc core_mtk/libziparchive/zip_archive.cc ---- core/libziparchive/zip_archive.cc 2016-01-22 15:55:46.569330000 -0800 -+++ core_mtk/libziparchive/zip_archive.cc 2016-01-23 05:28:26.459234000 -0800 -@@ -1124,27 +1124,7 @@ - return kIoError; - } - -- int result = 0; --#if defined(__linux__) -- // Make sure we have enough space on the volume to extract the compressed -- // entry. Note that the call to ftruncate below will change the file size but -- // will not allocate space on disk. -- // Note: fallocate is only supported by the following filesystems - -- // btrfs, ext4, ocfs2, and xfs. Therefore fallocate might fail with -- // EOPNOTSUPP error when issued in other filesystems. -- // Hence, check for the return error code before concluding that the -- // disk does not have enough space. -- if (declared_length > 0) { -- result = TEMP_FAILURE_RETRY(fallocate(fd, 0, current_offset, declared_length)); -- if (result == -1 && errno == ENOSPC) { -- ALOGW("Zip: unable to allocate space for file to %" PRId64 ": %s", -- static_cast<int64_t>(declared_length + current_offset), strerror(errno)); -- return kIoError; -- } -- } --#endif // defined(__linux__) -- -- result = TEMP_FAILURE_RETRY(ftruncate(fd, declared_length + current_offset)); -+ int result = TEMP_FAILURE_RETRY(ftruncate(fd, declared_length + current_offset)); - if (result == -1) { - ALOGW("Zip: unable to truncate file to %" PRId64 ": %s", - (int64_t)(declared_length + current_offset), strerror(errno)); -diff -ur core/mkbootimg/bootimg.h core_mtk/mkbootimg/bootimg.h ---- core/mkbootimg/bootimg.h 2016-01-22 15:55:46.573330000 -0800 -+++ core_mtk/mkbootimg/bootimg.h 2016-01-23 05:28:26.459234000 -0800 -@@ -26,6 +26,8 @@ - #define BOOT_ARGS_SIZE 512 - #define BOOT_EXTRA_ARGS_SIZE 1024 - -+#define MTK_HEADER_SIZE 512 -+ - struct boot_img_hdr - { - unsigned char magic[BOOT_MAGIC_SIZE]; -diff -ur core/mkbootimg/mkbootimg.c core_mtk/mkbootimg/mkbootimg.c ---- core/mkbootimg/mkbootimg.c 2016-01-22 15:55:46.573330000 -0800 -+++ core_mtk/mkbootimg/mkbootimg.c 2016-01-23 05:28:26.459234000 -0800 -@@ -25,10 +25,12 @@ - #include "mincrypt/sha.h" - #include "bootimg.h" - --static void *load_file(const char *fn, unsigned *_sz) -+static void *load_file(const char *fn, unsigned *_sz, int is_mtk, const char *mtk_fn) - { - char *data; -+ char *buf_start; - int sz; -+ int buf_sz; - int fd; - - data = 0; -@@ -40,13 +42,36 @@ - - if(lseek(fd, 0, SEEK_SET) != 0) goto oops; - -- data = (char*) malloc(sz); -+ buf_sz = sz + (is_mtk ? MTK_HEADER_SIZE : 0); -+ data = buf_start = (char*) malloc(buf_sz); - if(data == 0) goto oops; - -- if(read(fd, data, sz) != sz) goto oops; -+ if (is_mtk) { -+ /* MTK magic */ -+ data[0] = 0x88; -+ data[1] = 0x16; -+ data[2] = 0x88; -+ data[3] = 0x58; -+ -+ /* file length in little endian */ -+ data[4] = sz & 0xFF; -+ data[5] = (sz >> 8) & 0xFF; -+ data[6] = (sz >> 16) & 0xFF; -+ data[7] = (sz >> 24) & 0xFF; -+ -+ /* MTK "file name" */ -+ strncpy(data + 8, mtk_fn, 32); -+ -+ /* MTK header padding */ -+ memset(data + 40, 0xff, MTK_HEADER_SIZE - 40); -+ -+ buf_start += MTK_HEADER_SIZE; -+ } -+ -+ if(read(fd, buf_start, sz) != sz) goto oops; - close(fd); - -- if(_sz) *_sz = sz; -+ if(_sz) *_sz = buf_sz; - return data; - - oops: -@@ -68,6 +93,7 @@ - " [ --dt <filename> ]\n" - " [ --ramdisk_offset <address> ]\n" - " [ --tags_offset <address> ]\n" -+ " [ --mtk <boot|recovery> ]\n" - " -o|--output <filename>\n" - ); - return 1; -@@ -99,6 +125,8 @@ - { - boot_img_hdr hdr; - -+ int is_mtk = 0; -+ int is_mtk_boot = 0; - char *kernel_fn = 0; - void *kernel_data = 0; - char *ramdisk_fn = 0; -@@ -167,6 +195,16 @@ - } - } else if(!strcmp(arg, "--dt")) { - dt_fn = val; -+ } else if (!strcmp(arg, "--mtk")) { -+ if (!strcmp(val, "boot")) { -+ is_mtk = 1; -+ is_mtk_boot = 1; -+ } else if (!strcmp(val, "recovery")) { -+ is_mtk = 1; -+ is_mtk_boot = 0; -+ } else { -+ return usage(); -+ } - } else { - return usage(); - } -@@ -216,7 +254,7 @@ - strncpy((char *)hdr.extra_cmdline, cmdline, BOOT_EXTRA_ARGS_SIZE); - } - -- kernel_data = load_file(kernel_fn, &hdr.kernel_size); -+ kernel_data = load_file(kernel_fn, &hdr.kernel_size, is_mtk, "KERNEL"); - if(kernel_data == 0) { - fprintf(stderr,"error: could not load kernel '%s'\n", kernel_fn); - return 1; -@@ -226,7 +264,7 @@ - ramdisk_data = 0; - hdr.ramdisk_size = 0; - } else { -- ramdisk_data = load_file(ramdisk_fn, &hdr.ramdisk_size); -+ ramdisk_data = load_file(ramdisk_fn, &hdr.ramdisk_size, is_mtk, is_mtk_boot ? "ROOTFS" : "RECOVERY"); - if(ramdisk_data == 0) { - fprintf(stderr,"error: could not load ramdisk '%s'\n", ramdisk_fn); - return 1; -@@ -234,7 +272,7 @@ - } - - if(second_fn) { -- second_data = load_file(second_fn, &hdr.second_size); -+ second_data = load_file(second_fn, &hdr.second_size, is_mtk, ""); - if(second_data == 0) { - fprintf(stderr,"error: could not load secondstage '%s'\n", second_fn); - return 1; -@@ -242,7 +280,7 @@ - } - - if(dt_fn) { -- dt_data = load_file(dt_fn, &hdr.dt_size); -+ dt_data = load_file(dt_fn, &hdr.dt_size, is_mtk, ""); - if (dt_data == 0) { - fprintf(stderr,"error: could not load device tree image '%s'\n", dt_fn); - return 1; -diff -ur core/mkbootimg/unpackbootimg.c core_mtk/mkbootimg/unpackbootimg.c ---- core/mkbootimg/unpackbootimg.c 2016-01-22 15:55:46.573330000 -0800 -+++ core_mtk/mkbootimg/unpackbootimg.c 2016-01-23 05:28:26.459234000 -0800 -@@ -38,11 +38,21 @@ - fclose(f); - } - -+void maybe_skip_mtk_header(FILE* f, int is_mtk) -+{ -+ if (!is_mtk) { -+ return; -+ } -+ -+ fseek(f, MTK_HEADER_SIZE, SEEK_CUR); -+} -+ - int usage() { - printf("usage: unpackbootimg\n"); - printf("\t-i|--input boot.img\n"); - printf("\t[ -o|--output output_directory]\n"); - printf("\t[ -p|--pagesize <size-in-hexadecimal> ]\n"); -+ printf("\t[ --mtk 1 ]\n"); - return 0; - } - -@@ -52,6 +62,7 @@ - char* directory = "./"; - char* filename = NULL; - int pagesize = 0; -+ int is_mtk = 0; - - argc--; - argv++; -@@ -66,6 +77,12 @@ - directory = val; - } else if(!strcmp(arg, "--pagesize") || !strcmp(arg, "-p")) { - pagesize = strtoul(val, 0, 16); -+ } else if (!strcmp(arg, "--mtk")) { -+ if (!strcmp(val, "1")) { -+ is_mtk = 1; -+ } -+ -+ return usage(); - } else { - return usage(); - } -@@ -153,23 +170,27 @@ - //printf("total read: %d\n", total_read); - total_read += read_padding(f, sizeof(header), pagesize); - -+ int mtk_size_adjust = is_mtk ? -MTK_HEADER_SIZE : 0; -+ - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-zImage"); - FILE *k = fopen(tmp, "wb"); -- byte* kernel = (byte*)malloc(header.kernel_size); -+ byte* kernel = (byte*)malloc(header.kernel_size + mtk_size_adjust); - //printf("Reading kernel...\n"); -- fread(kernel, header.kernel_size, 1, f); -+ maybe_skip_mtk_header(f, is_mtk); -+ fread(kernel, header.kernel_size + mtk_size_adjust, 1, f); - total_read += header.kernel_size; -- fwrite(kernel, header.kernel_size, 1, k); -+ fwrite(kernel, header.kernel_size + mtk_size_adjust, 1, k); - fclose(k); - - //printf("total read: %d\n", header.kernel_size); - total_read += read_padding(f, header.kernel_size, pagesize); - - -- byte* ramdisk = (byte*)malloc(header.ramdisk_size); -+ byte* ramdisk = (byte*)malloc(header.ramdisk_size + mtk_size_adjust); - //printf("Reading ramdisk...\n"); -- fread(ramdisk, header.ramdisk_size, 1, f); -+ maybe_skip_mtk_header(f, is_mtk); -+ fread(ramdisk, header.ramdisk_size + mtk_size_adjust, 1, f); - total_read += header.ramdisk_size; - sprintf(tmp, "%s/%s", directory, basename(filename)); - if(ramdisk[0] == 0x02 && ramdisk[1]== 0x21) -@@ -177,7 +198,7 @@ - else - strcat(tmp, "-ramdisk.gz"); - FILE *r = fopen(tmp, "wb"); -- fwrite(ramdisk, header.ramdisk_size, 1, r); -+ fwrite(ramdisk, header.ramdisk_size + mtk_size_adjust, 1, r); - fclose(r); - - total_read += read_padding(f, header.ramdisk_size, pagesize); -@@ -185,11 +206,12 @@ - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-second"); - FILE *s = fopen(tmp, "wb"); -- byte* second = (byte*)malloc(header.second_size); -+ byte* second = (byte*)malloc(header.second_size + mtk_size_adjust); - //printf("Reading second...\n"); -- fread(second, header.second_size, 1, f); -+ maybe_skip_mtk_header(f, is_mtk); -+ fread(second, header.second_size + mtk_size_adjust, 1, f); - total_read += header.second_size; -- fwrite(second, header.second_size, 1, r); -+ fwrite(second, header.second_size + mtk_size_adjust, 1, r); - fclose(s); - - total_read += read_padding(f, header.second_size, pagesize); -@@ -197,11 +219,12 @@ - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-dt"); - FILE *d = fopen(tmp, "wb"); -- byte* dt = (byte*)malloc(header.dt_size); -+ byte* dt = (byte*)malloc(header.dt_size + mtk_size_adjust); - //printf("Reading dt...\n"); -- fread(dt, header.dt_size, 1, f); -+ maybe_skip_mtk_header(f, is_mtk); -+ fread(dt, header.dt_size + mtk_size_adjust, 1, f); - total_read += header.dt_size; -- fwrite(dt, header.dt_size, 1, r); -+ fwrite(dt, header.dt_size + mtk_size_adjust, 1, r); - fclose(d); - - fclose(f); -Only in core_mtk: README.md -diff -ur core/rootdir/init.trace.rc core_mtk/rootdir/init.trace.rc ---- core/rootdir/init.trace.rc 2016-01-22 15:55:46.573330000 -0800 -+++ core_mtk/rootdir/init.trace.rc 2016-01-23 05:28:26.459234000 -0800 -@@ -3,25 +3,30 @@ - on early-boot - - # Allow writing to the kernel trace log. -+ mount debugfs debugfs /sys/kernel/debug -+ chmod 0755 /sys/kernel/debug - chmod 0222 /sys/kernel/debug/tracing/trace_marker - - # Allow the shell group to enable (some) kernel tracing. - chown root shell /sys/kernel/debug/tracing/trace_clock -- chown root shell /sys/kernel/debug/tracing/buffer_size_kb -+ chown system shell /sys/kernel/debug/tracing/buffer_size_kb - chown root shell /sys/kernel/debug/tracing/options/overwrite -- chown root shell /sys/kernel/debug/tracing/options/print-tgid -+ chown root shell /sys/kernel/debug/tracing/options/record-cmd - chown root shell /sys/kernel/debug/tracing/events/sched/sched_switch/enable - chown root shell /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable - chown root shell /sys/kernel/debug/tracing/events/power/cpu_frequency/enable - chown root shell /sys/kernel/debug/tracing/events/power/cpu_idle/enable - chown root shell /sys/kernel/debug/tracing/events/power/clock_set_rate/enable - chown root shell /sys/kernel/debug/tracing/events/cpufreq_interactive/enable -- chown root shell /sys/kernel/debug/tracing/tracing_on -+ # change to system owner for AMS to control -+ chown system shell /sys/kernel/debug/tracing/tracing_on -+ chown system shell /sys/kernel/debug/tracing/tracing_enabled -+ chown root shell /sys/kernel/debug/tracing/set_event - - chmod 0664 /sys/kernel/debug/tracing/trace_clock - chmod 0664 /sys/kernel/debug/tracing/buffer_size_kb - chmod 0664 /sys/kernel/debug/tracing/options/overwrite -- chmod 0664 /sys/kernel/debug/tracing/options/print-tgid -+ chmod 0664 /sys/kernel/debug/tracing/options/record-cmd - chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_switch/enable - chmod 0664 /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable - chmod 0664 /sys/kernel/debug/tracing/events/power/cpu_frequency/enable -@@ -29,7 +34,9 @@ - chmod 0664 /sys/kernel/debug/tracing/events/power/clock_set_rate/enable - chmod 0664 /sys/kernel/debug/tracing/events/cpufreq_interactive/enable - chmod 0664 /sys/kernel/debug/tracing/tracing_on -+ chmod 0664 /sys/kernel/debug/tracing/tracing_enabled -+ chmod 0664 /sys/kernel/debug/tracing/set_event - - # Allow only the shell group to read and truncate the kernel trace. -- chown root shell /sys/kernel/debug/tracing/trace -- chmod 0660 /sys/kernel/debug/tracing/trace -+ chown system shell /sys/kernel/debug/tracing/trace -+ chmod 0664 /sys/kernel/debug/tracing/trace -diff -ur core/rootdir/ueventd.rc core_mtk/rootdir/ueventd.rc ---- core/rootdir/ueventd.rc 2016-01-22 15:55:46.573330000 -0800 -+++ core_mtk/rootdir/ueventd.rc 2016-01-23 05:28:26.459234000 -0800 -@@ -13,23 +13,96 @@ - /dev/ashmem 0666 root root - /dev/binder 0666 root root - -+ #change partition permission -+/dev/preloader 0640 root system -+/dev/bootimg 0640 root system -+/dev/recovery 0660 root system -+/dev/sec_ro 0640 root system -+/dev/kb 0660 root system -+/dev/dkb 0660 root system -+/dev/seccfg 0660 root system -+/dev/pro_info 0660 root system -+/dev/otp 0660 root system -+/dev/nvram 0660 root system -+/dev/misc 0660 root system -+/dev/misc2 0660 root system -+/dev/block/platform/mtk-msdc.0/by-name/misc2 0660 root system -+/dev/block/mmcblk0 0660 root system -+/dev/block/mmcblk0boot0 0660 root system -+/dev/block/mmcblk0boot1 0660 root system -+/dev/misc-sd 0660 root system -+ -+ -+#connectivity -+# Create char device file for WMT, GPS, BT, FM, WIFI -+# mknod /dev/stpwmt c 190 0; -+# mknod /dev/stpgps c 191 0; -+# mknod /dev/stpbt c 192 0; -+ -+# chmod 0660 /dev/stpwmt -+# chown system system /dev/stpwmt -+# chmod 0660 /dev/wmtdetect -+# chown system system /dev/wmtdetect -+# -+# BT -+# chmod 0660 /dev/stpbt -+# chown bluetooth radio /dev/stpbt -+# -+# GPS -+# chown gps gps /dev/stpgps -+# chmod 0660 /dev/stpgps -+ -+/dev/stpwmt 0660 system system -+/dev/wmtdetect 0660 system system -+/dev/stpbt 0660 bluetooth radio -+/dev/stpgps 0660 gps gps -+/dev/stpant 0660 system system -+ -+# WIFI -+# chown system system /dev/wmtWifi -+# chmod 0660 /dev/wmtWifi -+ -+/dev/wmtWifi 0660 system system -+ -+# FMRadio -+/dev/fm 0660 system media -+ -+# add the read write right of ttyUSB* -+/dev/bus/usb/* 0660 root usb -+/dev/ttyUSB0 0660 radio radio -+/dev/ttyUSB1 0660 radio radio -+/dev/ttyUSB2 0660 radio radio -+/dev/ttyUSB3 0660 radio radio -+/dev/ttyUSB4 0660 radio radio -+ - # Anyone can read the logs, but if they're not in the "logs" - # group, then they'll only see log entries for their UID. -+/dev/xLog 0600 root root - /dev/log/* 0666 root log -+/dev/log/ksystem 0600 root log - - # the msm hw3d client device node is world writable/readable - /dev/msm_hw3dc 0666 root root - - # the DIAG device node is not world writable/readable. --/dev/diag 0660 system qcom_diag -+# /dev/diag 0660 system qcom_diag - - # gpu driver for adreno200 is globally accessible - /dev/kgsl 0666 root root - -+# Begin Immersion changes -+#/dev/tspdrv 0660 system system -+# End Immersion changes -+ -+#begin fpc fingerprint -+/dev/fpc1020 0666 system system -+#end -+ - # kms driver for drm based gpu - /dev/dri/* 0666 root graphics - - # these should not be world writable -+/dev/diag 0660 radio radio - /dev/diag_arm9 0660 radio radio - /dev/android_adb 0660 adb adb - /dev/android_adb_enable 0660 adb adb -@@ -39,7 +112,7 @@ - /dev/alarm 0664 system radio - /dev/rtc0 0640 system system - /dev/tty0 0660 root system --/dev/graphics/* 0660 system graphics -+/dev/graphics/* 0660 root graphics - /dev/msm_hw3dm 0660 system graphics - /dev/input/* 0660 root input - /dev/eac 0660 root audio -@@ -85,6 +158,22 @@ - /dev/usb_accessory 0660 root usb - /dev/tun 0660 system vpn - -+/dev/ccci* 0660 radio radio -+/dev/ttyC* 0660 radio radio -+/sys/kernel/ccci modem_info 0644 radio radio -+/sys/kernel/ccci md1_postfix 0644 radio radio -+/sys/kernel/ccci md2_postfix 0644 radio radio -+/dev/eemcs* 0660 radio radio -+/dev/ccci_pcm_rx 0660 media media -+/dev/ccci_pcm_tx 0660 media media -+/dev/ccci_aud 0660 media media -+/dev/ccci2_aud 0660 media media -+/dev/eemcs_aud 0660 media media -+ -+# SGX device node -+/dev/pvrsrvkm 0666 root root -+/dev/pvr_sync 0666 root root -+ - # CDMA radio interface MUX - /dev/ts0710mux* 0640 radio radio - /dev/ppp 0660 radio vpn -@@ -98,39 +187,80 @@ - /sys/devices/system/cpu/cpu* cpufreq/scaling_min_freq 0664 system system - /sys/devices/system/cpu/cpu* cpufreq/scaling_governor 0664 system system - --/sys/devices/system/cpu/cpufreq ondemand/boostfreq 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/boostpulse 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/boosttime 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/down_differential 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/down_differential_multi_core 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/ignore_nice_load 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/input_boost 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/io_is_busy 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/optimal_freq 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/powersave_bias 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/sampling_down_factor 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/sampling_rate 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/sampling_rate_min 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/sync_freq 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/up_threshold 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/up_threshold_any_cpu_load 0664 system system --/sys/devices/system/cpu/cpufreq ondemand/up_threshold_multi_core 0664 system system -- --/sys/devices/system/cpu/cpufreq interactive/above_hispeed_delay 0664 system system --/sys/devices/system/cpu/cpufreq interactive/align_windows 0664 system system --/sys/devices/system/cpu/cpufreq interactive/boost 0664 system system --/sys/devices/system/cpu/cpufreq interactive/boostpulse 0664 system system --/sys/devices/system/cpu/cpufreq interactive/boostpulse_duration 0664 system system --/sys/devices/system/cpu/cpufreq interactive/go_hispeed_load 0664 system system --/sys/devices/system/cpu/cpufreq interactive/hispeed_freq 0664 system system --/sys/devices/system/cpu/cpufreq interactive/io_is_busy 0664 system system --/sys/devices/system/cpu/cpufreq interactive/max_freq_hysteresis 0664 system system --/sys/devices/system/cpu/cpufreq interactive/min_sample_rate 0664 system system --/sys/devices/system/cpu/cpufreq interactive/min_sample_time 0664 system system --/sys/devices/system/cpu/cpufreq interactive/sampling_down_factor 0664 system system --/sys/devices/system/cpu/cpufreq interactive/sync_freq 0664 system system --/sys/devices/system/cpu/cpufreq interactive/target_loads 0664 system system --/sys/devices/system/cpu/cpufreq interactive/timer_rate 0664 system system --/sys/devices/system/cpu/cpufreq interactive/timer_slack 0664 system system --/sys/devices/system/cpu/cpufreq interactive/up_threshold_any_cpu_freq 0664 system system --/sys/devices/system/cpu/cpufreq interactive/up_threshold_any_cpu_load 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/boostfreq 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/boostpulse 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/boosttime 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/down_differential 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/down_differential_multi_core 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/ignore_nice_load 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/input_boost 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/io_is_busy 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/optimal_freq 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/powersave_bias 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/sampling_down_factor 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/sampling_rate 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/sampling_rate_min 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/sync_freq 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/up_threshold 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/up_threshold_any_cpu_load 0664 system system -+#/sys/devices/system/cpu/cpufreq ondemand/up_threshold_multi_core 0664 system system -+ -+#/sys/devices/system/cpu/cpufreq interactive/above_hispeed_delay 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/align_windows 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/boost 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/boostpulse 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/boostpulse_duration 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/go_hispeed_load 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/hispeed_freq 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/io_is_busy 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/max_freq_hysteresis 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/min_sample_rate 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/min_sample_time 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/sampling_down_factor 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/sync_freq 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/target_loads 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/timer_rate 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/timer_slack 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/up_threshold_any_cpu_freq 0664 system system -+#/sys/devices/system/cpu/cpufreq interactive/up_threshold_any_cpu_load 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/green delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/green delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/red delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/red delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/blue delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/blue delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/yellow delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/yellow delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/white delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/white delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/cyan delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/cyan delay_off 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/violet delay_on 0664 system system -+/sys/devices/platform/leds-mt65xx/leds/violet delay_off 0664 system system -+#NFC device -+/dev/msr3110 0666 root root -+/dev/mt6605 0660 nfc radio -+ -+#GPS -+/dev/gps 0660 gps system -+ -+#GPIO -+/dev/mtgpio 0600 radio root -+ -+#MTK BTIF driver -+/dev/btif 0600 system system -+ -+#FOR VIA MODEM -+/dev/ttySDIO* 0660 radio sdcard_rw -+/dev/ttyRB* 0660 radio radio -+ -+# Mali node -+/dev/mali 0666 system graphics -+ -+#touch -+/dev/touch 0660 root system -+/dev/hotknot 0660 root system -+ -+#hang_detect -+/dev/RT_Monitor 0600 system system -+/dev/kick_powerkey 0600 system system |
