Guest User

Untitled

a guest
Jan 9th, 2011
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.26 KB | None | 0 0
  1. # Contributor: graysky <graysky AT archlinux dot us>
  2. # Contributor: Tobias Powalowski <[email protected]>
  3. # Contributor: Thomas Baechler <[email protected]>
  4. ###########################################################################################################
  5. # Patch and Build Options
  6. ###########################################################################################################
  7. _BFQ_patches="n" # add BFQ patches
  8. _makenconfig="n" # nconfig option
  9. _localmodcfg="n" # make localmod config - compile ONLY probed modules - see notes below!
  10. _use_current="n" # use the current kernel's .config file - see notes below!
  11. ###########################################################################################################
  12. # More Details and References
  13. ###########################################################################################################
  14. #
  15. ## Note all kernels get the ck patch set so there is no option to enable/disable it!
  16. #
  17. ## BFQ
  18. # read, http://algo.ing.unimo.it/people/paolo/disk_sched/
  19. #
  20. ## MAKENCONFIG OPTION
  21. # Allows you to select additional kernel options prior to a build via a nconfig.
  22. #
  23. ## LOCALMODCONFIG OPTION
  24. # As of mainline 2.6.32, running with this option will only build the modules that you currently have
  25. # probed in your system VASTLY reducing the number of modules build.
  26. #
  27. # WARNING - make CERTAIN that all modules are modprobed BEFORE you begin making the pkg!
  28. # Read, https://bbs.archlinux.org/viewtopic.php?pid=830221#p830221
  29. # To keep track of which modules are needed for your specific system/hardware, give my module_db script
  30. # a try: http://aur.archlinux.org/packages.php?ID=41689
  31. #
  32. # Note that if you use my script, this PKGBUILD will auto run the reload_data base for you to probe
  33. # all the modules you have logged!
  34. #
  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. ###########################################################################################################
  40. pkgname='kernel26-ck'
  41. true && pkgname=('kernel26-ck' 'kernel26-ck-headers')
  42. _basekernel=2.6.37
  43. pkgver=${_basekernel}
  44. pkgrel=1
  45. arch=('i686' 'x86_64')
  46. license=('GPL2')
  47. url="http://users.on.net/~ckolivas/kernel"
  48. _archpatchversion=1
  49. _ckpatchversion=1
  50. _kernelname=-ck
  51. _patchname="patch-${pkgver}-${_archpatchversion}-ARCH"
  52. _ckpatchname="patch-${_basekernel}-ck${_ckpatchversion}"
  53. _bfqpath="http://algo.ing.unimo.it/people/paolo/disk_sched/patches/2.6.37"
  54. source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2 # kernel source
  55. ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2 # arch patchset
  56. config config.x86_64 kernel26.preset # configs
  57. # ck patchset
  58. http://www.kernel.org/pub/linux/kernel/people/ck/patches/2.6/${_basekernel}/${_basekernel}-ck${_ckpatchversion}/${_ckpatchname}.bz2
  59. # BFQ patches
  60. ${_bfqpath}/0001-bfq_iosched-block-prepare_IO_context_code-v1-2.6.37.patch
  61. ${_bfqpath}/0002-bfq_iosched-block-add-cgroups-kconfig-and-build-bits-for-BFQ-v1-2.6.37.patch
  62. ${_bfqpath}/0003-bfq_iosched-block-introduce_BFQ-v1-2.6.37.patch)
  63.  
  64. ## x86_64 processor types/specific for loop - uncomment for mass builds only
  65. for pt in core2 k8 atom; do
  66.  
  67. build() {
  68. ### Patch source with -ARCH patches
  69. # See http://projects.archlinux.org/linux-2.6-ARCH.git/
  70. msg "Patching source with-ARCH patches"
  71. cd ${srcdir}/linux-$_basekernel
  72. patch -Np1 -i ${srcdir}/${_patchname}
  73.  
  74. ### Patch source with ck's magic
  75. # Fix double name in EXTRAVERSION
  76. sed -i -re "s/^(.EXTRAVERSION).*$/\1 = /" ${srcdir}/${_ckpatchname}
  77. # Add -ck base patch set
  78. msg "Patching source with ck1 patch set"
  79. patch -Np1 -i ${srcdir}/${_ckpatchname}
  80.  
  81. ### Optionally patch source for BFQ patches
  82. if [ ${_BFQ_patches} = "y" ]; then
  83. msg "Patching source with BFQ patches"
  84. for p in $(ls ${srcdir}/*-bfq_*); do
  85. patch -Np1 -i $p
  86. done
  87. fi
  88.  
  89. ### Clean tree and copy ARCH config over
  90. msg "Running make mrproper to clean source tree"
  91. make mrproper
  92.  
  93. if [ "$CARCH" = "x86_64" ]; then
  94. cat ../config.x86_64 >./.config
  95. else
  96. cat ../config >./.config
  97. fi
  98.  
  99. ### Optionally use running kernel's config
  100. # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
  101. if [ ${_use_current} = "y" ]; then
  102. if [[ -s /proc/config.gz ]]; then
  103. msg "Extracting config from /proc/config.gz..."
  104. modprobe configs
  105. zcat /proc/config.gz > ./.config
  106. else
  107. warning "You kernel was not compiled with IKCONFIG_PROC!"
  108. warning "You cannot read the current config!"
  109. warning "Aborting!"
  110. exit 0
  111. fi
  112. fi
  113.  
  114. if [ "${_kernelname}" != "" ]; then
  115. sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
  116. fi
  117.  
  118. msg "Running make prepare for you to enable patched options of your choosing"
  119. make prepare
  120.  
  121. # If user patched to BFQ and enabled it in the prev step, set it as default io scheduler
  122. if [ ${_BFQ_patches} = "y" ]; then
  123. sed -i s'/CONFIG_DEFAULT_CFQ=y/# CONFIG_DEFAULT_CFQ is not set/g' ./.config
  124. sed -i s'/# CONFIG_DEFAULT_BFQ is not set/CONFIG_DEFAULT_BFQ=y/g' ./.config
  125. sed -i s'/CONFIG_DEFAULT_IOSCHED="cfq"/CONFIG_DEFAULT_IOSCHED="bfq"/g' ./.config
  126. fi
  127.  
  128. ### Optionally load needed modules for the make localmodconfig
  129. # See http://aur.archlinux.org/packages.php?ID=41689
  130. if [ $_localmodcfg = "y" ]; then
  131.  
  132. msg "If you have modprobe_db installed, running reload_database now"
  133. if [ -e /usr/bin/reload_database ]; then
  134. /usr/bin/reload_database
  135. fi
  136. msg "Running Steven Rostedt's make localmodconfig now"
  137. make localmodconfig
  138. fi
  139.  
  140. if [ $_makenconfig = "y" ]; then
  141. msg "Running make nconfig"
  142. make nconfig
  143. fi
  144.  
  145. ## for loop only
  146. if [ $_pn="core2" ]; then
  147. sed -i s'/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/g' ./.config
  148. sed -i s'/# CONFIG_MCORE2 is not set/CONFIG_MCORE2=y/g' ./.config
  149. fi
  150.  
  151. if [ $_pn="k8" ]; then
  152. sed -i s'/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/g' ./.config
  153. sed -i s'/# CONFIG_MK8 is not set/CONFIG_MK8=y/g' ./.config
  154. fi
  155.  
  156. if [ $_pn="atom" ]; then
  157. sed -i s'/CONFIG_GENERIC_CPU=y/# CONFIG_GENERIC_CPU is not set/g' ./.config
  158. sed -i s'/# CONFIG_MATOM is not set/CONFIG_MATOM=y/g' ./.config
  159. fi
  160. ##
  161.  
  162. msg "Running make bzImage and modules"
  163. make bzImage modules
  164. }
  165.  
  166. package_kernel26-ck-$_pt() {
  167. pkgdesc="ARCH kernel with Brain Fuck Scheduler v0.363 by Con Kolivas. Other goodies in ck1 patch set and BFQ I/O scheduler optional."
  168. backup=(etc/mkinitcpio.d/${pkgname}.preset)
  169. depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio>=0.5.20')
  170. install=kernel26.install
  171. optdepends=('crda: to set the correct wireless channels of your country' \
  172. 'lirc-ck: Linux Infrared Remote Control kernel modules for kernel26-ck' \
  173. 'nvidia-ck: nVidia drivers for kernel26-ck' \
  174. 'nvidia-beta-ck: nVidia beta drivers for kernel26-ck' \
  175. 'nvidia-173xx-ck: nVidia drivers for kernel26-ck, 173xx branch' \
  176. 'modprobed_db: Keeps track of EVERY kernel module that has ever been probed - useful for those of us who make localmodconfig')
  177.  
  178. KARCH=x86
  179. cd ${srcdir}/linux-$_basekernel
  180. #get kernel version
  181. _kernver="$(make kernelrelease)"
  182. mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
  183. msg "Running make modules_install"
  184. make INSTALL_MOD_PATH=${pkgdir} modules_install
  185. cp System.map ${pkgdir}/boot/System.map26${_kernelname}
  186. cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
  187.  
  188. # add vmlinux
  189. install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
  190.  
  191. # install fallback mkinitcpio.conf file and preset file for kernel
  192. install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
  193.  
  194. # set correct depmod command for install
  195. sed \
  196. -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
  197. -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
  198. -i $startdir/kernel26.install
  199. sed \
  200. -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
  201. -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
  202. -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
  203. -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
  204.  
  205. echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
  206.  
  207. # remove build and source links
  208. rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
  209.  
  210. # remove the firmware
  211. rm -rf ${pkgdir}/lib/firmware
  212. }
  213.  
  214. package_kernel26-ck-headers-$_pt() {
  215. pkgdesc='Header files and scripts to build modules for kernel26-ck'
  216. provides=("kernel26-ck-headers=${pkgver}")
  217.  
  218. mkdir -p ${pkgdir}/lib/modules/${_kernver}
  219. cd ${pkgdir}/lib/modules/${_kernver}
  220. ln -sf ../../../usr/src/linux-${_kernver} build
  221. cd ${srcdir}/linux-$_basekernel
  222. install -D -m644 Makefile \
  223. ${pkgdir}/usr/src/linux-${_kernver}/Makefile
  224. install -D -m644 kernel/Makefile \
  225. ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
  226. install -D -m644 .config \
  227. ${pkgdir}/usr/src/linux-${_kernver}/.config
  228. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
  229.  
  230. for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video xen; do
  231. cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
  232. done
  233.  
  234. # copy arch includes for external modules
  235. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
  236. cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
  237.  
  238. # copy files necessary for later builds, like nvidia and vmware
  239. cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
  240. cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
  241.  
  242. # fix permissions on scripts dir
  243. chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
  244. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
  245.  
  246. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
  247.  
  248. cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
  249. if [ "$CARCH" = "i686" ]; then
  250. cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
  251. fi
  252. cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
  253.  
  254. # add headers for lirc package
  255. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
  256. cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
  257. # need to remove zc0301 from the array with 2.26.36
  258. for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo; do
  259. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
  260. cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
  261. done
  262. # add docbook makefile
  263. install -D -m644 Documentation/DocBook/Makefile \
  264. ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
  265. # add dm headers
  266. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
  267. cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
  268. # add inotify.h
  269. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
  270. cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
  271. # add wireless headers
  272. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
  273. cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
  274. # add dvb headers for external modules
  275. # in reference to:
  276. # http://bugs.archlinux.org/task/9912
  277. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
  278. cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
  279. # add dvb headers for external modules
  280. # in reference to:
  281. # http://bugs.archlinux.org/task/11194
  282. if [ -d ${srcdir}/linux-$_basekernel/include/config/dvb ]; then
  283. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
  284. cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
  285. fi
  286. # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
  287. # in reference to:
  288. # http://bugs.archlinux.org/task/13146
  289. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
  290. cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
  291. cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
  292. # add dvb headers
  293. # in reference to:
  294. # http://bugs.archlinux.org/task/20402
  295. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
  296. cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
  297. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
  298. cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
  299. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
  300. cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
  301. # add xfs and shmem for aufs building
  302. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
  303. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
  304. cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
  305. # add headers for virtualbox
  306. # in reference to:
  307. # http://bugs.archlinux.org/task/14568
  308. cp -a include/drm $pkgdir/usr/src/linux-${_kernver}/include/
  309. # add headers for broadcom wl
  310. # in reference to:
  311. # http://bugs.archlinux.org/task/14568
  312. cp -a include/trace $pkgdir/usr/src/linux-${_kernver}/include/
  313. # add headers for crypto modules
  314. # in reference to:
  315. # http://bugs.archlinux.org/task/22081
  316. cp -a include/crypto $pkgdir/usr/src/linux-${_kernver}/include/
  317. # copy in Kconfig files
  318. for i in `find . -name "Kconfig*"`; do
  319. mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
  320. cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
  321. done
  322.  
  323. chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
  324. find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
  325. # remove unneeded architectures
  326. 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}
  327. }
  328. # Global pkgdesc and depends are here so that they will be picked up by AUR
  329. pkgdesc="ARCH kernel with Brain Fuck Scheduler v0.363 by Con Kolivas. Other goodies in ck1 patch set and BFQ I/O scheduler optional."
  330. sha256sums=('edbf091805414739cf57a3bbfeba9e87f5e74f97e38f04d12060e9e0c71e383a'
  331. 'ef2ac68de4202d25bc9bc6f9bbc7687e5ead93ec6ec48d897acf0434840f7e93'
  332. '3db466dc75f32e863576a6fbeac025a8b0d67e484b4e17f3775a7c61215ba5b2'
  333. '14c14d6a6a2f6afa1e475ac47b0ede347cd1720da42c83ff84de38a26679d5c0'
  334. 'f226c292ab3c1a87b78a372ae7589e820a3d9673e3bdec87ead82f876789cb95'
  335. '74566aa7fa7f4df1830561989c4601bc77f6dd0a817321b3c92d1b2479a7cd03'
  336. 'e26487ece1e8d0907dfb2d9e7853563acd5466284eb07f0c4b6bbc0dbe9a3bf1'
  337. '54c14dd574cf0d1a375fa210f59cbb9c6dbb5ee6fce57a52d4f828173d3f3559'
  338. '4561045bfcde95fc27478067e01e0d7dbbd2a22c2a5fd24c31508b25eb4cea71')
  339. done
Advertisement
Add Comment
Please, Sign In to add comment