summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamji Jiyani <ramjiyani@google.com>2022-09-21 14:02:37 -0700
committerRamji Jiyani <ramjiyani@google.com>2022-09-30 17:41:39 +0000
commitea705b4ac32fd227e2becb3d0fd84843c16f8386 (patch)
treed2263d482d7a482040acb277db9153fb91d01000
parent734319f979565cead8df77028080884c250d045c (diff)
Revert "ANDROID: GKI: Add script to generate symbol protection headers"
This reverts commit 31d5735baf0b20dd6a90bd8fcd1fa73a6531a62b. Reason for revert: Part of old protected/unprotected module implemenation. It is being replaced by a new design listed as option 2A at go/gki-modules-build-integration Bug: 232430739 Test: TH Signed-off-by: Ramji Jiyani <ramjiyani@google.com> Change-Id: I649c57196b167d9452e5e6d3b2af2dd8c1d4bcdd
-rwxr-xr-xscripts/gen_gki_modules_headers.sh96
1 files changed, 0 insertions, 96 deletions
diff --git a/scripts/gen_gki_modules_headers.sh b/scripts/gen_gki_modules_headers.sh
deleted file mode 100755
index 9fab5185db19..000000000000
--- a/scripts/gen_gki_modules_headers.sh
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Copyright 2021 Google LLC
-# Author: ramjiyani@google.com (Ramji Jiyani)
-#
-
-#
-# Generates hearder files for GKI modules symbol and export protections
-#
-# Called By: KERNEL_SRC/kernel/Makefile if CONFIG_MODULE_SIG_PROTECT=y
-#
-# gki_module_exported.h: Symbols protected from _export_ by unsigned modules
-# gki_module_protected.h: Symbols protected from _access_ by unsigned modules
-#
-# If valid symbol file doesn't exists then still generates valid C header files for
-# compilation to proceed with no symbols to protect
-#
-
-# Collect arguments from Makefile
-TARGET=$1
-SRCTREE=$2
-
-set -e
-
-#
-# Common Definitions
-#
-
-#
-# generate_header():
-# Args: $1 = Name of the header file
-# $2 = Input symbol list
-# $3 = Symbol type (protected/exported)
-#
-generate_header() {
- local header_file=$1
- local symbol_file=$2
- local symbol_type=$3
-
- echo " GEN ${header_file}"
- if [ -f "${header_file}" ]; then
- rm -f -- "${header_file}"
- fi
-
- # Find Maximum symbol name length if valid symbol_file exist
- if [ -s "${symbol_file}" ]; then
- # Skip 1st line (symbol header), Trim white spaces & +1 for null termination
- local max_name_len=$(awk '
- {
- $1=$1;
- if ( length > L && NR > 1) {
- L=length
- }
- } END { print ++L }' "${symbol_file}")
- else
- # Set to 1 to generate valid C header file
- local max_name_len=1
- fi
-
- # Header generation
- cat > "${header_file}" <<- EOT
- /*
- * DO NOT EDIT
- *
- * Build generated header file with GKI module symbols/exports
- */
-
- #define NO_OF_$(printf ${symbol_type} | tr [:lower:] [:upper:])_SYMBOLS \\
- $(printf '\t')(sizeof(gki_${symbol_type}_symbols) / sizeof(gki_${symbol_type}_symbols[0]))
- #define MAX_$(printf ${symbol_type} | tr [:lower:] [:upper:])_NAME_LEN (${max_name_len})
-
- static const char gki_${symbol_type}_symbols[][MAX_$(printf ${symbol_type} |
- tr [:lower:] [:upper:])_NAME_LEN] = {
- EOT
-
- # If a valid symbol_file present add symbols in an array except the 1st line
- if [ -s "${symbol_file}" ]; then
- sed -e 1d -e 's/^[ \t]*/\t"/;s/[ \t]*$/",/' "${symbol_file}" >> "${header_file}"
- fi
-
- # Terminate the file
- echo "};" >> "${header_file}"
-}
-
-if [ "$(basename "${TARGET}")" = "gki_module_protected.h" ]; then
- # Sorted list of protected symbols
- GKI_PROTECTED_SYMBOLS="${SRCTREE}/android/abi_gki_modules_protected"
-
- generate_header "${TARGET}" "${GKI_PROTECTED_SYMBOLS}" "protected"
-else
- # Sorted list of exported symbols
- GKI_EXPORTED_SYMBOLS="${SRCTREE}/android/abi_gki_modules_exports"
-
- generate_header "${TARGET}" "${GKI_EXPORTED_SYMBOLS}" "exported"
-fi