void-packages/srcpkgs/kirkwood-kernel/template

165 lines
5.0 KiB
Bash
Raw Normal View History

2015-05-17 21:59:33 +02:00
# Template file for 'kirkwood-kernel'
pkgname=kirkwood-kernel
2015-12-20 09:16:29 +01:00
version=4.1.15
2015-05-17 21:59:33 +02:00
revision=1
wrksrc="linux-${version}"
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
homepage="http://www.kernel.org/"
license="GPL-2"
short_desc="The Linux kernel and modules for kirkwood"
2015-06-27 10:38:17 +02:00
_commit="e2827e1b7fde0280099b9f8ea2d85a5b67bcaf37"
2015-05-17 21:59:33 +02:00
distfiles="${KERNEL_SITE}/kernel/v4.x/linux-${version}.tar.xz
http://www.arm.linux.org.uk/developer/machines/download.php>mach-types
2015-06-27 10:38:17 +02:00
https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/${_commit}/core/linux-kirkwood/archlinuxarm.patch
https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/${_commit}/core/linux-kirkwood/config"
skip_extraction="mach-types archlinuxarm.patch config"
2015-10-25 15:24:13 +01:00
checksum="
2015-12-20 09:16:29 +01:00
472288cc966188c5d7c511c6be0f78682843c9ca2d5d6c4d67d77455680359a3
2015-11-29 21:21:40 +01:00
f0c32b80f6a445a58fd673b790a5693c256e324f708e60dc5f2df9da57b1dcb0
2015-06-27 10:38:17 +02:00
53259fb05cb3903c5215da33426a654e3f212756cce155363decf8dc5ed7751e
1a6825cf6467604138e25c806cd9ff5b964894dbafc1f6a97fe8386c45f644bd"
2015-05-17 21:59:33 +02:00
nodebug=yes
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
2015-09-22 12:18:49 +02:00
only_for_archs="armv5tel armv5tel-musl"
2015-05-17 21:59:33 +02:00
hostmakedepends="perl kmod uboot-mkimage libressl-openssl bc"
makedepends="ncurses-devel"
triggers="kernel-hooks"
2015-07-01 00:46:59 +02:00
_kernver="${version}_${revision}"
2015-05-17 21:59:33 +02:00
# These files could be modified when an external module is built.
mutable_files="
/usr/lib/modules/${_kernver}/modules.builtin.bin
/usr/lib/modules/${_kernver}/modules.softdep
/usr/lib/modules/${_kernver}/modules.dep
/usr/lib/modules/${_kernver}/modules.dep.bin
/usr/lib/modules/${_kernver}/modules.symbols
/usr/lib/modules/${_kernver}/modules.symbols.bin
/usr/lib/modules/${_kernver}/modules.alias
/usr/lib/modules/${_kernver}/modules.alias.bin
/usr/lib/modules/${_kernver}/modules.devname"
post_extract() {
local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
cp "${srcdir}/mach-types" arch/arm/tools
patch -p1 < "${srcdir}/archlinuxarm.patch"
}
do_configure() {
2015-06-27 10:38:17 +02:00
local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
cp ${srcdir}/config .config
2015-05-17 21:59:33 +02:00
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
}
do_build() {
if [ "$CROSS_BUILD" ]; then
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
fi
make ${makejobs} ${_args} ARCH=arm prepare
make ${makejobs} ${_args} ARCH=arm uImage modules
}
do_install() {
local hdrdest
# Run depmod after compressing modules.
sed -i '2iexit 0' scripts/depmod.sh
# Install kernel, firmware and modules
make ${makejobs} ARCH=arm INSTALL_MOD_PATH=${DESTDIR} modules_install
vmkdir boot
mv arch/arm/boot/uImage ${DESTDIR}/boot
hdrdest=${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}
# Switch to /usr.
vmkdir usr
mv ${DESTDIR}/lib ${DESTDIR}/usr
cd ${DESTDIR}/usr/lib/modules/${_kernver}
rm -f source build
ln -sf ../../../src/${sourcepkg}-headers-${_kernver} build
cd ${wrksrc}
# Install required headers to build external modules
install -Dm644 Makefile ${hdrdest}/Makefile
install -Dm644 kernel/Makefile ${hdrdest}/kernel/Makefile
install -Dm644 .config ${hdrdest}/.config
mkdir -p ${hdrdest}/include
# Remove firmware stuff provided by the "linux-firmware" pkg.
rm -rf ${DESTDIR}/usr/lib/firmware
for i in acpi asm-generic config crypto drm generated linux math-emu \
media net pcmcia scsi sound trace uapi video xen; do
[ -d include/$i ] && cp -a include/$i ${hdrdest}/include
done
cd ${wrksrc}
# Copy files necessary for later builds.
cp Module.symvers ${hdrdest}
cp -a scripts ${hdrdest}
# fix permissions on scripts dir
chmod og-w -R ${hdrdest}/scripts
# copy arch includes for external modules
mkdir -p ${hdrdest}/arch/arm/mach-kirkwood
cp -a arch/arm/include ${hdrdest}/arch/arm
mkdir -p ${hdrdest}/arch/arm/kernel
cp arch/arm/Makefile ${hdrdest}/arch/arm
cp arch/arm/kernel/asm-offsets.s ${hdrdest}/arch/arm/kernel
# Add docbook makefile
install -Dm644 Documentation/DocBook/Makefile \
${hdrdest}/Documentation/DocBook/Makefile
# Add md headers
mkdir -p ${hdrdest}/drivers/md
cp drivers/md/*.h ${hdrdest}/drivers/md
# Add inotify.h
mkdir -p ${hdrdest}/include/linux
cp include/linux/inotify.h ${hdrdest}/include/linux
# Add wireless headers
mkdir -p ${hdrdest}/net/mac80211/
cp net/mac80211/*.h ${hdrdest}/net/mac80211
# Copy in Kconfig files
for i in $(find . -name "Kconfig*"); do
mkdir -p ${hdrdest}/$(echo $i | sed 's|/Kconfig.*||')
cp $i ${hdrdest}/$i
done
# Remove unneeded architectures
for arch in alpha arm26 avr32 blackfin cris frv h8300 \
ia64 m* p* s* um v850 x86 xtensa; do
rm -rf ${hdrdest}/arch/${arch}
done
# Compress all modules with xz to save a few MBs.
msg_normal "$pkgver: compressing kernel modules with gzip, please wait...\n"
find ${DESTDIR} -name '*.ko' | xargs -n1 -P0 gzip -9
# ... and run depmod again.
depmod -b ${DESTDIR}/usr -F System.map ${_kernver}
}
kirkwood-kernel-headers_package() {
nostrip=yes
noverifyrdeps=yes
noshlibprovides=yes
short_desc="The Linux kernel headers for the kirkwood platform"
pkg_install() {
vmove usr/src
vmove usr/lib/modules/${_kernver}/build
}
}