aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Gencel <johnnylittleplanet@gmail.com>2018-12-01 11:17:16 +0100
committerfirebird11 <hbgassel@gmail.com>2019-01-12 13:43:04 +0100
commita2899609b6109101bddb24b3b1ca5ffdf2a80e0a (patch)
treea8321b6285f0eeccdf9e52a3601386bb49a6f8f5
parentb80b7653581050a9d97392e1be5b57054725f7c8 (diff)
d855: delete baseband validationHEADp9.0
other variants don't seem to require it and it doesn't work on latest TWRP this is also not really necessary Change-Id: Ia7e63f2b77d60ba1bb52acfef00a492a62cbe58d
-rwxr-xr-xBoardConfig.mk7
-rw-r--r--board-info.txt1
-rw-r--r--device.mk4
-rw-r--r--recovery/Android.mk8
-rw-r--r--recovery/recovery_updater.cpp189
-rw-r--r--releasetools.py36
6 files changed, 0 insertions, 245 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 7e7f3d8..6cd3716 100755
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -20,9 +20,6 @@
TARGET_OTA_ASSERT_DEVICE := g3,d855
-# Assertions
-TARGET_BOARD_INFO_FILE ?= device/lge/d855/board-info.txt
-
# Bluetooth
BOARD_HAVE_BLUETOOTH_QCOM := true
BLUETOOTH_HCI_USE_MCT := true
@@ -56,10 +53,6 @@ TARGET_RECOVERY_FSTAB := device/lge/d855/rootdir/etc/fstab.g3
BOARD_NFC_CHIPSET := pn547
BOARD_NFC_HAL_SUFFIX := msm8974
-# Releasetools
-TARGET_RECOVERY_UPDATER_LIBS := librecovery_updater_g3
-TARGET_RELEASETOOLS_EXTENSIONS := device/lge/d855
-
# RIL
BOARD_GLOBAL_CFLAGS += -DUSE_RIL_VERSION_10
BOARD_GLOBAL_CPPFLAGS += -DUSE_RIL_VERSION_10
diff --git a/board-info.txt b/board-info.txt
deleted file mode 100644
index f8ee431..0000000
--- a/board-info.txt
+++ /dev/null
@@ -1 +0,0 @@
-require version-baseband=21C:MPSS.DI.2.0.1.C1.13.2-00002
diff --git a/device.mk b/device.mk
index 51e479c..1b421fb 100644
--- a/device.mk
+++ b/device.mk
@@ -33,10 +33,6 @@ DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay
PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/configs/gps.conf:system/etc/gps.conf
-# Recovery
-PRODUCT_PACKAGES += \
- librecovery_updater_g3
-
# RIL
PRODUCT_PACKAGES += \
librmnetctl
diff --git a/recovery/Android.mk b/recovery/Android.mk
deleted file mode 100644
index c4c5495..0000000
--- a/recovery/Android.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_C_INCLUDES := bootable/recovery
-LOCAL_SRC_FILES := recovery_updater.cpp
-LOCAL_MODULE := librecovery_updater_g3
-LOCAL_MODULE_TAGS := eng
-include $(BUILD_STATIC_LIBRARY)
diff --git a/recovery/recovery_updater.cpp b/recovery/recovery_updater.cpp
deleted file mode 100644
index 44a7bfc..0000000
--- a/recovery/recovery_updater.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2016, The CyanogenMod 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 <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "edify/expr.h"
-#include "updater/install.h"
-
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-
-#define ALPHABET_LEN 256
-#define KB 1024
-
-#define BASEBAND_PART_PATH "/dev/block/platform/msm_sdcc.1/by-name/modem"
-#define BASEBAND_VER_STR_START "QC_IMAGE_VERSION_STRING="
-#define BASEBAND_VER_STR_START_LEN 24
-#define BASEBAND_VER_BUF_LEN 255
-#define BASEBAND_SZ 64000 * KB /* MMAP 64M of BASEBAND, BASEBAND partition is 64M */
-
-/* Boyer-Moore string search implementation from Wikipedia */
-
-/* Return longest suffix length of suffix ending at str[p] */
-static int max_suffix_len(const char *str, size_t str_len, size_t p) {
- uint32_t i;
-
- for (i = 0; (str[p - i] == str[str_len - 1 - i]) && (i < p); ) {
- i++;
- }
-
- return i;
-}
-
-/* Generate table of distance between last character of pat and rightmost
- * occurrence of character c in pat
- */
-static void bm_make_delta1(int *delta1, const char *pat, size_t pat_len) {
- uint32_t i;
- for (i = 0; i < ALPHABET_LEN; i++) {
- delta1[i] = pat_len;
- }
- for (i = 0; i < pat_len - 1; i++) {
- uint8_t idx = (uint8_t) pat[i];
- delta1[idx] = pat_len - 1 - i;
- }
-}
-
-/* Generate table of next possible full match from mismatch at pat[p] */
-static void bm_make_delta2(int *delta2, const char *pat, size_t pat_len) {
- int p;
- uint32_t last_prefix = pat_len - 1;
-
- for (p = pat_len - 1; p >= 0; p--) {
- /* Compare whether pat[p-pat_len] is suffix of pat */
- if (strncmp(pat + p, pat, pat_len - p) == 0) {
- last_prefix = p + 1;
- }
- delta2[p] = last_prefix + (pat_len - 1 - p);
- }
-
- for (p = 0; p < (int) pat_len - 1; p++) {
- /* Get longest suffix of pattern ending on character pat[p] */
- int suf_len = max_suffix_len(pat, pat_len, p);
- if (pat[p - suf_len] != pat[pat_len - 1 - suf_len]) {
- delta2[pat_len - 1 - suf_len] = pat_len - 1 - p + suf_len;
- }
- }
-}
-
-static char * bm_search(const char *str, size_t str_len, const char *pat,
- size_t pat_len) {
- int delta1[ALPHABET_LEN];
- int delta2[pat_len];
- int i;
-
- bm_make_delta1(delta1, pat, pat_len);
- bm_make_delta2(delta2, pat, pat_len);
-
- if (pat_len == 0) {
- return (char *) str;
- }
-
- i = pat_len - 1;
- while (i < (int) str_len) {
- int j = pat_len - 1;
- while (j >= 0 && (str[i] == pat[j])) {
- i--;
- j--;
- }
- if (j < 0) {
- return (char *) (str + i + 1);
- }
- i += MAX(delta1[(uint8_t) str[i]], delta2[j]);
- }
-
- return NULL;
-}
-
-static int get_baseband_version(char *ver_str, size_t len) {
- int ret = 0;
- int fd;
- char *baseband_data = NULL;
- char *offset = NULL;
-
- fd = open(BASEBAND_PART_PATH, O_RDONLY);
- if (fd < 0) {
- ret = errno;
- goto err_ret;
- }
-
- baseband_data = (char *) mmap(NULL, BASEBAND_SZ, PROT_READ, MAP_PRIVATE, fd, 0);
- if (baseband_data == (char *)-1) {
- ret = errno;
- goto err_fd_close;
- }
-
- /* Do Boyer-Moore search across BASEBAND data */
- offset = bm_search(baseband_data, BASEBAND_SZ, BASEBAND_VER_STR_START, BASEBAND_VER_STR_START_LEN);
- if (offset != NULL) {
- strncpy(ver_str, offset + BASEBAND_VER_STR_START_LEN, len);
- } else {
- ret = -ENOENT;
- }
-
- munmap(baseband_data, BASEBAND_SZ);
-err_fd_close:
- close(fd);
-err_ret:
- return ret;
-}
-
-/* verify_baseband("BASEBAND_VERSION", "BASEBAND_VERSION", ...) */
-Value * VerifyBasebandFn(const char *name, State *state, int argc, Expr *argv[]) {
- char current_baseband_version[BASEBAND_VER_BUF_LEN];
- char *baseband_string;
- char *baseband_version;
- char *baseband_short_version;
- int i, ret;
-
- ret = get_baseband_version(current_baseband_version, BASEBAND_VER_BUF_LEN);
- if (ret) {
- return ErrorAbort(state, "%s() failed to read current BASEBAND version: %d",
- name, ret);
- }
-
- for (i = 0; i < argc; i++) {
- baseband_string = Evaluate(state, argv[i]);
- if (baseband_string < 0) {
- return ErrorAbort(state, "%s() error parsing arguments: %d",
- name, baseband_string);
- }
-
- baseband_short_version = strtok(baseband_string, ":");
- baseband_version = strtok(NULL, ":");
-
- uiPrintf(state, "Checking for BASEBAND version %s", baseband_short_version);
- if (strncmp(baseband_version, current_baseband_version, strlen(baseband_version)) == 0) {
- return StringValue(strdup("1"));
- }
- }
-
- uiPrintf(state, "ERROR: It appears you are running an unsupported baseband.");
- return StringValue(strdup("0"));
-}
-
-void Register_librecovery_updater_g3() {
- RegisterFunction("g3.verify_baseband", VerifyBasebandFn);
-}
diff --git a/releasetools.py b/releasetools.py
deleted file mode 100644
index 72d362f..0000000
--- a/releasetools.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-# Copyright (c) 2011, The Linux Foundation. All rights reserved.
-#
-# 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.
-
-import hashlib
-import common
-import re
-
-def FullOTA_Assertions(info):
- AddBasebandAssertion(info)
- return
-
-def IncrementalOTA_Assertions(info):
- AddBasebandAssertion(info)
- return
-
-def AddBasebandAssertion(info):
- android_info = info.input_zip.read("OTA/android-info.txt")
- m = re.search(r'require\s+version-baseband\s*=\s*(\S+)', android_info)
- if m:
- versions = m.group(1).split('|')
- if len(versions) and '*' not in versions:
- cmd = 'assert(g3.verify_baseband(' + ','.join(['"%s"' % baseband for baseband in versions]) + ') == "1");'
- info.script.AppendExtra(cmd)
- return