Advertisement
Guest User

Untitled

a guest
Mar 16th, 2010
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.47 KB | None | 0 0
  1. # Contributor: Mathias Burén <[email protected]>
  2. # Maintainer: xduugu
  3. pkgname=kernel26-git
  4. pkgver=20100315
  5. pkgrel=1
  6. pkgdesc="The Linux Kernel and modules from Linus' git tree"
  7. url="http://www.kernel.org/"
  8. arch=(i686 x86_64)
  9. license=('GPL2')
  10. depends=('coreutils' 'kernel26-firmware-git' 'module-init-tools' 'mkinitcpio>=0.5.20')
  11. makedepends=('git')
  12. backup=(etc/mkinitcpio.d/$pkgname.preset)
  13. install=$pkgname.install
  14. changelog=$pkgname.changelog
  15. source=($pkgname.preset config.{i686,x86_64} \
  16. logo_linux_{clut224.ppm,mono.pbm,vga16.ppm}
  17. patches/0001-drm-radeon-kms-pm-fix-typo-in-power-table-parsing.patch
  18. patches/0002-drm-radeon-kms-gfx-init-fixes-for-r6xx-r7xx.patch
  19. patches/0003-i2c-algo-bit-Add-pre-and-post-xfer-hooks.patch
  20. patches/0004-drm-radeon-kms-use-new-pre-post_xfer-i2c-bit-algo-h.patch
  21. patches/0005-drm-radeon-kms-add-gui_idle-callback.patch
  22. patches/0006-drm-radeon-kms-add-support-for-gui-idle-interrupts.patch
  23. patches/0007-drm-radeon-kms-wait-for-gpu-idle-before-changing-po.patch
  24. patches/0008-drm-radeon-kms-pm-rework-power-mode-parsing.patch
  25. patches/0009-drm-radeon-kms-pm-add-asic-specific-callbacks-for-s.patch
  26. patches/0010-drm-radeon-kms-pm-add-asic-specific-callbacks-for-g.patch
  27. patches/0011-drm-radeon-kms-r6xx-add-support-for-SIMD-pm.patch)
  28. md5sums=('7dd364c1dea0c459f3f3c76e86acbea9'
  29. 'a5549f442953feb52c3a6d03fe62e5a9'
  30. 'c98b594b5abb99aa908de632c207fca2'
  31. '6a5a1925501fe20fafd04fdb3cb4f6ed'
  32. 'e8c333eaeac43f5c6a1d7b2f47af12e2'
  33. 'c120adbd9c0daa0136237a83adeabd1e'
  34. 'e13145c5dd95282f5d7bea7750e98134'
  35. 'e68960be18544b74d8a09dd7c61283ee'
  36. 'dcb253d371916afb68edd0beedf5435f'
  37. 'a49c1d482e5a1d3868c3b2c099721080'
  38. 'a0e8269fc94405623866ea1e4c48ec95'
  39. '4fdb89fbfa678607aef6678fc0ecc181'
  40. 'f5942305d19f8e1352f52a6335b01c46'
  41. 'bc600eb294403046d4d4058eca2b23c2'
  42. '3ef4234f337d6c3f3f95d9adfd509bcc'
  43. 'dca519233f0c0e7b64a5e5f0abd8ada7'
  44. 'e14883c72f6fc444b5570fb3e729fba7')
  45.  
  46.  
  47. _gitroot="git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git"
  48. _gitname="drm-2.6"
  49.  
  50.  
  51. ####################################################################
  52. # KERNEL CONFIG FILES
  53. #
  54. # This PKGBUILD searches for config files in the current directory
  55. # and will use the first one it finds from the following
  56. # list as base configuration:
  57. # config.local
  58. # config.saved.$CARCH
  59. # config.$CARCH
  60. #
  61. ####################################################################
  62.  
  63.  
  64. #############################################################
  65. # PATCHES
  66. #
  67. # This package builds the vanilla git kernel by default,
  68. # but it is possible to patch the source without modifying
  69. # this PKGBUILD.
  70. #
  71. # Simply create a directory 'patches' in your PKGBUILD
  72. # directory and _any_ file (dotfiles excluded) in this
  73. # folder will be applied to the kernel source.
  74. #
  75. # Prefixing the patch file names with dots will obviously
  76. # excluded them from the patching process.
  77. #
  78. #############################################################
  79.  
  80.  
  81. #############################
  82. # CONFIGURATION
  83. #
  84. # Uncomment desired options
  85. #############################
  86.  
  87.  
  88. #######
  89. # Set to e.g. menuconfig, xconfig or gconfig
  90. #
  91. # For a full list of supported commands, please have a look
  92. # at "Configuration targets" section of `make help`'s output.
  93. #
  94. # If unset or set to an empty string, the (manual) kernel
  95. # configuration step will be skipped.
  96. #
  97. _config_cmd="menuconfig"
  98.  
  99.  
  100. #######
  101. # The directory where the kernel should be built
  102. #
  103. # Can be useful, for example, if you want to compile on a
  104. # tmpfs mount, which can speed up the compilation process
  105. #
  106. _build_dir="$srcdir"
  107.  
  108.  
  109. #######
  110. # Stop build process after kernel configuration
  111. #
  112. # This option enables _save_config implicitly.
  113. #
  114. # _configure_only=1
  115.  
  116.  
  117. #######
  118. # Append the date to the localversion
  119. #
  120. # e.g. -ARCH -> -ARCH-20090422
  121. #
  122. # _date_localversion=1
  123.  
  124.  
  125. #######
  126. # Set the pkgver to the kernel version
  127. # rather than the build date
  128. #
  129. # _kernel_pkgver=1
  130.  
  131.  
  132. #######
  133. # Save the .config file to package directory
  134. # as config.saved.$CARCH
  135. #
  136. # _save_config=1
  137.  
  138.  
  139. #######
  140. # Make the kernel build process verbose
  141. #
  142. # _verbose=1
  143.  
  144.  
  145.  
  146. ##############################
  147. # where the magic happens...
  148. ##############################
  149. build() {
  150. #################################
  151. # Get the latest kernel sources
  152. #################################
  153. msg "Fetching sources..."
  154.  
  155. cd "$startdir"
  156. if [[ -d $_gitname ]]; then
  157. msg2 "Updating sources..."
  158. cd "$_gitname" && git fetch && cd "$OLDPWD" || return 1
  159. else
  160. msg2 "Cloning the project..."
  161. warning "The initial clone will download approximately 300 mb"
  162. git clone --mirror "$_gitroot" "$_gitname" && git checkout -b drm-radeon-testing origin/drm-radeon-testing || return 1
  163. fi
  164.  
  165. msg "Creating build branch..."
  166. rm -rf "$_build_dir/$_gitname-build"
  167. git clone "$_gitname" "$_build_dir/$_gitname-build" || return 1
  168.  
  169. cd "$_build_dir/$_gitname-build" || return 1
  170.  
  171.  
  172. ####################################
  173. # Add Arch Linux logo to the source
  174. ####################################
  175. msg "Adding Arch Linux logo..."
  176. cp "$srcdir/logo_linux_clut224.ppm" drivers/video/logo/ &&
  177. cp "$srcdir/logo_linux_mono.pbm" drivers/video/logo/ &&
  178. cp "$srcdir/logo_linux_vga16.ppm" drivers/video/logo/ || return 1
  179.  
  180.  
  181. #################
  182. # Apply patches
  183. #################
  184. shopt -s nullglob
  185. if [[ -d $startdir/patches && -n $(echo "$startdir/patches/"*) ]]; then
  186. msg "Applying patches..."
  187. local i
  188. for i in "$startdir/patches/"*; do
  189. msg2 "Applying ${i##*/}..."
  190. patch -Np1 -i "$i" || (error "Applying ${i##*/} failed" && return 1)
  191. done
  192. fi
  193. shopt -u nullglob
  194.  
  195.  
  196. #################
  197. # CONFIGURATION
  198. #################
  199.  
  200. #########################
  201. # Loading configuration
  202. #########################
  203. msg "Loading configuration..."
  204. for i in local "saved.$CARCH" "$CARCH"; do
  205. if [[ -e $startdir/config.$i ]]; then
  206. msg2 "Using kernel config file config.$i..."
  207. cp -f "$startdir/config.$i" .config || return 1
  208. break
  209. fi
  210. done
  211.  
  212. [[ ! -e .config ]] &&
  213. warning "No suitable kernel config file was found. You'll have to configure the kernel from scratch."
  214.  
  215.  
  216. ###########################
  217. # Start the configuration
  218. ###########################
  219. msg "Updating configuration..."
  220. yes "" | make config > /dev/null
  221.  
  222. # fix lsmod path
  223. sed -ri "s@s(bin/lsmod)@\1@" scripts/kconfig/streamline_config.pl
  224.  
  225. if [[ -n $_config_cmd ]]; then
  226. msg2 "Running make $_config_cmd..."
  227. make $_config_cmd || return 1
  228. else
  229. warning "Unknown config command: $_config_cmd"
  230. fi
  231.  
  232.  
  233. ##############################################
  234. # Save the config file the package directory
  235. ##############################################
  236. if [[ -n $_save_config || -n $_configure_only ]]; then
  237. msg "Saving configuration..."
  238. msg2 "Saving $_build_dir/$_gitname-build/.config as $startdir/config.saved.$CARCH"
  239. cp .config "$startdir/config.saved.$CARCH" || return 1
  240. fi
  241.  
  242.  
  243. #######################################
  244. # Stop after configuration if desired
  245. #######################################
  246. if [[ -n $_configure_only ]]; then
  247. rm -rf "$_build_dir/$_gitname-build"
  248. return 1
  249. fi
  250.  
  251.  
  252. ###############################
  253. # Append date to localversion
  254. ###############################
  255. if [[ -n $_date_localversion ]]; then
  256. local _localversion="$(sed -rn 's/^CONFIG_LOCALVERSION="([^"]*)"$/\1/p' .config)"
  257. [[ -n $_localversion ]] && msg2 "CONFIG_LOCALVERSION is set to: $_localversion"
  258.  
  259. # since this is a git package, the $pkgver is equal to $(date +%Y%m%d)
  260. msg2 "Appending $pkgver to CONFIG_LOCALVERSION..."
  261. sed -i "s/^CONFIG_LOCALVERSION=.*$/CONFIG_LOCALVERSION=\"$_localversion-$pkgver\"/" \
  262. .config
  263. fi
  264.  
  265.  
  266. #################
  267. # BUILD PROCESS
  268. #################
  269.  
  270. ################################
  271. # Build the kernel and modules
  272. ################################
  273. msg "Building kernel and modules..."
  274. make V="$_verbose" bzImage modules || return 1
  275. }
  276.  
  277. package() {
  278. local _karch="x86"
  279. cd "$_build_dir/$_gitname-build" || return 1
  280.  
  281. ######################
  282. # Get kernel version
  283. ######################
  284. local _kernver=$(make kernelrelease)
  285. local _basekernel=${_kernver%%-*}
  286.  
  287.  
  288. ############################################################
  289. # Use kernel version instead of the current date as pkgver
  290. ############################################################
  291. if [[ -n $_kernel_pkgver ]]; then
  292. msg "Updating pkgver..."
  293. # work around AUR parser bug
  294. (( 1 )) && pkgver=${_kernver//-/_}
  295.  
  296. # do not silently overwrite existing packages
  297. if (( ! FORCE )) && [[ -e $PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT} ]]; then
  298. error "A package has already been built. (use -f to overwrite)"
  299. return 1
  300. fi
  301. fi
  302.  
  303.  
  304. #############################################################
  305. # Provide kernel26
  306. # (probably someone wants to use this kernel exclusively?)
  307. #############################################################
  308. provides=("${provides[@]}" kernel26{,-headers}"=${_kernver//-/_}")
  309.  
  310.  
  311. ################
  312. # INSTALLATION
  313. ################
  314.  
  315. #####################
  316. # Install the image
  317. #####################
  318. msg "Installing kernel image..."
  319. install -D -m644 System.map "$pkgdir/boot/System.map26-git" &&
  320. install -D -m644 arch/$_karch/boot/bzImage "$pkgdir/boot/vmlinuz26-git" &&
  321. install -D -m644 .config "$pkgdir/boot/kconfig26-git" || return 1
  322.  
  323.  
  324. ##########################
  325. # Install kernel modules
  326. ##########################
  327. msg "Installing kernel modules..."
  328. make INSTALL_MOD_PATH="$pkgdir" modules_install
  329.  
  330.  
  331. ##############################
  332. # Install fake kernel source
  333. ##############################
  334. install -D -m644 Module.symvers "$pkgdir/usr/src/linux-$_kernver/Module.symvers" &&
  335. install -D -m644 Makefile "$pkgdir/usr/src/linux-$_kernver/Makefile" &&
  336. install -D -m644 kernel/Makefile "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile" &&
  337. install -D -m644 .config "$pkgdir/usr/src/linux-$_kernver/.config" &&
  338. install -D -m644 .config "$pkgdir/lib/modules/$_kernver/.config" || return 1
  339.  
  340.  
  341. #######################################################
  342. # Install scripts directory and fix permissions on it
  343. #######################################################
  344. cp -a scripts "$pkgdir/usr/src/linux-$_kernver" &&
  345. chmod og-w -R "$pkgdir/usr/src/linux-$_kernver" || return 1
  346.  
  347.  
  348. ##########################
  349. # Install header files
  350. ##########################
  351. msg "Installing header files..."
  352.  
  353. # kernel headers
  354. msg2 "kernel"
  355. for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video; do
  356. mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/$i" &&
  357. cp -a include/$i "$pkgdir/usr/src/linux-$_kernver/include" || return 1
  358. done
  359. # required by virtualbox and probably others
  360. ln -s "../generated/autoconf.h" "$pkgdir/usr/src/linux-$_kernver/include/linux/" || return 1
  361.  
  362. # lirc headers
  363. msg2 "lirc"
  364. mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video" &&
  365. cp drivers/media/video/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/" || return 1
  366.  
  367. for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
  368. mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" &&
  369. cp -a drivers/media/video/$i/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" || return 1
  370. done
  371.  
  372. # md headers
  373. msg2 "md"
  374. mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/md" &&
  375. cp -a drivers/md/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/md" || return 1
  376.  
  377. # inotify.h
  378. msg2 "inotify.h"
  379. mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/linux" &&
  380. cp -a include/linux/inotify.h "$pkgdir/usr/src/linux-$_kernver/include/linux/" || return 1
  381.  
  382. # CLUSTERIP file for iptables
  383. msg2 "CLUSTERIP file for iptables"
  384. mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" &&
  385. cp -a net/ipv4/netfilter/ipt_CLUSTERIP.c "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" || return 1
  386.  
  387. # wireless headers
  388. msg2 "wireless"
  389. mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" &&
  390. cp net/mac80211/*.h "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" || return 1
  391.  
  392. # Kconfig files
  393. msg2 "Kconfig files"
  394. for i in $(find . -name "Kconfig*"); do
  395. mkdir -p "$pkgdir/usr/src/linux-$_kernver/${i%/*}" &&
  396. cp -a "$i" "$pkgdir/usr/src/linux-$_kernver/$i" || return 1
  397. done
  398.  
  399.  
  400. ########################################
  401. # Install architecture dependent files
  402. ########################################
  403. msg "Installing architecture files..."
  404. mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel" &&
  405. cp -a arch/$_karch/kernel/asm-offsets.s "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel" || return 1
  406.  
  407. cp -a arch/$_karch/Makefile* "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" &&
  408. cp -a arch/$_karch/configs "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" || return 1
  409.  
  410. # copy arch includes for external modules and fix the nVidia issue
  411. mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" &&
  412. cp -a "arch/$_karch/include" "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/" || return 1
  413.  
  414. # create a necessary symlink to the arch folder
  415. cd "$pkgdir/usr/src/linux-$_kernver/arch" || return 1
  416.  
  417. if [[ $CARCH = "x86_64" ]]; then
  418. ln -s $_karch x86_64 || return 1
  419. else
  420. ln -s $_karch i386 || return 1
  421. fi
  422.  
  423. cd "$OLDPWD" || return 1
  424.  
  425.  
  426. ################################
  427. # Remove unneeded architecures
  428. ################################
  429. msg "Removing unneeded architectures..."
  430. for i in "$pkgdir/usr/src/linux-$_kernver/arch/"*; do
  431. [[ ${i##*/} != $_karch ]] && rm -rf "$i"
  432. done
  433.  
  434.  
  435. ############################
  436. # Remove .gitignore files
  437. ############################
  438. msg "Removing .gitignore files from kernel source..."
  439. find "$pkgdir/usr/src/linux-$_kernver/" -name ".gitignore" -delete
  440.  
  441.  
  442. ##################################
  443. # Create some important symlinks
  444. ##################################
  445. msg "Creating important symlinks..."
  446.  
  447. # the build symlink needs to be relative
  448. cd "$pkgdir/lib/modules/$_kernver" &&
  449. rm -rf source build &&
  450. ln -s "/usr/src/linux-$_kernver" build &&
  451. cd "$OLDPWD" || return 1
  452.  
  453. cd "$pkgdir/usr/src" &&
  454. ln -s "linux-$_kernver" "linux-$_basekernel-git" &&
  455. cd "$OLDPWD" || return 1
  456.  
  457. cd "$pkgdir/lib/modules" &&
  458. ln -s "$_kernver" "$_basekernel-git" &&
  459. cd "$OLDPWD" || return 1
  460.  
  461.  
  462. ###################
  463. # Fix permissions
  464. ###################
  465. msg "Fixing permissions..."
  466. chown -R root:root "$pkgdir/usr/src/linux-$_kernver" &&
  467. find "$pkgdir/usr/src/linux-$_kernver" -type d -exec chmod 755 {} \; || return 1
  468.  
  469.  
  470. ############################
  471. # Install mkinitcpio files
  472. ############################
  473. msg "Installing preset file..."
  474. install -D -m644 "$srcdir/kernel26-git.preset" \
  475. "$pkgdir/etc/mkinitcpio.d/kernel26-git.preset" || return 1
  476.  
  477. msg "Generating kernel26-git.kver..."
  478. echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" \
  479. > "$pkgdir/etc/mkinitcpio.d/kernel26-git.kver" || return 1
  480.  
  481.  
  482. #######################
  483. # Remove the firmware
  484. #######################
  485. rm -rf "$pkgdir/lib/firmware"
  486.  
  487.  
  488. ##########################
  489. # Remove build directory
  490. ##########################
  491. if (( ! CLEANUP )) && [[ $_build_dir != $srcdir ]]; then
  492. msg "Saving $_build_dir/$_gitname-build to $srcdir/$_gitname-build..."
  493. mv "$_build_dir/$_gitname-build" "$srcdir"
  494. fi
  495. rm -rf "$_build_dir/$_gitname-build"
  496. }
  497.  
  498. # vim: set fenc=utf-8 ts=2 sw=2 noet:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement