mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

185 lines
6.3 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/linux24/lx_config.sh
  9. # ROCK Linux is Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. treever=${pkg/linux/} ; treever=${treever/-*/}
  23. archdir="$base/download/$repository/linux$treever"
  24. srctar="linux-${vanilla_ver}.tar.bz2"
  25. lx_cpu=`echo "$arch_machine" | sed -e s/x86$/i386/ \
  26. -e s/i.86/i386/ -e s/powerpc/ppc/ -e s/hppa/parisc/`
  27. [ $arch = sparc -a "$ROCKCFG_SPARC_64BIT_KERNEL" = 1 ] && \
  28. lx_cpu=sparc64
  29. MAKE="$MAKE ARCH=$lx_cpu CROSS_COMPILE=$archprefix KCC=$KCC"
  30. # correct the abolute path for patchfiles supplied in the .conf file
  31. for x in $patchfiles ; do
  32. if [ ! -e $x ] ; then
  33. var_remove patchfiles " " "$x"
  34. x=$archdir/$x
  35. var_append patchfiles " " "$x"
  36. fi
  37. done
  38. auto_config ()
  39. {
  40. if [ -f $base/architecture/$arch/kernel$treever.conf.sh ] ; then
  41. echo " using: architecture/$arch/kernel$treever.conf.sh"
  42. . $base/architecture/$arch/kernel$treever.conf.sh > .config
  43. elif [ -f $base/architecture/$arch/kernel$treever.conf.m4 ] ; then
  44. echo " using: architecture/$arch/kernel$treever.conf.m4"
  45. m4 -I $base/architecture/$arch -I $base/architecture/share \
  46. $base/architecture/$arch/kernel$treever.conf.m4 > .config
  47. elif [ -f $base/architecture/$arch/kernel$treever.conf ] ; then
  48. echo " using: architecture/$arch/kernel$treever.conf"
  49. cp $base/architecture/$arch/kernel$treever.conf .config
  50. elif [ -f $base/architecture/$arch/kernel.conf.sh ] ; then
  51. echo " using: architecture/$arch/kernel.conf.sh"
  52. . $base/architecture/$arch/kernel.conf.sh > .config
  53. elif [ -f $base/architecture/$arch/kernel.conf.m4 ] ; then
  54. echo " using: architecture/$arch/kernel.conf.m4"
  55. m4 -I $base/architecture/$arch -I $base/architecture/share \
  56. $base/architecture/$arch/kernel.conf.m4 > .config
  57. elif [ -f $base/architecture/$arch/kernel.conf ] ; then
  58. echo " using: architecture/$arch/kernel.conf"
  59. cp $base/architecture/$arch/kernel.conf .config
  60. else
  61. echo " using: no rock kernel config found"
  62. cp arch/$lx_cpu/defconfig .config
  63. fi
  64. echo " merging (system default): 'arch/$lx_cpu/defconfig'"
  65. grep '^CONF.*=y' arch/$lx_cpu/defconfig | cut -f1 -d= | \
  66. while read tag ; do egrep -q "(^| )$tag[= ]" .config || echo "$tag=y"
  67. done >> .config ; cp .config .config.1
  68. # all modules needs to be first so modules can be disabled by i.e.
  69. # the targets later
  70. echo "Enabling all modules ..."
  71. yes '' | eval $MAKE no2modconfig > /dev/null ; cp .config .config.2
  72. if [ -f $base/target/$target/kernel$treever.conf.sh ] ; then
  73. confscripts="$base/target/$target/kernel$treever.conf.sh $confscripts"
  74. elif [ -f $base/target/$target/kernel.conf.sh ] ; then
  75. confscripts="$base/target/$target/kernel.conf.sh $confscripts"
  76. fi
  77. for x in $confscripts ; do
  78. echo " running: $x"
  79. sh $x .config
  80. done
  81. cp .config .config.3
  82. # merge various text/plain config files
  83. for x in $base/config/$config/linux.cfg \
  84. $base/target/$target/kernel.conf ; do
  85. if [ -f $x ] ; then
  86. echo " merging: 'config/$config/linux.cfg'"
  87. tag="$(sed '/CONFIG_/ ! d; s,.*CONFIG_\([^ =]*\).*,\1,' \
  88. $x | tr '\n' '|')"
  89. egrep -v "\bCONFIG_($tag)\b" < .config > .config.4
  90. sed 's,\(CONFIG_.*\)=n,# \1 is not set,' \
  91. $x >> .config.4
  92. cp .config.4 .config
  93. fi
  94. done
  95. # create a valid .config
  96. yes '' | eval $MAKE oldconfig > /dev/null ; cp .config .config.5
  97. # last disable broken crap
  98. sh $base/package/base/linux24/disable-broken.sh \
  99. $pkg_linux_brokenfiles < .config > config.6
  100. cp config.6 .config
  101. # create a valid .config (dependencies might need to be disabled)
  102. yes '' | eval $MAKE oldconfig > /dev/null
  103. # save final config
  104. cp .config .config_modules
  105. echo "Creating config without modules ...."
  106. sed "s,\(CONFIG_.*\)=m,# \1 is not set," .config > .config_new
  107. mv .config_new .config
  108. # create a valid .config (dependencies might need to be disabled)
  109. yes '' | eval $MAKE oldconfig > /dev/null
  110. mv .config .config_nomods
  111. # which .config to use?
  112. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = "modules" ] ; then
  113. cp .config_modules .config
  114. else
  115. cp .config_nomods .config
  116. fi
  117. }
  118. lx_config ()
  119. {
  120. echo "Generic linux source patching and configuration ..."
  121. hook_eval prepatch
  122. apply_patchfiles
  123. hook_eval postpatch
  124. echo "Redefining some VERSION flags ..."
  125. x="-`echo $ver-rock | cut -d - -f 2-`"
  126. sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $x/" Makefile > Makefile.new
  127. mv Makefile.new Makefile
  128. echo "Correcting user and permissions ..."
  129. chown -R root.root . * ; chmod -R u=rwX,go=rX .
  130. if [[ $treever = 24* ]] ; then
  131. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  132. eval $MAKE include/linux/version.h symlinks
  133. cp $base/package/base/linux24/autoconf.h include/linux/
  134. touch include/linux/modversions.h
  135. fi
  136. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = none ] ; then
  137. echo "Using \$base/config/\$config/linux.cfg."
  138. echo "Since automatic generation is disabled ..."
  139. cp -v $base/config/$config/linux.cfg .config
  140. else
  141. echo "Automatically creating default configuration ...."
  142. auto_config
  143. fi
  144. echo "... configuration finished!"
  145. if [[ $treever != 24* ]] ; then
  146. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  147. eval $MAKE include/linux/version.h include/asm
  148. eval $MAKE oldconfig > /dev/null
  149. fi
  150. echo "Clean up the *.orig and *~ files ... "
  151. rm -f .config.old `find -name '*.orig' -o -name '*~'`
  152. echo "Generic linux source configuration finished."
  153. }
  154. pkg_linux_brokenfiles="$base/architecture/$arch/kernel-disable.lst \
  155. $base/architecture/$arch/kernel$treever-disable.lst \
  156. $base/package/base/linux$treever/disable-broken.lst \
  157. $pkg_linux_brokenfiles"