1#
2# Copyright (C) 2021 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# Default to Linux version 5.10
17LINUX_VER=5.10
18
19# The only other Linux version supported is 5.4.
20uname -r | grep ^5.4
21if [ $? -eq 0 ]; then
22  LINUX_VER=5.4
23fi
24
25# Unload test kernel module
26su root insmod /data/local/tmp/kmi_sym-a12-$LINUX_VER.ko
27if [ $? -ne 0 ]; then
28  echo "Failed to load the test kernel module!"
29  su root dmesg | grep kmi_sym: | tail -21 >&2
30  exit 1
31fi
32
33# Unload test kernel module
34su root rmmod kmi_sym
35if [ $? -ne 0 ]; then
36  echo "Failed to unload the test kernel module!"
37  su root dmesg | tail -21 >&2
38  exit 1
39fi
40
41exit 0
42