Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Contributor: Mathias Burén <[email protected]>
- # Maintainer: xduugu
- pkgname=kernel26-git
- pkgver=20100315
- pkgrel=1
- pkgdesc="The Linux Kernel and modules from Linus' git tree"
- url="http://www.kernel.org/"
- arch=(i686 x86_64)
- license=('GPL2')
- depends=('coreutils' 'kernel26-firmware-git' 'module-init-tools' 'mkinitcpio>=0.5.20')
- makedepends=('git')
- backup=(etc/mkinitcpio.d/$pkgname.preset)
- install=$pkgname.install
- changelog=$pkgname.changelog
- source=($pkgname.preset config.{i686,x86_64} \
- logo_linux_{clut224.ppm,mono.pbm,vga16.ppm}
- patches/0001-drm-radeon-kms-pm-fix-typo-in-power-table-parsing.patch
- patches/0002-drm-radeon-kms-gfx-init-fixes-for-r6xx-r7xx.patch
- patches/0003-i2c-algo-bit-Add-pre-and-post-xfer-hooks.patch
- patches/0004-drm-radeon-kms-use-new-pre-post_xfer-i2c-bit-algo-h.patch
- patches/0005-drm-radeon-kms-add-gui_idle-callback.patch
- patches/0006-drm-radeon-kms-add-support-for-gui-idle-interrupts.patch
- patches/0007-drm-radeon-kms-wait-for-gpu-idle-before-changing-po.patch
- patches/0008-drm-radeon-kms-pm-rework-power-mode-parsing.patch
- patches/0009-drm-radeon-kms-pm-add-asic-specific-callbacks-for-s.patch
- patches/0010-drm-radeon-kms-pm-add-asic-specific-callbacks-for-g.patch
- patches/0011-drm-radeon-kms-r6xx-add-support-for-SIMD-pm.patch)
- md5sums=('7dd364c1dea0c459f3f3c76e86acbea9'
- 'a5549f442953feb52c3a6d03fe62e5a9'
- 'c98b594b5abb99aa908de632c207fca2'
- '6a5a1925501fe20fafd04fdb3cb4f6ed'
- 'e8c333eaeac43f5c6a1d7b2f47af12e2'
- 'c120adbd9c0daa0136237a83adeabd1e'
- 'e13145c5dd95282f5d7bea7750e98134'
- 'e68960be18544b74d8a09dd7c61283ee'
- 'dcb253d371916afb68edd0beedf5435f'
- 'a49c1d482e5a1d3868c3b2c099721080'
- 'a0e8269fc94405623866ea1e4c48ec95'
- '4fdb89fbfa678607aef6678fc0ecc181'
- 'f5942305d19f8e1352f52a6335b01c46'
- 'bc600eb294403046d4d4058eca2b23c2'
- '3ef4234f337d6c3f3f95d9adfd509bcc'
- 'dca519233f0c0e7b64a5e5f0abd8ada7'
- 'e14883c72f6fc444b5570fb3e729fba7')
- _gitroot="git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6.git"
- _gitname="drm-2.6"
- ####################################################################
- # KERNEL CONFIG FILES
- #
- # This PKGBUILD searches for config files in the current directory
- # and will use the first one it finds from the following
- # list as base configuration:
- # config.local
- # config.saved.$CARCH
- # config.$CARCH
- #
- ####################################################################
- #############################################################
- # PATCHES
- #
- # This package builds the vanilla git kernel by default,
- # but it is possible to patch the source without modifying
- # this PKGBUILD.
- #
- # Simply create a directory 'patches' in your PKGBUILD
- # directory and _any_ file (dotfiles excluded) in this
- # folder will be applied to the kernel source.
- #
- # Prefixing the patch file names with dots will obviously
- # excluded them from the patching process.
- #
- #############################################################
- #############################
- # CONFIGURATION
- #
- # Uncomment desired options
- #############################
- #######
- # Set to e.g. menuconfig, xconfig or gconfig
- #
- # For a full list of supported commands, please have a look
- # at "Configuration targets" section of `make help`'s output.
- #
- # If unset or set to an empty string, the (manual) kernel
- # configuration step will be skipped.
- #
- _config_cmd="menuconfig"
- #######
- # The directory where the kernel should be built
- #
- # Can be useful, for example, if you want to compile on a
- # tmpfs mount, which can speed up the compilation process
- #
- _build_dir="$srcdir"
- #######
- # Stop build process after kernel configuration
- #
- # This option enables _save_config implicitly.
- #
- # _configure_only=1
- #######
- # Append the date to the localversion
- #
- # e.g. -ARCH -> -ARCH-20090422
- #
- # _date_localversion=1
- #######
- # Set the pkgver to the kernel version
- # rather than the build date
- #
- # _kernel_pkgver=1
- #######
- # Save the .config file to package directory
- # as config.saved.$CARCH
- #
- # _save_config=1
- #######
- # Make the kernel build process verbose
- #
- # _verbose=1
- ##############################
- # where the magic happens...
- ##############################
- build() {
- #################################
- # Get the latest kernel sources
- #################################
- msg "Fetching sources..."
- cd "$startdir"
- if [[ -d $_gitname ]]; then
- msg2 "Updating sources..."
- cd "$_gitname" && git fetch && cd "$OLDPWD" || return 1
- else
- msg2 "Cloning the project..."
- warning "The initial clone will download approximately 300 mb"
- git clone --mirror "$_gitroot" "$_gitname" && git checkout -b drm-radeon-testing origin/drm-radeon-testing || return 1
- fi
- msg "Creating build branch..."
- rm -rf "$_build_dir/$_gitname-build"
- git clone "$_gitname" "$_build_dir/$_gitname-build" || return 1
- cd "$_build_dir/$_gitname-build" || return 1
- ####################################
- # Add Arch Linux logo to the source
- ####################################
- msg "Adding Arch Linux logo..."
- cp "$srcdir/logo_linux_clut224.ppm" drivers/video/logo/ &&
- cp "$srcdir/logo_linux_mono.pbm" drivers/video/logo/ &&
- cp "$srcdir/logo_linux_vga16.ppm" drivers/video/logo/ || return 1
- #################
- # Apply patches
- #################
- shopt -s nullglob
- if [[ -d $startdir/patches && -n $(echo "$startdir/patches/"*) ]]; then
- msg "Applying patches..."
- local i
- for i in "$startdir/patches/"*; do
- msg2 "Applying ${i##*/}..."
- patch -Np1 -i "$i" || (error "Applying ${i##*/} failed" && return 1)
- done
- fi
- shopt -u nullglob
- #################
- # CONFIGURATION
- #################
- #########################
- # Loading configuration
- #########################
- msg "Loading configuration..."
- for i in local "saved.$CARCH" "$CARCH"; do
- if [[ -e $startdir/config.$i ]]; then
- msg2 "Using kernel config file config.$i..."
- cp -f "$startdir/config.$i" .config || return 1
- break
- fi
- done
- [[ ! -e .config ]] &&
- warning "No suitable kernel config file was found. You'll have to configure the kernel from scratch."
- ###########################
- # Start the configuration
- ###########################
- msg "Updating configuration..."
- yes "" | make config > /dev/null
- # fix lsmod path
- sed -ri "s@s(bin/lsmod)@\1@" scripts/kconfig/streamline_config.pl
- if [[ -n $_config_cmd ]]; then
- msg2 "Running make $_config_cmd..."
- make $_config_cmd || return 1
- else
- warning "Unknown config command: $_config_cmd"
- fi
- ##############################################
- # Save the config file the package directory
- ##############################################
- if [[ -n $_save_config || -n $_configure_only ]]; then
- msg "Saving configuration..."
- msg2 "Saving $_build_dir/$_gitname-build/.config as $startdir/config.saved.$CARCH"
- cp .config "$startdir/config.saved.$CARCH" || return 1
- fi
- #######################################
- # Stop after configuration if desired
- #######################################
- if [[ -n $_configure_only ]]; then
- rm -rf "$_build_dir/$_gitname-build"
- return 1
- fi
- ###############################
- # Append date to localversion
- ###############################
- if [[ -n $_date_localversion ]]; then
- local _localversion="$(sed -rn 's/^CONFIG_LOCALVERSION="([^"]*)"$/\1/p' .config)"
- [[ -n $_localversion ]] && msg2 "CONFIG_LOCALVERSION is set to: $_localversion"
- # since this is a git package, the $pkgver is equal to $(date +%Y%m%d)
- msg2 "Appending $pkgver to CONFIG_LOCALVERSION..."
- sed -i "s/^CONFIG_LOCALVERSION=.*$/CONFIG_LOCALVERSION=\"$_localversion-$pkgver\"/" \
- .config
- fi
- #################
- # BUILD PROCESS
- #################
- ################################
- # Build the kernel and modules
- ################################
- msg "Building kernel and modules..."
- make V="$_verbose" bzImage modules || return 1
- }
- package() {
- local _karch="x86"
- cd "$_build_dir/$_gitname-build" || return 1
- ######################
- # Get kernel version
- ######################
- local _kernver=$(make kernelrelease)
- local _basekernel=${_kernver%%-*}
- ############################################################
- # Use kernel version instead of the current date as pkgver
- ############################################################
- if [[ -n $_kernel_pkgver ]]; then
- msg "Updating pkgver..."
- # work around AUR parser bug
- (( 1 )) && pkgver=${_kernver//-/_}
- # do not silently overwrite existing packages
- if (( ! FORCE )) && [[ -e $PKGDEST/$pkgname-$pkgver-$pkgrel-${CARCH}${PKGEXT} ]]; then
- error "A package has already been built. (use -f to overwrite)"
- return 1
- fi
- fi
- #############################################################
- # Provide kernel26
- # (probably someone wants to use this kernel exclusively?)
- #############################################################
- provides=("${provides[@]}" kernel26{,-headers}"=${_kernver//-/_}")
- ################
- # INSTALLATION
- ################
- #####################
- # Install the image
- #####################
- msg "Installing kernel image..."
- install -D -m644 System.map "$pkgdir/boot/System.map26-git" &&
- install -D -m644 arch/$_karch/boot/bzImage "$pkgdir/boot/vmlinuz26-git" &&
- install -D -m644 .config "$pkgdir/boot/kconfig26-git" || return 1
- ##########################
- # Install kernel modules
- ##########################
- msg "Installing kernel modules..."
- make INSTALL_MOD_PATH="$pkgdir" modules_install
- ##############################
- # Install fake kernel source
- ##############################
- install -D -m644 Module.symvers "$pkgdir/usr/src/linux-$_kernver/Module.symvers" &&
- install -D -m644 Makefile "$pkgdir/usr/src/linux-$_kernver/Makefile" &&
- install -D -m644 kernel/Makefile "$pkgdir/usr/src/linux-$_kernver/kernel/Makefile" &&
- install -D -m644 .config "$pkgdir/usr/src/linux-$_kernver/.config" &&
- install -D -m644 .config "$pkgdir/lib/modules/$_kernver/.config" || return 1
- #######################################################
- # Install scripts directory and fix permissions on it
- #######################################################
- cp -a scripts "$pkgdir/usr/src/linux-$_kernver" &&
- chmod og-w -R "$pkgdir/usr/src/linux-$_kernver" || return 1
- ##########################
- # Install header files
- ##########################
- msg "Installing header files..."
- # kernel headers
- msg2 "kernel"
- for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video; do
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/$i" &&
- cp -a include/$i "$pkgdir/usr/src/linux-$_kernver/include" || return 1
- done
- # required by virtualbox and probably others
- ln -s "../generated/autoconf.h" "$pkgdir/usr/src/linux-$_kernver/include/linux/" || return 1
- # lirc headers
- msg2 "lirc"
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video" &&
- cp drivers/media/video/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/" || return 1
- for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" &&
- cp -a drivers/media/video/$i/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/media/video/$i" || return 1
- done
- # md headers
- msg2 "md"
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/drivers/md" &&
- cp -a drivers/md/*.h "$pkgdir/usr/src/linux-$_kernver/drivers/md" || return 1
- # inotify.h
- msg2 "inotify.h"
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/include/linux" &&
- cp -a include/linux/inotify.h "$pkgdir/usr/src/linux-$_kernver/include/linux/" || return 1
- # CLUSTERIP file for iptables
- msg2 "CLUSTERIP file for iptables"
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" &&
- cp -a net/ipv4/netfilter/ipt_CLUSTERIP.c "$pkgdir/usr/src/linux-$_kernver/net/ipv4/netfilter/" || return 1
- # wireless headers
- msg2 "wireless"
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" &&
- cp net/mac80211/*.h "$pkgdir/usr/src/linux-$_kernver/net/mac80211/" || return 1
- # Kconfig files
- msg2 "Kconfig files"
- for i in $(find . -name "Kconfig*"); do
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/${i%/*}" &&
- cp -a "$i" "$pkgdir/usr/src/linux-$_kernver/$i" || return 1
- done
- ########################################
- # Install architecture dependent files
- ########################################
- msg "Installing architecture files..."
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel" &&
- cp -a arch/$_karch/kernel/asm-offsets.s "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/kernel" || return 1
- cp -a arch/$_karch/Makefile* "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" &&
- cp -a arch/$_karch/configs "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" || return 1
- # copy arch includes for external modules and fix the nVidia issue
- mkdir -p "$pkgdir/usr/src/linux-$_kernver/arch/$_karch" &&
- cp -a "arch/$_karch/include" "$pkgdir/usr/src/linux-$_kernver/arch/$_karch/" || return 1
- # create a necessary symlink to the arch folder
- cd "$pkgdir/usr/src/linux-$_kernver/arch" || return 1
- if [[ $CARCH = "x86_64" ]]; then
- ln -s $_karch x86_64 || return 1
- else
- ln -s $_karch i386 || return 1
- fi
- cd "$OLDPWD" || return 1
- ################################
- # Remove unneeded architecures
- ################################
- msg "Removing unneeded architectures..."
- for i in "$pkgdir/usr/src/linux-$_kernver/arch/"*; do
- [[ ${i##*/} != $_karch ]] && rm -rf "$i"
- done
- ############################
- # Remove .gitignore files
- ############################
- msg "Removing .gitignore files from kernel source..."
- find "$pkgdir/usr/src/linux-$_kernver/" -name ".gitignore" -delete
- ##################################
- # Create some important symlinks
- ##################################
- msg "Creating important symlinks..."
- # the build symlink needs to be relative
- cd "$pkgdir/lib/modules/$_kernver" &&
- rm -rf source build &&
- ln -s "/usr/src/linux-$_kernver" build &&
- cd "$OLDPWD" || return 1
- cd "$pkgdir/usr/src" &&
- ln -s "linux-$_kernver" "linux-$_basekernel-git" &&
- cd "$OLDPWD" || return 1
- cd "$pkgdir/lib/modules" &&
- ln -s "$_kernver" "$_basekernel-git" &&
- cd "$OLDPWD" || return 1
- ###################
- # Fix permissions
- ###################
- msg "Fixing permissions..."
- chown -R root:root "$pkgdir/usr/src/linux-$_kernver" &&
- find "$pkgdir/usr/src/linux-$_kernver" -type d -exec chmod 755 {} \; || return 1
- ############################
- # Install mkinitcpio files
- ############################
- msg "Installing preset file..."
- install -D -m644 "$srcdir/kernel26-git.preset" \
- "$pkgdir/etc/mkinitcpio.d/kernel26-git.preset" || return 1
- msg "Generating kernel26-git.kver..."
- echo -e "# DO NOT EDIT THIS FILE\nALL_kver='$_kernver'" \
- > "$pkgdir/etc/mkinitcpio.d/kernel26-git.kver" || return 1
- #######################
- # Remove the firmware
- #######################
- rm -rf "$pkgdir/lib/firmware"
- ##########################
- # Remove build directory
- ##########################
- if (( ! CLEANUP )) && [[ $_build_dir != $srcdir ]]; then
- msg "Saving $_build_dir/$_gitname-build to $srcdir/$_gitname-build..."
- mv "$_build_dir/$_gitname-build" "$srcdir"
- fi
- rm -rf "$_build_dir/$_gitname-build"
- }
- # vim: set fenc=utf-8 ts=2 sw=2 noet:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement