diff --git a/BoardConfig.mk b/BoardConfig.mk index deaa3f7..0a58a66 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -55,14 +55,10 @@ TARGET_KERNEL_CONFIG := exynos7870-a6lte_defconfig TARGET_KERNEL_SOURCE := kernel/samsung/exynos7870 # Extracted with libbootimg -BOARD_CUSTOM_BOOTIMG := true -BOARD_CUSTOM_BOOTIMG_MK := $(DEVICE_PATH)/dtbhtool/mkbootimg.mk -BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 +BOARD_MKBOOTIMG_ARGS := --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --tags_offset 0x00000100 --dt $(OUT_DIR)/target/product/a6lte/obj/KERNEL_OBJ/arch/$(TARGET_ARCH)/boot/dtb.img BOARD_KERNEL_BASE := 0x10000000 BOARD_KERNEL_PAGESIZE := 2048 -BOARD_KERNEL_IMAGE_NAME := Image -BOARD_KERNEL_SEPARATED_DT := true -TARGET_CUSTOM_DTBTOOL := dtbhtoolExynos +BOARD_KERNEL_IMAGE_NAME := Image dtb.img # File systems BOARD_HAS_LARGE_FILESYSTEM := true @@ -70,13 +66,14 @@ BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4 TARGET_USERIMAGES_USE_EXT4 := true TARGET_USERIMAGES_USE_F2FS := true -# LZMA support -LZMA_RAMDISK_TARGETS := recovery - -TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/recovery.fstab +TARGET_RECOVERY_FSTAB := $(DEVICE_PATH)/recovery/root/etc/recovery.fstab # Recovery TARGET_RECOVERY_PIXEL_FORMAT := "ABGR_8888" + +# System as root +BOARD_BUILD_SYSTEM_ROOT_IMAGE := true +BOARD_SUPPRESS_SECURE_ERASE := true AB_OTA_UPDATER := false # TWRP specific build flags @@ -105,10 +102,3 @@ TW_INCLUDE_FUSE_NTFS := true # Vendor separation TARGET_COPY_OUT_VENDOR := vendor - -# Android Verified Boot -BOARD_AVB_ENABLE := false -BOARD_BUILD_DISABLED_VBMETAIMAGE := true - -# Include -TARGET_SPECIFIC_HEADER_PATH := $(DEVICE_PATH)/dtbhtool/include diff --git a/README.md b/README.md index 5ecf94c..4675da8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# TWRP for the Samsung Galaxy A6 201 +# TWRP for the Samsung Galaxy A6 2018 ### How to build ### @@ -16,8 +16,7 @@ $ git clone https://github.com/samsungexynos7870/android_manifest_samsung_a6lte. $ repo sync --no-repo-verify -c --force-sync --no-clone-bundle --no-tags --optimized-fetch --prune -j`nproc` # Build -$ mv device/samsung/a6lte/build_twrp.sh . -$ . build_twrp.sh a6lte +$ source build/envsetup.sh ; lunch omni_a6lte-eng ; mka recoveryimage ``` ## Credits 2020 @Astrako diff --git a/build_twrp.sh b/build_twrp.sh deleted file mode 100644 index eb69c49..0000000 --- a/build_twrp.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# configure some default settings for the build -export ALLOW_MISSING_DEPENDENCIES=true - -# lzma -export LZMA_RAMDISK_TARGETS="recovery" - -# compile it -for i in $*; do - TARGET_DEVICE="$i" - . build/envsetup.sh - lunch omni_`echo $i`-eng - mka recoveryimage -j`nproc` -done diff --git a/dtbhtool/Android.mk b/dtbhtool/Android.mk deleted file mode 100644 index 6992700..0000000 --- a/dtbhtool/Android.mk +++ /dev/null @@ -1,69 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -# Host static library -include $(CLEAR_VARS) -LOCAL_SRC_FILES := dtbimg.c -LOCAL_STATIC_LIBRARIES := libfdt -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libdtbimg -LOCAL_MODULE := libdtbimg -include $(BUILD_HOST_STATIC_LIBRARY) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := mkbootimg.c -LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libcrypto_static - -LOCAL_MODULE := mkdtbhbootimg - -include $(BUILD_HOST_EXECUTABLE) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := unpackbootimg.c -LOCAL_MODULE := unpackdtbhbootimg -include $(BUILD_HOST_EXECUTABLE) - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := mkdtbimg.c -LOCAL_STATIC_LIBRARIES := libdtbimg libfdt - -LOCAL_MODULE := dtbhtoolExynos - -include $(BUILD_HOST_EXECUTABLE) - -# Target static library -include $(CLEAR_VARS) -LOCAL_SRC_FILES := dtbimg.c -LOCAL_STATIC_LIBRARIES := libfdt -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libdtbimg -LOCAL_MODULE := libdtbimg -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := mkbootimg.c -LOCAL_STATIC_LIBRARIES := libdtbimg libfdt libcrypto_static libcutils libc -LOCAL_MODULE := utility_mkdtbhbootimg -LOCAL_MODULE_STEM := mkdtbhbootimg -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities -LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities -LOCAL_FORCE_STATIC_EXECUTABLE := true -include $(BUILD_EXECUTABLE) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := unpackbootimg.c -LOCAL_STATIC_LIBRARIES := libcutils libc -LOCAL_MODULE := utility_unpackdtbhbootimg -LOCAL_MODULE_STEM := unpackdtbhbootimg -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_UNSTRIPPED_PATH := $(PRODUCT_OUT)/symbols/utilities -LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities -LOCAL_FORCE_STATIC_EXECUTABLE := true -include $(BUILD_EXECUTABLE) - -include $(CLEAR_VARS) -LOCAL_SRC_FILES := unpackdtbhimg.c -LOCAL_MODULE := unpackdtbhimg -include $(BUILD_HOST_EXECUTABLE) - -$(call dist-for-goals,dist_files,$(LOCAL_BUILT_MODULE)) diff --git a/dtbhtool/bootimg.h b/dtbhtool/bootimg.h deleted file mode 100644 index ef0e61c..0000000 --- a/dtbhtool/bootimg.h +++ /dev/null @@ -1,102 +0,0 @@ -/* tools/mkbootimg/bootimg.h -** -** Copyright 2007, 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. -*/ - -#ifndef _BOOT_IMAGE_H_ -#define _BOOT_IMAGE_H_ - -typedef struct boot_img_hdr boot_img_hdr; - -#define BOOT_MAGIC "ANDROID!" -#define BOOT_MAGIC_SIZE 8 -#define BOOT_NAME_SIZE 16 -#define BOOT_ARGS_SIZE 512 - -struct boot_img_hdr -{ - unsigned char magic[BOOT_MAGIC_SIZE]; - - unsigned kernel_size; /* size in bytes */ - unsigned kernel_addr; /* physical load addr */ - - unsigned ramdisk_size; /* size in bytes */ - unsigned ramdisk_addr; /* physical load addr */ - - unsigned second_size; /* size in bytes */ - unsigned second_addr; /* physical load addr */ - - unsigned tags_addr; /* physical addr for kernel tags */ - unsigned page_size; /* flash page size we assume */ - unsigned dt_size; /* device tree in bytes */ - unsigned unused; /* future expansion: should be 0 */ - unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */ - - unsigned char cmdline[BOOT_ARGS_SIZE]; - - unsigned id[8]; /* timestamp / checksum / sha1 / etc */ -}; - -/* -** +-----------------+ -** | boot header | 1 page -** +-----------------+ -** | kernel | n pages -** +-----------------+ -** | ramdisk | m pages -** +-----------------+ -** | second stage | o pages -** +-----------------+ -** | device tree | p pages -** +-----------------+ -** | signature | 256 bytes -** +-----------------+ -** -** n = (kernel_size + page_size - 1) / page_size -** m = (ramdisk_size + page_size - 1) / page_size -** o = (second_size + page_size - 1) / page_size -** p = (dt_size + page_size - 1) / page_size -** -** 0. all entities are page_size aligned in flash -** 1. kernel and ramdisk are required (size != 0) -** 2. second is optional (second_size == 0 -> no second) -** 3. load each element (kernel, ramdisk, second) at -** the specified physical address (kernel_addr, etc) -** 4. prepare tags at tag_addr. kernel_args[] is -** appended to the kernel commandline in the tags. -** 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr -** 6. if second_size != 0: jump to second_addr -** else: jump to kernel_addr -*/ - -#if 0 -typedef struct ptentry ptentry; - -struct ptentry { - char name[16]; /* asciiz partition name */ - unsigned start; /* starting block number */ - unsigned length; /* length in blocks */ - unsigned flags; /* set to zero */ -}; - -/* MSM Partition Table ATAG -** -** length: 2 + 7 * n -** atag: 0x4d534d70 -** x n -*/ -#endif - -#endif diff --git a/dtbhtool/dtbimg.c b/dtbhtool/dtbimg.c deleted file mode 100644 index f751e88..0000000 --- a/dtbhtool/dtbimg.c +++ /dev/null @@ -1,311 +0,0 @@ -/* tools/mkbootimg/dtbimg.c -** -** Copyright 2007, The Android Open Source Project -** Copyright 2013, Sony Mobile Communications -** -** 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. -** -** December 2016, Christopher N. Hesse -** Separate dt creation from mkbootimg program. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* must be provided by the device tree */ -#include - -#include "libfdt.h" - -struct dt_blob; - -struct dt_entry { - uint32_t chip; - uint32_t platform; - uint32_t subtype; - uint32_t hw_rev; - uint32_t hw_rev_end; - uint32_t offset; - uint32_t size; /* including padding */ - uint32_t space; - - struct dt_blob *blob; -}; - -/* - * Comparator for sorting dt_entries - */ -static int dt_entry_cmp(const void *ap, const void *bp) -{ - struct dt_entry *a = (struct dt_entry*)ap; - struct dt_entry *b = (struct dt_entry*)bp; - - if (a->chip != b->chip) - return a->chip - b->chip; - return a->hw_rev - b->hw_rev; -} - -/* - * In memory representation of a dtb blob - */ -struct dt_blob { - uint32_t size; - uint32_t offset; - - void *payload; - struct dt_blob *next; -}; - -static void *load_file(const char *fn, unsigned *_sz) -{ - char *data; - int sz; - int fd; - - data = 0; - fd = open(fn, O_RDONLY); - if(fd < 0) return 0; - - sz = lseek(fd, 0, SEEK_END); - if(sz < 0) goto oops; - - if(lseek(fd, 0, SEEK_SET) != 0) goto oops; - - data = (char*) malloc(sz); - if(data == 0) goto oops; - - if(read(fd, data, sz) != sz) goto oops; - close(fd); - - if(_sz) *_sz = sz; - return data; - -oops: - close(fd); - if(data != 0) free(data); - return 0; -} - -void *load_dtbh_block(const char *dtb_path, unsigned pagesize, unsigned *_sz) -{ - const unsigned pagemask = pagesize - 1; - struct dt_entry *new_entries; - struct dt_entry *entries = NULL; - struct dt_entry *entry; - struct dt_blob *blob; - struct dt_blob *blob_list = NULL; - struct dt_blob *last_blob = NULL; - struct dirent *de; - unsigned new_count; - unsigned entry_count = 0; - unsigned offset; - unsigned dtb_sz; - unsigned hdr_sz = DT_HEADER_PHYS_SIZE; - uint32_t version = DTBH_VERSION; - unsigned blob_sz = 0; - char fname[PATH_MAX]; -#ifdef DTBH_MODEL - const unsigned *model; -#endif - const unsigned *prop_chip; - const unsigned *prop_platform; - const unsigned *prop_subtype; - const unsigned *prop_hw_rev; - const unsigned *prop_hw_rev_end; - int namlen; - int len; - void *dtb; - char *dtbh; - DIR *dir; - unsigned c; - - dir = opendir(dtb_path); - - if (dir == NULL) - err(1, "failed to open '%s'", dtb_path); - - while ((de = readdir(dir)) != NULL) { - namlen = strlen(de->d_name); - if (namlen < 4 || strcmp(&de->d_name[namlen - 4], ".dtb")) - continue; - - snprintf(fname, sizeof(fname), "%s/%s", dtb_path, de->d_name); - - dtb = load_file(fname, &dtb_sz); - if (dtb == NULL) - err(1, "failed to read dtb '%s'", fname); - - if (fdt_check_header(dtb) != 0) { - warnx("'%s' is not a valid dtb, skipping", fname); - free(dtb); - continue; - } - - offset = fdt_path_offset(dtb, "/"); - -#ifdef DTBH_MODEL - model = fdt_getprop(dtb, offset, "model", &len); - if (strstr((char *)&model[0], DTBH_MODEL) == NULL) { - warnx("model of %s is invalid, skipping (expected *%s* but got %s)", - fname, DTBH_MODEL, (char *)&model[0]); - free(dtb); - continue; - } -#endif - - prop_chip = fdt_getprop(dtb, offset, "model_info-chip", &len); - if (len % (sizeof(uint32_t)) != 0) { - warnx("model_info-chip of %s is of invalid size, skipping", fname); - free(dtb); - continue; - } - - prop_platform = fdt_getprop(dtb, offset, "model_info-platform", &len); - if (strcmp((char *)&prop_platform[0], DTBH_PLATFORM)) { - warnx("model_info-platform of %s is invalid, skipping (expected %s but got %s)", - fname, DTBH_PLATFORM, (char *)&prop_platform[0]); - free(dtb); - continue; - } - - prop_subtype = fdt_getprop(dtb, offset, "model_info-subtype", &len); - if (strcmp((char *)&prop_subtype[0], DTBH_SUBTYPE)) { - warnx("model_info-subtype of %s is invalid, skipping (expected %s but got %s)", - fname, DTBH_SUBTYPE, (char *)&prop_subtype[0]); - free(dtb); - continue; - } - - prop_hw_rev = fdt_getprop(dtb, offset, "model_info-hw_rev", &len); - if (len % (sizeof(uint32_t)) != 0) { - warnx("model_info-hw_rev of %s is of invalid size, skipping", fname); - free(dtb); - continue; - } - - prop_hw_rev_end = fdt_getprop(dtb, offset, "model_info-hw_rev_end", &len); - if (len % (sizeof(uint32_t)) != 0) { - warnx("model_info-hw_rev_end of %s is of invalid size, skipping", fname); - free(dtb); - continue; - } - - blob = calloc(1, sizeof(struct dt_blob)); - if (blob == NULL) - err(1, "failed to allocate memory"); - - blob->payload = dtb; - blob->size = dtb_sz; - if (blob_list == NULL) { - blob_list = blob; - last_blob = blob; - } else { - last_blob->next = blob; - last_blob = blob; - } - - blob_sz += (blob->size + pagemask) & ~pagemask; - new_count = entry_count + 1; - new_entries = realloc(entries, new_count * sizeof(struct dt_entry)); - if (new_entries == NULL) - err(1, "failed to allocate memory"); - - entries = new_entries; - entry = &entries[entry_count]; - memset(entry, 0, sizeof(*entry)); - entry->chip = ntohl(prop_chip[0]); - entry->platform = DTBH_PLATFORM_CODE; - entry->subtype = DTBH_SUBTYPE_CODE; - entry->hw_rev = ntohl(prop_hw_rev[0]); - entry->hw_rev_end = ntohl(prop_hw_rev_end[0]); - entry->space = 0x20; /* space delimiter */ - entry->blob = blob; - - entry_count++; - - hdr_sz += entry_count * DT_ENTRY_PHYS_SIZE; - } - - closedir(dir); - - if (entry_count == 0) { - warnx("unable to locate any dtbs in the given path"); - return NULL; - } - - hdr_sz += sizeof(uint32_t); /* eot marker */ - hdr_sz = (hdr_sz + pagemask) & ~pagemask; - - qsort(entries, entry_count, sizeof(struct dt_entry), dt_entry_cmp); - - /* The size of the dt header is now known, calculate the blob offsets... */ - offset = hdr_sz; - for (blob = blob_list; blob; blob = blob->next) { - blob->offset = offset; - offset += (blob->size + pagemask) & ~pagemask; - } - - /* ...and update the entries */ - for (c = 0; c < entry_count; c++) { - entry = &entries[c]; - - entry->offset = entry->blob->offset; - entry->size = (entry->blob->size + pagemask) & ~pagemask; - } - - /* - * All parts are now gathered, so build the dt block - */ - dtbh = calloc(hdr_sz + blob_sz, 1); - if (dtbh == NULL) - err(1, "failed to allocate memory"); - - offset = 0; - - memcpy(dtbh, DTBH_MAGIC, sizeof(uint32_t)); - memcpy(dtbh + sizeof(uint32_t), &version, sizeof(uint32_t)); - memcpy(dtbh + (sizeof(uint32_t) * 2), &entry_count, sizeof(uint32_t)); - - offset += DT_HEADER_PHYS_SIZE; - - /* add dtbh entries */ - for (c = 0; c < entry_count; c++) { - entry = &entries[c]; - memcpy(dtbh + offset, entry, DT_ENTRY_PHYS_SIZE); - offset += DT_ENTRY_PHYS_SIZE; - } - - /* add padding after dt header */ - offset += pagesize - (offset & pagemask); - - for (blob = blob_list; blob; blob = blob->next) { - memcpy(dtbh + offset, blob->payload, blob->size); - offset += (blob->size + pagemask) & ~pagemask; - } - - *_sz = hdr_sz + blob_sz; - - return dtbh; -} diff --git a/dtbhtool/dtbtool.txt b/dtbhtool/dtbtool.txt deleted file mode 100644 index 2756207..0000000 --- a/dtbhtool/dtbtool.txt +++ /dev/null @@ -1,136 +0,0 @@ -Copyright (c) 2012, The Linux Foundation. All rights reserved. - -Redistribution and use in source form and compiled forms (SGML, HTML, -PDF, PostScript, RTF and so forth) with or without modification, are -permitted provided that the following conditions are met: - -Redistributions in source form must retain the above copyright -notice, this list of conditions and the following disclaimer as the -first lines of this file unmodified. - -Redistributions in compiled form (transformed to other DTDs, -converted to PDF, PostScript, RTF and other formats) 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. - -THIS DOCUMENTATION IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND -NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE FREEBSD -DOCUMENTATION PROJECT 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 DOCUMENTATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -June 2014, Ketut Putu Kumajaya -Samsung Exynos DTBH device tree documentation. - - -Android - Table of Device Tree -============================== - -0) Document revision - v1.0 - Initial version (dng) - -1) Android boot image: ----------------------- -1.1) Header: - 1) Magic (8B) - 2) kernel size (4B) - 3) kernel addr (4B) - 4) ramdisk size (4B) - 5) ramdisk addr (4B) - 6) 2ndary size (4B) - 7) 2ndary addr (4B) - 8) tags addr (4B) - 9) page size (4B) - 10) unused #1 (4B) (zero in standard Android) - 11) unused #2 (4B) (zero in standard Android) - 12) product name (16B) - 13) kernel cmdline (512B) - 14) id (8B) - -1.2) Layout: - A) header (as above - 1 page) - B) kernel (n pages) - C) ramdisk (m pages) - D) second stage (o pages) - -2) Exynos DTBH table of device tree --------------------------- -2.1) Changes: - i) use "unused #1, #2" members in existing boot image - header to point to new table of device tree - (#1 - size of Exynos DTBH table of DT) - ii) append table of device tree (described later) - after "D) second stage" - -2.2) Format: - size - x +------------------+ - | | MAGIC ("DTBH") | 4B - | +------------------+ - header | VERSION | uint32 (version 2, 0x00000002) - | +------------------+ - | | num of DTBs | uint32 (number of DTB entries, e.g. 5 entries, 0x00000005) - x +------------------+ - | | chip #1 | uint32 (e.g. ID for 5422, 0x0000152e) - | +------------------+ - | | platform #1 | uint32 (e.g. ID for k3g, 0x00001e92) - | +------------------+ - device | subtype #1 | uint32 (e.g. ID for k3g_eur_open, 0x7d64f612) - #1 +------------------+ - entry | hw_rev #1 | uint32 (e.g. k3g rev 2, 0x00000002) - | +------------------+ - | | hw_rev_end #1 | uint32 (e.g. k3g rev_end 2, 0x00000002) - | +------------------+ - | | offset #1 | uint32 (byte offset from start/before MAGIC - | +------------------+ to DTB entry, e.g. 0x00000800) - | | size #1 | uint32 (size in bytes of DTB blob - | +------------------+ e.g. 110,592 bytes, 0x0001b000) - | | space #1 | uint32 (0x00000020) - x +------------------+ - . . - . . (repeat) - . . - - x +------------------+ - | | chip #Z | uint32 (e.g. ID for 5422, 0x0000152e) - | +------------------+ - | | platform #Z | uint32 (e.g. ID for k3g, 0x00001e92) - | +------------------+ - device | subtype #Z | uint32 (e.g. ID for k3g_eur_open, 0x7d64f612) - #1 +------------------+ - entry | hw_rev #Z | uint32 (e.g. k3g rev 10, 0x0000000A) - | +------------------+ - | | hw_rev_end #Z | uint32 (e.g. k3g rev_end 255, 0x000000FF) - | +------------------+ - | | offset #Z | uint32 (byte offset from start/before MAGIC - | +------------------+ to DTB entry, e.g. 0x0006c800) - | | size #Z | uint32 (size in bytes of DTB blob - | +------------------+ e.g. 110,592 bytes, 0x0001b000) - | | space #Z | uint32 (0x00000020) - x +------------------+ - | padding | variable length for next DTB to start on - +------------------+ page boundary - | DTB #1 | variable (start is page aligned) - | | - | | - +------------------+ - | padding | variable length for next DTB to start on - +------------------+ page boundary - . - . - . - - +------------------+ - | DTB #Z (last) | variable (start is page aligned) - | | - | | - +------------------+ - diff --git a/dtbhtool/libdtbimg/dtbimg.h b/dtbhtool/libdtbimg/dtbimg.h deleted file mode 100644 index 4bf9db8..0000000 --- a/dtbhtool/libdtbimg/dtbimg.h +++ /dev/null @@ -1,30 +0,0 @@ -/* tools/libdtbimg/dtbimg.h -** -** Copyright 2017, The LineageOS 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. -*/ - -#ifndef _DTBIMG_H_ -#define _DTBIMG_H_ - -/* - * Returns dt image data. - * - * dtb_path: path to the compiled device tree blobs - * pagesize: board pagesize - * _sz: size of the resulting dt image - */ -void *load_dtbh_block(const char *dtb_path, unsigned pagesize, unsigned *_sz); - -#endif // _DTBIMG_H_ diff --git a/dtbhtool/mkbootimg.c b/dtbhtool/mkbootimg.c deleted file mode 100644 index 7b59139..0000000 --- a/dtbhtool/mkbootimg.c +++ /dev/null @@ -1,338 +0,0 @@ -/* tools/mkbootimg/mkbootimg.c -** -** Copyright 2007, The Android Open Source Project -** Copyright 2013, Sony Mobile Communications -** -** 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. -** -** June 2014, Ketut Putu Kumajaya -** Modified for Samsung Exynos DTBH, based on mkqcdtbootimg from Sony -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include "bootimg.h" - -static void *load_file(const char *fn, unsigned *_sz) -{ - char *data; - int sz; - int fd; - - data = 0; - fd = open(fn, O_RDONLY); - if(fd < 0) return 0; - - sz = lseek(fd, 0, SEEK_END); - if(sz < 0) goto oops; - - if(lseek(fd, 0, SEEK_SET) != 0) goto oops; - - data = (char*) malloc(sz); - if(data == 0) goto oops; - - if(read(fd, data, sz) != sz) goto oops; - close(fd); - - if(_sz) *_sz = sz; - return data; - -oops: - close(fd); - if(data != 0) free(data); - return 0; -} - -int usage(void) -{ - fprintf(stderr,"usage: mkbootimg\n" - " --kernel \n" - " --ramdisk \n" - " [ --second <2ndbootloader-filename> ]\n" - " [ --cmdline ]\n" - " [ --board ]\n" - " [ --base
]\n" - " [ --pagesize ]\n" - " [ --ramdisk_offset
]\n" - " [ --dt_dir ]\n" - " [ --dt ]\n" - " [ --signature ]\n" - " -o|--output \n" - ); - return 1; -} - - - -static unsigned char padding[131072] = { 0, }; - -int write_padding(int fd, unsigned pagesize, unsigned itemsize) -{ - unsigned pagemask = pagesize - 1; - unsigned count; - - if((itemsize & pagemask) == 0) { - return 0; - } - - count = pagesize - (itemsize & pagemask); - - if(write(fd, padding, count) != count) { - return -1; - } else { - return 0; - } -} - -int main(int argc, char **argv) -{ - boot_img_hdr hdr; - - char *kernel_fn = 0; - void *kernel_data = 0; - char *ramdisk_fn = 0; - void *ramdisk_data = 0; - char *second_fn = 0; - void *second_data = 0; - char *cmdline = ""; - char *bootimg = 0; - char *board = ""; - char *dt_dir = 0; - char *dt_fn = 0; - void *dt_data = 0; - char *sig_fn = 0; - void *sig_data = 0; - unsigned pagesize = 2048; - int fd; - SHA_CTX ctx; - uint8_t sha[SHA_DIGEST_LENGTH]; - unsigned base = 0x10000000; - unsigned kernel_offset = 0x00008000; - unsigned ramdisk_offset = 0x01000000; - unsigned second_offset = 0x00f00000; - unsigned tags_offset = 0x00000100; - - argc--; - argv++; - - memset(&hdr, 0, sizeof(hdr)); - - while(argc > 0){ - char *arg = argv[0]; - char *val = argv[1]; - if(argc < 2) { - return usage(); - } - argc -= 2; - argv += 2; - if(!strcmp(arg, "--output") || !strcmp(arg, "-o")) { - bootimg = val; - } else if(!strcmp(arg, "--kernel")) { - kernel_fn = val; - } else if(!strcmp(arg, "--ramdisk")) { - ramdisk_fn = val; - } else if(!strcmp(arg, "--second")) { - second_fn = val; - } else if(!strcmp(arg, "--cmdline")) { - cmdline = val; - } else if(!strcmp(arg, "--base")) { - base = strtoul(val, 0, 16); - } else if(!strcmp(arg, "--kernel_offset")) { - kernel_offset = strtoul(val, 0, 16); - } else if(!strcmp(arg, "--ramdisk_offset")) { - ramdisk_offset = strtoul(val, 0, 16); - } else if(!strcmp(arg, "--second_offset")) { - second_offset = strtoul(val, 0, 16); - } else if(!strcmp(arg, "--tags_offset")) { - tags_offset = strtoul(val, 0, 16); - } else if(!strcmp(arg, "--board")) { - board = val; - } else if(!strcmp(arg,"--pagesize")) { - pagesize = strtoul(val, 0, 10); - if ((pagesize != 2048) && (pagesize != 4096) && (pagesize != 8192) && (pagesize != 16384) && (pagesize != 32768) && (pagesize != 65536) && (pagesize != 131072)) { - fprintf(stderr,"error: unsupported page size %d\n", pagesize); - return -1; - } - } else if (!strcmp(arg, "--dt_dir")) { - dt_dir = val; - } else if(!strcmp(arg, "--dt")) { - dt_fn = val; - } else if(!strcmp(arg, "--signature")) { - sig_fn = val; - } else { - return usage(); - } - } - hdr.page_size = pagesize; - - hdr.kernel_addr = base + kernel_offset; - hdr.ramdisk_addr = base + ramdisk_offset; - hdr.second_addr = base + second_offset; - hdr.tags_addr = base + tags_offset; - - if (dt_dir && dt_fn) { - fprintf(stderr,"error: don't use both --dt_dir and --dt option\n"); - return usage(); - } - - if(bootimg == 0) { - fprintf(stderr,"error: no output filename specified\n"); - return usage(); - } - - if(kernel_fn == 0) { - fprintf(stderr,"error: no kernel image specified\n"); - return usage(); - } - - if(ramdisk_fn == 0) { - fprintf(stderr,"error: no ramdisk image specified\n"); - return usage(); - } - - if(strlen(board) >= BOOT_NAME_SIZE) { - fprintf(stderr,"error: board name too large\n"); - return usage(); - } - - strcpy(hdr.name, board); - - memcpy(hdr.magic, BOOT_MAGIC, BOOT_MAGIC_SIZE); - - if(strlen(cmdline) > (BOOT_ARGS_SIZE - 1)) { - fprintf(stderr,"error: kernel commandline too large\n"); - return 1; - } - strcpy((char*)hdr.cmdline, cmdline); - - kernel_data = load_file(kernel_fn, &hdr.kernel_size); - if(kernel_data == 0) { - fprintf(stderr,"error: could not load kernel '%s'\n", kernel_fn); - return 1; - } - - if(!strcmp(ramdisk_fn,"NONE")) { - ramdisk_data = 0; - hdr.ramdisk_size = 0; - } else { - ramdisk_data = load_file(ramdisk_fn, &hdr.ramdisk_size); - if(ramdisk_data == 0) { - fprintf(stderr,"error: could not load ramdisk '%s'\n", ramdisk_fn); - return 1; - } - } - - if(second_fn) { - second_data = load_file(second_fn, &hdr.second_size); - if(second_data == 0) { - fprintf(stderr,"error: could not load secondstage '%s'\n", second_fn); - return 1; - } - } - - if (dt_dir) { - dt_data = load_dtbh_block(dt_dir, pagesize, &hdr.dt_size); - if (dt_data == 0) { - fprintf(stderr, "error: could not load device tree blobs '%s'\n", dt_dir); - return 1; - } - } - - if(dt_fn) { - dt_data = load_file(dt_fn, &hdr.dt_size); - if (dt_data == 0) { - fprintf(stderr,"error: could not load device tree image '%s'\n", dt_fn); - return 1; - } - } - - if(sig_fn) { - sig_data = load_file(sig_fn, 0); - if (sig_data == 0) { - fprintf(stderr,"error: could not load signature '%s'\n", sig_fn); - return 1; - } - } - - /* put a hash of the contents in the header so boot images can be - * differentiated based on their first 2k. - */ - SHA1_Init(&ctx); - SHA1_Update(&ctx, kernel_data, hdr.kernel_size); - SHA1_Update(&ctx, &hdr.kernel_size, sizeof(hdr.kernel_size)); - SHA1_Update(&ctx, ramdisk_data, hdr.ramdisk_size); - SHA1_Update(&ctx, &hdr.ramdisk_size, sizeof(hdr.ramdisk_size)); - SHA1_Update(&ctx, second_data, hdr.second_size); - SHA1_Update(&ctx, &hdr.second_size, sizeof(hdr.second_size)); - if(dt_data) { - SHA1_Update(&ctx, dt_data, hdr.dt_size); - SHA1_Update(&ctx, &hdr.dt_size, sizeof(hdr.dt_size)); - } - SHA1_Final(sha, &ctx); - memcpy(hdr.id, sha, - SHA_DIGEST_LENGTH > sizeof(hdr.id) ? sizeof(hdr.id) : SHA_DIGEST_LENGTH); - - fd = open(bootimg, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if(fd < 0) { - fprintf(stderr,"error: could not create '%s'\n", bootimg); - return 1; - } - - if(write(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) goto fail; - if(write_padding(fd, pagesize, sizeof(hdr))) goto fail; - - if(write(fd, kernel_data, hdr.kernel_size) != hdr.kernel_size) goto fail; - if(write_padding(fd, pagesize, hdr.kernel_size)) goto fail; - - if(write(fd, ramdisk_data, hdr.ramdisk_size) != hdr.ramdisk_size) goto fail; - if(write_padding(fd, pagesize, hdr.ramdisk_size)) goto fail; - - if(second_data) { - if(write(fd, second_data, hdr.second_size) != hdr.second_size) goto fail; - if(write_padding(fd, pagesize, hdr.ramdisk_size)) goto fail; - } - - if(dt_data) { - if(write(fd, dt_data, hdr.dt_size) != hdr.dt_size) goto fail; - if(write_padding(fd, pagesize, hdr.dt_size)) goto fail; - } - - if(sig_data) { - if(write(fd, sig_data, 256) != 256) goto fail; - } - - return 0; - -fail: - unlink(bootimg); - close(fd); - fprintf(stderr,"error: failed writing '%s': %s\n", bootimg, - strerror(errno)); - return 1; -} diff --git a/dtbhtool/mkbootimg.mk b/dtbhtool/mkbootimg.mk deleted file mode 100644 index 0155c2f..0000000 --- a/dtbhtool/mkbootimg.mk +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright (C) 2017 The LineageOS 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. - -LOCAL_PATH := $(call my-dir) - -ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true) -ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true) -ifeq ($(strip $(BUILD_TINY_ANDROID)),true) -include system/tools/dtbtool/Android.mk -endif - -ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) -DTBTOOL_NAME := dtbToolLineage -else -DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL) -endif - -DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX) - -INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img - -ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),) -# dtbToolCM will search subdirectories -possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ -else -# Most specific paths must come first in possible_dtb_dirs -possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/exynos/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/ -endif - -define build-dtimage-target - $(call pretty,"Target dt image: $@") - $(hide) for dir in $(possible_dtb_dirs); do \ - if [ -d "$$dir" ]; then \ - dtb_dir="$$dir"; \ - break; \ - fi; \ - done; \ - $(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir"; - $(hide) chmod a+r $@ -endef - -$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET) - $(build-dtimage-target) - @echo "Made DT image: $@" - -.PHONY: dtimage -dtimage: $(INSTALLED_DTIMAGE_TARGET) - -endif -endif - -ifeq ($(strip $(TARGET_NEEDS_LOKI)),true) -LOKI_TOOL := loki_tool -else -LOKI_TOOL := echo -TARGET_LOKI_ABOOT_IMAGE := -endif - -$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS) - $(call pretty,"Target boot image: $@") - $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ - $(hide) echo -n "SEANDROIDENFORCE" >> $@ - $(hide) $(LOKI_TOOL) patch boot $(TARGET_LOKI_ABOOT_IMAGE) $@ $@.lok - $(hide) cp $@.lok $@ || true - $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE),raw) - @echo "Made boot image: $@" - -$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) $(RECOVERYIMAGE_EXTRA_DEPS) - @echo "----- Making recovery image ------" - $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ --id > $(RECOVERYIMAGE_ID_FILE) - $(hide) echo -n "SEANDROIDENFORCE" >> $@ - $(hide) $(LOKI_TOOL) patch recovery $(TARGET_LOKI_ABOOT_IMAGE) $@ $@.lok - $(hide) cp $@.lok $@ || true - $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE),raw) - @echo "Made recovery image: $@" diff --git a/dtbhtool/mkdtbimg.c b/dtbhtool/mkdtbimg.c deleted file mode 100644 index d5fda12..0000000 --- a/dtbhtool/mkdtbimg.c +++ /dev/null @@ -1,126 +0,0 @@ -/* tools/mkbootimg/mkdtbimg.c -** -** Copyright 2016-2017, The LineageOS 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. -** -** December 2016, Christopher N. Hesse -** Separate dt creation from mkbootimg program. -** -** January 2017, Christopher N. Hesse -** Adjust to dtbToolCM call syntax. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -int usage(void) -{ - fprintf(stderr,"usage: mkdtimg\n" - " --dt_dir \n" - " -o|--output \n" - ); - return 1; -} - - - -int main(int argc, char **argv) -{ - char *dtimg = 0; - char *dt_dir = 0; - void *dt_data = 0; - unsigned pagesize = 0; - unsigned default_pagesize = 2048; - uint32_t dt_size; - int fd; - struct stat sbuf; - - argc--; - argv++; - - while(argc > 0){ - char *arg = argv[0]; - char *val = argv[1]; - if(argc < 1) { - return usage(); - } - argc -= 2; - argv += 2; - if(!strcmp(arg, "--output") || !strcmp(arg, "-o")) { - dtimg = val; - } else if (!strcmp(arg, "--dt_dir")) { - dt_dir = val; - } else if (!strcmp(arg, "-p")) { - // Ignore this parameter - } else if (!strcmp(arg, "-s")) { - pagesize = strtol(val, NULL, 10); - if (pagesize == 0) - pagesize = default_pagesize; - } else { - // Check if this is the dtb path - int err = stat(arg, &sbuf); - if (err != 0 || !S_ISDIR(sbuf.st_mode)) - return usage(); - dt_dir = arg; - } - } - - if(dtimg == 0) { - fprintf(stderr,"error: no output filename specified\n"); - return usage(); - } - - if(dt_dir == 0) { - fprintf(stderr,"error: no dtb path specified\n"); - return usage(); - } - - dt_data = load_dtbh_block(dt_dir, pagesize, &dt_size); - if (dt_data == 0) { - fprintf(stderr, "error: could not load device tree blobs '%s'\n", dt_dir); - return 1; - } - - fd = open(dtimg, O_CREAT | O_TRUNC | O_WRONLY, 0644); - if(fd < 0) { - fprintf(stderr,"error: could not create '%s'\n", dtimg); - return 1; - } - - if(write(fd, dt_data, dt_size) != dt_size) goto fail; - - return 0; - -fail: - unlink(dtimg); - close(fd); - fprintf(stderr,"error: failed writing '%s': %s\n", dtimg, - strerror(errno)); - return 1; -} diff --git a/dtbhtool/samsung_dtbh.h b/dtbhtool/samsung_dtbh.h deleted file mode 100644 index a694962..0000000 --- a/dtbhtool/samsung_dtbh.h +++ /dev/null @@ -1,37 +0,0 @@ -/* tools/mkbootimg/samsung_dtbh.h -** -** Copyright 2017, The LineageOS 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. -*/ - -#ifndef _SAMSUNG_DTBH_H_ -#define _SAMSUNG_DTBH_H_ - -#define DTBH_MAGIC "DTBH" -#define DTBH_VERSION 2 -#define DTBH_PLATFORM "android" -#define DTBH_SUBTYPE "samsung" - /* Hardcoded entry */ -#define DTBH_PLATFORM_CODE 0x000050a6 -#define DTBH_SUBTYPE_CODE 0x217584da - -/* DTBH_MAGIC + DTBH_VERSION + DTB counts */ -#define DT_HEADER_PHYS_SIZE 12 - -/* - * keep the eight uint32_t entries first in this struct so we can memcpy them to the file - */ -#define DT_ENTRY_PHYS_SIZE (sizeof(uint32_t) * 8) - -#endif // _SAMSUNG_DTBH_H_ diff --git a/dtbhtool/unpackbootimg.c b/dtbhtool/unpackbootimg.c deleted file mode 100644 index acc9659..0000000 --- a/dtbhtool/unpackbootimg.c +++ /dev/null @@ -1,222 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bootimg.h" - -typedef unsigned char byte; - -int read_padding(FILE* f, unsigned itemsize, int pagesize) -{ - byte* buf = (byte*)malloc(sizeof(byte) * pagesize); - unsigned pagemask = pagesize - 1; - unsigned count; - - if((itemsize & pagemask) == 0) { - free(buf); - return 0; - } - - count = pagesize - (itemsize & pagemask); - - fread(buf, count, 1, f); - free(buf); - return count; -} - -void write_string_to_file(char* file, char* string) -{ - FILE* f = fopen(file, "w"); - fwrite(string, strlen(string), 1, f); - fwrite("\n", 1, 1, f); - fclose(f); -} - -int usage() { - printf("usage: unpackbootimg\n"); - printf("\t-i|--input boot.img\n"); - printf("\t[ -o|--output output_directory]\n"); - printf("\t[ -p|--pagesize ]\n"); - return 0; -} - -int main(int argc, char** argv) -{ - char tmp[PATH_MAX]; - char* directory = "./"; - char* filename = NULL; - int pagesize = 0; - - argc--; - argv++; - while(argc > 0){ - char *arg = argv[0]; - char *val = argv[1]; - argc -= 2; - argv += 2; - if(!strcmp(arg, "--input") || !strcmp(arg, "-i")) { - filename = val; - } else if(!strcmp(arg, "--output") || !strcmp(arg, "-o")) { - directory = val; - } else if(!strcmp(arg, "--pagesize") || !strcmp(arg, "-p")) { - pagesize = strtoul(val, 0, 16); - } else { - return usage(); - } - } - - if (filename == NULL) { - return usage(); - } - - int total_read = 0; - FILE* f = fopen(filename, "rb"); - boot_img_hdr header; - - //printf("Reading header...\n"); - int i; - for (i = 0; i <= 512; i++) { - fseek(f, i, SEEK_SET); - fread(tmp, BOOT_MAGIC_SIZE, 1, f); - if (memcmp(tmp, BOOT_MAGIC, BOOT_MAGIC_SIZE) == 0) - break; - } - total_read = i; - if (i > 512) { - printf("Android boot magic not found.\n"); - return 1; - } - fseek(f, i, SEEK_SET); - printf("Android magic found at: %d\n", i); - - fread(&header, sizeof(header), 1, f); - printf("BOARD_KERNEL_CMDLINE %s\n", header.cmdline); - printf("BOARD_KERNEL_BASE %08x\n", header.kernel_addr - 0x00008000); - printf("BOARD_RAMDISK_OFFSET %08x\n", header.ramdisk_addr - header.kernel_addr + 0x00008000); - printf("BOARD_SECOND_OFFSET %08x\n", header.second_addr - header.kernel_addr + 0x00008000); - printf("BOARD_TAGS_OFFSET %08x\n",header.tags_addr - header.kernel_addr + 0x00008000); - printf("BOARD_PAGE_SIZE %d\n", header.page_size); - printf("BOARD_SECOND_SIZE %d\n", header.second_size); - printf("BOARD_DT_SIZE %d\n", header.dt_size); - - if (pagesize == 0) { - pagesize = header.page_size; - } - - //printf("cmdline...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-cmdline"); - write_string_to_file(tmp, header.cmdline); - - //printf("base...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-base"); - char basetmp[200]; - sprintf(basetmp, "%08x", header.kernel_addr - 0x00008000); - write_string_to_file(tmp, basetmp); - - //printf("ramdisk_offset...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-ramdisk_offset"); - char ramdisktmp[200]; - sprintf(ramdisktmp, "%08x", header.ramdisk_addr - header.kernel_addr + 0x00008000); - write_string_to_file(tmp, ramdisktmp); - - //printf("second_offset...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-second_offset"); - char secondtmp[200]; - sprintf(secondtmp, "%08x", header.second_addr - header.kernel_addr + 0x00008000); - write_string_to_file(tmp, secondtmp); - - //printf("tags_offset...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-tags_offset"); - char tagstmp[200]; - sprintf(tagstmp, "%08x", header.tags_addr - header.kernel_addr + 0x00008000); - write_string_to_file(tmp, tagstmp); - - //printf("pagesize...\n"); - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-pagesize"); - char pagesizetmp[200]; - sprintf(pagesizetmp, "%d", header.page_size); - write_string_to_file(tmp, pagesizetmp); - - total_read += sizeof(header); - //printf("total read: %d\n", total_read); - total_read += read_padding(f, sizeof(header), pagesize); - - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-zImage"); - FILE *k = fopen(tmp, "wb"); - byte* kernel = (byte*)malloc(header.kernel_size); - //printf("Reading kernel...\n"); - fread(kernel, header.kernel_size, 1, f); - total_read += header.kernel_size; - fwrite(kernel, header.kernel_size, 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); - //printf("Reading ramdisk...\n"); - fread(ramdisk, header.ramdisk_size, 1, f); - total_read += header.ramdisk_size; - sprintf(tmp, "%s/%s", directory, basename(filename)); - if(ramdisk[0] == 0x02 && ramdisk[1]== 0x21) - strcat(tmp, "-ramdisk.lz4"); - else - strcat(tmp, "-ramdisk.gz"); - FILE *r = fopen(tmp, "wb"); - fwrite(ramdisk, header.ramdisk_size, 1, r); - fclose(r); - - total_read += read_padding(f, header.ramdisk_size, pagesize); - - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-second"); - FILE *s = fopen(tmp, "wb"); - byte* second = (byte*)malloc(header.second_size); - //printf("Reading second...\n"); - fread(second, header.second_size, 1, f); - total_read += header.second_size; - fwrite(second, header.second_size, 1, r); - fclose(s); - - total_read += read_padding(f, header.second_size, pagesize); - - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-dt"); - FILE *d = fopen(tmp, "wb"); - byte* dt = (byte*)malloc(header.dt_size); - //printf("Reading dt...\n"); - fread(dt, header.dt_size, 1, f); - total_read += header.dt_size; - fwrite(dt, header.dt_size, 1, r); - fclose(d); - - total_read += read_padding(f, header.dt_size, pagesize); - - sprintf(tmp, "%s/%s", directory, basename(filename)); - strcat(tmp, "-signature"); - FILE *fsig = fopen(tmp, "wb"); - byte* bsig = (byte*)malloc(256); - //printf("Reading signature...\n"); - fread(bsig, 256, 1, f); - total_read += 256; - fwrite(bsig, 256, 1, r); - fclose(fsig); - - fclose(f); - - //printf("Total Read: %d\n", total_read); - return 0; -} diff --git a/dtbhtool/unpackdtbhimg.c b/dtbhtool/unpackdtbhimg.c deleted file mode 100644 index 0cdbabd..0000000 --- a/dtbhtool/unpackdtbhimg.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2018, The LineageOS 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_PAGE_SIZE 2048 -#define DT_NAME_LEN 64 - -struct dt_entry { - uint32_t chip; - uint32_t platform; - uint32_t subtype; - uint32_t hw_rev; - uint32_t hw_rev_end; - uint32_t offset; - uint32_t size; /* including padding */ - uint32_t space; -}; - -struct dtbh_header { - uint32_t magic; - uint32_t version; - uint32_t entry_count; - - struct dt_entry entries[]; -}; - -static void show_dt_entry(struct dt_entry *ent) { - printf("chip: %u, platform: 0x%x, subtype: 0x%x, hw_rev: %u, hw_rev_end: %u, offset: %u, " - "size: %u, space: %u\n", ent->chip, ent->platform, ent->subtype, ent->hw_rev, - ent->hw_rev_end, ent->offset, ent->size, ent->space); -} - -static void dump_dtb(void *buffer, uint32_t size, char *dest) -{ - FILE *output; - ssize_t len; - - output = fopen(dest, "wb"); - if (output == NULL) { - fprintf(stderr, "error: could not open %s\n", dest); - return; - } - - len = fwrite(buffer, size, 1, output); - fclose(output); - - if (len < 0) { - printf("error: failed to write %s (%s)\n", dest, strerror(errno)); - return; - } - - printf("Successfully dumped %s (size=%zu)\n", dest, size); -} - -int usage(void) -{ - fprintf(stderr,"usage: unpackdtbhimg\n" - " -i|--input \n" - " -o|--output \n" - " -p|--pagesize \n" - ); - return 1; -} - -int main(int argc, char *argv[]) { - char *dtbhimg = 0; - char *output_dir = 0; - FILE *dtbhimg_fp; - ssize_t len; - int page_size = DEFAULT_PAGE_SIZE; - struct dtbh_header *header; - void *dt_blob; - - argc--; - argv++; - - while (argc > 0){ - char *arg = argv[0]; - char *val = argv[1]; - if (argc < 1) { - return usage(); - } - argc -= 2; - argv += 2; - if (!strcmp(arg, "--input") || !strcmp(arg, "-i")) { - dtbhimg = val; - } else if (!strcmp(arg, "--output") || !strcmp(arg, "-o")) { - output_dir = val; - } else if (!strcmp(arg, "--pagesize") || !strcmp(arg, "-p")) { - page_size = atoi(val); - } - } - - if (dtbhimg == 0) { - fprintf(stderr,"error: no input filename specified\n"); - return usage(); - } - - if (output_dir == 0) { - fprintf(stderr,"error: no output path specified\n"); - return usage(); - } - - printf("using page_size: %d\n", page_size); - - dtbhimg_fp = fopen(dtbhimg, "r"); - if (dtbhimg_fp == NULL) { - fprintf(stderr, "error: could not open %s\n", dtbhimg); - goto err_open; - } - - header = calloc(page_size, 1); - if (header == NULL) { - goto err_calloc; - } - - len = fread(header, page_size, 1, dtbhimg_fp); - if (len != 1) { - fprintf(stderr, "Failed to read DTBH header: %s\n", strerror(errno)); - goto err_read; - } - - printf("DTBH_MAGIC = '%.4s'\n", &header->magic); - printf("DTBH_VERSION = %u\n", header->version); - printf("Number of entries: %u\n", header->entry_count); - - for (uint32_t i = 0; i < header->entry_count; i++) { - printf("DTB %d: ", i); - show_dt_entry(&header->entries[i]); - dt_blob = malloc(header->entries[i].size); - if (fseek(dtbhimg_fp, header->entries[i].offset, SEEK_SET) != 0) { - fprintf(stderr, "failed to set offset to 0x%x: %s\n", header->entries[i].offset, - strerror(errno)); - goto err_loop; - } - len = fread(dt_blob, header->entries[i].size, 1, dtbhimg_fp); - if (len != 1) { - fprintf(stderr, "Failed to read DTB: %s\n", strerror(errno)); - } - - size_t dest_file_len = DT_NAME_LEN + strlen(output_dir); - char dest_file[dest_file_len]; - snprintf(dest_file, dest_file_len, "%s/chip%u-0x%x-0x%x_rev%u-%u.dtb", output_dir, - header->entries[i].chip, header->entries[i].platform, header->entries[i].subtype, - header->entries[i].hw_rev, header->entries[i].hw_rev_end); - dump_dtb(dt_blob, header->entries[i].size, dest_file); - free(dt_blob); - } - - free(header); - fclose(dtbhimg_fp); - - return 0; - -err_loop: - free(dt_blob); -err_read: - free(header); -err_calloc: - fclose(dtbhimg_fp); -err_open: - return 1; -} diff --git a/omni_a6lte.mk b/omni_a6lte.mk index 21c56fd..61de262 100644 --- a/omni_a6lte.mk +++ b/omni_a6lte.mk @@ -30,4 +30,3 @@ PRODUCT_NAME := omni_a6lte PRODUCT_MODEL := Samsung Galaxy A6 2018 PRODUCT_BRAND := samsung PRODUCT_MANUFACTURER := samsung - diff --git a/recovery.fstab b/recovery.fstab deleted file mode 100644 index 6cb5a28..0000000 --- a/recovery.fstab +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2018 The TwrpBuilder 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. -# - -# mount_point fstype device device2 flags - -/boot emmc /dev/block/platform/13540000.dwmmc0/by-name/BOOT flags=display="Kernel";backup=1 -/cache ext4 /dev/block/platform/13540000.dwmmc0/by-name/CACHE flags=display="Cache" -/recovery emmc /dev/block/platform/13540000.dwmmc0/by-name/RECOVERY flags=display="Recovery";backup=1 -/system ext4 /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM flags=display="System";backup=1 -/system_image emmc /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM flags=display="System_image";backup=1;flashimg=1 -/vendor ext4 /dev/block/platform/13540000.dwmmc0/by-name/VENDOR flags=display="Vendor";backup=1;wipeingui -/vendor_image emmc /dev/block/platform/13540000.dwmmc0/by-name/VENDOR flags=display="Vendor_image";backup=1;flashimg=1 -/data ext4 /dev/block/platform/13540000.dwmmc0/by-name/USERDATA flags=display="Data";encryptable=footer;length=-20480;fileencryption=ice -/modem emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO flags=display="Modem";backup=1 -/efs ext4 /dev/block/platform/13540000.dwmmc0/by-name/EFS flags=display="EFS";backup=1 - -# Internal storage -/storage ext4 /data/media/0 flags=display="Internal Storage";usermrf;backup=1;fsflags="bind";removable - -# Removable storage -/sdcard1 vfat /dev/block/mmcblk1p1 /dev/block/mmcblk1 flags=fsflags=utf8;display="MicroSD";storage;wipeingui;removable -/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=fsflags=utf8;display="USB-Storage";storage;wipeingui;removable diff --git a/recovery/root/etc/recovery.fstab b/recovery/root/etc/recovery.fstab new file mode 100644 index 0000000..bcaf8de --- /dev/null +++ b/recovery/root/etc/recovery.fstab @@ -0,0 +1,39 @@ +# +# This file is part of the OrangeFox Recovery Project +# Copyright (C) 2019-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 . +# + +# mount_point fstype device device2 flags + +/boot emmc /dev/block/platform/13540000.dwmmc0/by-name/BOOT flags=display="Kernel";backup=1 +/cache ext4 /dev/block/platform/13540000.dwmmc0/by-name/CACHE flags=display="Cache" +/recovery emmc /dev/block/platform/13540000.dwmmc0/by-name/RECOVERY flags=display="Recovery";backup=1 +/system ext4 /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM flags=display="System";backup=1 +/system_image emmc /dev/block/platform/13540000.dwmmc0/by-name/SYSTEM flags=display="System image";backup=1;flashimg=1 +/vendor ext4 /dev/block/platform/13540000.dwmmc0/by-name/VENDOR flags=display="Vendor";backup=1;wipeingui +/vendor_image emmc /dev/block/platform/13540000.dwmmc0/by-name/VENDOR flags=display="Vendor image";backup=1;flashimg=1 +/odm ext4 /dev/block/platform/13540000.dwmmc0/by-name/ODM flags=display="Odm";backup=1;wipeingui +/odm_image emmc /dev/block/platform/13540000.dwmmc0/by-name/ODM flags=display="Odm_image";backup=1;flashimg=1 +/data ext4 /dev/block/platform/13540000.dwmmc0/by-name/USERDATA flags=display="Data";encryptable=footer;length=-20480;fileencryption=ice +/modem emmc /dev/block/platform/13540000.dwmmc0/by-name/RADIO flags=display="Modem";backup=1 +/efs ext4 /dev/block/platform/13540000.dwmmc0/by-name/EFS flags=display="EFS";backup=1 + +# Internal storage +/storage ext4 /data/media/0 flags=display="Internal Storage";usermrf;backup=1;fsflags="bind";removable + +# Removable storage +/sdcard1 vfat /dev/block/mmcblk1p1 /dev/block/mmc1k1p1 flags=display="Micro SDcard";storage;wipeingui;removable +/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-Storage";storage;wipeingui;removable diff --git a/recovery/root/init.recovery.exynos7870.rc b/recovery/root/init.recovery.exynos7870.rc new file mode 100644 index 0000000..783776e --- /dev/null +++ b/recovery/root/init.recovery.exynos7870.rc @@ -0,0 +1,4 @@ +on fs + export ANDROID_ROOT /system_root + +on boot diff --git a/recovery/root/init.recovery.usb.rc b/recovery/root/init.recovery.usb.rc index 71ba47f..96ee43a 100644 --- a/recovery/root/init.recovery.usb.rc +++ b/recovery/root/init.recovery.usb.rc @@ -16,10 +16,6 @@ on boot write /sys/class/android_usb/android0/iSerial ${ro.serialno} write /sys/class/android_usb/android0/f_mass_storage/inquiry_string "Samsung" -# ss_conn_daemon2 service -on property:sys.usb.config=none - stop ss_conn_daemon2_service - on property:sys.usb.config=mtp write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/idVendor 04e8 @@ -49,260 +45,3 @@ on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,adb write /sys/class/android_usb/android0/functions ${sys.usb.config} write /sys/class/android_usb/android0/enable 1 setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=midi - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 686C - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=midi,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=midi,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 686C - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=ncm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/functions ncm - write /sys/class/android_usb/android0/bDeviceClass 2 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=ncm,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ncm,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/functions ncm,adb - write /sys/class/android_usb/android0/bDeviceClass 2 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6863 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/bDeviceClass 224 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6864 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/bDeviceClass 224 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=ptp - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6865 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=ptp,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=ptp,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6866 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,dm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,acm,dm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=rndis,acm,dm,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=rndis,acm,dm,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=acm,dm,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=acm,dm,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=acm,dm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=sec_charging - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions mtp - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=sec_charging,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=sec_charging,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions mtp,adb - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=vzw_charging - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions mtp - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=vzw_charging,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=vzw_charging,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions mtp,adb - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mass_storage - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685B - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mass_storage,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mass_storage,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685e - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mass_storage,acm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 685e - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -# rndis,acm,diag and diag,acm,adb used for Hidden Menu - -on property:sys.usb.config=rndis,diag - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6862 - write /sys/class/android_usb/android0/f_diag/clients diag_mdm - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=dm,acm,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=dm,acm,adb - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/f_diag/clients diag_mdm - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=diag,acm - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 685d - write /sys/class/android_usb/android0/f_diag/clients diag_mdm - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - - -on property:sys.usb.config=rndis,acm,diag - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04E8 - write /sys/class/android_usb/android0/idProduct 6864 - write /sys/class/android_usb/android0/f_diag/clients diag_mdm - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mtp,conn_gadget - start ss_conn_daemon2_service - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/bDeviceClass 0 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - -on property:sys.usb.config=mtp,conn_gadget,adb - start adbd - -on property:sys.usb.ffs.ready=1 && property:sys.usb.config=mtp,conn_gadget,adb - start ss_conn_daemon2_service - write /sys/class/android_usb/android0/enable 0 - write /sys/class/android_usb/android0/idVendor 04e8 - write /sys/class/android_usb/android0/idProduct 6860 - write /sys/class/android_usb/android0/functions ${sys.usb.config} - write /sys/class/android_usb/android0/bDeviceClass 0 - write /sys/class/android_usb/android0/enable 1 - setprop sys.usb.state ${sys.usb.config} - diff --git a/recovery/root/ueventd.rc b/recovery/root/ueventd.rc deleted file mode 100644 index 7a61b80..0000000 --- a/recovery/root/ueventd.rc +++ /dev/null @@ -1,297 +0,0 @@ -subsystem adf - devname uevent_devname - -subsystem graphics - devname uevent_devpath - dirname /dev/graphics - -subsystem drm - devname uevent_devpath - dirname /dev/dri - -subsystem oncrpc - devname uevent_devpath - dirname /dev/oncrpc - -subsystem adsp - devname uevent_devpath - dirname /dev/adsp - -subsystem msm_camera - devname uevent_devpath - dirname /dev/msm_camera - -subsystem input - devname uevent_devpath - dirname /dev/input - -subsystem mtd - devname uevent_devpath - dirname /dev/mtd - -subsystem sound - devname uevent_devpath - dirname /dev/snd - -# ueventd can only set permissions on device nodes and their associated -# sysfs attributes, not on arbitrary paths. -# -# format for /dev rules: devname mode uid gid -# format for /sys rules: nodename attr mode uid gid -# shortcut: "mtd@NN" expands to "/dev/mtd/mtdNN" - -/dev/null 0666 root root -/dev/zero 0666 root root -/dev/full 0666 root root -/dev/ptmx 0666 root root -/dev/tty 0666 root root -/dev/random 0666 root root -/dev/urandom 0666 root root -# Make HW RNG readable by group system to let EntropyMixer read it. -/dev/hw_random 0440 root system -/dev/ashmem 0666 root root -/dev/binder 0666 root root -/dev/hwbinder 0666 root root -/dev/vndbinder 0666 root root -/dev/ovr* 0664 root system -/dev/tvr* 0664 root system - -# 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/log/* 0666 root log -/dev/pmsg0 0222 root log - -# the msm hw3d client device node is world writable/readable. -/dev/msm_hw3dc 0666 root root - -# gpu driver for adreno200 is globally accessible -/dev/kgsl 0666 root root - -# 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/ttyMSM0 0600 bluetooth bluetooth -/dev/uhid 0660 system bluetooth -/dev/uinput 0660 system bluetooth -/dev/alarm 0664 system radio -/dev/power_on_alarm 0660 system radio -/dev/rtc0 0640 system system -/dev/tty0 0660 root system -/dev/graphics/* 0660 root graphics -/dev/msm_hw3dm 0660 system graphics -/dev/input/* 0660 root input -/dev/eac 0660 root audio -/dev/cam 0660 root camera -/dev/pmem 0660 system graphics -/dev/pmem_adsp* 0660 system audio -/dev/pmem_camera* 0660 system camera -/dev/oncrpc/* 0660 root system -/dev/adsp/* 0660 system audio -/dev/snd/* 0660 system audio -/dev/mt9t013 0660 system system -/dev/msm_camera/* 0660 system system -/dev/akm8976_daemon 0640 compass system -/dev/akm8976_aot 0640 compass system -/dev/akm8973_daemon 0640 compass system -/dev/akm8973_aot 0640 compass system -/dev/bma150 0640 compass system -/dev/cm3602 0640 compass system -/dev/akm8976_pffd 0640 compass system -/dev/lightsensor 0640 system system -/dev/msm_pcm_out* 0660 system audio -/dev/msm_pcm_in* 0660 system audio -/dev/msm_pcm_ctl* 0660 system audio -/dev/msm_snd* 0660 system audio -/dev/msm_mp3* 0660 system audio -/dev/audience_a1026* 0660 system audio -/dev/tpa2018d1* 0660 system audio -/dev/msm_audpre 0660 system audio -/dev/msm_audio_ctl 0660 system audio -/dev/htc-acoustic 0660 system audio -/dev/vdec 0660 system audio -/dev/q6venc 0660 system audio -/dev/snd/dsp 0660 system audio -/dev/snd/dsp1 0660 system audio -/dev/snd/mixer 0660 system audio -/dev/smd0 0640 radio radio -/dev/qmi 0640 radio radio -/dev/qmi0 0640 radio radio -/dev/qmi1 0640 radio radio -/dev/qmi2 0640 radio radio -/dev/bus/usb/* 0660 root usb -/dev/mtp_usb 0660 root mtp -/dev/usb_accessory 0660 root usb -/dev/tun 0660 system vpn - -# CDMA radio interface MUX -/dev/ts0710mux* 0640 radio radio -/dev/ppp 0660 radio vpn - -# sysfs properties -/sys/devices/platform/trusty.* trusty_version 0440 root log -/sys/devices/virtual/input/input* enable 0660 root input -/sys/devices/virtual/input/input* poll_delay 0660 root input -/sys/devices/virtual/usb_composite/* enable 0664 root system -/sys/devices/system/cpu/cpu* cpufreq/scaling_max_freq 0664 system system -/sys/devices/system/cpu/cpu* cpufreq/scaling_min_freq 0664 system system - -# DVB API device nodes -/dev/dvb* 0660 root system - -# uevent.samsungexynos7870.rc -/dev/mali0 0666 system system -/dev/ion 0666 system system -/dev/ump 0666 system graphics -/dev/exynos-mem 0660 system graphics -/dev/video0 0660 system camera -/dev/video1 0660 system camera -/dev/video2 0660 system camera -/dev/video3 0660 system camera -/dev/video20 0660 system system -# media0 is used for GSC, DECON, etc -/dev/media0 0660 system camera -# media1 is used for DECON Ext WB -/dev/media1 0660 system graphics -# Various devices use the v4l-subdev interface -# We declare all such nodes simultaneously here -/dev/v4l-subdev0 0660 system camera -/dev/v4l-subdev1 0660 system camera -/dev/v4l-subdev2 0660 system camera -/dev/v4l-subdev3 0660 system camera -/dev/v4l-subdev4 0660 system camera -/dev/v4l-subdev5 0660 system camera -/dev/v4l-subdev6 0660 system camera -/dev/v4l-subdev7 0660 system camera -/dev/v4l-subdev8 0660 system camera -/dev/v4l-subdev9 0660 system camera -/dev/v4l-subdev10 0660 system camera -/dev/v4l-subdev11 0660 system camera -/dev/v4l-subdev12 0660 system camera -/dev/v4l-subdev13 0660 system camera -/dev/v4l-subdev14 0660 system camera -/dev/v4l-subdev15 0660 system camera -/dev/v4l-subdev16 0660 system camera -/dev/v4l-subdev17 0660 system camera -/dev/v4l-subdev18 0660 system camera -/dev/v4l-subdev19 0660 system camera -# v4l-subdev20 is used for DECON Ext WB -/dev/v4l-subdev20 0660 system graphics -/dev/v4l-subdev21 0660 system graphics - -# gscalers -/dev/video23 0660 media graphics -/dev/video26 0660 media graphics -/dev/video24 0660 media graphics -/dev/video27 0660 media graphics -/dev/video29 0660 media graphics -/dev/video30 0660 media graphics -# video31 is used for DECON Ext WB -/dev/video31 0660 media graphics - -# mscalers -/dev/video50 0660 mediacodec drmrpc -/dev/video51 0660 media graphics -/dev/m2m1shot_scaler0 0660 mediacodec drmrpc -/dev/m2m1shot_scaler1 0660 cameraserver cameraserver - -/dev/video55 0666 system graphics -/dev/fimg2d 0666 system graphics -/dev/i2c-2 0660 system system -/dev/HPD 0660 system system - -# mfc -/dev/video6 0660 mediacodec mediadrm -/dev/video7 0660 mediacodec mediadrm -/dev/video8 0660 mediacodec mediadrm -/dev/video9 0660 mediacodec mediadrm - -# camera -/dev/video100 0660 cameraserver camera -/dev/video101 0660 cameraserver camera -/dev/video102 0660 cameraserver camera -/dev/video103 0660 cameraserver camera -/dev/video104 0660 cameraserver camera -/dev/video109 0660 cameraserver camera -/dev/video110 0660 cameraserver camera -/dev/video111 0660 cameraserver camera -/dev/video112 0660 cameraserver camera -/dev/video120 0660 cameraserver camera -/dev/video121 0660 cameraserver camera -/dev/video122 0660 cameraserver camera -/dev/video130 0660 cameraserver camera -/dev/video131 0660 cameraserver camera -/dev/video132 0660 cameraserver camera -/dev/video140 0660 cameraserver camera -/dev/video141 0660 cameraserver camera -/dev/video142 0660 cameraserver camera -/dev/video150 0660 cameraserver camera -/dev/video151 0660 cameraserver camera -/dev/video152 0660 cameraserver camera -/dev/video160 0660 cameraserver camera -/dev/media2 0660 media media - -# hevc -/dev/video10 0660 media media -/dev/video11 0660 media media - -# jpeg -/dev/video12 0660 cameraserver media - -# audio -/dev/seiren 0660 system audio - -# MobiCore -/dev/mobicore 0600 system system -/dev/mobicore-user 0666 radio system - -# Secure MEM driver -/dev/s5p-smem 0660 system system - -# Fingerprint Sensor -/dev/vfsspi 0660 system system -/dev/esfp0 0660 system system -/dev/goodix_fp 0660 system system - -# cbd modem block -/dev/block/mmcblk0p5 0400 radio system - -# for DM tools -/dev/umts_dm0 0660 radio radio -/dev/umts_router 0660 radio radio - -# SIPC RIL -/dev/umts* 0660 system radio -/dev/ipc* 0660 system radio -/dev/umts_csd 0660 system loop_radio -/dev/smd4 0660 system radio -/dev/ramdump_memshare 0660 system radio -/dev/umts_ciq* 0660 system bridge_rw - -# interactive governor parameters -/sys/devices/system/cpu/cpu* cpufreq/interactive/timer_rate 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/timer_slack 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/min_sample_time 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/hispeed_freq 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/target_loads 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/go_hispeed_load 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/above_hispeed_delay 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/boost 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/boostpulse 0200 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/input_boost 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/boostpulse_duration 0660 system system -/sys/devices/system/cpu/cpu* cpufreq/interactive/io_is_busy 0660 system system - -# Sensor -/dev/input/event* 0660 system input -/sys/devices/virtual/input/input* enable 0660 system input -/sys/devices/virtual/input/input* poll_delay 0660 system input - -# Sensorhub IIO -/dev/ssp_sensorhub 0660 system system -/dev/iio:device* 0660 system system -/sys/devices/13930000.spi/spi_master/spi2/spi2.0/iio:device* buffer/enable 0660 system system -/sys/devices/13930000.spi/spi_master/spi2/spi2.0/iio:device* buffer/length 0660 system system -/sys/bus/iio/devices/iio:device* 0664 system radio diff --git a/system.prop b/system.prop deleted file mode 100644 index deb624a..0000000 --- a/system.prop +++ /dev/null @@ -1,8 +0,0 @@ -ro.hardware=samsungexynos7870 -ro.arch=exynos7870 -ro.chipname=exynos7870 -ro.product.brand=samsung -ro.product.name=a6lte -ro.product.device=a6lte -ro.build.product=a6lte -ro.treble.enabled=true diff --git a/vendorsetup.sh b/vendorsetup.sh index 60b0c86..1b52e06 100644 --- a/vendorsetup.sh +++ b/vendorsetup.sh @@ -1 +1,11 @@ -add_lunch_combo omni_a6lte-eng +TWRP_DEVICE="a6lte" + +# Common +export ALLOW_MISSING_DEPENDENCIES=true +export LC_ALL="C" + +export LZMA_RAMDISK_TARGETS="recovery" +export PLATFORM_SECURITY_PATCH="2099-12-31" +export PLATFORM_VERSION="16.1.0" + +add_lunch_combo omni_"$TWRP_DEVICE"-eng