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 'a34d983842bc66395596539470cc3f9d0b42695c9a6b6cd8fd7f96c6783d40e2'
32 'd1b6ca5414cbe579ed27a9744ecf7aae30523b2844afb5500a0cc7c4ad9e9a43'
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[@]}"
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
90 patch -Np1 -i ${srcdir}/${patch}
94 msg2 "copy configuration"
95 if [ "$CARCH" = "x86_64" ]; then
96 cat ../config-${_basekernel}-desktop.x86_64 >./.config
98 cat ../config-${_basekernel}-desktop.i686 >./.config
100 if [ "${_kernelname}" != "" ]; then
101 sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"\U${_kernelname}\"|g" ./.config
104 # set extraversion to pkgrel
105 msg2 "set extraversion to ${pkgrel}"
106 sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
108 # hack to prevent output kernel from being marked as dirty or git
109 msg2 "apply hack to prevent kernel tree being marked dirty"
110 echo "" > ${srcdir}/linux-${_basekernel}/.scmversion
116 # Configure the kernel. Replace the line below with one of your choice.
117 #make menuconfig # CLI menu for configuration
118 #make xconfig # X-based configuration
119 #make oldconfig # using old config from previous kernel version
120 # ... or manually edit .config
123 # this is useful to configure the kernel
124 #msg "Stopping build"
127 # yes "" | make config
130 make ${MAKEFLAGS} bzImage modules
133 package_linux-bede() {
134 pkgdesc="The Linux Kernel and modules, BlackEagle Desktop Edition"
138 "etc/mkinitcpio.d/${pkgname}.preset"
139 "etc/sysctl.d/sysctl-${pkgname}.conf"
141 depends=('coreutils' 'module-init-tools>=3.12-2' 'mkinitcpio>=0.7')
143 'crda: to set the correct wireless channels of your country'
144 'linux-firmware: when having some hardware needing special firmware'
147 'nouveau-drm' 'kernel26-slk' "kernel26${_kernelname}" "linux-bemm"
150 install=${pkgname}.install
153 cd ${srcdir}/linux-${_basekernel}
155 mkdir -p ${pkgdir}/{lib/modules,lib/firmware,boot}
158 _kernver=$(make kernelrelease)
161 make INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=${pkgdir} modules_install
163 # copy System.map and bzImage
164 cp System.map ${pkgdir}/boot/System.map${_kernelname}
165 cp arch/$KARCH/boot/bzImage ${pkgdir}/boot/vmlinuz${_kernelname}
167 # install fallback mkinitcpio.conf file and preset file for kernel
168 install -m644 -D ${srcdir}/${pkgname}.preset ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
170 # install sysctl enhancements
171 if [ "$CARCH" = "x86_64" ]; then
172 install -m644 -D ${srcdir}/sysctl-desktop.x86_64 ${pkgdir}/etc/sysctl.d/sysctl-${pkgname}.conf
174 install -m644 -D ${srcdir}/sysctl-desktop.i686 ${pkgdir}/etc/sysctl.d/sysctl-${pkgname}.conf
177 # set correct depmod command for install
179 -e "s/KERNEL_NAME=.*/KERNEL_NAME=${_kernelname}/g" \
180 -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" \
181 -i $startdir/${pkgname}.install
183 -e "s|source .*|source /etc/mkinitcpio.d/${pkgname}.kver|g" \
184 -e "s|default_image=.*|default_image=\"/boot/initramfs${_kernelname}.img\"|g" \
185 -e "s|fallback_image=.*|fallback_image=\"/boot/initramfs${_kernelname}-fallback.img\"|g" \
186 -i ${pkgdir}/etc/mkinitcpio.d/${pkgname}.preset
188 echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${pkgdir}/etc/mkinitcpio.d/${pkgname}.kver
190 # remove build and source links
191 rm -f ${pkgdir}/lib/modules/${_kernver}/{source,build}
193 # remove the firmware
194 rm -rf ${pkgdir}/lib/firmware
196 _fldkernelname=$(echo ${_kernelname} | tr "[:lower:]" "[:upper:]")
197 # make room for external modules
198 ln -s "../${_basekernel}${_fldkernelname}-external" "${pkgdir}/lib/modules/${_kernver}/external"
199 # add real version for building modules and running depmod from post_install/upgrade
200 mkdir -p "${pkgdir}/lib/modules/${_basekernel}${_fldkernelname}-external"
201 echo "${_kernver}" > "${pkgdir}/lib/modules/${_basekernel}${_fldkernelname}-external/version"
204 find ${pkgdir} -name '*.ko' -exec gzip -9 {} \;
207 package_linux-bede-headers() {
208 pkgdesc="Header files and scripts for building modules for linux${_kernelname}"
209 provides=('linux-headers')
210 replaces=("kernel26${_kernelname}-headers" "linux-bemm-headers")
211 mkdir -p ${pkgdir}/lib/modules/${_kernver}
212 cd ${pkgdir}/lib/modules/${_kernver}
213 ln -sf ../../../usr/src/linux-${_kernver} build
214 cd ${srcdir}/linux-${_basekernel}
215 install -D -m644 Makefile \
216 ${pkgdir}/usr/src/linux-${_kernver}/Makefile
217 install -D -m644 kernel/Makefile \
218 ${pkgdir}/usr/src/linux-${_kernver}/kernel/Makefile
219 install -D -m644 .config \
220 ${pkgdir}/usr/src/linux-${_kernver}/.config
222 # copy files necessary for later builds, like nvidia and vmware
223 cp Module.symvers ${pkgdir}/usr/src/linux-${_kernver}
224 cp -a scripts ${pkgdir}/usr/src/linux-${_kernver}
225 # fix permissions on scripts dir
226 chmod og-w -R ${pkgdir}/usr/src/linux-${_kernver}/scripts
227 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/.tmp_versions
229 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel
231 cp arch/$KARCH/Makefile ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
232 if [ "$CARCH" = "i686" ]; then
233 cp arch/$KARCH/Makefile_32.cpu ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/
235 cp arch/$KARCH/kernel/asm-offsets.s ${pkgdir}/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
237 # add docbook makefile
238 install -D -m644 Documentation/DocBook/Makefile \
239 ${pkgdir}/usr/src/linux-${_kernver}/Documentation/DocBook/Makefile
242 for config in `find ./include/config -size +1c -type f`; do
243 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${config})
244 cp -a ${config} ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${config})
248 for header in `find -size +1c -name '*.h'`; do
249 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${header})
250 cp -a ${header} ${pkgdir}/usr/src/linux-${_kernver}/$(dirname ${header})
253 # copy in Kconfig files
254 for i in `find . -name "Kconfig*"`; do
255 mkdir -p ${pkgdir}/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
256 cp $i ${pkgdir}/usr/src/linux-${_kernver}/$i
259 # strip scripts directory
260 find ${pkgdir}/usr/src/linux-${_kernver}/scripts -type f -perm -u+w 2>/dev/null | while read binary ; do
261 case "$(file -bi "$binary")" in
262 *application/x-sharedlib*) # Libraries (.so)
263 /usr/bin/strip $STRIP_SHARED "$binary"
265 *application/x-archive*) # Libraries (.a)
266 /usr/bin/strip $STRIP_STATIC "$binary"
268 *application/x-executable*) # Binaries
269 /usr/bin/strip $STRIP_BINARIES "$binary"
274 chown -R root.root ${pkgdir}/usr/src/linux-${_kernver}
275 find ${pkgdir}/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
276 # remove unneeded architectures
277 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}
279 pkgdesc="The Linux Kernel and modules, BlackEagle Desktop Edition"