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.

199 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. [ "$vanilla_ver" ] || vanilla_ver="$ver"
  25. srctar="linux-${vanilla_ver}.tar.bz2"
  26. lx_cpu=`echo "$arch_machine" | sed -e s/x86$/i386/ \
  27. -e s/i.86/i386/ -e s/powerpc/ppc/ -e s/hppa/parisc/`
  28. [ $arch = sparc -a "$ROCKCFG_SPARC_64BIT_KERNEL" = 1 ] && \
  29. lx_cpu=sparc64
  30. MAKE="$MAKE ARCH=$lx_cpu CROSS_COMPILE=$archprefix KCC=$KCC"
  31. # correct the abolute path for patchfiles supplied in the .desc file
  32. for x in $patchfiles ; do
  33. if [ ! -e $x ] ; then
  34. var_remove patchfiles " " "$x"
  35. x=$archdir/$x
  36. var_append patchfiles " " "$x"
  37. fi
  38. done
  39. auto_config ()
  40. {
  41. if [ -f $base/architecture/$arch/kernel$treever.conf.sh ] ; then
  42. echo " using: architecture/$arch/kernel$treever.conf.sh"
  43. . $base/architecture/$arch/kernel$treever.conf.sh > .config
  44. elif [ -f $base/architecture/$arch/kernel$treever.conf.m4 ] ; then
  45. echo " using: architecture/$arch/kernel$treever.conf.m4"
  46. m4 -I $base/architecture/$arch -I $base/architecture/share \
  47. $base/architecture/$arch/kernel$treever.conf.m4 > .config
  48. elif [ -f $base/architecture/$arch/kernel$treever.conf ] ; then
  49. echo " using: architecture/$arch/kernel$treever.conf"
  50. cp $base/architecture/$arch/kernel$treever.conf .config
  51. elif [ -f $base/architecture/$arch/kernel.conf.sh ] ; then
  52. echo " using: architecture/$arch/kernel.conf.sh"
  53. . $base/architecture/$arch/kernel.conf.sh > .config
  54. elif [ -f $base/architecture/$arch/kernel.conf.m4 ] ; then
  55. echo " using: architecture/$arch/kernel.conf.m4"
  56. m4 -I $base/architecture/$arch -I $base/architecture/share \
  57. $base/architecture/$arch/kernel.conf.m4 > .config
  58. elif [ -f $base/architecture/$arch/kernel.conf ] ; then
  59. echo " using: architecture/$arch/kernel.conf"
  60. cp $base/architecture/$arch/kernel.conf .config
  61. else
  62. echo " using: no rock kernel config found"
  63. cp arch/$lx_cpu/defconfig .config
  64. fi
  65. echo " merging (system default): 'arch/$lx_cpu/defconfig'"
  66. grep '^CONF.*=y' arch/$lx_cpu/defconfig | cut -f1 -d= | \
  67. while read tag ; do egrep -q "(^| )$tag[= ]" .config || echo "$tag=y"
  68. done >> .config ; cp .config .config.1
  69. # all modules needs to be first so modules can be disabled by i.e.
  70. # the targets later
  71. echo "Enabling all modules ..."
  72. yes '' | eval $MAKE no2modconfig > /dev/null ; cp .config .config.2
  73. if [ -f $base/target/$target/kernel$treever.conf.sh ] ; then
  74. confscripts="$base/target/$target/kernel$treever.conf.sh $confscripts"
  75. elif [ -f $base/target/$target/kernel.conf.sh ] ; then
  76. confscripts="$base/target/$target/kernel.conf.sh $confscripts"
  77. fi
  78. for x in $confscripts ; do
  79. echo " running: $x"
  80. sh $x .config
  81. done
  82. cp .config .config.3
  83. # merge various text/plain config files
  84. for x in $base/config/$config/linux.cfg \
  85. $base/target/$target/kernel.conf ; do
  86. if [ -f $x ] ; then
  87. echo " merging: 'config/$config/linux.cfg'"
  88. tag="$(sed '/CONFIG_/ ! d; s,.*CONFIG_\([^ =]*\).*,\1,' \
  89. $x | tr '\n' '|')"
  90. egrep -v "\bCONFIG_($tag)\b" < .config > .config.4
  91. sed 's,\(CONFIG_.*\)=n,# \1 is not set,' \
  92. $x >> .config.4
  93. cp .config.4 .config
  94. fi
  95. done
  96. # create a valid .config
  97. yes '' | eval $MAKE oldconfig > /dev/null ; cp .config .config.5
  98. # last disable broken stuff
  99. rm -f /tmp/$$.sed
  100. list="CONFIG_THIS_DOES_NOT_EXIST"
  101. for x in $pkg_linux_brokenfiles ; do
  102. if [ -f "$x" ] ; then
  103. echo "Disable broken file: $x"
  104. list="$list `tr ' ' '\t' < $x | cut -f1 | grep '^CONFIG_'`"
  105. fi
  106. done
  107. for x in $list ; do
  108. echo "s,^$x=.\$,# $x is not set,;" >> /tmp/$$.sed
  109. done
  110. sed -f /tmp/$$.sed < .config > .config.6
  111. cp .config.6 .config ; rm -f /tmp/$$.sed
  112. # create a valid .config (dependencies might need to be disabled)
  113. yes '' | eval $MAKE oldconfig > /dev/null
  114. # save final config
  115. cp .config .config_modules
  116. echo "Creating config without modules ...."
  117. sed "s,\(CONFIG_.*\)=m,# \1 is not set," .config > .config_new
  118. mv .config_new .config
  119. # create a valid .config (dependencies might need to be disabled)
  120. yes '' | eval $MAKE oldconfig > /dev/null
  121. mv .config .config_nomods
  122. # which .config to use?
  123. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = "modules" ] ; then
  124. cp .config_modules .config
  125. else
  126. cp .config_nomods .config
  127. fi
  128. }
  129. lx_config ()
  130. {
  131. echo "Generic linux source patching and configuration ..."
  132. hook_eval prepatch
  133. apply_patchfiles
  134. hook_eval postpatch
  135. echo "Redefining some VERSION flags ..."
  136. x="-`echo $ver-rock | cut -d - -f 2-`"
  137. sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $x/" Makefile > Makefile.new
  138. mv Makefile.new Makefile
  139. echo "Correcting user and permissions ..."
  140. chown -R root:root . * ; chmod -R u=rwX,go=rX .
  141. if [[ $treever = 24* ]] ; then
  142. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  143. eval $MAKE include/linux/version.h symlinks
  144. cp $base/package/base/linux24/autoconf.h include/linux/
  145. touch include/linux/modversions.h
  146. fi
  147. if [ "$ROCKCFG_PKG_LINUX_CONFIG_STYLE" = none ] ; then
  148. echo "Using \$base/config/\$config/linux.cfg."
  149. echo "Since automatic generation is disabled ..."
  150. cp -v $base/config/$config/linux.cfg .config
  151. else
  152. echo "Automatically creating default configuration ...."
  153. auto_config
  154. fi
  155. echo "... configuration finished!"
  156. if [[ $treever != 24* ]] ; then
  157. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  158. eval $MAKE include/linux/version.h include/asm
  159. eval $MAKE oldconfig > /dev/null
  160. fi
  161. echo "Clean up the *.orig and *~ files ... "
  162. rm -f .config.old `find -name '*.orig' -o -name '*~'`
  163. echo "Generic linux source configuration finished."
  164. }
  165. pkg_linux_brokenfiles="$base/architecture/$arch/kernel-disable.lst \
  166. $base/architecture/$arch/kernel$treever-disable.lst \
  167. $base/package/base/linux$treever/disable-broken.lst \
  168. $pkg_linux_brokenfiles"