1 # Maintainer: Dieghen89 <dieghen89@gmail.com>
8 true && pkgname=('kernel-netbook' 'kernel-netbook-headers')
9 makedepends=('dmidecode' 'xmlto' 'docbook-xsl' 'linux-firmware')
10 optdepends=('hibernate-script: tux on ice default script' 'tuxonice-userui: graphical interface for toi [AUR]')
12 pkgver=${_basekernel}.6
14 pkgdesc="Static kernel for netbooks with Intel Atom N270/N280/N450/N550 such as eeepc with the add-on of external firmware (broadcom-wl) and patchset (BFS + TOI + BFQ optional) - Only Intel GPU - Give more power to your netbook!"
18 url=('http://code.google.com/p/kernel-netbook')
20 ####################################
21 md5sums=('8d43453f8159b2332ad410b19d86a931'
22 'b815dda0a05f7774a0ed0b705b8cfd4c'
23 '62d04d148b99f993ef575a71332593a9'
24 'a4c69095403ff44d5dfd8a935c3aca5a'
25 'e470805b4ef9d469a85b6e2f811ac337'
26 '61ca56c06bf197c0548ecd9fe01b2515'
27 '93e1b461374ae8b5147bba9887964cbe'
28 'afbd01926c57fc5b82ee6034dc9311e5'
29 'e8c333eaeac43f5c6a1d7b2f47af12e2'
30 '5974286ba3e9716bfbad83d3f4ee985a'
31 'a6f0377c814da594cffcacbc0785ec1a'
32 '3f79843b6b1a3f7e8041eb8ed86e4ff5'
33 '2bb172117ede96c14289f9f9bc34f58f'
34 'aee89fe7f034aea2f2ca95322774c1b5'
35 '9d3c56a4b999c8bfbd4018089a62f662'
36 '263725f20c0b9eb9c353040792d644e5'
37 'a50c9076012cb2dda49952dc6ec3e9c1'
38 '52d41fa61e80277ace2b994412a0c856'
39 'a9c018cb0b9caa90f03ee90b71a2c457'
40 '6587a43af34dbceee5f28c98ce5e069b')
41 ###################################
42 # external drivers and firmware #
43 ###################################
46 broadcom_ver=5.100.82.112
47 broadcom="hybrid-portsrc_x86_32-v${broadcom_ver//./_}"
48 #BFS: - http://users.on.net/~ckolivas/kernel/ -
50 _ckpatchname="patch-${_basekernel}.0-ck${_ckpatchversion}"
51 #BFQ: - http://algo.ing.unimo.it/people/paolo/disk_sched/ -
53 _bfqpath="http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.1.0-v3r1"
55 _toipatch="current-tuxonice-for-3.0.patch.bz2"
58 source=( #kernel sources and arch patchset
59 "http://www.kernel.org/pub/linux/kernel/v3.x/linux-${_basekernel}.tar.bz2"
60 "http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.bz2"
61 #"ftp://ftp.archlinux.org/other/linux/patch-${pkgver}.gz"
63 "http://www.broadcom.com/docs/linux_sta/${broadcom}.tar.gz"
64 #"http://switch.dl.sourceforge.net/sourceforge/syntekdriver/stk11xx-$stk11xx_ver.tar.gz"
66 "http://ck.kolivas.org/patches/3.0/3.1/${_basekernel}.0-ck${_ckpatchversion}/${_ckpatchname}.bz2"
68 "${_bfqpath}/0001-block-prepare-I-O-context-code-for-BFQ-v3r1-for-3.1.patch"
69 "${_bfqpath}/0002-block-cgroups-kconfig-build-bits-for-BFQ-v3r1-3.1.patch"
70 "${_bfqpath}/0003-block-introduce-the-BFQ-v3r1-I-O-sched-for-3.1.patch"
72 "http://tuxonice.net/files/${_toipatch}"
75 "logo_linux_clut224.ppm"
76 "logo_linux_vga16.ppm"
81 "change-default-console-loglevel.patch"
82 "i915-fix-ghost-tv-output.patch"
83 "i915-fix-incorrect-error-message.patch"
84 "usb-add-reset-resume-quirk-for-several-webcams.patch"
85 "kernel-netbook.preset"
89 cd ${srcdir}/linux-$_basekernel
94 patch -p1 -i "${srcdir}/patch-${pkgver}"
96 # Some chips detect a ghost TV output
97 # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
98 # Arch Linux bug report: FS#19234
100 # It is unclear why this patch wasn't merged upstream, it was accepted,
101 # then dropped because the reasoning was unclear. However, it is clearly
103 patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
105 # In 3.1.0, a DRM_DEBUG message is falsely declared as DRM_ERROR. This
106 # worries users, as this message is displayed even at loglevel 4. Fix
108 patch -Np1 -i "${srcdir}/i915-fix-incorrect-error-message.patch"
110 # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
111 # remove this when a Kconfig knob is made available by upstream
112 # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
113 patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
115 # replace tux logo with arch one
116 install -m644 ${srcdir}/logo_linux_clut224.ppm drivers/video/logo/
117 install -m644 ${srcdir}/logo_linux_mono.pbm drivers/video/logo/
118 install -m644 ${srcdir}/logo_linux_vga16.ppm drivers/video/logo/
121 msg "Patching source with BFS patch:"
123 sed -i -e "s/-ck${_ckpatchversion}//g" ${srcdir}/${_ckpatchname}
125 patch -Np1 -i ${srcdir}/${_ckpatchname}
128 if [ $TUX_ON_ICE = "y" ] ; then
129 msg "Patching source with TuxOnIce patch"
130 bzip2 -dck ${srcdir}/${_toipatch} \
131 | sed 's/printk(KERN_INFO "PM: Creating hibernation image:\\n/printk(KERN_INFO "PM: Creating hibernation image: \\n/' \
132 | patch -Np1 -F4 || { echo "Failed TOI"; return 1 ; }
136 if [ $BFQ_IO_SCHEDULER = "y" ] ; then
137 msg "Patching source with BFQ patches"
138 for i in $(ls ${srcdir}/000*.patch); do
144 ### Clean tree and copy ARCH config over
145 msg "Running make mrproper to clean source tree"
149 cp ../config ./.config
155 # use menuconfig, if you want to change the configuration
161 msg "Now starts something magic:"
162 make ${MAKEFLAGS} bzImage modules
165 package_kernel-netbook() {
166 pkgdesc='Static kernel for netbooks with Intel Atom N270/N280/N450/N550 such as eeepc with the add-on of external firmware (broadcom-wl) - Only Intel GPU - Give more power to your netbook!'
167 depends=('coreutils' 'module-init-tools')
168 install=kernel-netbook.install
169 optdepends=('crda: for wireless regulatory domain support'
170 'linux-firmware: firmware for rt2860, tigon3, brcmsmac'
171 'hibernate-script: tux on ice default script'
172 'tuxonice-userui: graphical interface for toi [AUR]')
175 cd ${srcdir}/linux-$_basekernel
176 # install our modules
177 mkdir -p $pkgdir/{lib/modules,boot}
178 make INSTALL_MOD_PATH=$pkgdir modules_install
181 _kernver="$(make kernelrelease)"
183 # remove build and source links
184 rm -r $pkgdir/lib/modules/$_kernver/{source,build}
186 # remove the firmware directory
187 rm -rf ${pkgdir}/lib/firmware
190 install -D -m644 ${srcdir}/linux-$_basekernel/System.map $pkgdir/boot/System.map-netbook
191 install -D -m644 ${srcdir}/linux-$_basekernel/arch/x86/boot/bzImage ${pkgdir}/boot/vmlinuz-netbook
192 install -D -m644 ${srcdir}/linux-$_basekernel/.config $pkgdir/boot/kconfig-netbook
194 # install preset file for mkinitcpio
195 #sed -i -e "s/ALL_kver=.*/ALL_kver=\'${_kernver}\'/g" ${srcdir}/${pkgname}.preset
196 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
198 # set correct depmod command for install
199 sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" $startdir/$pkgname.install
201 ##Extramodules dir support
202 _extramodules="extramodules-${_basekernel}${_kernelname:--netbook}"
204 ##Section: Broadcom-wl
205 if [ "${BROADCOM_WL}" == "y" ] ; then
206 msg "Compiling broadcom-wl module:"
208 #patching broadcom as broadcom-wl package on AUR
209 patch -p1 -i linux3.patch
210 patch -p1 -i license.patch
211 patch -p1 -i semaphore.patch
212 make -C ${srcdir}/linux-$_basekernel M=`pwd`
213 install -D -m 755 wl.ko ${pkgdir}/lib/modules/${_extramodules}/wl.ko
216 # gzip -9 all modules to safe a lot of MB of space
217 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
219 # make room for external modules
220 ln -s "../${_extramodules}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
221 # add real version for building modules and running depmod from post_install/upgrade
222 mkdir -p "${pkgdir}/lib/modules/${_extramodules}"
223 echo "${_kernver}" > "${pkgdir}/lib/modules/${_extramodules}/version"
226 package_kernel-netbook-headers() {
228 pkgdesc='Header files and scripts for building modules for kernel-netbook'
230 mkdir -p "${pkgdir}/lib/modules/${_kernver}"
232 cd "${pkgdir}/lib/modules/${_kernver}"
233 ln -sf ../../../usr/src/linux-${_kernver} build
235 cd "${srcdir}/linux-${_basekernel}"
236 install -D -m644 Makefile \
237 "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
238 install -D -m644 kernel/Makefile \
239 "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
240 install -D -m644 .config \
241 "${pkgdir}/usr/src/linux-${_kernver}/.config"
243 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
245 for i in acpi asm-generic config crypto drm generated linux math-emu \
246 media net pcmcia scsi sound trace video xen; do
247 cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
250 # copy arch includes for external modules
251 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
252 cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
254 # copy files necessary for later builds, like nvidia and vmware
255 cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
256 cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
258 # fix permissions on scripts dir
259 chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
260 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
262 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
264 cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
266 if [ "${CARCH}" = "i686" ]; then
267 cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
270 cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
272 # add headers for lirc package
273 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
275 cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
277 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
278 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
279 cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
282 # add docbook makefile
283 install -D -m644 Documentation/DocBook/Makefile \
284 "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
287 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
288 cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
291 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
292 cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
294 # add wireless headers
295 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
296 cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
298 # add dvb headers for external modules
300 # http://bugs.archlinux.org/task/9912
301 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
302 cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
304 # http://bugs.archlinux.org/task/11194
305 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
306 cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
308 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
310 # http://bugs.archlinux.org/task/13146
311 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
312 cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
313 cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
317 # http://bugs.archlinux.org/task/20402
318 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
319 cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
320 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
321 cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
322 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
323 cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
325 # add xfs and shmem for aufs building
326 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
327 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
328 cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
330 # copy in Kconfig files
331 for i in `find . -name "Kconfig*"`; do
332 mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
333 cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
336 chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
337 find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
339 # strip scripts directory
340 find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
341 case "$(file -bi "${binary}")" in
342 *application/x-sharedlib*) # Libraries (.so)
343 /usr/bin/strip ${STRIP_SHARED} "${binary}";;
344 *application/x-archive*) # Libraries (.a)
345 /usr/bin/strip ${STRIP_STATIC} "${binary}";;
346 *application/x-executable*) # Binaries
347 /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
351 # remove unneeded architectures
352 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}