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.

170 lines
5.9 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/`
  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 parchfiles " " $x
  36. fi
  37. done
  38. lx_config ()
  39. {
  40. echo "Generic linux source patching and configuration ..."
  41. hook_eval prepatch
  42. apply_patchfiles
  43. hook_eval postpatch
  44. echo "Redefining some VERSION flags ..."
  45. x="-`echo $ver-rock | cut -d - -f 2-`"
  46. sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $x/" Makefile > Makefile.new
  47. mv Makefile.new Makefile
  48. echo "Correcting user and permissions ..."
  49. chown -R root.root . * ; chmod -R u=rwX,go=rX .
  50. if [[ $treever = 24* ]] ; then
  51. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  52. eval $MAKE include/linux/version.h symlinks
  53. cp $base/package/base/linux24/autoconf.h include/linux/
  54. touch include/linux/modversions.h
  55. fi
  56. echo "Creating default configuration ...."
  57. if [ -f $base/architecture/$arch/kernel$treever.conf.sh ] ; then
  58. echo " using: architecture/$arch/kernel$treever.conf.sh"
  59. . $base/architecture/$arch/kernel$treever.conf.sh > .config
  60. elif [ -f $base/architecture/$arch/kernel$treever.conf.m4 ] ; then
  61. echo " using: architecture/$arch/kernel$treever.conf.m4"
  62. m4 -I $base/architecture/$arch -I $base/architecture/share \
  63. $base/architecture/$arch/kernel$treever.conf.m4 > .config
  64. elif [ -f $base/architecture/$arch/kernel$treever.conf ] ; then
  65. echo " using: architecture/$arch/kernel$treever.conf"
  66. cp $base/architecture/$arch/kernel$treever.conf .config
  67. elif [ -f $base/architecture/$arch/kernel.conf.sh ] ; then
  68. echo " using: architecture/$arch/kernel.conf.sh"
  69. . $base/architecture/$arch/kernel.conf.sh > .config
  70. elif [ -f $base/architecture/$arch/kernel.conf.m4 ] ; then
  71. echo " using: architecture/$arch/kernel.conf.m4"
  72. m4 -I $base/architecture/$arch -I $base/architecture/share \
  73. $base/architecture/$arch/kernel.conf.m4 > .config
  74. elif [ -f $base/architecture/$arch/kernel.conf ] ; then
  75. echo " using: architecture/$arch/kernel.conf"
  76. cp $base/architecture/$arch/kernel.conf .config
  77. else
  78. echo " using: no rock kernel config found"
  79. cp arch/$lx_cpu/defconfig .config
  80. fi
  81. echo " merging (system default): 'arch/$lx_cpu/defconfig'"
  82. grep '^CONF.*=y' arch/$lx_cpu/defconfig | cut -f1 -d= | \
  83. while read tag ; do egrep -q "(^| )$tag[= ]" .config || echo "$tag=y"
  84. done >> .config ; cp .config .config.1
  85. # all modules needs to be first so modules can be disabled by i.e.
  86. # the targets later
  87. echo "Enabling all modules ..."
  88. yes '' | eval $MAKE no2modconfig > /dev/null ; cp .config .config.2
  89. if [ -f $base/target/$target/kernel$treever.conf.sh ] ; then
  90. conffiles="$base/target/$target/kernel$treever.conf.sh $conffiles"
  91. elif [ -f $base/target/$target/kernel.conf.sh ] ; then
  92. conffiles="$base/target/$target/kernel.conf.sh $conffiles"
  93. fi
  94. for x in $conffiles ; do
  95. echo " running: $x"
  96. sh $x .config
  97. done
  98. cp .config .config.3
  99. # merge target config
  100. if [ -f $base/config/$config/linux.cfg ] ; then
  101. echo " merging: 'config/$config/linux.cfg'"
  102. x="$(sed '/CONFIG_/ ! d; s,.*CONFIG_\([^ =]*\).*,\1,' \
  103. $base/config/$config/linux.cfg | tr '\n' '|')"
  104. egrep -v "\bCONFIG_($x)\b" < .config > .config.4
  105. sed 's,\(CONFIG_.*\)=n,# \1 is not set,' \
  106. $base/config/$config/linux.cfg >> .config.4
  107. cp .config.4 .config
  108. fi
  109. # create a valid .config
  110. yes '' | eval $MAKE oldconfig > /dev/null ; cp .config .config.5
  111. # last disable broken crap
  112. sh $base/package/base/linux24/disable-broken.sh \
  113. $pkg_linux_brokenfiles < .config > config.6
  114. cp config.6 .config
  115. # create a valid .config (dependencies might need to be disabled)
  116. yes '' | eval $MAKE oldconfig > /dev/null
  117. # save final config
  118. cp .config .config_modules
  119. echo "Creating config without modules ...."
  120. sed "s,\(CONFIG_.*\)=m,# \1 is not set," .config > .config_new
  121. mv .config_new .config
  122. # create a valid .config (dependencies might need to be disabled)
  123. yes '' | eval $MAKE oldconfig > /dev/null
  124. mv .config .config_nomods
  125. # which .config to use?
  126. if [ "$ROCKCFG_PKG_LINUX_MODS" = 0 ] ; then
  127. cp .config_nomods .config
  128. else
  129. cp .config_modules .config
  130. fi
  131. if [[ $treever != 24* ]] ; then
  132. echo "Create symlinks and a few headers for <$lx_cpu> ... "
  133. eval $MAKE include/linux/version.h include/asm
  134. eval $MAKE oldconfig > /dev/null
  135. fi
  136. echo "Clean up the *.orig and *~ files ... "
  137. rm -f .config.old `find -name '*.orig' -o -name '*~'`
  138. echo "Generic linux source configuration finished."
  139. }
  140. pkg_linux_brokenfiles="$base/architecture/$arch/kernel-disable.lst \
  141. $base/architecture/$arch/kernel$treever-disable.lst \
  142. $base/package/base/linux$treever/disable-broken.lst \
  143. $pkg_linux_brokenfiles"