void-packages/templates/kernel26.tmpl

84 lines
2.9 KiB
Cheetah

# Template file for 'kernel26'
pkgname=kernel26
version=2.6.27.3
wrksrc="linux-$version"
distfiles="http://www.kernel.org/pub/linux/kernel/v2.6/linux-$version.tar.bz2"
build_style=gnu_makefile
make_build_target="bzImage modules"
make_install_target="modules_install
INSTALL_MOD_PATH=$XBPS_DESTDIR/$pkgname-$version"
short_desc="The Linux kernel (2.6 branch)"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=52d9526ea8df33c9fab3df4564b0147b1866c76b0fd31474b92592567384a02c
long_desc="
This package provides the linux kernel image and kernel modules
from the 2.6 branch."
build_depends="perl-5.10.0 module-init-tools-3.5"
pre_build()
{
# If there's a file called kernel26-<arch>-dotconfig, use it to
# configure the kernel; otherwise run the menuconfig target.
if [ -f $XBPS_TEMPLATESDIR/kernel26-${xbps_machine}-dotconfig ]; then
echo "=> Detected a .config file for your machine, using it"
cp -f $XBPS_TEMPLATESDIR/kernel26-${xbps_machine}-dotconfig \
$wrksrc/.config
make oldconfig
else
echo "=> Couldn't find a .config file for your machine..."
make menuconfig
fi
}
post_install()
{
local destdir=$XBPS_DESTDIR/$pkgname-$version
local incdirs="acpi asm-generic asm-x86 config linux math-emu media \
net pcmcia scsi sound video"
local _archs="alpha arm arm26 avr32 blackfin cris frv h8300 ia64 m32r \
m68k* mips mn10300 parisc powerpc ppc s390 sh* sparc* \
um v850 xtensa"
#
# Install bzImage, vmlinux and copy necessary stuff to build packages
# that require this. This is based off of kernel26 pkgbuild from
# Archlinux.
#
install -d $destdir/lib $destdir/boot
cd $wrksrc || exit 1
install -m 644 arch/x86/boot/bzImage $destdir/boot/vmlinuz-$version
install -m 644 System.map $destdir/boot/System.map-$version
install -D -m 644 Makefile $destdir/usr/src/linux-$version/Makefile
install -D -m 644 kernel/Makefile \
$destdir/usr/src/linux-$version/kernel/Makefile
install -D -m 644 .config $destdir/usr/src/linux-$version/.config
for i in ${incdirs}; do
cp -a include/$i $destdir/usr/src/linux-$version/include
done
install -D -m 644 Module.symvers \
$destdir/usr/src/linux-$version/Module.symvers
cp -a scripts $destdir/usr/src/linux-$version
mkdir -p $destdir/usr/src/linux-$version/arch/x86/kernel
if [ "$xbps_machine" != "x86_64" ]; then
install -D -m 644 arch/x86/Makefile_32.cpu \
$destdir/usr/src/linux-$version/arch/x86/Makefile_32.cpu
fi
cp arch/x86/kernel/asm-offsets.s \
$destdir/usr/src/linux-$version/arch/x86/kernel
install -m 644 vmlinux $destdir/usr/src/linux-$version/vmlinux
for i in $(find . -name "Kconfig*"); do
mkdir -p $destdir/usr/src/linux-$version/$(echo $i | sed 's|/Kconfig.*||')
cp $i $destdir/usr/src/linux-$version/$i
done
cd $destdir/usr/src/linux-$version/include && ln -s asm-x86 asm
cd $destdir/usr/src && ln -s linux-$version linux
for arch in ${_arch}; do
rm -rf $destdir/usr/src/linux-$version/arch/$arch
done
}