1 # Maintainer: Figo.zhang <figo1802@gmail.com>
5 _kernelname=${pkgname#linux}
8 pkgver=${_basekernel}.3_$_rtpatch
9 _pkgver=${_basekernel}.3
11 arch=('i686' 'x86_64')
12 url="http://rt.wiki.kernel.org/"
14 pkgdesc="The Linux Kernel and modules (with realtime preemption)"
16 backup=(etc/mkinitcpio.d/${pkgname}.preset)
17 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
18 optdepends=('crda: to set the correct wireless channels of your country')
19 provides=('kernel26rt')
20 conflicts=('kernel26rt')
21 replaces=('kernel26rt')
22 install=${pkgname}.install
23 source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-${_basekernel}.tar.bz2"
24 "ftp://ftp.kernel.org/pub/linux/kernel/v3.0/patch-${_pkgver}.bz2"
25 "ftp://ftp.kernel.org/pub/linux/kernel/projects/rt/patch-${_pkgver}-${_rtpatch}.patch.bz2"
26 # the main kernel config files
27 'config' 'config.x86_64'
28 # standard config files for mkinitcpio ramdisk
31 'change-default-console-loglevel.patch')
33 # vim:set ts=2 sw=2 et:
34 md5sums=('398e95866794def22b12dfbc15ce89c0'
35 '1757786b9a9ffbd48ad9642199ff5bd7'
36 '2236fc6bae8e41979094a41e66fa9eb5'
37 'a17454195361a0b3b21ad9aebe51e299'
38 'fc4e963c403e897f65e8e18a6a7783c5'
39 'eb14dcfd80c00852ef81ded6e826826a'
40 '263725f20c0b9eb9c353040792d644e5'
41 '9d3c56a4b999c8bfbd4018089a62f662')
44 cd "${srcdir}/linux-${_basekernel}"
46 patch -p1 -i "${srcdir}/patch-${_pkgver}"
49 patch -p1 -i "${srcdir}/patch-${_pkgver}-$_rtpatch.patch"
51 # enable building proprietary nvidia driver against full rt preemption
52 # WARNING: GPL INCOMPATIBLE
54 # 's/EXPORT_SYMBOL_GPL(migrate_enable);/EXPORT_SYMBOL(migrate_enable);/' \
57 # add latest fixes from stable queue, if needed
58 # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
60 # fix #19234 i1915 display size
61 patch -Np1 -i "${srcdir}/fix-i915.patch"
63 # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
64 # remove this when a Kconfig knob is made available by upstream
65 # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
66 patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
68 if [ "${CARCH}" = "x86_64" ]; then
69 cat "${srcdir}/config.x86_64" > ./.config
71 cat "${srcdir}/config" > ./.config
81 make ${MAKEFLAGS} bzImage modules
85 pkgdesc="The Linux Kernel and modules"
87 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
88 optdepends=('crda: to set the correct wireless channels of your country')
90 conflicts=('kernel26')
92 backup=("etc/mkinitcpio.d/${pkgname}.preset")
93 install=${pkgname}.install
95 cd "${srcdir}/linux-${_basekernel}"
100 _kernver="$(make kernelrelease)"
102 mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
103 make INSTALL_MOD_PATH="${pkgdir}" modules_install
104 cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
107 install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
109 # install fallback mkinitcpio.conf file and preset file for kernel
110 install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
112 # set correct depmod command for install
114 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
115 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
116 -i "${startdir}/${pkgname}.install"
118 -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
119 -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
120 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
121 -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
123 # remove build and source links
124 rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
125 # remove the firmware
126 rm -rf "${pkgdir}/lib/firmware"
127 # gzip -9 all modules to safe 100MB of space
128 find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
131 package_linux-headers() {
132 pkgdesc="Header files and scripts for building modules for linux kernel"
133 provides=('kernel26-headers')
134 conflicts=('kernel26-headers')
135 replaces=('kernel26-headers')
137 mkdir -p "${pkgdir}/lib/modules/${_kernver}"
139 cd "${pkgdir}/lib/modules/${_kernver}"
140 ln -sf ../../../usr/src/linux-${_kernver} build
142 cd "${srcdir}/linux-${_basekernel}"
143 install -D -m644 Makefile \
144 "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
145 install -D -m644 kernel/Makefile \
146 "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
147 install -D -m644 .config \
148 "${pkgdir}/usr/src/linux-${_kernver}/.config"
150 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
152 for i in acpi asm-generic config crypto drm generated linux math-emu \
153 media net pcmcia scsi sound trace video xen; do
154 cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
157 # copy arch includes for external modules
158 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
159 cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
161 # copy files necessary for later builds, like nvidia and vmware
162 cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
163 cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
165 # fix permissions on scripts dir
166 chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
167 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
169 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
171 cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
173 if [ "${CARCH}" = "i686" ]; then
174 cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
177 cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
179 # add headers for lirc package
180 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
182 cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
184 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
185 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
186 cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
189 # add docbook makefile
190 install -D -m644 Documentation/DocBook/Makefile \
191 "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
194 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
195 cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
198 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
199 cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
201 # add wireless headers
202 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
203 cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
205 # add dvb headers for external modules
207 # http://bugs.archlinux.org/task/9912
208 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
209 cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
211 # http://bugs.archlinux.org/task/11194
212 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
213 cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
215 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
217 # http://bugs.archlinux.org/task/13146
218 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
219 cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
220 cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
224 # http://bugs.archlinux.org/task/20402
225 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
226 cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
227 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
228 cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
229 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
230 cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
232 # add xfs and shmem for aufs building
233 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
234 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
235 cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
237 # copy in Kconfig files
238 for i in `find . -name "Kconfig*"`; do
239 mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
240 cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
243 chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
244 find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
246 # strip scripts directory
247 find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
248 case "$(file -bi "${binary}")" in
249 *application/x-sharedlib*) # Libraries (.so)
250 /usr/bin/strip ${STRIP_SHARED} "${binary}";;
251 *application/x-archive*) # Libraries (.a)
252 /usr/bin/strip ${STRIP_STATIC} "${binary}";;
253 *application/x-executable*) # Binaries
254 /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
258 # remove unneeded architectures
259 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}
262 package_linux-docs() {
263 pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
264 provides=('kernel26-docs')
265 conflicts=('kernel26-docs')
266 replaces=('kernel26-docs')
268 cd "${srcdir}/linux-${_basekernel}"
270 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}"
271 mv Documentation "${pkgdir}/usr/src/linux-${_kernver}"
272 find "${pkgdir}" -type f -exec chmod 444 {} \;
273 find "${pkgdir}" -type d -exec chmod 755 {} \;
275 # remove a file already in linux package
276 rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"