1 # Maintainer: Nicky726 (Nicky726 <at> gmail <dot> com)
2 # Contributor: Sergej Pupykin (pupykin <dot> s+arch <at> gmail <dot> com)
3 # Contributor: Tobias Powalowski (tpowa <at> archlinux <dot> org)
4 # Contributor: Thomas Baechler (thomas <at> archlinux <dot> org)
5 # Contributor: Ng Oon-Ee (ng oon ee <at> gmail <dot> com)
6 pkgbase="kernel26-selinux"
7 pkgname=('kernel26-selinux')
8 true && pkgname=('kernel26-selinux' 'kernel26-selinux-headers')
9 _kernelname=${pkgname#kernel26}
11 pkgver=${_basekernel}.3
13 #makedepends=('xmlto' 'docbook-xsl')
14 _patchname="patch-${pkgver}-${pkgrel}-ARCH"
15 #_patchname="patch-${pkgver}-1-ARCH"
16 arch=('i686' 'x86_64')
18 url="http://www.kernel.org"
20 source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
21 ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
22 # the main kernel config files
24 # the SELinux enabling config file
26 # standard config files for mkinitcpio ramdisk
28 md5sums=('1aab7a741abe08d42e8eccf20de61e05'
29 'b23d7def30e57242cfe088f4d8ca8baa'
30 'de7cf2c54104b88e3385683f47fedaef'
31 '8be1f60e54eb505b7e67d39fd2233103'
32 'ab9328d8a3d2bed80b4611ca8898f6fe'
33 '25584700a0a679542929c4bed31433b6')
36 cd ${srcdir}/linux-$_basekernel
38 # See http://projects.archlinux.org/linux-2.6-ARCH.git/
39 patch -Np1 -i ${srcdir}/${_patchname}
41 if [ "$CARCH" = "x86_64" ]; then
42 cat ../config.x86_64 >./.config
44 cat ../config >./.config
46 cat ../config.selinux >>./.config
47 if [ "${_kernelname}" != "" ]; then
48 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
51 # hack to prevent output kernel from being marked as dirty or git (when building inside of git)
52 sed -i -e "s/head=\`git rev-parse --verify --short HEAD 2>\/dev\/null\`/0/" \
53 ${srcdir}/linux-${_basekernel}/scripts/setlocalversion
58 # Configure the kernel. Replace the line below with one of your choice.
59 #make menuconfig # CLI menu for configuration
60 #make xconfig # X-based configuration
61 #make oldconfig # using old config from previous kernel version
62 # ... or manually edit .config
65 # this is useful to configure the kernel
71 make ${MAKEFLAGS} bzImage modules
74 package_kernel26-selinux() {
75 pkgdesc="The SELinux enabled Linux Kernel and modules"
76 groups=('selinux' 'selinux-system-utilities')
77 backup=(etc/mkinitcpio.d/${pkgname}.preset)
78 depends=('selinux-coreutils' 'linux-firmware' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.6.8-2')
79 # pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
80 # nforce package support was abandoned by nvidia, kernel modules should cover everything now.
81 # kernel24 support is dropped since glibc24
82 replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
83 'alsa-driver' 'ieee80211' 'hostap-driver26'
84 'pwc' 'nforce' 'squashfs' 'unionfs' 'ivtv'
85 'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs'
86 'gspcav1' 'atl2' 'wlan-ng26' 'rt2500' 'nouveau-drm')
87 install=kernel26.install
88 optdepends=('crda: to set the correct wireless channels of your country')
91 cd ${srcdir}/linux-$_basekernel
93 _kernver="$(make kernelrelease)"
94 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
95 make INSTALL_MOD_PATH=${pkgdir} modules_install
96 cp System.map ${pkgdir}/boot/System.map26${_kernelname}
97 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz26${_kernelname}
99 install -m644 -D vmlinux ${pkgdir}/usr/src/linux-${_kernver}/vmlinux
101 # install fallback mkinitcpio.conf file and preset file for kernel
102 install -m644 -D ${srcdir}/kernel26.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
103 # set correct depmod command for install
105 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
106 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
107 -i $startdir/kernel26.install
109 -e "s|source .*|source /etc/mkinitcpio.d/kernel26${_kernelname}.kver|g" \
110 -e "s|default_image=.*|default_image=\"/boot/${pkgname}.img\"|g" \
111 -e "s|fallback_image=.*|fallback_image=\"/boot/${pkgname}-fallback.img\"|g" \
112 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
114 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
115 # remove build and source links
116 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
117 # remove the firmware
118 rm -rf ${pkgdir}/lib/firmware
119 # gzip -9 all modules to safe 100MB of space
120 find "${pkgdir}" -name '*.ko' -exec gzip -9 {} \;
123 package_kernel26-selinux-headers() {
124 pkgdesc="Header files and scripts for building modules for kernel26-selinux"
125 groups=('selinux' 'selinux-system-utilities')
126 provides=('kernel26-headers')
127 mkdir -p ${pkgdir}/lib/modules/${_kernver}
128 cd ${pkgdir}/lib/modules/${_kernver}
129 ln -sf ../../../usr/src/linux-${_kernver} build
130 cd ${srcdir}/linux-$_basekernel
131 install -D -m644 Makefile \
132 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
133 install -D -m644 kernel/Makefile \
134 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
135 install -D -m644 .config \
136 ${pkgdir}/usr/src/linux-${_kernver}/.config
137 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include
139 for i in acpi asm-generic config crypto drm generated linux math-emu \
140 media net pcmcia scsi sound trace video xen; do
141 cp -a include/$i ${pkgdir}/usr/src/linux-${_kernver}/include/
144 # copy arch includes for external modules
145 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/x86
146 cp -a arch/x86/include ${pkgdir}/usr/src/linux-${_kernver}/arch/x86/
148 # copy files necessary for later builds, like nvidia and vmware
149 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
150 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
151 # fix permissions on scripts dir
152 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
153 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
155 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
157 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
158 if [ "$CARCH" = "i686" ]; then
159 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
161 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
163 # add headers for lirc package
164 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video
165 cp drivers/media/video/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/
166 for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
167 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
168 cp -a drivers/media/video/$i/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/video/$i
170 # add docbook makefile
171 install -D -m644 Documentation/DocBook/Makefile \
172 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
174 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
175 cp drivers/md/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/md
177 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/linux
178 cp include/linux/inotify.h ${pkgdir}/usr/src/linux-${_kernver}/include/linux/
179 # add wireless headers
180 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
181 cp net/mac80211/*.h ${pkgdir}/usr/src/linux-${_kernver}/net/mac80211/
182 # add dvb headers for external modules
184 # http://bugs.archlinux.org/task/9912
185 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
186 cp drivers/media/dvb/dvb-core/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
187 # add dvb headers for external modules
189 # http://bugs.archlinux.org/task/11194
190 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
191 cp include/config/dvb/*.h ${pkgdir}/usr/src/linux-${_kernver}/include/config/dvb/
192 # add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
194 # http://bugs.archlinux.org/task/13146
195 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
196 cp drivers/media/dvb/frontends/lgdt330x.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
197 cp drivers/media/video/msp3400-driver.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
200 # http://bugs.archlinux.org/task/20402
201 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb
202 cp drivers/media/dvb/dvb-usb/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-usb/
203 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends
204 cp drivers/media/dvb/frontends/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/dvb/frontends/
205 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners
206 cp drivers/media/common/tuners/*.h ${pkgdir}/usr/src/linux-${_kernver}/drivers/media/common/tuners/
207 # add xfs and shmem for aufs building
208 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs
209 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/mm
210 cp fs/xfs/xfs_sb.h ${pkgdir}/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
211 # copy in Kconfig files
212 for i in `find . -name "Kconfig*"`; do
213 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
214 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
217 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
218 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
219 # strip scripts directory
220 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
221 case "$(file -bi "$binary")" in
222 *application/x-sharedlib*) # Libraries (.so)
223 /usr/bin/strip $STRIP_SHARED "$binary";;
224 *application/x-archive*) # Libraries (.a)
225 /usr/bin/strip $STRIP_STATIC "$binary";;
226 *application/x-executable*) # Binaries
227 /usr/bin/strip $STRIP_BINARIES "$binary";;
230 # remove unneeded architectures
231 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}