chkconf_kernel.sh 1.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
#!/bin/sh

# Simple shell script to check kernel configuration sanity
# for use with MIPL Mobile IPv6
#
# Author: Antti Tuominen <anttit@tcs.hut.fi>
#
# $Id: chkconf_kernel.sh 1.3 05/05/16 12:15:16+03:00 vnuorval@tcs.hut.fi $
#
# This program 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
# 2 of the License, or (at your option) any later version.


# Default settings for kernel
EXPERIMENTAL=y
SYSVIPC=y
PROC_FS=y
NET=y
NET_KEY=y
NET_KEY_MIGRATE=y
INET=y 
IPV6=y
INET6_ESP=y
IPV6_TUNNEL=y
IPV6_MULTIPLE_TABLES=y
IPV6_SUBTREES=y
IPV6_MIP6=y
XFRM=y
XFRM_USER=y
XFRM_SUB_POLICY=y
INET6_XFRM_MODE_ROUTEOPTIMIZATION=y

COMMON="EXPERIMENTAL SYSVIPC PROC_FS NET INET IPV6 IPV6_MIP6 \
	XFRM XFRM_USER XFRM_SUB_POLICY INET6_XFRM_MODE_ROUTEOPTIMIZATION"

MNHA="IPV6_TUNNEL IPV6_MULTIPLE_TABLES"

MN="IPV6_SUBTREES"

IPSEC="INET6_ESP"

PFKEY="NET_KEY NET_KEY_MIGRATE"

TAGS="$COMMON $MNHA $MN $IPSEC $PFKEY"

if [ "$1" = "" ] ; then
    KERNELCONFIG="/proc/config.gz"
    CAT=zcat
else
    LINUX=$1
    KERNELCONFIG="$LINUX/.config"
    CAT=cat
fi

if [ ! -f $KERNELCONFIG ] ; then
    echo "$KERNELCONFIG does not exist."
    exit 1
fi

WARN=0;

echo
echo "Checking kernel configuration..."
echo "Using $KERNELCONFIG";

for TAG in $TAGS ; do
    VAL=`$CAT $KERNELCONFIG | sed -ne "/$TAG[= ]/s/^CONFIG_$TAG[= ]//gp"`;
    eval "DFLT=\$$TAG";
    if [ "$VAL" != "$DFLT" ] ; then
	if [ -z "$VAL" ] ; then
	    VERDICT="not supported";
	else
	    VERDICT="$VAL";
	fi
	echo " Warning: CONFIG_$TAG should be set to $DFLT ($VERDICT)";
	let WARN=$WARN+1;
    fi
done

echo
if [ $WARN -eq 0 ] ; then
    echo "All kernel options are as they should.";
else
    echo "Above $WARN options may conflict with MIPL.";
    echo "If you are not sure, use the recommended setting.";
fi
echo