Newer
Older
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Customized version of linux for seblu computers
shopt -s nullglob
kernelver=3.3.3
kernelsuf=-seblu
pkgname=linux$kernelsuf-$kernelver
pkgver=1
license=('GPL2')
url='http://www.kernel.org'
options=('!strip')
makedepends=('xmlto' 'docbook-xsl')
source=(
"http://www.kernel.org/pub/linux/kernel/v3.0/$testing/linux-$kernelver.tar.xz"
'config.x86_64'
'config.i686'
# small hack to avoid makepkg to check checksum
SKIPCHECKSUMS=1
build() {
msg2 "Kernel version: $kernelver"
msg2 "Kernel suffix: $kernelsuf"
cd linux-$kernelver
for _f in "$srcdir"/*.patch; do
msg2 " Applying patch ${_f##*/}"
patch -N -p1 -i "$_f"
done
# loading default config
# use make localmodconfig to check .config is correct
msg2 'Copying config'
# removing last dot if zero
#sed -ri 's/^SUBLEVEL = 0$/SUBLEVEL =/' Makefile
fi
# updating suffixe in config (must be the right!)
msg2 'Setting kernel suffix'
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"$kernelsuf\"|g" .config
# define current build version
msg2 'Preparing compilation'
yes '' | make config &>/dev/null
nice -n 19 make prepare &>/dev/null
cpucount=$(grep -c processor /proc/cpuinfo 2>/dev/null)
jc=$((${cpucount:-1}))
# Compiling sources
msg2 "Compiling (jobs=$jc)"
nice -n 19 make -j $jc bzImage modules
}
package() {
cd linux-$kernelver
# get real compiled kernel version
compver=$(make kernelrelease)
pkgdesc="The Linux Kernel, version $compver"
provides=('linux' 'linux-headers' 'linux-docs')
install='install'
sed -ri "s/pkgname=.*/pkgname='$pkgname'/" "$startdir/install"
# installing modules
install -d "$pkgdir"/{lib/modules,boot}
make INSTALL_MOD_PATH="$pkgdir" modules_install
# install kernel and map
# install mkinitcpio preset file for kernel
install -d "$pkgdir/etc/mkinitcpio.d/"
cat > "$pkgdir/etc/mkinitcpio.d/$pkgname.preset" << EOF
# mkinitcpio preset file for $pkgname
ALL_config="/etc/mkinitcpio.conf"
PRESETS=('default' 'fallback')
#default_config="/etc/mkinitcpio.conf"
#default_options=""
#fallback_config="/etc/mkinitcpio.conf"
fallback_options="-S autodetect"
EOF
# setup current version package (used by install script)
install -d "$pkgdir/usr/share/$pkgname"
cat > "$pkgdir/usr/share/$pkgname/info" << EOF
KERNEL_NAME=$pkgname
KERNEL_VERSION=$kernelver
KERNEL_SUFFIX=$kernelsuf
KERNEL_BUILD=$compver
# remove build and source links
rm -f "$pkgdir/lib/modules/$compver"/{source,build}
# remove the firmware (avoiding conflict with 2.6
rm -rf "$pkgdir/lib/firmware"
# copy documentation
install -d "$pkgdir/usr/src/linux-$compver"
cp -r Documentation "$pkgdir/usr/src/linux-$compver"
# copy headers
copy_headers
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# check rights
chown -R root.root "$pkgdir/usr/src/linux-$compver"
chmod -R u=rwX,go=rX "$pkgdir/usr/src/linux-$compver"
# gzip -9 all modules to safe 100MB of space
find "$pkgdir" -name '*.ko' -exec gzip -9 {} \;
}
copy_headers() {
install -d "$pkgdir/lib/modules/$compver"
ln -sf ../../../usr/src/linux-$compver "$pkgdir/lib/modules/$compver/build"
cd "$srcdir/linux-$kernelver"
install -D -m644 Makefile "$pkgdir/usr/src/linux-$compver/Makefile"
install -D -m644 kernel/Makefile "$pkgdir/usr/src/linux-$compver/kernel/Makefile"
install -D -m644 .config "$pkgdir/usr/src/linux-$compver/.config"
for i in localversion*; do
install -m644 "$i" "$pkgdir/usr/src/linux-$compver/$i"
done
install -d "$pkgdir/usr/src/linux-$compver/include"
for i in acpi asm-generic config generated linux math-emu media net pcmcia scsi sound trace video xen; do
cp -a include/$i "$pkgdir/usr/src/linux-$compver/include/"
done
# copy arch includes for external modules
install -d "$pkgdir/usr/src/linux-$compver/arch/x86"
cp -a arch/x86/include "$pkgdir/usr/src/linux-$compver/arch/x86/"
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers "$pkgdir/usr/src/linux-$compver"
cp -a scripts "$pkgdir/usr/src/linux-$compver"
# fix permissions on scripts dir
chmod og-w -R "$pkgdir/usr/src/linux-$compver/scripts"
install -d "$pkgdir/usr/src/linux-$compver/.tmp_versions"
install -d "$pkgdir/usr/src/linux-$compver/arch/x86/kernel"
cp arch/x86/Makefile "$pkgdir/usr/src/linux-$compver/arch/x86/"
cp arch/x86/kernel/asm-offsets.s "$pkgdir/usr/src/linux-$compver/arch/x86/kernel/"
# add headers for lirc package
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/video"
cp drivers/media/video/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/video/"
for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102; do
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/video/$i"
cp -a drivers/media/video/$i/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/video/$i"
done
# add docbook makefile
install -D -m644 Documentation/DocBook/Makefile \
"$pkgdir/usr/src/linux-$compver/Documentation/DocBook/Makefile"
# add dm headers
install -d "$pkgdir/usr/src/linux-$compver/drivers/md"
cp drivers/md/*.h "$pkgdir/usr/src/linux-$compver/drivers/md"
# add inotify.h
install -d "$pkgdir/usr/src/linux-$compver/include/linux"
cp include/linux/inotify.h "$pkgdir/usr/src/linux-$compver/include/linux/"
# add wireless headers
install -d "$pkgdir/usr/src/linux-$compver/net/mac80211/"
cp net/mac80211/*.h "$pkgdir/usr/src/linux-$compver/net/mac80211/"
# add dvb headers for external modules
# in reference to:
# http://bugs.archlinux.org/task/9912
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/dvb-core"
cp drivers/media/dvb/dvb-core/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/dvb-core/"
# add dvb headers for external modules
# in reference to:
# http://bugs.archlinux.org/task/11194
install -d "$pkgdir/usr/src/linux-$compver/include/config/dvb/"
cp include/config/dvb/*.h "$pkgdir/usr/src/linux-$compver/include/config/dvb/"
# add dvb headers for http://mcentral.de/hg/~mrec/em28xx-new
# in reference to:
# http://bugs.archlinux.org/task/13146
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/frontends/"
cp drivers/media/dvb/frontends/lgdt330x.h "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/frontends/"
cp drivers/media/video/msp3400-driver.h "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/frontends/"
# in reference to:
# http://bugs.archlinux.org/task/20402
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/dvb-usb"
cp drivers/media/dvb/dvb-usb/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/dvb-usb/"
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/frontends"
cp drivers/media/dvb/frontends/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/dvb/frontends/"
install -d "$pkgdir/usr/src/linux-$compver/drivers/media/common/tuners"
cp drivers/media/common/tuners/*.h "$pkgdir/usr/src/linux-$compver/drivers/media/common/tuners/"
# add xfs and shmem for aufs building
install -d "$pkgdir/usr/src/linux-$compver/fs/xfs"
install -d "$pkgdir/usr/src/linux-$compver/mm"
cp fs/xfs/xfs_sb.h "$pkgdir/usr/src/linux-$compver/fs/xfs/xfs_sb.h"
# add headers vor virtualbox
# in reference to:
# http://bugs.archlinux.org/task/14568
cp -a include/drm "$pkgdir/usr/src/linux-$compver/include/"
# add headers for broadcom wl
# in reference to:
# http://bugs.archlinux.org/task/14568
cp -a include/trace "$pkgdir/usr/src/linux-$compver/include/"
# copy in Kconfig files
install -d "$pkgdir/usr/src/linux-$compver"/$(echo $i | sed 's|/Kconfig.*||')
cp "$i" "$pkgdir/usr/src/linux-$compver/$i"
done
# remove unneeded architectures
rm -rf "$pkgdir/usr/src/linux-$compver/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}
}
# vim:set ts=2 sw=2 ft=sh et: