I post the attached script in the vain hope that it might be useful for someone 
else
(and possibly enhanced by our all-knowing experts). 

Regards

Anders
-- 
Anders Blomdell                  Email: [email protected]
Department of Automatic Control
Lund University                  Phone:    +46 46 222 4625
P.O. Box 118                     Fax:      +46 46 138118
SE-221 00 Lund, Sweden

-------------- next part --------------
#!/bin/sh

while [ $# -gt 0 ] ; do
    case $1 in
        --cleanup) 
            CLEANUP=$1
            shift
            ;;
        *)
            if [ ! -z "${CONFIG}" ] ; then
                echo "Only one config file allowed"
                exit 1
            fi
            CONFIG=$1
            shift
            ;;
    esac
done

if [ -z "${CONFIG}" ] ; then
    echo "No config file given" 
    exit 1
fi

BLACKLIST_OPTIONS=(
    ACPI_PROCESSOR 
    APM 
    CONTEXT_TRACKING_FORCE 
    CPU_FREQ 
    CPU_IDLE 
    INTEL_IDLE 
    KGDB 
#    CC_STACKPROTECTOR
#    CC_STACKPROTECTOR_STRONG
)

RESULT=0
for o in ${BLACKLIST_OPTIONS[*]} ; do
  if grep -q "CONFIG_$o=" ${CONFIG} ; then
    echo "Invalid option CONFIG_$o"
    RESULT=1
  fi
done

if [ ${RESULT} -ne 0 -a "${CLEANUP}" == "--cleanup" ] ; then
    D=`mktemp -d`
    cp ${CONFIG} $D/config
    for o in ${BLACKLIST_OPTIONS[*]} ; do
        if grep  -q "CONFIG_$o=" ${D}/config ; then
            echo "Cleaning ${o}"
            grep -v "CONFIG_$o=" ${D}/config > ${D}/tmp
            mv ${D}/tmp ${D}/config
        fi
    done
    mv $D/config ${CONFIG} 
    rmdir ${D}
    echo "Remember to run 'make oldconfig'"
else
    exit $RESULT
fi

_______________________________________________
Xenomai mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai

Reply via email to