Guest User

Untitled

a guest
Oct 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: $
  4.  
  5. # Original Author: mavriq@gmail.com
  6.  
  7. inherit savedconfig
  8.  
  9. EXPORT_FUNCTIONS src_configure src_install
  10.  
  11. IUSE="nohighmem highmem4g highmem64g"
  12.  
  13. REQUIRED_USE="x86? (
  14. nohighmem? ( !highmem4g !highmem64g )
  15. highmem4g? ( !nohighmem !highmem64g )
  16. highmem64g? ( !nohighmem !highmem4g )
  17. )
  18. !x86? ( !nohighmem !highmem4g !highmem64g )
  19. "
  20.  
  21. kernel_config_option() {
  22. config="${S}/.config"
  23. origkey="$1"
  24. key=`echo "$1"| tr 'a-z' 'A-Z'`
  25. value="$2"
  26. case "${value}" in
  27. '') use "${origkey}" \
  28. && kernel_config_option "${key}" y \
  29. || kernel_config_option "${key}" n
  30. return 0 ;;
  31. n)
  32. einfo "In ${config} disagle CONFIG_${key}"
  33. sed -i -e "s:CONFIG_${key}=.:# CONFIG_${key} is not set:g" "${config}" ;;
  34. *)
  35. einfo "In ${config} set CONFIG_${key}=${value}"
  36. sed -i -e "s:.*\<CONFIG_${key}\>.*set:CONFIG_${key}=${value}:g" "${config}" ;;
  37. ## ^^--- y or m or any value (задел на будущее)
  38. esac
  39. }
  40.  
  41. calculate-kernel-tuneconfig_src_configure() {
  42. export KERNEL_ORIG_CONFIGNAME=$(cl-kernel -v --filter 'cl_kernel_config$' | sed -nr 's/.*\[.\]\s//p')
  43. if ! use savedconfig ; then
  44. cp ${KERNEL_ORIG_CONFIGNAME} .config
  45. return
  46. fi
  47. restore_config ".config"
  48. if [ ! -f ".config" ]; then
  49. ewarn "Could not locate user configfile, so we will use ${KERNEL_ORIG_CONFIGNAME}"
  50. cp -v "${KERNEL_ORIG_CONFIGNAME}" .config
  51. fi
  52.  
  53. ## Correct highmem parameter if need
  54. if use nohighmem || use highmem4g || use highmem64g; then
  55. ebegin "Correct highmem parameter"
  56. kernel_config_option nohighmem
  57. kernel_config_option highmem4g
  58. kernel_config_option highmem64g
  59. ( use nohighmem || use highmem64g ) && kernel_config_option X86_PAE y
  60. eend 0
  61. else
  62. einfo "Don't touch highmem parameter"
  63. fi
  64. yes ''| emake -j1 oldconfig &>make_oldconfig.log
  65. #yes ''| make -j1 oldconfig &>make_oldconfig.log
  66. if [ "$?" -ne 0 ] ; then
  67. cat make_oldconfig.log
  68. die "Error during make oldconfig"
  69. fi
  70. diff -su ${KERNEL_ORIG_CONFIGNAME} .config >"${PF}:${SLOT}.diff"
  71. }
  72.  
  73. calculate-kernel-tuneconfig_src_install() {
  74. use savedconfig || return
  75. save_config ${S}/.config
  76. insinto /etc/portage/savedconfig/${CATEGORY}
  77. doins "${PF}:${SLOT}.diff"
  78. }
Add Comment
Please, Sign In to add comment