/usr/bin/undertaker-kconfigdump is in undertaker 1.3b-1.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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #!/bin/bash -e
#
# undertaker-kconfigdump - generates models in Linux source trees
#
# Copyright (C) 2009-2011 Christian Dietrich <christian.dietrich@informatik.uni-erlangen.de>
# Copyright (C) 2009-2011 Reinhard Tartler <tartler@informatik.uni-erlangen.de>
# Copyright (C) 2012 Manuel Zerpies <manuel.f.zerpies@ww.stud,uni-erlangen.de>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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
#
# Arguments:
# - Architecture models to build
MODELS=${MODELS:-models}
PROCESSORS=${PROCESSORS:-$(getconf _NPROCESSORS_ONLN)}
function debug() {
if [ -n "$DEBUG" ]; then
echo -e "$@"
fi
}
function find_undertaker_basepath () {
# ensure to follow symbolic links
local undertaker_path=$(readlink -f `which undertaker`)
local b=$(dirname $undertaker_path)
echo "${b}/.."
}
PATH="`find_undertaker_basepath`/lib/undertaker:$PATH"
debug "PATH=$PATH\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
ALLARCHS="$(ls arch/*/Kconfig | cut -d '/' -f 2) um"
if [ -z "$1" ]; then
ARCHS=$ALLARCHS
else
ARCHS="$@"
fi
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
# Note that upstream commit 5c48b108ecbf6505d929e64d50dace13ac2bdf34 renamed
# arch/{um/Kconfig.x86 => x86/um/Kconfig}
# get the right file even in historic linux trees.
SUBARCH=$ARCH
KCONFIG=Kconfig
if [ x"$ARCH" = x"um" ]; then
SUBARCH=x86
if [ -r arch/um/Kconfig ]; then
KCONFIG=Kconfig
else
KCONFIG=Kconfig.um
fi
fi
test -f arch/$ARCH/$KCONFIG || {
echo "ERROR: Architecture $ARCH not found";
return
}
# dumpconf, remove all the comments because they will confuse rsf2model
SUBARCH=$SUBARCH ARCH=$ARCH dumpconf arch/$ARCH/$KCONFIG | grep -v '^#' > "$MODELS/$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/$ARCH.rsf" | grep -v '^CONFIG_'"$UPCASE_ARCH"'$' > "$MODELS/$ARCH.model"
# Add CONFIG_$i -> !CONFIG_* for every architecture
echo $ALLARCHS | sed "s/ *$ARCH */ /" | tr 'a-z' 'A-Z' | \
sed 's/$/"/; s/\</!CONFIG_/g; s/ / \&\& /g; s/^/'"CONFIG_$UPCASE_ARCH "'"/;' \
>> "$MODELS/$ARCH.model"
}
for ARCH in $ARCHS
do
do_convert $ARCH &
# run many converting processes in parallel
pwait ${PROCESSORS}
done
while [ $(jobs -r | wc -l) -gt 0 ]; do
sleep 0.5
done
|