2014-01-23 11:55:39 +00:00
|
|
|
# Template file for 'rpi-kernel'
|
2013-02-19 16:55:45 +00:00
|
|
|
#
|
2014-11-07 15:35:17 +00:00
|
|
|
_githash="519c51ec5c429c84c59a301b65d16fb79e9e09b2"
|
2014-01-23 11:55:39 +00:00
|
|
|
_gitshort="${_githash:0:7}"
|
2013-09-14 04:18:50 +00:00
|
|
|
|
2014-01-23 11:55:39 +00:00
|
|
|
pkgname=rpi-kernel
|
2014-11-07 15:35:17 +00:00
|
|
|
version=3.12.31
|
2014-10-20 13:58:19 +00:00
|
|
|
revision=1
|
2014-01-23 11:55:39 +00:00
|
|
|
wrksrc="linux-${_githash}"
|
2013-02-19 16:55:45 +00:00
|
|
|
maintainer="Juan RP <xtraeme@gmail.com>"
|
|
|
|
homepage="http://www.kernel.org"
|
|
|
|
license="GPL-2"
|
2014-05-04 11:19:39 +00:00
|
|
|
short_desc="The Linux kernel and modules for Raspberry Pi (${version%.*} series [git ${_gitshort}])"
|
2014-01-23 11:55:39 +00:00
|
|
|
distfiles="https://github.com/raspberrypi/linux/archive/${_githash}.tar.gz"
|
2014-11-07 15:35:17 +00:00
|
|
|
checksum=c2e78cb2bf5184e0c688ad1eb136fc66e08858aa2b1a45f77d274a5603e6043a
|
2013-02-19 16:55:45 +00:00
|
|
|
|
|
|
|
_kernver="${version}_${revision}"
|
2014-01-01 15:10:11 +00:00
|
|
|
|
|
|
|
nostrip=yes
|
|
|
|
noverifyrdeps=yes
|
2014-01-23 11:55:39 +00:00
|
|
|
|
2014-01-02 16:31:16 +00:00
|
|
|
only_for_archs="armv6l"
|
2014-08-06 08:07:49 +00:00
|
|
|
hostmakedepends="perl python kmod>=11_2 uboot-mkimage libressl-openssl elfutils bc"
|
2013-04-12 15:12:12 +00:00
|
|
|
makedepends="ncurses-devel"
|
2014-01-23 11:55:39 +00:00
|
|
|
replaces="kernel-rpi>=0"
|
2014-01-01 15:10:11 +00:00
|
|
|
triggers="kernel-hooks"
|
|
|
|
# These files could be modified when an external module is built.
|
|
|
|
mutable_files="
|
|
|
|
/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"
|
2013-05-27 21:05:10 +00:00
|
|
|
|
2014-01-23 11:55:39 +00:00
|
|
|
pre_configure() {
|
2013-05-27 21:55:34 +00:00
|
|
|
# Remove .git directory, otherwise scripts/setkernelversion.sh
|
|
|
|
# modifies KERNELRELEASE and appends + to it.
|
|
|
|
rm -rf .git
|
2013-05-27 21:05:10 +00:00
|
|
|
}
|
2013-02-19 16:55:45 +00:00
|
|
|
|
2013-03-14 12:53:59 +00:00
|
|
|
do_configure() {
|
2013-05-27 21:05:10 +00:00
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
2013-02-19 16:55:45 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy required files to create the bootable image.
|
|
|
|
cp ${FILESDIR}/args-uncompressed.txt arch/arm/boot/
|
|
|
|
cp ${FILESDIR}/boot-uncompressed.txt arch/arm/boot/
|
|
|
|
cp ${FILESDIR}/imagetool-uncompressed.py arch/arm/boot/
|
|
|
|
|
2013-09-14 04:18:50 +00:00
|
|
|
# Use upstream default configuration, no need to maintain ours.
|
|
|
|
make ${makejobs} ${_args} ARCH=arm bcmrpi_defconfig
|
2013-02-19 16:55:45 +00:00
|
|
|
|
|
|
|
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
|
|
|
|
sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
|
2013-03-14 12:53:59 +00:00
|
|
|
}
|
2013-02-19 16:55:45 +00:00
|
|
|
|
2013-03-14 12:53:59 +00:00
|
|
|
do_build() {
|
2013-05-27 21:05:10 +00:00
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
2013-03-14 12:53:59 +00:00
|
|
|
fi
|
2013-02-19 16:55:45 +00:00
|
|
|
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
|
2014-05-04 11:19:39 +00:00
|
|
|
make ${makejobs} ARCH=arm INSTALL_MOD_PATH=${DESTDIR} modules_install
|
2013-02-19 16:55:45 +00:00
|
|
|
|
|
|
|
# Generate kernel.img and install it to destdir.
|
|
|
|
cd arch/arm/boot
|
|
|
|
/usr/bin/python2 imagetool-uncompressed.py
|
|
|
|
cd ${wrksrc}
|
|
|
|
vinstall arch/arm/boot/kernel.img 644 boot
|
|
|
|
|
2014-01-23 11:55:39 +00:00
|
|
|
hdrdest=${DESTDIR}/usr/src/${sourcepkg}-headers-${_kernver}
|
2013-02-19 16:55:45 +00:00
|
|
|
|
|
|
|
# Switch to /usr.
|
|
|
|
vmkdir usr
|
2013-05-27 21:15:54 +00:00
|
|
|
mv ${DESTDIR}/lib ${DESTDIR}/usr
|
2013-02-19 16:55:45 +00:00
|
|
|
|
2013-05-27 21:15:54 +00:00
|
|
|
cd ${DESTDIR}/usr/lib/modules/${_kernver}
|
|
|
|
rm -f source build
|
2014-01-23 11:55:39 +00:00
|
|
|
ln -sf ../../../src/${sourcepkg}-headers-${_kernver} build
|
2013-02-19 16:55:45 +00:00
|
|
|
|
|
|
|
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 \
|
2014-08-10 19:18:17 +00:00
|
|
|
media net pcmcia scsi sound trace uapi video xen; do
|
2013-02-19 16:55:45 +00:00
|
|
|
[ -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-bcm2708
|
|
|
|
cp -a arch/arm/include ${hdrdest}/arch/arm
|
|
|
|
cp -a arch/arm/mach-bcm2708/include ${hdrdest}/arch/arm/mach-bcm2708
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# add dvb headers for external modules
|
|
|
|
mkdir -p ${hdrdest}/include/config/dvb/
|
|
|
|
cp include/config/dvb/*.h ${hdrdest}/include/config/dvb/
|
|
|
|
|
|
|
|
# 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' -exec gzip -9 {} \;
|
|
|
|
|
|
|
|
# ... and run depmod again.
|
|
|
|
depmod -b ${DESTDIR}/usr -F System.map ${_kernver}
|
|
|
|
}
|
2013-04-12 15:12:12 +00:00
|
|
|
|
2014-01-23 11:55:39 +00:00
|
|
|
rpi-kernel-headers_package() {
|
2013-04-12 15:12:12 +00:00
|
|
|
nostrip=yes
|
|
|
|
noverifyrdeps=yes
|
2014-01-23 11:55:39 +00:00
|
|
|
replaces="kernel-rpi-headers>=0"
|
2014-05-04 11:19:39 +00:00
|
|
|
short_desc="The Linux kernel headers for Raspberry Pi (${version%.*} series [git ${_gitshort}])"
|
2013-04-12 15:12:12 +00:00
|
|
|
pkg_install() {
|
|
|
|
vmove usr/src
|
|
|
|
vmove usr/lib/modules/${_kernver}/build
|
|
|
|
}
|
|
|
|
}
|