Skip to contentSkip to conversation

Script to cleanup linux .config file

Xenomai Anders Blomdell 2 participants 4 messages Dec 4, 2014

lore
Share & tools
lore
#0 lore 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

Signature · 67 lines
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
#1 lore raw
Quoted 2 lines · Anders Blomdell

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).

I would say the simple option is to disable the options by directly patching the Kconfig in the I-pipe patch.

Signature · 1 line
					    Gilles.
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 7 lines · Gilles Chanteperdrix
Quoted 2 lines · Anders Blomdell

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).

I would say the simple option is to disable the options by directly patching the Kconfig in the I-pipe patch.

Something like:

config ACPI_PROCESSOR
depends on ! IPIPE

perhaps? Should I submit a patch for latest ipipe?

/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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJUgIMrAAoJENZYyvaDG8NcdzoH/j69M5q6UxT2BGJbnlFZXJtf AtbT1cKHrfKHP0coyR7nmtEd/pIBRaYRWGyy3h68fq4ECX0id1mus5XCF/cnjz/J BX8Y0FUmb9P6yTxqy+4ZPEykTb0TcraD8Qy2tHFfmdoEeBMo7NJ5AiJ6u3xN6NMi UPL4cdRUgJOWp8oMDdzI640cLPSbsRtyMDDGr/nrH7t/+KIHzTn+S79TTtulbUct xjvZNOPPyKwrSU88zUctvqF5PGTy1o72RYoBrAUQhaQxVB8Eo/C5gBY5sKUaJ1Ys W6zifY7rjBtCM7trkM4t5nsXmv7k97yQ6KZUakokxFZeNvakPRI00e2qBZ87QYQ= =HuAw
-----END PGP SIGNATURE-----

#3 lore raw
Quoted 12 lines · Anders Blomdell

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Gilles Chanteperdrix
Quoted 3 lines · Anders Blomdell

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).

I would say the simple option is to disable the options by directly patching the Kconfig in the I-pipe patch.

Quoted 6 lines

Something like:

config ACPI_PROCESSOR
depends on ! IPIPE

perhaps? Should I submit a patch for latest ipipe?

Yes, but be aware: not all options must be disabled on all architectures.

Signature · 1 line
                    Gilles.