Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Contributor: 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="y" # 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!
- _use_my_config="y" # use my config file instead of download. myconfig will be used
- _BFQ_enable_="y" # 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 built and the build time to do it.
- #
- # 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
- # Alternative I/O scheduler by Paolo. For more, see: http://algo.ing.unimo.it/people/paolo/disk_sched/
- #
- ###########################################################################################################
- pkgname=linux-ck
- true && pkgname=(linux-ck linux-ck-headers)
- _kernelname=-ck
- _basekernel=3.1
- pkgver=${_basekernel}.1
- pkgrel=1
- arch=('i686' 'x86_64')
- url="https://wiki.archlinux.org/index.php/linux-ck"
- license=('GPL2')
- options=('!strip')
- _ckpatchversion=2
- _ckpatchname="patch-${_basekernel}.0-ck${_ckpatchversion}"
- _bfqpath="http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.1.0-v3r1"
- source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.1.tar.bz2"
- "http://www.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.xz"
- "http://ck.kolivas.org/patches/3.0/3.1/${_basekernel}.0-ck${_ckpatchversion}/${_ckpatchname}.bz2"
- 'change-default-console-loglevel.patch'
- 'i915-fix-ghost-tv-output.patch'
- 'i915-fix-incorrect-error-message.patch'
- 'usb-add-reset-resume-quirk-for-several-webcams.patch'
- 'config' 'config.x86_64'
- 'linux-ck.install' 'linux-ck.preset'
- "${_bfqpath}/0001-block-prepare-I-O-context-code-for-BFQ-v3r1-for-3.1.patch"
- "${_bfqpath}/0002-block-cgroups-kconfig-build-bits-for-BFQ-v3r1-3.1.patch"
- "${_bfqpath}/0003-block-introduce-the-BFQ-v3r1-I-O-sched-for-3.1.patch"
- 'logo_linux_mono.pbm' # optional Arch logo for boot
- logo_linux_{clut224,vga16}.ppm) # optional Arch logo for boot
- build() {
- cd "${srcdir}/linux-${_basekernel}"
- # add upstream patch
- 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
- # Some chips detect a ghost TV output
- # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
- # Arch Linux bug report: FS#19234
- #
- # It is unclear why this patch wasn't merged upstream, it was accepted,
- # then dropped because the reasoning was unclear. However, it is clearly
- # needed.
- patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
- # In 3.1.1, a DRM_DEBUG message is falsely declared as DRM_ERROR. This
- # worries users, as this message is displayed even at loglevel 4. Fix
- # this.
- patch -Np1 -i "${srcdir}/i915-fix-incorrect-error-message.patch"
- # Add the USB_QUIRK_RESET_RESUME for several webcams
- # FS#26528
- patch -Np1 -i "${srcdir}/usb-add-reset-resume-quirk-for-several-webcams.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 ck2 patch set using bfs v0.415"
- patch -Np1 -i "${srcdir}/${_ckpatchname}"
- ### Patch with BFQ IO Scheduler
- 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 [ ${_use_my_config} = "y" ] ; then
- zcat "${srcdir}/../myconfig" > ./.config
- make oldconfig
- else
- if [ "${CARCH}" = "x86_64" ]; then
- zcat "${srcdir}/config.x86_64" > ./.config
- else
- zcat "${srcdir}/config" > ./.config
- fi
- 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
- ### BFQ to be compiled in but not enabled
- 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=y\n# CONFIG_DEFAULT_BFQ is not set/' ./.config
- ### Optionally enable BFQ as the default io scheduler
- [[ $_BFQ_enable_ = "y" ]] && sed -i -e '/CONFIG_DEFAULT_IOSCHED/ s,cfq,bfq,' \
- -i -e s'/CONFIG_DEFAULT_CFQ=y/# CONFIG_DEFAULT_CFQ is not set\nCONFIG_DEFAULT_BFQ=y/' ./.config
- # set extraversion to pkgrel
- sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" 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} bzImage modules
- }
- package_linux-ck() {
- _Kpkgdesc='Linux Kernel and modules with Brain Fuck Scheduler v0.415 and all the goodies in the ck2 patch set.'
- pkgdesc="${_Kpkgdesc}"
- 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=('kernel26-ck')
- replaces=('kernel26-ck')
- backup=("etc/mkinitcpio.d/linux-ck.preset")
- install=linux-ck.install
- #groups=('ck-generic')
- 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=-ck/g" \
- -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
- -i "${startdir}/linux-ck.install"
- sed \
- -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-linux-ck\"|g" \
- -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}
- # remove the firmware
- rm -rf "${pkgdir}/lib/firmware"
- # gzip -9 all modules to save 100MB of space
- find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
- # make room for external modules
- ln -s "../extramodules-${_basekernel}${_kernelname:ck}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
- # add real version for building modules and running depmod from post_install/upgrade
- mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:ck}"
- echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:ck}/version"
- }
- package_linux-ck-headers() {
- _Hpkgdesc='Header files and scripts to build modules for linux-ck.'
- pkgdesc="${_Hpkgdesc}"
- provides=("${pkgname}=${pkgver}")
- conflicts=('kernel26-ck-headers')
- replaces=('kernel26-ck-headers')
- #groups=('ck-generic')
- 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/"
- [[ -e 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='Linux Kernel and modules with Brain Fuck Scheduler v0.415 and all the goodies in the ck2 patch set.'
- sha256sums=('2573d2378c754b0c602b57586e9311e5b38c5d1e6c137f02873833633a4b9359'
- '650b55304f9917b65763fe935427835c610d3c63548f992bddd6a89f4bfa5b73'
- '46c8a5cbca3471522903250f1fa431c5378e24ce0f7cd221c624145bbc967d08'
- 'b9d79ca33b0b51ff4f6976b7cd6dbb0b624ebf4fbf440222217f8ffc50445de4'
- '9ccadbe3eb30bb283af3eb869c3a4bdb764628854811cc616a2e02e9ef398705'
- '6f2af62930ba30e219e50418931cd87966990b4b446d406d9a8ebc56190a9277'
- 'ffc2f8a4899e225d26600cbb4636fd6002ddd9c00c6cfa5e309a89a33baff49d'
- 'd157b07673afad73a422f77b7bb2c1fef17103bda42224820c67a85be77d161b'
- '04a19ee64b116eaeb17c124b4ebafb5ecacd02bd400f374c2a6abe642778ff0a'
- # my linux-ck.install
- # '1fd85f1ea7b363e442699bf5ac065c2f1a6ad23fe8ad358ac66ce5d2ee74c9bc'
- '08bc42191e3dd92875d448b13c68e9fd7de49e4d8a44e43b57f67322d249f501'
- # my linux-ck.preset
- # 'c2cf8cc2600502de348f3dc3aae9a3bde5486759db15cb8a93df7aa35bd6e7da'
- 'aaa32c5d1206dde61e14e16a1f0bd5902de9180d949a8f3b4681c8ba628d323c'
- '01855a32d43a8ce451466ee2072b0fddf98718daad4bd6f1fdd1c9c8ea6ead8a'
- '0bfb39b76f4c86e5575fac037c84c4da65039e3e972fa8422e3c6b720e0566d2'
- 'e3a88737ee9adfd32a3b7355be2e1f0767ebb42136f247ee6acd430775917262'
- '1e5bea8de1c2cc24498fb9a4fdbb313f36f38f671f2bfc46ccf7acbd7958a4b9'
- '111feb3ac4a8a80b6aae616c5dff8cd62e2b9c8719b390dfa72b45101592fadc'
- '5147681ae1ef8ca99d458f3a074058267876647b7287b702f5bcf07e795d7e43')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement