/usr/bin/undertaker-kconfigdump is in undertaker 1.2-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | #!/bin/bash
set -e
# This script is used for precalculating the configuration models of a
# linux tree. Therefore the config is first dumped with dumpconf to an
# rsf file. This rsf file is piped to rsf2model which calculates the
# model which is used by the undertaker afterwards.
#
# dumpconf and rsf2model can be placed in $PREFIX/lib/undertaker or
# /usr/lib/undertaker or /usr/local/lib/undertaker, because they won't
# be needed anywhere else than here.
#
# Enviroment variables:
# - MODELS: the directory where the models are placed (default:
# models)
# - DEBUG: give some debug informations
MODELS=${MODELS:-models}
PROCESSORS=${PROCESSORS:-$(getconf _NPROCESSORS_ONLN)}
function debug() {
if [ -n "$DEBUG" ]; then
echo -e "$@"
fi
}
PATH="/usr/lib/undertaker:$PATH"
PYTHONPATH="/usr/lib/python2.6/site-packages"
export PYTHONPATH
debug "PATH=$PATH\n"
debug "PYTHONPATH=$PYTHONPATH\n"
if ! which dumpconf > /dev/null; then
echo "No dumpconf binary found."
exit 1
fi
if ! which rsf2model > /dev/null; then
echo "No rsf2model binary found."
exit 1
fi
debug "rsf2model: $(which rsf2model)"
debug "dumpconf: $(which dumpconf)"
if [ ! -f arch/x86/Kconfig ]; then
echo "Not run in an linux tree. Please run inside an linux tree without arguments"
exit 1
fi
ARCHS=$(ls arch/*/Kconfig | cut -d '/' -f 2)
mkdir -p "$MODELS"
function pwait() {
# This functions blocks until less than $1 subprocesses are running
jobs="$1"
[ -z "$jobs" ] && jobs=5
while [ $(jobs -r | wc -l) -ge "$jobs" ]; do
sleep 0.5
done
}
function do_convert() {
ARCH=$1
UPCASE_ARCH=$(echo $ARCH | tr 'a-z' 'A-Z')
echo "Calculating model for $ARCH"
# special case for user mode linux
SUBARCH=$ARCH
KCONFIG=Kconfig
if [ x"$ARCH" = x"um" ]; then
SUBARCH=x86
KCONFIG=Kconfig.x86
fi
# dumpconf, remove all the comments because they will confuse rsf2model
SUBARCH=$SUBARCH ARCH=$ARCH dumpconf arch/$ARCH/$KCONFIG | grep -v '^#' > "$MODELS/kconfig-$ARCH.rsf"
# rsf2model, but CONFIG_$UPCASE_ARCH will be replaced by
# a rule that no other architecture can be selected at the same
# time. E.g. X86 -> !ARM && !S390
rsf2model "$MODELS/kconfig-$ARCH.rsf" | grep -v '^CONFIG_'"$UPCASE_ARCH"'$' > "$MODELS/$ARCH.model"
# Add CONFIG_$i -> !CONFIG_* for every architecture
echo $ARCHS | sed "s/ *$ARCH */ /" | tr 'a-z' 'A-Z' | \
sed 's/$/"/; s/\</!CONFIG_/g; s/ / \&\& /g; s/^/'"CONFIG_$UPCASE_ARCH "'"/;' \
>> "$MODELS/$ARCH.model"
if [ -z "$DEBUG" ]; then
rm -f "$MODELS/kconfig-$ARCH.rsf"
fi
}
for ARCH in $ARCHS um
do
do_convert $ARCH &
# run many converting processes in parallel
pwait ${PROCESSORS}
done
|