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.

197 lines
6.6 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 stuff
  98. rm -f /tmp/$$.sed
  99. list="CONFIG_THIS_DOES_NOT_EXIST"
  100. for x in $pkg_linux_brokenfiles ; do
  101. if [ -f "$x" ] ; then
  102. echo "Disable broken file: $x"
  103. list="$list `tr ' ' '\t' < $x | cut -f1 | grep '^CONFIG_'`"
  104. fi
  105. done
  106. for x in $list ; do
  107. echo "s,^$x=.\$,# $x is not set,;" >> /tmp/$$.sed
  108. done
  109. sed -f /tmp/$$.sed < .config > .config.6
  110. cp .config.6 .config ; rm -f /tmp/$$.sed
  111. # create a valid .config (dependencies might need to be disabled)
  112. yes '' | eval $MAKE oldconfig > /dev/null
  113. # save final config
  114. cp .config .config_modules
  115. echo "Creating config without modules ...."
  116. sed "s,\(CONFIG_.*\)=m,# \1 is not set," .config > .config_new
  117. mv .config_new .config
  118. # create a valid .config (dependencies might need to be disabled)
  119. yes '' | eval $MAKE oldconfig > /dev/null
  120. mv .config .config_nomods
  121. # which .config to use?
  122. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = "modules" ] ; then
  123. cp .config_modules .config
  124. else
  125. cp .config_nomods .config
  126. fi
  127. }
  128. lx_config ()
  129. {
  130. echo "Generic linux source patching and configuration ..."
  131. hook_eval prepatch
  132. apply_patchfiles
  133. hook_eval postpatch
  134. echo "Redefining some VERSION flags ..."
  135. x="-`echo $ver-rock | cut -d - -f 2-`"
  136. sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $x/" Makefile > Makefile.new
  137. mv Makefile.new Makefile
  138. echo "Correcting user and permissions ..."
  139. chown -R root.root . * ; chmod -R u=rwX,go=rX .
  140. if [[ $treever = 24* ]] ; then
  141. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  142. eval $MAKE include/linux/version.h symlinks
  143. cp $base/package/base/linux24/autoconf.h include/linux/
  144. touch include/linux/modversions.h
  145. fi
  146. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = none ] ; then
  147. echo "Using \$base/config/\$config/linux.cfg."
  148. echo "Since automatic generation is disabled ..."
  149. cp -v $base/config/$config/linux.cfg .config
  150. else
  151. echo "Automatically creating default configuration ...."
  152. auto_config
  153. fi
  154. echo "... configuration finished!"
  155. if [[ $treever != 24* ]] ; then
  156. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  157. eval $MAKE include/linux/version.h include/asm
  158. eval $MAKE oldconfig > /dev/null
  159. fi
  160. echo "Clean up the *.orig and *~ files ... "
  161. rm -f .config.old `find -name '*.orig' -o -name '*~'`
  162. echo "Generic linux source configuration finished."
  163. }
  164. pkg_linux_brokenfiles="$base/architecture/$arch/kernel-disable.lst \
  165. $base/architecture/$arch/kernel$treever-disable.lst \
  166. $base/package/base/linux$treever/disable-broken.lst \
  167. $pkg_linux_brokenfiles"