randconfig.sh 943 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # build random configurations
  3. # Usage:
  4. # ARCH=i386 nohup ./extra/scripts/randconfig.sh & sleep 1800 && touch STOP
  5. #
  6. # The above builds random i386 configs and automatically stops after 30 minutes
  7. test "x$AWK" = "x" && AWK=awk
  8. test "x$ARCH" = "x" && ARCH=`uname -m`
  9. KCONFIG_ALLCONFIG=.config.allconfig
  10. (echo TARGET_$ARCH=y
  11. ) > $KCONFIG_ALLCONFIG
  12. export KCONFIG_ALLCONFIG
  13. if test "x$NCPU" = "x"
  14. then
  15. test -r /proc/cpuinfo && \
  16. eval `$AWK 'BEGIN{NCPU=0}
  17. /processor/{let NCPU++}
  18. END{if (NCPU<1) {NCPU=1}; print("NCPU="NCPU);}' /proc/cpuinfo` || \
  19. NCPU=1
  20. fi
  21. MAKELEVEL="-j$NCPU"
  22. i=0
  23. while test ! -f STOP
  24. do
  25. ARCH=$ARCH make $* randconfig > /dev/null
  26. ARCH=$ARCH make $* silentoldconfig > /dev/null
  27. if (make $MAKELEVEL $*) 2>&1 >& mk.log
  28. then
  29. :
  30. else
  31. i=`expr $i + 1`
  32. num=`printf "%.5d" $i`
  33. mv .config FAILED.$num.config
  34. mv mk.log FAILED.$num.log
  35. fi
  36. make distclean > /dev/null || true
  37. done
  38. rm -f STOP