1 # Maintainer: BlackEagle < ike DOT devolder AT gmail DOT com >
2 # Contributor: Tobias Powalowski <tpowa@archlinux.org>
3 # Contributor: Thomas Baechler <thomas@archlinux.org>
6 pkgbase="linux${_kernelname}"
7 pkgname="linux${_kernelname}"
8 true && pkgname=("linux${_kernelname}" "linux${_kernelname}-headers")
13 arch=('i686' 'x86_64')
15 url="http://www.kernel.org"
19 "http://www.kernel.org/pub/linux/kernel/v3.x/linux-${_basekernel}.tar.xz"
20 # the main kernel config files
21 "config-${_basekernel}-desktop.i686"
22 "config-${_basekernel}-desktop.x86_64"
23 # standard config files for mkinitcpio ramdisk
24 "linux${_kernelname}.preset"
25 # sysctl updates for desktop usage picked up from opensuse
27 "sysctl-desktop.x86_64"
30 'dd96ed02b53fb5d57762e4b1f573460909de472ca588f81ec6660e4a172e7ba7'
31 '46c0d6993f557433ac7a693b27df346054e62b8778b2e9ab8561df9ce7175343'
32 'd8028b62f44ed4d21430b40e53006daed1bb34f8454bf916043c9b27aa3fabe0'
33 'd5bb4aabbd556f8a3452198ac42cad6ecfae020b124bcfea0aa7344de2aec3b5'
34 'cce2cd65f49ef30e9f2c977210fcb3f21707b53088615eb737e2bb53c67ca7c9'
35 '5d59b290f2ec7354048e24cc52048e104fa91a3ac4c393adbb0e268c129d03e2'
39 if [ ${_patchver} -ne 0 ]; then
40 pkgver=${_basekernel}.${_patchver}
41 _patchname="patch-${pkgver}"
42 source=( "${source[@]}"
43 "http://www.kernel.org/pub/linux/kernel/v3.x/${_patchname}.gz"
45 sha256sums=( "${sha256sums[@]}"
46 '74e7508fc424d80848fcf699165a8ae76850519945c752db4d40659c028d36b7'
55 if [ ${#_extrapatches[@]} -ne 0 ]; then
56 source=( "${source[@]}"
59 sha256sums=( "${sha256sums[@]}"
60 "${_extrapatchessums[@]}"
64 # some stuff for the AUR parser :p
65 if [ "aur" == "there" ]; then
67 "http://www.kernel.org/pub/linux/kernel/v3.x/linux-${_basekernel}.tar.xz"
68 # the main kernel config files
69 "config-${_basekernel}-desktop.i686"
70 "config-${_basekernel}-desktop.x86_64"
71 # standard config files for mkinitcpio ramdisk
72 "linux${_kernelname}.preset"
73 # sysctl updates for desktop usage picked up from opensuse
75 "sysctl-desktop.x86_64"
80 cd ${srcdir}/linux-${_basekernel}
81 # Add revision patches
82 if [ ${_patchver} -ne 0 ]; then
83 msg2 "apply ${_patchname}"
84 patch -Np1 -i ${srcdir}/${_patchname}
88 for patch in ${_extrapatches[@]}; do
89 patch=$(basename ${patch} | sed -e 's/\.\(gz\|bz2\|xz\)//')
91 patch -Np1 -i ${srcdir}/${patch}
95 msg2 "copy configuration"
96 if [ "$CARCH" = "x86_64" ]; then
97 cat ../config-${_basekernel}-desktop.x86_64 >./.config
99 cat ../config-${_basekernel}-desktop.i686 >./.config
101 if [ "${_kernelname}" != "" ]; then
102 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"\U${_kernelname}\"|g" ./.config
105 # set extraversion to pkgrel
106 msg2 "set extraversion to ${pkgrel}"
107 sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
109 # hack to prevent output kernel from being marked as dirty or git
110 msg2 "apply hack to prevent kernel tree being marked dirty"
111 echo "" > ${srcdir}/linux-${_basekernel}/.scmversion
117 # Configure the kernel. Replace the line below with one of your choice.
118 #make menuconfig # CLI menu for configuration
119 #make xconfig # X-based configuration
120 #make oldconfig # using old config from previous kernel version
121 # ... or manually edit .config
124 # this is useful to configure the kernel
125 #msg "Stopping build"
128 # yes "" | make config
131 make ${MAKEFLAGS} bzImage modules
134 package_linux-bede() {
135 pkgdesc="The Linux Kernel and modules, BlackEagle Desktop Edition"
139 "etc/mkinitcpio.d/${pkgname}.preset"
140 "etc/sysctl.d/sysctl-${pkgname}.conf"
142 depends=('coreutils' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.7')
144 'crda: to set the correct wireless channels of your country'
145 'linux-firmware: when having some hardware needing special firmware'
148 'nouveau-drm' 'kernel26-slk' "kernel26${_kernelname}" "linux-bemm"
151 install=${pkgname}.install
154 cd ${srcdir}/linux-${_basekernel}
156 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
159 _kernver=$(make kernelrelease)
162 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=${pkgdir} modules_install
164 # copy System.map and bzImage
165 cp System.map ${pkgdir}/boot/System.map${_kernelname}
166 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz${_kernelname}
168 # install fallback mkinitcpio.conf file and preset file for kernel
169 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
171 # install sysctl enhancements
172 if [ "$CARCH" = "x86_64" ]; then
173 install -m644 -D ${srcdir}/sysctl-desktop.x86_64 ${pkgdir}/etc/sysctl.d/sysctl-${pkgname}.conf
175 install -m644 -D ${srcdir}/sysctl-desktop.i686 ${pkgdir}/etc/sysctl.d/sysctl-${pkgname}.conf
178 # set correct depmod command for install
180 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
181 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
182 -i $startdir/${pkgname}.install
184 -e "s|source .*|source /etc/mkinitcpio.d/${pkgname}.kver|g" \
185 -e "s|default_image=.*|default_image=\"/boot/initramfs${_kernelname}.img\"|g" \
186 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs${_kernelname}-fallback.img\"|g" \
187 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
189 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
191 # remove build and source links
192 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
194 # remove the firmware
195 rm -rf ${pkgdir}/lib/firmware
197 _fldkernelname=$(echo ${_kernelname} | tr "[:lower:]" "[:upper:]")
198 # make room for external modules
199 ln -s "../${_basekernel}${_fldkernelname}-external" "${pkgdir}/lib/modules/${_kernver}/external"
200 # add real version for building modules and running depmod from post_install/upgrade
201 mkdir -p "${pkgdir}/lib/modules/${_basekernel}${_fldkernelname}-external"
202 echo "${_kernver}" > "${pkgdir}/lib/modules/${_basekernel}${_fldkernelname}-external/version"
205 find ${pkgdir} -name '*.ko' -exec gzip -9 {} \;
208 package_linux-bede-headers() {
209 pkgdesc="Header files and scripts for building modules for linux${_kernelname}"
210 provides=('linux-headers')
211 replaces=("kernel26${_kernelname}-headers" "linux-bemm-headers")
212 mkdir -p ${pkgdir}/lib/modules/${_kernver}
213 cd ${pkgdir}/lib/modules/${_kernver}
214 ln -sf ../../../usr/src/linux-${_kernver} build
215 cd ${srcdir}/linux-${_basekernel}
216 install -D -m644 Makefile \
217 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
218 install -D -m644 kernel/Makefile \
219 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
220 install -D -m644 .config \
221 ${pkgdir}/usr/src/linux-${_kernver}/.config
223 # copy files necessary for later builds, like nvidia and vmware
224 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
225 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
226 # fix permissions on scripts dir
227 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
228 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
230 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
232 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
233 if [ "$CARCH" = "i686" ]; then
234 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
236 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
238 # add docbook makefile
239 install -D -m644 Documentation/DocBook/Makefile \
240 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
243 for config in `find ./include/config -size +1c -type f`; do
244 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${config})
245 cp -a ${config} ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${config})
249 for header in `find -size +1c -name '*.h'`; do
250 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${header})
251 cp -a ${header} ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${header})
254 # copy in Kconfig files
255 for i in `find . -name "Kconfig*"`; do
256 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
257 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
260 # strip scripts directory
261 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
262 case "$(file -bi "$binary")" in
263 *application/x-sharedlib*) # Libraries (.so)
264 /usr/bin/strip $STRIP_SHARED "$binary"
266 *application/x-archive*) # Libraries (.a)
267 /usr/bin/strip $STRIP_STATIC "$binary"
269 *application/x-executable*) # Binaries
270 /usr/bin/strip $STRIP_BINARIES "$binary"
275 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
276 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
277 # remove unneeded architectures
278 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,score,sh,sh64,sparc,sparc64,tile,um,v850,xtensa}
280 pkgdesc="The Linux Kernel and modules, BlackEagle Desktop Edition"