configinit.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Usage: configinit.sh config-spec-file results-dir
  5. #
  6. # Create a .config file from the spec file. Run from the kernel source tree.
  7. # Exits with 0 if all went well, with 1 if all went well but the config
  8. # did not match, and some other number for other failures.
  9. #
  10. # The first argument is the .config specification file, which contains
  11. # desired settings, for example, "CONFIG_NO_HZ=y". For best results,
  12. # this should be a full pathname.
  13. #
  14. # Copyright (C) IBM Corporation, 2013
  15. #
  16. # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
  17. T="`mktemp -d ${TMPDIR-/tmp}/configinit.sh.XXXXXX`"
  18. trap 'rm -rf $T' 0
  19. # Capture config spec file.
  20. c=$1
  21. resdir=$2
  22. sed -e 's/^\(CONFIG[0-9A-Z_]*\)=.*$/grep -v "^# \1" |/' < $c > $T/u.sh
  23. sed -e 's/^\(CONFIG[0-9A-Z_]*=\).*$/grep -v \1 |/' < $c >> $T/u.sh
  24. grep '^grep' < $T/u.sh > $T/upd.sh
  25. echo "cat - $c" >> $T/upd.sh
  26. if test -z "$TORTURE_TRUST_MAKE"
  27. then
  28. make clean > $resdir/Make.clean 2>&1
  29. fi
  30. make $TORTURE_KMAKE_ARG $TORTURE_DEFCONFIG > $resdir/Make.defconfig.out 2>&1
  31. mv .config .config.sav
  32. sh $T/upd.sh < .config.sav > .config
  33. cp .config .config.new
  34. yes '' | make $TORTURE_KMAKE_ARG oldconfig > $resdir/Make.oldconfig.out 2> $resdir/Make.oldconfig.err
  35. # verify new config matches specification.
  36. configcheck.sh .config $c
  37. exit 0