All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Script to cleanup linux .config file
@ 2014-12-04 10:21 Anders Blomdell
  2014-12-04 12:12 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 4+ messages in thread
From: Anders Blomdell @ 2014-12-04 10:21 UTC (permalink / raw)
  To: Xenomai

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: anders.blomdell@control.lth.se
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-04 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 10:21 [Xenomai] Script to cleanup linux .config file Anders Blomdell
2014-12-04 12:12 ` Gilles Chanteperdrix
2014-12-04 15:52   ` Anders Blomdell
2014-12-04 16:44     ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.