OpenSDE Packages Database (without history before r20070)
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
4.8 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: package/.../linux24/linux24.conf
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. # Copyright (C) 1998 - 2003 Clifford Wolf
  8. #
  9. # More information can be found in the files COPYING and README.
  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; version 2 of the License. A copy of the
  14. # GNU General Public License can be found in the file COPYING.
  15. # --- T2-COPYRIGHT-NOTE-END ---
  16. . $base/package/*/linux*/linux-conf.in
  17. main_lx() {
  18. lx_patch
  19. lx_config
  20. hook_eval premake
  21. # we need to rerun the oldconfig since the used .config
  22. # might not match the one used in the last oldconfig run
  23. # (e.g. the nomods is run last - and normally the module
  24. # one is used)
  25. yes '' | eval $MAKE $makeopt oldconfig > /dev/null
  26. if [[ $treever = 24* ]] ; then
  27. echo "Creating dependencies ..."
  28. eval $MAKE $makeopt dep
  29. fi
  30. kerneldir="$PWD"
  31. moduledir="$root/lib/modules/${lx_kernelrelease}"
  32. echo "Cleanup kernel ..."
  33. eval $MAKE $makeopt clean > /dev/null
  34. cp -vf .config $root/boot/kconfig_${lx_kernelrelease}
  35. if [ -z "$SDEDEBUG_LINUX_SUBMODULES_ONLY" ] ; then
  36. var_append makeopt ' ' vmlinux
  37. if grep -q "CONFIG_MODULES=y" .config ; then
  38. var_append makeopt ' ' modules
  39. var_append makeinstopt ' ' "INSTALL_MOD_PATH=$root DEPMOD=/bin/true modules_install"
  40. else
  41. makeinstopt=
  42. fi
  43. case "$lx_cpu" in
  44. i386|x86_64)
  45. var_append makeopt ' ' bzImage ;;
  46. mips)
  47. var_append makeopt ' ' vmlinux.ecoff ;;
  48. ppc|sh)
  49. var_append makeopt ' ' zImage ;;
  50. sparc*)
  51. var_append makeopt ' ' image ;;
  52. esac
  53. echo "Building the kernel ..."
  54. eval $MAKE $makeopt
  55. cp -vf System.map $root/boot/System.map_${lx_kernelrelease}
  56. hook_eval inmake
  57. [ "$makeinstopt" ] && eval $MAKE $makeinstopt
  58. echo "Installing the kernel ..."
  59. # for debugging with oprofile, also used to boot on some arches
  60. cp -vf vmlinux $root/boot/vmlinux_${lx_kernelrelease}
  61. case "$lx_cpu" in
  62. i386|x86_64)
  63. cp -vf arch/${lx_cpu}/boot/bzImage $root/boot/vmlinuz_${lx_kernelrelease}
  64. ;;
  65. alpha)
  66. gzip < vmlinux > $root/boot/vmlinux_${lx_kernelrelease}.gz
  67. ;;
  68. mips)
  69. cp -vf vmlinux.ecoff $root/boot/vmlinux_${lx_kernelrelease}.ecoff
  70. ;;
  71. ppc)
  72. for x in arch/ppc/boot/images/zImage.* ; do
  73. cp -v $x $root/boot/${x/*\//}-${lx_kernelrelease}
  74. done
  75. ;;
  76. sh)
  77. cp -vf arch/sh/boot/zImage $root/boot/vmlinux_${lx_kernelrelease}
  78. ;;
  79. sparc*)
  80. cp -vf arch/$lx_cpu/boot/image $root/boot/vmlinux_${lx_kernelrelease}
  81. ;;
  82. esac
  83. else
  84. eval $MAKE $makeopt scripts
  85. touch $root/boot/System.map_${lx_kernelrelease}
  86. mkdir -p $moduledir
  87. ln -sf $PWD $moduledir/build
  88. fi
  89. hook_eval postmake
  90. # iterate over the packages that provide 3rd party linux kernel modules
  91. if grep -q "CONFIG_MODULES=y" .config ; then
  92. module_error=0
  93. echo_status "Registered 3rd party kernel modules:"
  94. for x in $lx_3rd_party_modules ; do
  95. echo "Sub-building 3rd party module package $x ..."
  96. pushd $builddir
  97. # ugly, bash does not abort properly when we have this in a if
  98. # and without it the return 1 aborts immediatly ... :-(
  99. set +e
  100. build_package $x postlinux.conf
  101. error=$?
  102. set -e
  103. if [ $error -ne 0 ]; then
  104. echo_warning "Failed building $x."
  105. module_error=1
  106. fi
  107. echo "Done building $x"
  108. popd
  109. done
  110. # maybe fail hard
  111. if ! atstage rebuild && [ $module_error = 1 ]; then
  112. abort "At least one of the 3rd party kernel modules failed!"
  113. fi
  114. if atstage native; then
  115. echo "Running 'depmod -a -q -F /boot/System.map ${lx_kernelrelease}' ..."
  116. depmod -a -q -F $root/boot/System.map_${lx_kernelrelease} ${lx_kernelrelease}
  117. # due static depmod :-(
  118. for x in $moduledir/modules.*
  119. do [ -f $x ] && add_flist $x; done
  120. [ -z "`type -p mkinitrd`" ] || mkinitrd ${lx_kernelrelease}
  121. else
  122. # In theory depmod here as well ...
  123. [ ! -e $root/sbin/mkinitrd ] || sh $root/sbin/mkinitrd -R $root ${lx_kernelrelease}
  124. fi
  125. echo "Fixing /lib/modules/${ver}/build symlink ..."
  126. rm -f $root/lib/modules/${lx_kernelrelease}/build
  127. ln -sf ../../../usr/src/linux-${lx_kernelrelease} \
  128. $root/lib/modules/${lx_kernelrelease}/build
  129. fi
  130. echo "Copying kernel patches ..."
  131. (
  132. cd $root/usr/src/
  133. rm -rf linux$treever-patches ; mkdir -p linux$treever-patches
  134. echo -e "This directory contains all the applied patches, used\n\
  135. to build the kernel (in addition to the official kernel sources)." > \
  136. linux$treever-patches/README
  137. for x in $patchfiles ; do
  138. # if the patch does not exist it was downloaded or so
  139. # and we just do not copy it ...
  140. [ -f $x ] && cp -v $x linux$treever-patches/ || true
  141. done
  142. )
  143. }
  144. custmain="main_lx"
  145. autopatch=0