Advertisement
Guest User

Untitled

a guest
Aug 28th, 2011
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.63 KB | None | 0 0
  1. # Maintainer: graysky <graysky AT archlinux DOT us>
  2. # Contributor: Tobias Powalowski <tpowa@archlinux.org>
  3. # Contributor: Thomas Baechler <thomas@archlinux.org>
  4. ###########################################################################################################
  5. # Patch and Build Options
  6. ###########################################################################################################
  7. #
  8. ## Note all kernels get the ck patch set with BFS so there is no option to enable/disable it!
  9. #
  10. _usearchlogo="y" # use the blue Arch logo rather than default tux logo when booting
  11. _makenconfig="n" # select additional kernel options prior to a build via nconfig
  12. _localmodcfg="n" # compile ONLY probed modules - see notes below!
  13. _localyescfg="n" # convert all modules to core - see notes below!
  14. _use_current="n" # use the current kernel's .config file - see notes below!
  15. _BFQ_enable_="n" # enable BFQ as the default I/O scheduler
  16. ###########################################################################################################
  17. # More Details and References
  18. ###########################################################################################################
  19. ## LOCALMODCONFIG OPTION
  20. # As of mainline 2.6.32, running with this option will only build the modules that you currently have
  21. # probed in your system VASTLY reducing the number of modules build.
  22. #
  23. # WARNING - make CERTAIN that all modules are modprobed BEFORE you begin making the pkg!
  24. # Read, https://bbs.archlinux.org/viewtopic.php?pid=830221#p830221
  25. # To keep track of which modules are needed for your specific system/hardware, give my module_db script
  26. # a try: http://aur.archlinux.org/packages.php?ID=41689
  27. #
  28. # Note that if you use my script, this PKGBUILD will auto run the reload_data base for you to probe
  29. # all the modules you have logged!
  30. #
  31. ## LOCALYESCONFIG OPTION
  32. # This adds the option localyesconfig to make. This is similar to localmodconfig, but after it removes
  33. # unnecessary modules it runs "sed -i s/=m/=y/" on the .config file. It then runs "make silentoldconfig"
  34. # to fix any holes that were created by the conversion of modules to core.
  35. ## USE CURRENT KERNEL'S .CONFIG
  36. # Enabling this option will use the .config of the RUNNING kernel rather than the ARCH defaults.
  37. # Useful when the package gets updated and you already went through the trouble of customizing your
  38. # config options. NOT recommended when a new kernel is released, but again, convenient for package bumps.
  39. ## BFQ
  40. # Read, http://algo.ing.unimo.it/people/paolo/disk_sched/
  41. #
  42. ###########################################################################################################
  43. pkgname=(linux-ck-corei7-avx linux-ck-corei7-avx-headers)
  44. _kernelname=-ck
  45. _basekernel=3.0
  46. pkgver=${_basekernel}.3
  47. pkgrel=4
  48. arch=('i686' 'x86_64')
  49. url="https://wiki.archlinux.org/index.php/linux-ck"
  50. license=('GPL2')
  51. #makedepends=('xmlto' 'docbook-xsl')
  52. options=('!strip')
  53. _ckpatchversion=1
  54. _ckpatchname="patch-${_basekernel}.0-ck${_ckpatchversion}"
  55. _bfqpath="http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.0.0"
  56. source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-${_basekernel}.tar"
  57. "ftp://ftp.kernel.org/pub/linux/kernel/v3.0/patch-${pkgver}.gz"
  58. # the main kernel config files
  59. 'config' 'config.x86_64'
  60. 'linux-ck.install' 'linux-ck.preset' # standard config files for mkinitcpio ramdisk
  61. 'fix-i915.patch'
  62. 'change-default-console-loglevel.patch'
  63. http://www.kernel.org/pub/linux/kernel/people/ck/patches/${_basekernel}/${_basekernel}.0-ck${_ckpatchversion}/${_ckpatchname}.bz2 # ck_patchset
  64. #${_bfqpath}/{0001 0002 0003} # bfq patchset
  65. logo_linux_mono.pbm # optional Arch logo for boot
  66. logo_linux_{clut224,vga16}.ppm) # optional Arch logo for boot
  67.  
  68. build() {
  69. cd "${srcdir}/linux-${_basekernel}"
  70.  
  71. patch -p1 -i "${srcdir}/patch-${pkgver}"
  72.  
  73. # add latest fixes from stable queue, if needed
  74. # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
  75.  
  76. # fix #19234 i1915 display size
  77. patch -Np1 -i "${srcdir}/fix-i915.patch"
  78.  
  79. # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
  80. # remove this when a Kconfig knob is made available by upstream
  81. # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
  82. patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
  83.  
  84. ### Patch source with ck patchset with BFS
  85. # Fix double name in EXTRAVERSION
  86. sed -i -re "s/^(.EXTRAVERSION).*$/\1 = /" ${srcdir}/${_ckpatchname}
  87. msg "Patching source with the ck1 patch set using bfs v0.406"
  88. patch -Np1 -i ${srcdir}/${_ckpatchname}
  89.  
  90. ### Optionally enable BFQ IO Scheduler as default
  91. # msg "Patching source with BFQ patches"
  92. # for p in $(ls ${srcdir}/000*.patch); do
  93. # patch -Np1 -i $p
  94. # done
  95.  
  96. ### Clean tree and copy ARCH config over
  97. msg "Running make mrproper to clean source tree"
  98. make mrproper
  99.  
  100. if [ "$CARCH" = "x86_64" ]; then
  101. cat ../config.x86_64 >./.config
  102. else
  103. cat ../config >./.config
  104. fi
  105.  
  106. ### Optionally use the blue Arch logo at kernel load
  107. if [ $_usearchlogo = "y" ]; then
  108. install -m644 ${srcdir}/logo_linux_clut224.ppm drivers/video/logo/
  109. install -m644 ${srcdir}/logo_linux_mono.pbm drivers/video/logo/
  110. install -m644 ${srcdir}/logo_linux_vga16.ppm drivers/video/logo/
  111. sed -i -e 's/# CONFIG_LOGO is not set/CONFIG_LOGO=y\nCONFIG_LOGO_LINUX_MONO=y\nCONFIG_LOGO_LINUX_VGA16=y\nCONFIG_LOGO_LINUX_CLUT224=y/' ./.config
  112. fi
  113.  
  114. ### Optionally use running kernel's config
  115. # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
  116. if [ $_use_current = "y" ]; then
  117. if [[ -s /proc/config.gz ]]; then
  118. msg "Extracting config from /proc/config.gz..."
  119. modprobe configs
  120. zcat /proc/config.gz > ./.config
  121. else
  122. warning "You kernel was not compiled with IKCONFIG_PROC!"
  123. warning "You cannot read the current config!"
  124. warning "Aborting!"
  125. exit
  126. fi
  127. fi
  128.  
  129. if [ "${_kernelname}" != "" ]; then
  130. sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  131. fi
  132.  
  133. ### Optionally enable BFQ as the default io scheduler
  134. if [ $_BFQ_enable_ = "y" ]; then
  135. sed -i -e s'/CONFIG_CFQ_GROUP_IOSCHED=y/CONFIG_CFQ_GROUP_IOSCHED=y\nCONFIG_IOSCHED_BFQ=y\nCONFIG_CGROUP_BFQIO=y/' \
  136. -i -e s'/CONFIG_DEFAULT_CFQ=y/# CONFIG_DEFAULT_CFQ is not set\nCONFIG_DEFAULT_BFQ=y/' \
  137. -i -e '/CONFIG_DEFAULT_IOSCHED/ s,cfq,bfq,' ./.config
  138. fi
  139.  
  140. # remove the sublevel from Makefile
  141. # this ensures our kernel version is always 3.X-ARCH
  142. # this way, minor kernel updates will not break external modules
  143. # we need to change this soon, see FS#16702
  144. sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
  145.  
  146. # get kernel version
  147. msg "Running make prepare for you to enable patched options of your choosing"
  148. make prepare
  149.  
  150. ### Optionally load needed modules for the make localmodconfig
  151. # See http://aur.archlinux.org/packages.php?ID=41689
  152. if [ $_localmodcfg = "y" ]; then
  153. msg "If you have modprobe_db installed, running reload_database now"
  154. if [ -e /usr/bin/reload_database ]; then
  155. /usr/bin/reload_database
  156. fi
  157. msg "Running Steven Rostedt's make localmodconfig now"
  158. make localmodconfig
  159. fi
  160.  
  161. if [ $_localyescfg = "y" ]; then
  162. msg "Running make localyesconfig"
  163. make localyesconfig
  164. fi
  165.  
  166. if [ $_makenconfig = "y" ]; then
  167. msg "Running make nconfig"
  168. make nconfig
  169. fi
  170.  
  171. msg "Running make bzImage and modules"
  172. make ${MAKEFLAGS} KCFLAGS="-march=corei7-avx -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" KCPPFLAGS="-march=corei7-avx -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2" bzImage modules
  173. }
  174.  
  175. package_linux-ck-corei7-avx() {
  176. _Kpkgdesc='The Linux Kernel and modules with Brain Fuck Scheduler v0.406 and all the goodies in the ck1 patch set.'
  177. pkgdesc="${_Kpkgdesc} Intel Sandybridge Core i3/i5/i7 optimized."
  178. depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
  179. optdepends=('crda: to set the correct wireless channels of your country' 'lirc-ck: Linux Infrared Remote Control kernel modules for linux-ck' 'nvidia-ck: nVidia drivers for linux-ck' 'nvidia-beta-ck: nVidia beta drivers for linux-ck' 'modprobed_db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig')
  180. provides=("${pkgname}=${pkgver}")
  181. conflicts=('linux-ck-atom' 'linux-ck-core2' 'linux-ck' 'linux-ck-k8' 'linux-ck-k10' 'linux-ck-corei7-avx')
  182. replaces=('kernel26-ck-corei7-avx')
  183. backup=("etc/mkinitcpio.d/linux-ck.preset")
  184. install=linux-ck.install
  185. groups=('ck-corei7-avx')
  186.  
  187. cd "${srcdir}/linux-${_basekernel}"
  188. KARCH=x86
  189.  
  190. # get kernel version
  191. _kernver="$(make kernelrelease)"
  192.  
  193. mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
  194. make INSTALL_MOD_PATH="${pkgdir}" modules_install
  195. cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-linux-ck"
  196.  
  197. # add vmlinux
  198. install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
  199.  
  200. # install fallback mkinitcpio.conf file and preset file for kernel
  201. install -D -m644 "${srcdir}/linux-ck.preset" "${pkgdir}/etc/mkinitcpio.d/linux-ck.preset"
  202.  
  203. # set correct depmod command for install
  204. sed \
  205. -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
  206. -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
  207. -i "${startdir}/linux-ck.install"
  208. sed \
  209. -e "s|default_image=.*|default_image=\"/boot/initramfs-linux-ck.img\"|g" \
  210. -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-linux-ck-fallback.img\"|g" \
  211. -i "${pkgdir}/etc/mkinitcpio.d/linux-ck.preset"
  212.  
  213. # remove build and source links
  214. rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
  215. # add compat symlink for the kernel image
  216. ln -sf vmlinuz-linux-ck "${pkgdir}/boot/vmlinuz26${_kernelname}"
  217. # remove the firmware
  218. rm -rf "${pkgdir}/lib/firmware"
  219. # gzip -9 all modules to save 100MB of space
  220. find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
  221. }
  222.  
  223. package_linux-ck-corei7-avx-headers() {
  224. _Hpkgdesc='Header files and scripts to build modules for linux-ck.'
  225. pkgdesc="${_Hpkgdesc} Intel Sandybridge Core i3/i5/i7 optimized."
  226. provides=("${pkgname}=${pkgver}")
  227. conflicts=('linux-ck-atom-headers' 'linux-ck-core2-headers' 'linux-ck-corei7-avx-headers' 'linux-ck-headers' 'linux-ck-k8-headers' 'linux-ck-k10-headers')
  228. replaces=('kernel26-ck-corei7-avx-headers')
  229. groups=('ck-corei7-avx')
  230.  
  231. mkdir -p "${pkgdir}/lib/modules/${_kernver}"
  232.  
  233. cd "${pkgdir}/lib/modules/${_kernver}"
  234. ln -sf ../../../usr/src/linux-${_kernver} build
  235.  
  236. cd "${srcdir}/linux-${_basekernel}"
  237. install -D -m644 Makefile \
  238. "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
  239. install -D -m644 kernel/Makefile \
  240. "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
  241. install -D -m644 .config \
  242. "${pkgdir}/usr/src/linux-${_kernver}/.config"
  243.  
  244. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
  245.  
  246. for i in acpi asm-generic config crypto drm generated linux math-emu \
  247. media net pcmcia scsi sound trace video xen; do
  248. cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
  249. done
  250.  
  251. # copy arch includes for external modules
  252. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
  253. cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
  254.  
  255. # copy files necessary for later builds, like nvidia and vmware
  256. cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
  257. cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
  258.  
  259. # fix permissions on scripts dir
  260. chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
  261. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
  262.  
  263. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
  264.  
  265. cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  266.  
  267. if [ "${CARCH}" = "i686" ]; then
  268. cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
  269. fi
  270.  
  271. cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
  272.  
  273. # add headers for lirc package
  274. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
  275.  
  276. cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
  277.  
  278. for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
  279. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  280. cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
  281. done
  282.  
  283. # add docbook makefile
  284. install -D -m644 Documentation/DocBook/Makefile \
  285. "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
  286.  
  287. # add dm headers
  288. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  289. cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
  290.  
  291. # add inotify.h
  292. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
  293. cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
  294.  
  295. # add wireless headers
  296. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  297. cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
  298.  
  299. # add dvb headers for external modules
  300. # in reference to:
  301. # http://bugs.archlinux.org/task/9912
  302. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
  303. cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
  304. # and...
  305. # http://bugs.archlinux.org/task/11194
  306. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  307. cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
  308.  
  309. # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  310. # in reference to:
  311. # http://bugs.archlinux.org/task/13146
  312. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  313. cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  314. cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  315.  
  316. # add dvb headers
  317. # in reference to:
  318. # http://bugs.archlinux.org/task/20402
  319. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
  320. cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
  321. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
  322. cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
  323. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
  324. cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
  325.  
  326. # add xfs and shmem for aufs building
  327. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
  328. mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
  329. cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
  330.  
  331. # copy in Kconfig files
  332. for i in `find . -name "Kconfig*"`; do
  333. mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
  334. cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
  335. done
  336.  
  337. chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
  338. find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
  339.  
  340. # strip scripts directory
  341. find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
  342. case "$(file -bi "${binary}")" in
  343. *application/x-sharedlib*) # Libraries (.so)
  344. /usr/bin/strip ${STRIP_SHARED} "${binary}";;
  345. *application/x-archive*) # Libraries (.a)
  346. /usr/bin/strip ${STRIP_STATIC} "${binary}";;
  347. *application/x-executable*) # Binaries
  348. /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
  349. esac
  350. done
  351.  
  352. # remove unneeded architectures
  353. rm -rf "${pkgdir}"/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,microblaze,mn10300,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
  354. }
  355. # Global pkgdesc and depends are here so that they will be picked up by AUR
  356. pkgdesc='The Linux Kernel and modules with Brain Fuck Scheduler v0.406 and all the goodies in the ck1 patch set.'
  357. sha256sums=('64b0228b54ce39b0b2df086109a7b737cde58e3df4f779506ddcaccee90356a0'
  358. 'ffc606851dba5c1fe9a6590492f16f39798297c6beb28b5baa1b476018f4b244'
  359. '9ca531cfc309fed1c01a297b7e08db844c01509a8ffbfc83fd91086858dcd95f'
  360. 'ff686ca6ce4ca152991e34fda7d1408eafeee70d3db392cca129fccb3d817069'
  361. '2a8bdb10801a1205c90d0f77b227a5e026317156fd0961c14b69aadb9dbb808f'
  362. 'c2cf8cc2600502de348f3dc3aae9a3bde5486759db15cb8a93df7aa35bd6e7da'
  363. '9ccadbe3eb30bb283af3eb869c3a4bdb764628854811cc616a2e02e9ef398705'
  364. 'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
  365. '34ca007d90df006e70b7de31e6db969c63d3c7f6e141463cff036b89b7d22ee0'
  366. '1e5bea8de1c2cc24498fb9a4fdbb313f36f38f671f2bfc46ccf7acbd7958a4b9'
  367. '111feb3ac4a8a80b6aae616c5dff8cd62e2b9c8719b390dfa72b45101592fadc'
  368. '5147681ae1ef8ca99d458f3a074058267876647b7287b702f5bcf07e795d7e43')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement