diff options
| author | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 02:09:49 -0500 |
|---|---|---|
| committer | Kai Germaschewski <kai@tp1.ruhr-uni-bochum.de> | 2002-06-06 02:09:49 -0500 |
| commit | f56dec0252d197c3796f3f932eeea1f29a499505 (patch) | |
| tree | d04189332e1c9ef9732b831a1015ffef51a2b813 /scripts | |
| parent | 3da9cf2895a490d8c7a1a8d78130f66a88e93efa (diff) | |
| parent | 561e79b059e0a06dea7bc216641626fdfad099fb (diff) | |
Merge tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5
into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Configure | 158 | ||||
| -rw-r--r-- | scripts/Makefile | 2 | ||||
| -rw-r--r-- | scripts/fixdep.c | 2 | ||||
| -rwxr-xr-x | scripts/mkcompile_h | 26 | ||||
| -rwxr-xr-x | scripts/mkversion_h | 25 | ||||
| -rw-r--r-- | scripts/tkparse.c | 16 | ||||
| -rw-r--r-- | scripts/tkparse.h | 2 |
7 files changed, 167 insertions, 64 deletions
diff --git a/scripts/Configure b/scripts/Configure index f0d5988da0b5..1e8bc91f471f 100644 --- a/scripts/Configure +++ b/scripts/Configure @@ -48,6 +48,10 @@ # # 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net> # - Improve the exit message (Jeff Ronne). +# +# 7 October 2000, Ghozlane Toumi, <gtoumi@messel.emse.fr> +# added switches for "random" , "all yes" and "all modules" +# # # Make sure we're really running bash. @@ -76,6 +80,43 @@ function endmenu () { } # +# returns a random number between 1 and $1 +# +function rnd () { + rnd=$[ $RANDOM % $1 + 1 ] +} + +# +# randomly chose a number in a config list (LIST_CONFIG_NAME) +# or in a range ( MIN_CONFIG_NAME MAX_CONFIG_NAME ) +# ONLY if there is no forced default (and we are in an "auto" mode) +# we are limited by the range of values taken by "$RANDOM" +# +# rndval CONFIG_NAME +# + +function rndval () { + [ "$AUTO" != "yes" -o -n "$old" ] && return + def_list=$(eval echo "\${LIST_$1}") + def_min=$(eval echo "\${MIN_$1}") + def_max=$(eval echo "\${MAX_$1}") + + if [ -n "$def_list" ]; then + set -- $(echo $def_list | sed 's/,/ /g') + rnd $# + while [ $rnd -le $# ] ; do + def=$1 + shift + done + return + fi + if [ -n "$def_min" -a -n "$def_max" ]; then + rnd $[ $def_max - $def_min ] + def=$[ $def_min + $rnd ] + fi +} + +# # help prints the corresponding help text from Configure.help to stdout # # help variable @@ -109,7 +150,11 @@ ${var}:\\ # readln prompt default oldval # function readln () { - if [ "$DEFAULT" = "-d" -a -n "$3" ]; then + if [ "$AUTO" = "yes" ]; then + echo -n "$1" + ans=$2 + echo $ans + elif [ "$DEFAULT" = "-d" -a -n "$3" ]; then echo "$1" ans=$2 else @@ -169,6 +214,17 @@ function define_tristate () { function bool () { old=$(eval echo "\${$2}") def=${old:-'n'} + if [ "$AUTO" = "yes" -a -z "$old" ]; then + if [ "$RND" = "-r" ]; then + rnd 2 + case $rnd in + "1") def="y" ;; + "2") def="n" ;; + esac + else + def=$DEF_ANS; + fi + fi case "$def" in "y" | "m") defprompt="Y/n/?" def="y" @@ -200,6 +256,18 @@ function tristate () { else old=$(eval echo "\${$2}") def=${old:-'n'} + if [ "$AUTO" = "yes" -a -z "$old" ]; then + if [ "$RND" = "-r" ]; then + rnd 3 + case $rnd in + "1") def="y" ;; + "2") def="n" ;; + "3") def="m" ;; + esac + else + def=$DEF_ANS + fi + fi case "$def" in "y") defprompt="Y/m/n/?" ;; @@ -256,6 +324,17 @@ function dep_tristate () { if [ $need_module = 1 ]; then if [ "$CONFIG_MODULES" = "y" ]; then + if [ "$AUTO" = "yes" -a -z "$old" ]; then + if [ "$RND" = "-r" ]; then + rnd 2 + case $rnd in + "1") def="m" ;; + "2") def="n" ;; + esac + else + def=$DEF_ANS + fi + fi case "$def" in "y" | "m") defprompt="M/n/?" def="m" @@ -351,6 +430,7 @@ function int () { else max=10000000 # !! fi + rndval $2 while :; do readln "$1 ($2) [$def] " "$def" "$old" if expr \( \( $ans + 0 \) \>= $min \) \& \( $ans \<= $max \) >/dev/null 2>&1 ; then @@ -382,6 +462,7 @@ function hex () { old=$(eval echo "\${$2}") def=${old:-$3} def=${def#*[x,X]} + rndval $2 while :; do readln "$1 ($2) [$def] " "$def" "$old" ans=${ans#*[x,X]} @@ -464,6 +545,15 @@ function choice () { shift; shift done + if [ "$RND" = "-r" -a -z "$old" ] ; then + set -- $choices + rnd $# + while [ $rnd -le $# ] ; do + def=$1 + shift ; shift + done + fi + val="" while [ -z "$val" ]; do ambg=n @@ -512,6 +602,7 @@ function choice () { CONFIG=.tmpconfig CONFIG_H=.tmpconfig.h +FORCE_DEFAULT=.force_default trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2 # @@ -532,34 +623,57 @@ if [ "$1" = "-d" ] ; then shift fi +RND="" +DEF_ANS="" +AUTO="" +case "$1" in + -r) RND="-r" ; AUTO="yes" ; shift ;; + -y) DEF_ANS="y" ; AUTO="yes" ; shift ;; + -m) DEF_ANS="m" ; AUTO="yes" ; shift ;; + -n) DEF_ANS="n" ; AUTO="yes" ; shift ;; +esac + CONFIG_IN=./config.in if [ "$1" != "" ] ; then CONFIG_IN=$1 fi -DEFAULTS=.config -if [ ! -f .config ]; then - DEFAULTS=/etc/kernel-config - if [ ! -f $DEFAULTS ]; then - DEFAULTS=/boot/config-`uname -r` - if [ ! -f $DEFAULTS ]; then - DEFAULTS=arch/$ARCH/defconfig - fi +for DEFAULTS in .config /lib/modules/`uname -r`/.config /etc/kernel-config /boot/config-`uname -r` arch/$ARCH/defconfig +do + [ -r $DEFAULTS ] && break +done + +if [ "$AUTO" != "yes" ]; then + if [ -f $DEFAULTS ]; then + echo "#" + echo "# Using defaults found in" $DEFAULTS + echo "#" + . $DEFAULTS + sed -e 's/# \(CONFIG_[^ ]*\) is not.*/\1=n/' <$DEFAULTS >.config-is-not.$$ + . .config-is-not.$$ + rm .config-is-not.$$ + else + echo "#" + echo "# No defaults found" + echo "#" fi -fi - -if [ -f $DEFAULTS ]; then - echo "#" - echo "# Using defaults found in" $DEFAULTS - echo "#" - . $DEFAULTS - sed -e 's/# \(CONFIG_[^ ]*\) is not.*/\1=n/' <$DEFAULTS >.config-is-not.$$ - . .config-is-not.$$ - rm .config-is-not.$$ else - echo "#" - echo "# No defaults found" - echo "#" + if [ -f $FORCE_DEFAULT ]; then + echo "#" + echo "# Forcing defaults found in $FORCE_DEFAULT" + echo "#" + sed -e ' +s/# \(CONFIG_[^ ]*\) is not.*/\1=n/; +s/# range \(CONFIG_[^ ]*\) \([^ ][^ ]*\) \([^ ][^ ]*\)/MIN_\1=\2; MAX_\1=\3/; +s/# list \(CONFIG_[^ ]*\) \([^ ][^ ]*\)/LIST_\1=\2/ +' <$FORCE_DEFAULT >.default_val.$$ + . .default_val.$$ + rm .default_val.$$ + else + echo "#" + echo "# No defaults found" + echo "#" + fi fi . $CONFIG_IN diff --git a/scripts/Makefile b/scripts/Makefile index 83f72fb047b4..9968873e37ae 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -5,7 +5,7 @@ # The following temporary rule will make sure that people's # trees get updated to the right permissions, since patch(1) # can't do it -CHMOD_FILES := docgen gen-all-syms kernel-doc mkcompile_h mkversion_h makelst +CHMOD_FILES := docgen gen-all-syms kernel-doc mkcompile_h makelst all: fixdep split-include $(CHMOD_FILES) diff --git a/scripts/fixdep.c b/scripts/fixdep.c index 07c927c58f3f..4a42364ab18a 100644 --- a/scripts/fixdep.c +++ b/scripts/fixdep.c @@ -214,7 +214,7 @@ void use_config(char *m, int slen) if (*p == '_') *p = '/'; else - *p = tolower(*p); + *p = tolower((unsigned char)*p); } printf(" $(wildcard %s/include/config/%s.h) \\\n", topdir, s); } diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index e18fc4f263e3..6313db961724 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -10,24 +10,32 @@ else echo 0 > ../.version fi + +UTS_VERSION="#$VERSION" +if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi +UTS_VERSION="$UTS_VERSION `LANG=C date`" + +# Truncate to maximum length + +UTS_LEN=64 +UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" + # Generate a temporary compile.h ( echo /\* This file is auto generated, version $VERSION \*/ echo \#define UTS_MACHINE \"$ARCH\" - echo -n \#define UTS_VERSION \"\#$VERSION - if [ -n "$SMP" ] ; then echo -n " SMP"; fi - echo ' '`date`'"' + echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" - echo \#define LINUX_COMPILE_TIME \"`date +%T`\" + echo \#define LINUX_COMPILE_TIME \"`LANG=C date +%T`\" echo \#define LINUX_COMPILE_BY \"`whoami`\" - echo \#define LINUX_COMPILE_HOST \"`hostname`\" + echo \#define LINUX_COMPILE_HOST \"`hostname | $UTS_TRUNCATE`\" if [ -x /bin/dnsdomainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\" + echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname | $UTS_TRUNCATE`\" elif [ -x /bin/domainname ]; then - echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\" + echo \#define LINUX_COMPILE_DOMAIN \"`domainname | $UTS_TRUNCATE`\" else echo \#define LINUX_COMPILE_DOMAIN fi @@ -48,10 +56,10 @@ if [ -r $TARGET ] && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' $TARGET > .tmpver.1 && \ grep -v 'UTS_VERSION\|LINUX_COMPILE_TIME' .tmpcompile > .tmpver.2 && \ cmp -s .tmpver.1 .tmpver.2; then - echo $TARGET was not updated; + echo ' (unchanged)' rm -f .tmpcompile else - echo $TARGET was updated + echo ' (updated)' mv -f .tmpcompile $TARGET fi rm -f .tmpver.1 .tmpver.2 diff --git a/scripts/mkversion_h b/scripts/mkversion_h deleted file mode 100755 index dd8c5eb6d7dd..000000000000 --- a/scripts/mkversion_h +++ /dev/null @@ -1,25 +0,0 @@ -TARGET=$1 -KERNELRELEASE=$2 -VERSION=$3 -PATCHLEVEL=$4 -SUBLEVEL=$5 - -# Generate a temporary version.h - -( echo \#define UTS_RELEASE \"$KERNELRELEASE\" - echo \#define LINUX_VERSION_CODE `expr $VERSION \\* 65536 + $PATCHLEVEL \\* 256 + $SUBLEVEL` - echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))' -) > .tmpversion - -# Only replace the real version.h if the new one is different -# in order to preserve the timestamp and avoid unnecessary -# recompilations. - -if [ -r $TARGET ] && \ - cmp -s $TARGET .tmpversion; then - echo $TARGET was not updated; - rm -f .tmpversion -else - echo $TARGET was updated; - mv -f .tmpversion $TARGET -fi diff --git a/scripts/tkparse.c b/scripts/tkparse.c index ddd1ad7e9a8b..dbede1326f17 100644 --- a/scripts/tkparse.c +++ b/scripts/tkparse.c @@ -74,12 +74,12 @@ static void syntax_error( const char * msg ) /* - * Find index of a specyfic variable in the symbol table. + * Find index of a specific variable in the symbol table. * Create a new entry if it does not exist yet. */ -#define VARTABLE_SIZE 4096 -struct variable vartable[VARTABLE_SIZE]; +struct variable *vartable; int max_varnum = 0; +static int vartable_size = 0; int get_varnum( char * name ) { @@ -88,8 +88,13 @@ int get_varnum( char * name ) for ( i = 1; i <= max_varnum; i++ ) if ( strcmp( vartable[i].name, name ) == 0 ) return i; - if (max_varnum > VARTABLE_SIZE-1) - syntax_error( "Too many variables defined." ); + while (max_varnum+1 >= vartable_size) { + vartable = realloc(vartable, (vartable_size += 1000)*sizeof(*vartable)); + if (!vartable) { + fprintf(stderr, "tkparse realloc vartable failed\n"); + exit(1); + } + } vartable[++max_varnum].name = malloc( strlen( name )+1 ); strcpy( vartable[max_varnum].name, name ); return max_varnum; @@ -818,5 +823,6 @@ int main( int argc, const char * argv [] ) do_source ( "-" ); fix_conditionals ( config_list ); dump_tk_script ( config_list ); + free(vartable); return 0; } diff --git a/scripts/tkparse.h b/scripts/tkparse.h index 1ca16b1852e7..2ded97e85384 100644 --- a/scripts/tkparse.h +++ b/scripts/tkparse.h @@ -115,7 +115,7 @@ struct variable char global_written; }; -extern struct variable vartable[]; +extern struct variable *vartable; extern int max_varnum; /* |
