All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anders Blomdell <anders.blomdell@control.lth.se>
To: Xenomai <xenomai@xenomai.org>
Subject: [Xenomai] Script to cleanup linux .config file
Date: Thu, 04 Dec 2014 11:21:09 +0100	[thread overview]
Message-ID: <54803595.90308@control.lth.se> (raw)

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


             reply	other threads:[~2014-12-04 10:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 10:21 Anders Blomdell [this message]
2014-12-04 12:12 ` [Xenomai] Script to cleanup linux .config file Gilles Chanteperdrix
2014-12-04 15:52   ` Anders Blomdell
2014-12-04 16:44     ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54803595.90308@control.lth.se \
    --to=anders.blomdell@control.lth.se \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.