1 # $Id: PKGBUILD 130991 2011-07-09 12:23:51Z thomas $
2 # Maintainer: Gadget3000 <gadget3000 at msn dot com>
3 # Maintainer: Tobias Powalowski <tpowa@archlinux.org>
4 # Maintainer: Thomas Baechler <thomas@archlinux.org>
8 true && pkgname=('linux-sony' 'linux-sony-headers' 'linux-sony-docs')
9 #pkgname=linux-custom # Build kernel with a different name
10 _kernelname=${pkgname#linux}
12 pkgver=${_basekernel}.9
14 arch=('i686' 'x86_64')
15 url="http://code.google.com/p/vaio-f11-linux/wiki/KernelSupport"
17 makedepends=('xmlto' 'docbook-xsl')
19 source=("http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.1.tar.xz"
20 "http://www.kernel.org/pub/linux/kernel/v3.x/patch-${pkgver}.xz"
21 # the main kernel config files
22 'config' 'config.x86_64'
23 # standard config files for mkinitcpio ramdisk
25 'change-default-console-loglevel.patch'
26 'i915-fix-ghost-tv-output.patch'
27 'i915-fix-incorrect-error-message.patch'
28 'i915-gpu-finish.patch'
29 'vaio-full-3.0.4.patch')
30 md5sums=('edbdc798f23ae0f8045c82f6fa22c536'
31 '61494c09959f4185f703bfd68c7fb970'
32 'dcef1356a5dae93f4bad2b02e72dce39'
33 '807fa58ded90ab7354664866aa517240'
34 'a96b5ae5ad2d57be4109d762a21d5fa2'
35 '9d3c56a4b999c8bfbd4018089a62f662'
36 '263725f20c0b9eb9c353040792d644e5'
37 'a50c9076012cb2dda49952dc6ec3e9c1'
38 '4cd79aa147825837dc8bc9f6b736c0a0'
39 '600ceb09163a7704c418c8a6101dbd4c')
42 cd "${srcdir}/linux-${_basekernel}"
45 patch -p1 -i "${srcdir}/patch-${pkgver}"
47 # add latest fixes from stable queue, if needed
48 # http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
51 # drm/i915: Only clear the GPU domains upon a successful finish
52 patch -Np1 -i "${srcdir}/i915-gpu-finish.patch"
54 # Some chips detect a ghost TV output
55 # mailing list discussion: http://lists.freedesktop.org/archives/intel-gfx/2011-April/010371.html
56 # Arch Linux bug report: FS#19234
58 # It is unclear why this patch wasn't merged upstream, it was accepted,
59 # then dropped because the reasoning was unclear. However, it is clearly
61 patch -Np1 -i "${srcdir}/i915-fix-ghost-tv-output.patch"
63 # In 3.1.1, a DRM_DEBUG message is falsely declared as DRM_ERROR. This
64 # worries users, as this message is displayed even at loglevel 4. Fix
66 patch -Np1 -i "${srcdir}/i915-fix-incorrect-error-message.patch"
68 # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
69 # remove this when a Kconfig knob is made available by upstream
70 # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
71 patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
73 patch -Np1 -i "${srcdir}/vaio-full-3.0.4.patch"
75 if [ "${CARCH}" = "x86_64" ]; then
76 cat "${srcdir}/config.x86_64" > ./.config
78 cat "${srcdir}/config" > ./.config
81 if [ "${_kernelname}" != "" ]; then
82 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
85 # set extraversion to pkgrel
86 sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
92 # Configure the kernel. Replace the line below with one of your choice.
93 #make menuconfig # CLI menu for configuration
94 #make nconfig # new CLI menu for configuration
95 #make xconfig # X-based configuration
96 #make oldconfig # using old config from previous kernel version
97 # ... or manually edit .config
101 # this is useful to configure the kernel
102 #msg "Stopping build"
109 make ${MAKEFLAGS} bzImage modules
112 package_linux-sony() {
113 pkgdesc="The Linux Kernel and modules patched for full Sony hardware support"
115 depends=('coreutils' 'linux-firmware' 'module-init-tools>=3.16' 'mkinitcpio>=0.7')
116 optdepends=('crda: to set the correct wireless channels of your country')
117 provides=('kernel26-sony')
118 conflicts=('kernel26-sony')
119 replaces=('kernel26-sony')
120 backup=("etc/mkinitcpio.d/${pkgname}.preset")
121 install=${pkgname}.install
123 cd "${srcdir}/linux-${_basekernel}"
128 _kernver="$(make kernelrelease)"
130 mkdir -p "${pkgdir}"/{lib/modules,lib/firmware,boot}
131 make INSTALL_MOD_PATH="${pkgdir}" modules_install
132 cp arch/$KARCH/boot/bzImage "${pkgdir}/boot/vmlinuz-${pkgname}"
135 install -D -m644 vmlinux "${pkgdir}/usr/src/linux-${_kernver}/vmlinux"
137 # install fallback mkinitcpio.conf file and preset file for kernel
138 install -D -m644 "${srcdir}/${pkgname}.preset" "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
140 # set correct depmod command for install
142 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
143 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
144 -i "${startdir}/${pkgname}.install"
146 -e "s|ALL_kver=.*|ALL_kver=\"/boot/vmlinuz-${pkgname}\"|g" \
147 -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
148 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
149 -i "${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset"
151 # remove build and source links
152 rm -f "${pkgdir}"/lib/modules/${_kernver}/{source,build}
153 # remove the firmware
154 rm -rf "${pkgdir}/lib/firmware"
155 # gzip -9 all modules to save 100MB of space
156 find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
157 # make room for external modules
158 ln -s "../extramodules-${_basekernel}${_kernelname:--ARCH}" "${pkgdir}/lib/modules/${_kernver}/extramodules"
159 # add real version for building modules and running depmod from post_install/upgrade
160 mkdir -p "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}"
161 echo "${_kernver}" > "${pkgdir}/lib/modules/extramodules-${_basekernel}${_kernelname:--ARCH}/version"
164 package_linux-sony-headers() {
165 true && pkgdesc="Header files and scripts for building modules for linux kernel"
166 provides=('kernel26-sony-headers')
167 conflicts=('kernel26-sony-headers')
168 replaces=('kernel26-sony-headers')
170 mkdir -p "${pkgdir}/lib/modules/${_kernver}"
172 cd "${pkgdir}/lib/modules/${_kernver}"
173 ln -sf ../../../usr/src/linux-${_kernver} build
175 cd "${srcdir}/linux-${_basekernel}"
176 install -D -m644 Makefile \
177 "${pkgdir}/usr/src/linux-${_kernver}/Makefile"
178 install -D -m644 kernel/Makefile \
179 "${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile"
180 install -D -m644 .config \
181 "${pkgdir}/usr/src/linux-${_kernver}/.config"
183 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include"
185 for i in acpi asm-generic config crypto drm generated linux math-emu \
186 media net pcmcia scsi sound trace video xen; do
187 cp -a include/${i} "${pkgdir}/usr/src/linux-${_kernver}/include/"
190 # copy arch includes for external modules
191 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/x86"
192 cp -a arch/x86/include "${pkgdir}/usr/src/linux-${_kernver}/arch/x86/"
194 # copy files necessary for later builds, like nvidia and vmware
195 cp Module.symvers "${pkgdir}/usr/src/linux-${_kernver}"
196 cp -a scripts "${pkgdir}/usr/src/linux-${_kernver}"
198 # fix permissions on scripts dir
199 chmod og-w -R "${pkgdir}/usr/src/linux-${_kernver}/scripts"
200 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions"
202 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel"
204 cp arch/${KARCH}/Makefile "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
206 if [ "${CARCH}" = "i686" ]; then
207 cp arch/${KARCH}/Makefile_32.cpu "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/"
210 cp arch/${KARCH}/kernel/asm-offsets.s "${pkgdir}/usr/src/linux-${_kernver}/arch/${KARCH}/kernel/"
212 # add headers for lirc package
213 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video"
215 cp drivers/media/video/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/"
217 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
218 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
219 cp -a drivers/media/video/${i}/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/${i}"
222 # add docbook makefile
223 install -D -m644 Documentation/DocBook/Makefile \
224 "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"
227 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
228 cp drivers/md/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/md"
231 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/linux"
232 cp include/linux/inotify.h "${pkgdir}/usr/src/linux-${_kernver}/include/linux/"
234 # add wireless headers
235 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
236 cp net/mac80211/*.h "${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/"
238 # add dvb headers for external modules
240 # http://bugs.archlinux.org/task/9912
241 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core"
242 cp drivers/media/dvb/dvb-core/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/"
244 # http://bugs.archlinux.org/task/11194
245 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
246 cp include/config/dvb/*.h "${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/"
248 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
250 # http://bugs.archlinux.org/task/13146
251 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
252 cp drivers/media/dvb/frontends/lgdt330x.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
253 cp drivers/media/video/msp3400-driver.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
257 # http://bugs.archlinux.org/task/20402
258 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb"
259 cp drivers/media/dvb/dvb-usb/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/"
260 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends"
261 cp drivers/media/dvb/frontends/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/"
262 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners"
263 cp drivers/media/common/tuners/*.h "${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/"
265 # add xfs and shmem for aufs building
266 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs"
267 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}/mm"
268 cp fs/xfs/xfs_sb.h "${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h"
270 # copy in Kconfig files
271 for i in `find . -name "Kconfig*"`; do
272 mkdir -p "${pkgdir}"/usr/src/linux-${_kernver}/`echo ${i} | sed 's|/Kconfig.*||'`
273 cp ${i} "${pkgdir}/usr/src/linux-${_kernver}/${i}"
276 chown -R root.root "${pkgdir}/usr/src/linux-${_kernver}"
277 find "${pkgdir}/usr/src/linux-${_kernver}" -type d -exec chmod 755 {} \;
279 # strip scripts directory
280 find "${pkgdir}/usr/src/linux-${_kernver}/scripts" -type f -perm -u+w 2>/dev/null | while read binary ; do
281 case "$(file -bi "${binary}")" in
282 *application/x-sharedlib*) # Libraries (.so)
283 /usr/bin/strip ${STRIP_SHARED} "${binary}";;
284 *application/x-archive*) # Libraries (.a)
285 /usr/bin/strip ${STRIP_STATIC} "${binary}";;
286 *application/x-executable*) # Binaries
287 /usr/bin/strip ${STRIP_BINARIES} "${binary}";;
291 # remove unneeded architectures
292 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}
295 package_linux-sony-docs() {
296 true && pkgdesc="Kernel hackers manual - HTML documentation that comes with the Linux kernel."
297 provides=('kernel26-sony-docs')
298 conflicts=('kernel26-sony-docs')
299 replaces=('kernel26-sony-docs')
301 cd "${srcdir}/linux-${_basekernel}"
303 mkdir -p "${pkgdir}/usr/src/linux-${_kernver}"
304 cp -al Documentation "${pkgdir}/usr/src/linux-${_kernver}"
305 find "${pkgdir}" -type f -exec chmod 444 {} \;
306 find "${pkgdir}" -type d -exec chmod 755 {} \;
308 # remove a file already in linux package
309 rm -f "${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile"