Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Maintainer: graysky <graysky AT archlinux DOT us>
- # Contributor: Tobias Powalowski <tpowa@archlinux.org>
- # Contributor: Thomas Baechler <thomas@archlinux.org>
- ###########################################################################################################
- # Patch and Build Options
- ###########################################################################################################
- #
- ## Note all kernels get the ck patch set with BFS so there is no option to enable/disable it!
- #
- _usearchlogo="y" # use the blue Arch logo rather than default tux logo when booting
- _makenconfig="n" # select additional kernel options prior to a build via nconfig
- _localmodcfg="n" # compile ONLY probed modules - see notes below!
- _localyescfg="n" # convert all modules to core - see notes below!
- _use_current="n" # use the current kernel's .config file - see notes below!
- _BFQ_enable_="n" # enable BFQ as the default I/O scheduler
- ###########################################################################################################
- # More Details and References
- ###########################################################################################################
- ## LOCALMODCONFIG OPTION
- # As of mainline 2.6.32, running with this option will only build the modules that you currently have
- # probed in your system VASTLY reducing the number of modules build.
- #
- # WARNING - make CERTAIN that all modules are modprobed BEFORE you begin making the pkg!
- # Read, https://bbs.archlinux.org/viewtopic.php?pid=830221#p830221
- # To keep track of which modules are needed for your specific system/hardware, give my module_db script
- # a try: http://aur.archlinux.org/packages.php?ID=41689
- #
- # Note that if you use my script, this PKGBUILD will auto run the reload_data base for you to probe
- # all the modules you have logged!
- #
- ## LOCALYESCONFIG OPTION
- # This adds the option localyesconfig to make. This is similar to localmodconfig, but after it removes
- # unnecessary modules it runs "sed -i s/=m/=y/" on the .config file. It then runs "make silentoldconfig"
- # to fix any holes that were created by the conversion of modules to core.
- ## USE CURRENT KERNEL'S .CONFIG
- # Enabling this option will use the .config of the RUNNING kernel rather than the ARCH defaults.
- # Useful when the package gets updated and you already went through the trouble of customizing your
- # config options. NOT recommended when a new kernel is released, but again, convenient for package bumps.
- ## BFQ
- # Read, http://algo.ing.unimo.it/people/paolo/disk_sched/
- #
- ###########################################################################################################
- pkgname=(linux-ck-corei7-avx linux-ck-corei7-avx-headers)
- _kernelname=-ck
- _basekernel=3.0
- pkgver=${_basekernel}.3
- pkgrel=4
- arch=('i686' 'x86_64')
- url="https://wiki.archlinux.org/index.php/linux-ck"
- license=('GPL2')
- #makedepends=('xmlto' 'docbook-xsl')
- options=('!strip')
- _ckpatchversion=1
- _ckpatchname="patch-${_basekernel}.0-ck${_ckpatchversion}"
- _bfqpath="http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.0.0"
- source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-${_basekernel}.tar"
- "ftp://ftp.kernel.org/pub/linux/kernel/v3.0/patch-${pkgver}.gz"
- # the main kernel config files
- 'config' 'config.x86_64'
- 'linux-ck.install' 'linux-ck.preset' # standard config files for mkinitcpio ramdisk
- 'fix-i915.patch'
- 'change-default-console-loglevel.patch'
- http://www.kernel.org/pub/linux/kernel/people/ck/patches/${_basekernel}/${_basekernel}.0-ck${_ckpatchversion}/${_ckpatchname}.bz2 # ck_patchset
- #${_bfqpath}/{0001 0002 0003} # bfq patchset
- logo_linux_mono.pbm # optional Arch logo for boot
- logo_linux_{clut224,vga16}.ppm) # optional Arch logo for boot
- build() {
- cd "${srcdir}/linux-${_basekernel}"
- patch -p1 -i "${srcdir}/patch-${pkgver}"
- # add latest fixes from stable queue, if needed
- # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
- # fix #19234 i1915 display size
- patch -Np1 -i "${srcdir}/fix-i915.patch"
- # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
- # remove this when a Kconfig knob is made available by upstream
- # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
- patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
- ### Patch source with ck patchset with BFS
- # Fix double name in EXTRAVERSION
- sed -i -re "s/^(.EXTRAVERSION).*$/\1 = /" ${srcdir}/${_ckpatchname}
- msg "Patching source with the ck1 patch set using bfs v0.406"
- patch -Np1 -i ${srcdir}/${_ckpatchname}
- ### Optionally enable BFQ IO Scheduler as default
- # msg "Patching source with BFQ patches"
- # for p in $(ls ${srcdir}/000*.patch); do
- # patch -Np1 -i $p
- # done
- ### Clean tree and copy ARCH config over
- msg "Running make mrproper to clean source tree"
- make mrproper
- if [ "$CARCH" = "x86_64" ]; then
- cat ../config.x86_64 >./.config
- else
- cat ../config >./.config
- fi
- ### Optionally use the blue Arch logo at kernel load
- if [ $_usearchlogo = "y" ]; then
- install -m644 ${srcdir}/logo_linux_clut224.ppm drivers/video/logo/
- install -m644 ${srcdir}/logo_linux_mono.pbm drivers/video/logo/
- install -m644 ${srcdir}/logo_linux_vga16.ppm drivers/video/logo/
- 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
- fi
- ### Optionally use running kernel's config
- # code originally by nous; http://aur.archlinux.org/packages.php?ID=40191
- if [ $_use_current = "y" ]; then
- if [[ -s /proc/config.gz ]]; then
- msg "Extracting config from /proc/config.gz..."
- modprobe configs
- zcat /proc/config.gz > ./.config
- else
- warning "You kernel was not compiled with IKCONFIG_PROC!"
- warning "You cannot read the current config!"
- warning "Aborting!"
- exit
- fi
- fi
- if [ "${_kernelname}" != "" ]; then
- sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
- fi
- ### Optionally enable BFQ as the default io scheduler
- if [ $_BFQ_enable_ = "y" ]; then
- sed -i -e s'/CONFIG_CFQ_GROUP_IOSCHED=y/CONFIG_CFQ_GROUP_IOSCHED=y\nCONFIG_IOSCHED_BFQ=y\nCONFIG_CGROUP_BFQIO=y/' \
- -i -e s'/CONFIG_DEFAULT_CFQ=y/# CONFIG_DEFAULT_CFQ is not set\nCONFIG_DEFAULT_BFQ=y/' \
- -i -e '/CONFIG_DEFAULT_IOSCHED/ s,cfq,bfq,' ./.config
- fi
- # remove the sublevel from Makefile
- # this ensures our kernel version is always 3.X-ARCH
- # this way, minor kernel updates will not break external modules
- # we need to change this soon, see FS#16702
- sed -ri 's|^(SUBLEVEL =).*|\1|' Makefile
- # get kernel version
- msg "Running make prepare for you to enable patched options of your choosing"
- make prepare
- ### Optionally load needed modules for the make localmodconfig
- # See http://aur.archlinux.org/packages.php?ID=41689
- if [ $_localmodcfg = "y" ]; then
- msg "If you have modprobe_db installed, running reload_database now"
- if [ -e /usr/bin/reload_database ]; then
- /usr/bin/reload_database
- fi
- msg "Running Steven Rostedt's make localmodconfig now"
- make localmodconfig
- fi
- if [ $_localyescfg = "y" ]; then
- msg "Running make localyesconfig"
- make localyesconfig
- fi
- if [ $_makenconfig = "y" ]; then
- msg "Running make nconfig"
- make nconfig
- fi
- msg "Running make bzImage and modules"
- 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
- }
- package_linux-ck-corei7-avx() {
- _Kpkgdesc='The Linux Kernel and modules with Brain Fuck Scheduler v0.406 and all the goodies in the ck1 patch set.'
- pkgdesc="${_Kpkgdesc} Intel Sandybridge Core i3/i5/i7 optimized."
- depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
- 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')
- provides=("${pkgname}=${pkgver}")
- conflicts=('linux-ck-atom' 'linux-ck-core2' 'linux-ck' 'linux-ck-k8' 'linux-ck-k10' 'linux-ck-corei7-avx')
- replaces=('kernel26-ck-corei7-avx')
- backup=("etc/mkinitcpio.d/linux-ck.preset")
- install=linux-ck.install
- groups=('ck-corei7-avx')
- cd "${srcdir}/linux-${_basekernel}"
- KARCH=x86
- # get kernel version
- _kernver="$(make kernelrelease)"
- mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
- make INSTALL_MOD_PATH="${pkgdir}" modules_install
- cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-linux-ck"
- # add vmlinux
- install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
- # install fallback mkinitcpio.conf file and preset file for kernel
- install -D -m644 "${srcdir}/linux-ck.preset" "${pkgdir}/etc/mkinitcpio.d/linux-ck.preset"
- # set correct depmod command for install
- sed \
- -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
- -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
- -i "${startdir}/linux-ck.install"
- sed \
- -e "s|default_image=.*|default_image=\"/boot/initramfs-linux-ck.img\"|g" \
- -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-linux-ck-fallback.img\"|g" \
- -i "${pkgdir}/etc/mkinitcpio.d/linux-ck.preset"
- # remove build and source links
- rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
- # add compat symlink for the kernel image
- ln -sf vmlinuz-linux-ck "${pkgdir}/boot/vmlinuz26${_kernelname}"
- # remove the firmware
- rm -rf "${pkgdir}/lib/firmware"
- # gzip -9 all modules to save 100MB of space
- find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
- }
- package_linux-ck-corei7-avx-headers() {
- _Hpkgdesc='Header files and scripts to build modules for linux-ck.'
- pkgdesc="${_Hpkgdesc} Intel Sandybridge Core i3/i5/i7 optimized."
- provides=("${pkgname}=${pkgver}")
- 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')
- replaces=('kernel26-ck-corei7-avx-headers')
- groups=('ck-corei7-avx')
- mkdir -p "${pkgdir}/lib/modules/${_kernver}"
- cd "${pkgdir}/lib/modules/${_kernver}"
- ln -sf ../../../usr/src/linux-${_kernver} build
- cd "${srcdir}/linux-${_basekernel}"
- 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"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
- for i in acpi asm-generic config crypto drm generated linux math-emu \
- media net pcmcia scsi sound trace video xen; do
- cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
- done
- # copy arch includes for external modules
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
- cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
- # copy files necessary for later builds, like nvidia and vmware
- cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
- cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
- # fix permissions on scripts dir
- chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
- cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
- if [ "${CARCH}" = "i686" ]; then
- cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
- fi
- cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
- # add headers for lirc package
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
- cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
- for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; 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}"
- done
- # add docbook makefile
- install -D -m644 Documentation/DocBook/Makefile \
- "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
- # add dm headers
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
- cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
- # add inotify.h
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
- cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
- # add wireless headers
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
- cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
- # add dvb headers for external modules
- # in reference to:
- # http://bugs.archlinux.org/task/9912
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
- cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
- # and...
- # http://bugs.archlinux.org/task/11194
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
- cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
- # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
- # in reference to:
- # http://bugs.archlinux.org/task/13146
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
- cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
- cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
- # add dvb headers
- # in reference to:
- # http://bugs.archlinux.org/task/20402
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
- cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
- cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
- cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
- # add xfs and shmem for aufs building
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
- mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
- cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
- # copy in Kconfig files
- for i in `find . -name "Kconfig*"`; do
- mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
- cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
- done
- chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
- find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
- # strip scripts directory
- find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
- case "$(file -bi "${binary}")" in
- *application/x-sharedlib*) # Libraries (.so)
- /usr/bin/strip ${STRIP_SHARED} "${binary}";;
- *application/x-archive*) # Libraries (.a)
- /usr/bin/strip ${STRIP_STATIC} "${binary}";;
- *application/x-executable*) # Binaries
- /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
- esac
- done
- # remove unneeded architectures
- 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}
- }
- # Global pkgdesc and depends are here so that they will be picked up by AUR
- pkgdesc='The Linux Kernel and modules with Brain Fuck Scheduler v0.406 and all the goodies in the ck1 patch set.'
- sha256sums=('64b0228b54ce39b0b2df086109a7b737cde58e3df4f779506ddcaccee90356a0'
- 'ffc606851dba5c1fe9a6590492f16f39798297c6beb28b5baa1b476018f4b244'
- '9ca531cfc309fed1c01a297b7e08db844c01509a8ffbfc83fd91086858dcd95f'
- 'ff686ca6ce4ca152991e34fda7d1408eafeee70d3db392cca129fccb3d817069'
- '2a8bdb10801a1205c90d0f77b227a5e026317156fd0961c14b69aadb9dbb808f'
- 'c2cf8cc2600502de348f3dc3aae9a3bde5486759db15cb8a93df7aa35bd6e7da'
- '9ccadbe3eb30bb283af3eb869c3a4bdb764628854811cc616a2e02e9ef398705'
- 'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
- '34ca007d90df006e70b7de31e6db969c63d3c7f6e141463cff036b89b7d22ee0'
- '1e5bea8de1c2cc24498fb9a4fdbb313f36f38f671f2bfc46ccf7acbd7958a4b9'
- '111feb3ac4a8a80b6aae616c5dff8cd62e2b9c8719b390dfa72b45101592fadc'
- '5147681ae1ef8ca99d458f3a074058267876647b7287b702f5bcf07e795d7e43')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement