Merge "Build targets for checking GKI KMI compatibility"
This commit is contained in:
21
gki/Android.mk
Normal file
21
gki/Android.mk
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright 2021 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.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
gki_path := $(LOCAL_PATH)
|
||||
|
||||
include $(gki_path)/kmi_abi_chk/kmi_compatibility_test.mk
|
||||
3
gki/OWNERS
Normal file
3
gki/OWNERS
Normal file
@@ -0,0 +1,3 @@
|
||||
howardsoc@google.com
|
||||
hsinyichen@google.com
|
||||
ycchen@google.com
|
||||
62
gki/kmi_abi_chk/kmi_compatibility_test.mk
Normal file
62
gki/kmi_abi_chk/kmi_compatibility_test.mk
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (C) 2021 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.
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
KMI_CHK_SCRIPT := $(LOCAL_PATH)/kmi_compatibility_test.sh
|
||||
|
||||
# Current kernel symbol files to be checked
|
||||
# Use the one under $(LOCAL_PATH)/sym-5.* by default for self testing.
|
||||
# The reason not to use the one under kernel/prebuilts/5.* by default
|
||||
# is because the KMI ABI may not be stable during development.
|
||||
#
|
||||
# Set CURR_5_4_SYMVERS/CURR_5_10_SYMVERS explicitly for the actual
|
||||
# current kernel symbol file to be checked. E.g.,
|
||||
# $ m CURR_5_10_SYMVERS=kernel/prebuilts/5.10/arm64/vmlinux.symvers \
|
||||
# gki_5_10_kmi_compatibility_test
|
||||
CURR_5_4_SYMVERS ?= development/gki/kmi_abi_chk/sym-5.4/Module.symvers
|
||||
CURR_5_10_SYMVERS ?= development/gki/kmi_abi_chk/sym-5.10/vmlinux.symvers
|
||||
|
||||
# Previous kernel symbol files, against which the latest one is checked
|
||||
# The file names of previous kernel symbol files are of this form:
|
||||
# *.symvers-$(BID)
|
||||
# Here *.symvers is a symbolic link to the latest build.
|
||||
PREV_5_4_SYMVERS := $(LOCAL_PATH)/sym-5.4/Module.symvers
|
||||
PREV_5_10_SYMVERS := $(LOCAL_PATH)/sym-5.10/vmlinux.symvers
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gki_5_4_kmi_compatibility_test
|
||||
LOCAL_MODULE_CLASS := FAKE
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(KMI_CHK_SCRIPT) $(CURR_5_4_SYMVERS) $(PREV_5_4_SYMVERS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(KMI_CHK_SCRIPT) $(CURR_5_4_SYMVERS) $(PREV_5_4_SYMVERS)
|
||||
$(hide) touch $@
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gki_5_10_kmi_compatibility_test
|
||||
LOCAL_MODULE_CLASS := FAKE
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
|
||||
$(LOCAL_BUILT_MODULE): $(KMI_CHK_SCRIPT) $(CURR_5_10_SYMVERS) $(PREV_5_10_SYMVERS)
|
||||
@mkdir -p $(dir $@)
|
||||
$(hide) $(KMI_CHK_SCRIPT) $(CURR_5_10_SYMVERS) $(PREV_5_10_SYMVERS)
|
||||
$(hide) touch $@
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gki_kmi_compatibility_test
|
||||
LOCAL_REQUIRED_MODULES := gki_5_4_kmi_compatibility_test gki_5_10_kmi_compatibility_test
|
||||
include $(BUILD_PHONY_PACKAGE)
|
||||
78
gki/kmi_abi_chk/kmi_compatibility_test.sh
Executable file
78
gki/kmi_abi_chk/kmi_compatibility_test.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (C) 2021 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.
|
||||
|
||||
# Usage:
|
||||
# development/gki/kmi_abi_chk/kmi_static_chk.sh \
|
||||
# <current_symbol_info> <previous_symbol_info> ...
|
||||
#
|
||||
if [[ "$#" -lt 2 ]]; then
|
||||
echo "Usage: $0 <current_symbol_info> <previous_symbol_info> ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ret=0
|
||||
for f in "$@"; do
|
||||
if [[ ! -e "$f" ]]; then
|
||||
echo "Kernel symbol file $f does not exist!" >&2
|
||||
ret=1
|
||||
elif ! grep -iE "^0x[0-9a-f]{8}+.[_0-9a-z]+.vmlinux.EXPORT_SYMBOL" $f > /dev/null; then
|
||||
ret=1
|
||||
echo "$f doesn't look like kernel symbol file!" >&2
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ ! ret -eq 0 ]]; then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
tmp=$(mktemp /tmp/linux-symvers.XXXXXX)
|
||||
trap "rm -f $tmp" EXIT
|
||||
|
||||
curr=$1
|
||||
shift
|
||||
|
||||
# Filter for vmlinux EXPORTE_SYMBOL* and remove trailing white spaces.
|
||||
# The reason trailing white spaces is removed only for the current
|
||||
# symbol file is because the following example/possibility:
|
||||
#
|
||||
# In the current symbol file:
|
||||
# 0x8581ad8e get_net_ns_by_fd vmlinux EXPORT_SYMBOL\t
|
||||
#
|
||||
# In the previous symbol file:
|
||||
# 0x8581ad8e get_net_ns_by_fd vmlinux EXPORT_SYMBOL_GPL\t
|
||||
#
|
||||
# The symbol is GPLed previously, but not in the current release, which won't
|
||||
# break KMI ABI, because the requirement is "relaxed". We want this case to
|
||||
# pass so a keyword like "...EXPORT_SYMBOL" in the current symbol file can
|
||||
# still match "...EXPORT_SYMBOL_GPL" in the previous symbol file.
|
||||
grep "vmlinux.EXPORT_SYMBOL" $curr | sed 's/[ \t]*$//' > $tmp
|
||||
|
||||
echo "Current kernel symbol file, $curr, is checking against:"
|
||||
|
||||
for f in "$@"; do
|
||||
echo " $f"
|
||||
# if nothing is found, grep returns 1, which means every symbol in the
|
||||
# previous release (usually in *.symvers-$BID) can be found in the current
|
||||
# release, so is considered successful here.
|
||||
# if grep returns 0, which means some symbols are found in the previous
|
||||
# symbol file but not in the current symbol file, then something wrong!
|
||||
if grep -vf $tmp $f; then
|
||||
ret=1
|
||||
echo "$f contains symbol(s) not found in, or incompatible with, $curr." >&2
|
||||
fi
|
||||
done
|
||||
|
||||
exit $ret
|
||||
1
gki/kmi_abi_chk/sym-5.10/vmlinux.symvers
Symbolic link
1
gki/kmi_abi_chk/sym-5.10/vmlinux.symvers
Symbolic link
@@ -0,0 +1 @@
|
||||
vmlinux.symvers-7833008
|
||||
1
gki/kmi_abi_chk/sym-5.4/Module.symvers
Symbolic link
1
gki/kmi_abi_chk/sym-5.4/Module.symvers
Symbolic link
@@ -0,0 +1 @@
|
||||
Module.symvers-7855344
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user