# Maintainer: Jens Pranaitis <jens@jenux.homelinux.org>
# Based on the work of godane <slaxemulator@gmail.com>
pkgname=kernel26slax
_basekernel=2.6.26
pkgver=2.6.26.3
pkgrel=1
_patchname="patch-${pkgver}-${pkgrel}-ARCH"
pkgdesc="Linux kernel based on slax config. Used in arch-live."
arch=(i686)
license=('GPL2')
groups=('base')
url="http://www.kernel.org"
backup=(etc/mkinitcpio.d/${pkgname}.preset)
depends=('coreutils' 'module-init-tools' 'mkinitcpio>=0.5.18')
# pwc, ieee80211 and hostap-driver26 modules are included in kernel26 now
# nforce package support was abandoned by nvidia, kernel modules should cover everything now.
# kernel24 support is dropped since glibc24
replaces=('kernel24' 'kernel24-scsi' 'kernel26-scsi'
'alsa-driver' 'ieee80211' 'hostap-driver26'
'pwc' 'nforce' 'squashfs' 'ivtv'
'zd1211' 'kvm-modules' 'iwlwifi' 'rt2x00-cvs' 'kernel26')
provides=('kernel26')
install=$pkgname.install
source=(ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_basekernel.tar.bz2
http://kernel.org/pub/linux/kernel/v2.6/patch-$pkgver.bz2
#makefile-fix.patch
#ftp://ftp.archlinux.org/other/kernel26/${_patchname}.bz2
# the main kernel config files
config #config.x86_64
# standard config files for mkinitcpio ramdisk
$pkgname.preset
#sqaushfs 3.3 for 2.6.25
squashfs3.3-patch
squashfs-2.6.25.patch
#add sqlzma option
sqlzma3.3-optional.patch
# adding patches to support aufs
aufs-patches.patch
http://patches.aircrack-ng.org/mac80211_2.6.26_frag.patch
http://patches.aircrack-ng.org/ath5k-frequency-chaos_2.6.26.2.patch
http://patches.aircrack-ng.org/ieee80211_inject-2.6.22.patch
http://patches.aircrack-ng.org/zd1211rw_inject_2.6.26.patch
)
md5sums=('5169d01c405bc3f866c59338e217968c'
'556282beb8feabee2972e1971984f6dd'
'017184a4809c8b300490777f12c54047'
'25584700a0a679542929c4bed31433b6'
'9a2bcd0298dc4f43372c7f0808458521'
'8667abdfb0c25a663c03cb3197671932'
'5b98928e0a507884cce468d0399196de'
'e1cc3c48b5f52bb19b2b011bd488e065'
'573f7d9f66ac010e03841fa5413a9e6a'
'adf116e0e44159b90e049079ee538a81'
'2c3adc6510c5bd47f0a04ace4aa2ea1d'
'a162a23b5db02738309e54b6ca9fcbc9'
)
build() {
KARCH=x86
cd $startdir/src/linux-$_basekernel
# added squashfs+lzma patch
patch -Np1 -i $startdir/src/squashfs3.3-patch || return 1
patch -Np2 -i $startdir/src/squashfs-2.6.25.patch || return 1
patch -Np1 -i $startdir/src/sqlzma3.3-optional.patch || return 1
patch -Np1 -i $startdir/src/aufs-patches.patch || return 1
# add injection support
patch -Np1 -i $startdir/src/mac80211_2.6.26_frag.patch || return 1
patch -Np1 -i $startdir/src/ath5k-frequency-chaos_2.6.26.2.patch || return 1
patch -Np1 -i $startdir/src/ieee80211_inject-2.6.22.patch || return 1
patch -Np0 -i $srcdir/zd1211rw_inject_2.6.26.patch || return 1
cp ../config ./.config
# build the full kernel version to use in pathnames
. ./.config
### next line is only needed for rc kernels
_kernver="2.6.26${CONFIG_LOCALVERSION}"
#_kernver="${_basekernel}${CONFIG_LOCALVERSION}"
# load configuration
yes "" | make config
make bzImage modules || return 1
mkdir -p $startdir/pkg/{lib/modules,boot}
make INSTALL_MOD_PATH=$startdir/pkg modules_install || return 1
cp System.map $startdir/pkg/boot/System.map26
cp arch/$KARCH/boot/bzImage $startdir/pkg/boot/vmlinuz26
install -D -m644 Makefile \
$startdir/pkg/usr/src/linux-${_kernver}/Makefile
install -D -m644 kernel/Makefile \
$startdir/pkg/usr/src/linux-${_kernver}/kernel/Makefile
install -D -m644 .config \
$startdir/pkg/usr/src/linux-${_kernver}/.config
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include
for i in acpi asm-{generic,x86} config linux math-emu media net pcmcia scsi sound video; do
cp -a include/$i $startdir/pkg/usr/src/linux-${_kernver}/include/
done
# copy files necessary for later builds, like nvidia and vmware
cp Module.symvers $startdir/pkg/usr/src/linux-${_kernver}
cp -a scripts $startdir/pkg/usr/src/linux-${_kernver}
# fix permissions on scripts dir
chmod og-w -R $startdir/pkg/usr/src/linux-${_kernver}/scripts
#mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/.tmp_versions
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/kernel
cp arch/$KARCH/Makefile $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/
if [ "$CARCH" = "i686" ]; then
cp arch/$KARCH/Makefile_32.cpu $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/
fi
cp arch/$KARCH/kernel/asm-offsets.s $startdir/pkg/usr/src/linux-${_kernver}/arch/$KARCH/kernel/
# add headers for lirc package
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video
cp drivers/media/video/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/
for i in bt8xx cpia2 cx25840 cx88 em28xx et61x251 pwc saa7134 sn9c102 usbvideo zc0301; do
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i
cp -a drivers/media/video/$i/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/video/$i
done
# add dm headers
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/md
cp drivers/md/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/md
# add inotify.h
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/include/linux
cp include/linux/inotify.h $startdir/pkg/usr/src/linux-${_kernver}/include/linux/
# add CLUSTERIP file for iptables
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/ipv4/netfilter/
# add wireless headers
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/
cp net/mac80211/*.h $startdir/pkg/usr/src/linux-${_kernver}/net/mac80211/
# add dvb headers for external modules
# in reference to:
# http://bugs.archlinux.org/task/9912
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core
cp drivers/media/dvb/dvb-core/*.h $startdir/pkg/usr/src/linux-${_kernver}/drivers/media/dvb/dvb-core/
# add xfs and shmem for aufs building
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/fs/xfs
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/mm
cp fs/xfs/xfs_sb.h $startdir/pkg/usr/src/linux-${_kernver}/fs/xfs/xfs_sb.h
# add vmlinux
cp vmlinux $startdir/pkg/usr/src/linux-${_kernver}
# copy in Kconfig files
for i in `find . -name "Kconfig*"`; do
mkdir -p $startdir/pkg/usr/src/linux-${_kernver}/`echo $i | sed 's|/Kconfig.*||'`
cp $i $startdir/pkg/usr/src/linux-${_kernver}/$i
done
cd $startdir/pkg/usr/src/linux-${_kernver}/include && ln -s asm-$KARCH asm
chown -R root.root $startdir/pkg/usr/src/linux-${_kernver}
find $startdir/pkg/usr/src/linux-${_kernver} -type d -exec chmod 755 {} \;
cd $startdir/pkg/lib/modules/${_kernver} && \
(rm -f source build; ln -sf ../../../usr/src/linux-${_kernver} build)
# install fallback mkinitcpio.conf file and preset file for kernel
install -m644 -D $startdir/src/${pkgname}.preset $startdir/pkg/etc/mkinitcpio.d/${pkgname}.preset || return 1
# set correct depmod command for install
sed -i -e "s/KERNEL_VERSION=.*/KERNEL_VERSION=${_kernver}/g" $startdir/$pkgname.install
echo -e "# DO NOT EDIT THIS FILE\nALL_kver='${_kernver}'" > ${startdir}/pkg/etc/mkinitcpio.d/${pkgname}.kver
# remove unneeded architectures
rm -rf $startdir/pkg/usr/src/linux-${_kernver}/arch/{alpha,arm,arm26,avr32,blackfin,cris,frv,h8300,ia64,m32r,m68k,m68knommu,mips,parisc,powerpc,ppc,s390,sh,sh64,sparc,sparc64,um,v850,xtensa}
}