4 _kernelname=${pkgname#linux}
7 pkgdesc="The Linux Vanilla Kernel and modules"
11 url="http://www.kernel.org"
12 backup=(etc/mkinitcpio.d/${pkgname}.preset)
13 depends=('coreutils' 'linux-firmware' 'module-init-tools' 'mkinitcpio>=0.5.20')
14 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
15 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
16 # kernel24 support is dropped since glibc24
17 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
18 'alsa-driver' 'ieee80211' 'hostap-driver26'
19 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
20 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
21 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
22 install=linux-vanilla.install
23 source=("ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-${pkgver}.tar.bz2"
28 'change-default-console-loglevel.patch')
29 optdepends=('crda: to set the correct wireless channels of your country')
30 md5sums=('69dfba755ab8691a426d8061c94a7ddc'
31 'cbaaa923f00c1935055273ccc1630144'
32 '93687a4b7e1e6bcd4e7417d6e5079bc4'
33 'e1f87d6a39f8d8c110accfe234f47e79'
34 '263725f20c0b9eb9c353040792d644e5'
35 '9d3c56a4b999c8bfbd4018089a62f662')
39 cd ${srcdir}/linux-${pkgver}
41 # fix #19234 i1915 display size
42 patch -Np1 -i "${srcdir}/fix-i915.patch"
44 # set DEFAULT_CONSOLE_LOGLEVEL to 4 (same value as the 'quiet' kernel param)
45 # remove this when a Kconfig knob is made available by upstream
46 # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
47 patch -Np1 -i "${srcdir}/change-default-console-loglevel.patch"
49 if [ "$CARCH" = "x86_64" ]; then
50 cat ../config.x86_64 >./.config
52 cat ../config >./.config
54 if [ "${_kernelname}" != "" ]; then
55 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
61 # Configure the kernel. Replace the line below with one of your choice.
62 #make menuconfig # CLI menu for configuration
63 #make xconfig # X-based configuration
64 #make oldconfig # using old config from previous kernel version
65 # ... or manually edit .config
70 # this is useful to configure the kernel
74 make bzImage modules || return 1
77 _kernver="$(make kernelrelease)"
78 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
79 make INSTALL_MOD_PATH=${pkgdir} modules_install
80 cp System.map ${pkgdir}/boot/System.map26-${_idstr}
81 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz-${_idstr}
83 install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
85 # install fallback mkinitcpio.conf file and preset file for kernel
86 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset || return 1
87 # set correct depmod command for install
89 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
90 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
91 -i $startdir/linux-vanilla.install
93 -e "s|source .*|source /etc/mkinitcpio.d/linux-${_idstr}.kver|g" \
94 -e "s|default_image=.*|default_image=\"/boot/initramfs-${pkgname}.img\"|g" \
95 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs-${pkgname}-fallback.img\"|g" \
96 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
98 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${startdir}/pkg/etc/mkinitcpio.d/${pkgname}.kver
99 # remove unneeded architectures
100 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}
101 # remove the firmware
102 rm -rf ${pkgdir}/lib/firmware
104 # gzip -9 all modules to safe 100MB of space
105 find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
107 # remove build and source links
108 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
109 cd ${pkgdir}/lib/modules/${_kernver}
110 ln -sf ../../../usr/src/linux-${_kernver} build
111 cd ${srcdir}/linux-${pkgver}
113 install -D -m644 Makefile \
114 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
115 install -D -m644 kernel/Makefile \
116 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
117 install -D -m644 .config \
118 ${pkgdir}/usr/src/linux-${_kernver}/.config
119 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
121 for i in acpi asm-generic config crypto drm generated linux math-emu \
122 media net pcmcia scsi sound trace video xen; do
123 cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
126 # copy arch includes for external modules
127 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
128 cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
130 # copy files necessary for later builds, like nvidia and vmware
131 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
132 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
133 # fix permissions on scripts dir
134 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
135 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
137 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
139 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
140 if [ "$CARCH" = "i686" ]; then
141 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
143 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
145 # add headers for lirc package
146 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
147 cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
148 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
149 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
150 cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
152 # add docbook makefile
153 install -D -m644 Documentation/DocBook/Makefile \
154 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
156 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
157 cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
159 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
160 cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
161 # add wireless headers
162 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
163 cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
164 # add dvb headers for external modules
166 # http://bugs.archlinux.org/task/9912
167 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
168 cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
169 # add dvb headers for external modules
171 # http://bugs.archlinux.org/task/11194
172 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
173 cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
174 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
176 # http://bugs.archlinux.org/task/13146
177 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
178 cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
179 cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
182 # http://bugs.archlinux.org/task/20402
183 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
184 cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
185 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
186 cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
187 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
188 cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
189 # add xfs and shmem for aufs building
190 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
191 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
192 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
193 # copy in Kconfig files
194 for i in `find . -name "Kconfig*"`; do
195 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
196 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
199 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
200 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
201 # strip scripts directory
202 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
203 case "$(file -bi "$binary")" in
204 *application/x-sharedlib*) # Libraries (.so)
205 /usr/bin/strip $STRIP_SHARED "$binary";;
206 *application/x-archive*) # Libraries (.a)
207 /usr/bin/strip $STRIP_STATIC "$binary";;
208 *application/x-executable*) # Binaries
209 /usr/bin/strip $STRIP_BINARIES "$binary";;
212 # remove unneeded architectures
213 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}