2015-01-19 14:30:54 +01:00
|
|
|
# Template file for 'sun7i-kernel'
|
2014-01-25 14:25:44 +01:00
|
|
|
#
|
2014-10-09 08:27:08 +02:00
|
|
|
# Latest commit as of 20141009
|
|
|
|
_githash="0c7986b137afd15670df1f66c83031a2c5d7b10c"
|
2014-01-25 14:25:44 +01:00
|
|
|
_gitshort="${_githash:0:7}"
|
|
|
|
|
2015-01-19 14:30:54 +01:00
|
|
|
pkgname=sun7i-kernel
|
2014-10-09 08:27:08 +02:00
|
|
|
version=3.4.103
|
2015-05-26 13:54:14 +02:00
|
|
|
revision=4
|
2015-04-10 09:16:30 +02:00
|
|
|
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
2014-01-25 14:25:44 +01:00
|
|
|
homepage="http://www.kernel.org"
|
|
|
|
license="GPL-2"
|
2015-01-19 14:30:54 +01:00
|
|
|
short_desc="Linux kernel for sun7i (${version%.*} series [git ${_gitshort}])"
|
2014-01-26 13:21:46 +01:00
|
|
|
distfiles="https://github.com/linux-sunxi/linux-sunxi/archive/${_githash}.tar.gz"
|
2014-10-09 08:27:08 +02:00
|
|
|
checksum=fb836df43e0f981ed33a18b4b8009360d6cbb5695f378ccb4b2d9fb30d310ca3
|
2014-01-25 14:25:44 +01:00
|
|
|
|
|
|
|
wrksrc="linux-sunxi-${_githash}"
|
|
|
|
_kernver="${version}_${revision}"
|
|
|
|
|
|
|
|
nostrip=yes
|
|
|
|
noverifyrdeps=yes
|
2015-05-26 07:39:16 +02:00
|
|
|
only_for_archs="armv7l armv7l-musl"
|
2015-03-27 10:50:40 +01:00
|
|
|
hostmakedepends="perl python kmod uboot-mkimage libressl-openssl bc"
|
2014-01-25 14:25:44 +01:00
|
|
|
makedepends="ncurses-devel"
|
|
|
|
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"
|
|
|
|
|
|
|
|
do_configure() {
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
|
|
|
fi
|
|
|
|
|
2015-03-22 18:35:50 +01:00
|
|
|
# Apply backported kernel firmware changes required by eudev>=2.1.
|
|
|
|
$XBPS_FETCH_CMD https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/core/linux-sun7i/0001-Backport-firmware-loader.patch
|
|
|
|
patch -p1 -i 0001-Backport-firmware-loader.patch
|
2015-05-21 11:35:25 +02:00
|
|
|
# Apply backported kernel msdos partition UUID changes
|
|
|
|
$XBPS_FETCH_CMD https://raw.githubusercontent.com/archlinuxarm/PKGBUILDs/master/core/linux-sun7i/0001-Backport-msdos-partition-UUIDs.patch
|
|
|
|
patch -p1 -i 0001-Backport-msdos-partition-UUIDs.patch
|
2015-03-22 18:35:50 +01:00
|
|
|
|
2014-01-25 14:25:44 +01:00
|
|
|
unset LDFLAGS
|
2014-01-26 18:58:16 +01:00
|
|
|
if [ -f ${FILESDIR}/config ]; then
|
|
|
|
cp ${FILESDIR}/config .config
|
|
|
|
make ${makejobs} ${_args} ARCH=arm oldconfig
|
|
|
|
else
|
|
|
|
# Use upstream default configuration, too huge!
|
|
|
|
make ${makejobs} ${_args} ARCH=arm sun7i_defconfig
|
|
|
|
fi
|
2014-01-25 14:25:44 +01:00
|
|
|
|
|
|
|
# Always use our revision to CONFIG_LOCALVERSION to match our pkg version.
|
|
|
|
sed -i -e "s|^\(CONFIG_LOCALVERSION=\).*|\1\"_${revision}\"|" .config
|
|
|
|
|
|
|
|
# Enable Autofs for systemd
|
|
|
|
sed -i -e "s|.*CONFIG_AUTOFS4_FS.*|CONFIG_AUTOFS4_FS=y|" .config
|
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
_args="CROSS_COMPILE=${XBPS_CROSS_TRIPLET}-"
|
|
|
|
fi
|
|
|
|
unset LDFLAGS
|
|
|
|
make ${makejobs} ${_args} ARCH=arm prepare
|
2015-05-26 13:54:14 +02:00
|
|
|
make ${makejobs} ${_args} ARCH=arm zImage modules
|
2014-01-25 14:25:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
do_install() {
|
|
|
|
local hdrdest
|
|
|
|
|
|
|
|
# Run depmod after compressing modules.
|
|
|
|
sed -i '2iexit 0' scripts/depmod.sh
|
|
|
|
|
|
|
|
# Install kernel, firmware and modules
|
|
|
|
make ARCH=arm INSTALL_MOD_PATH=${DESTDIR} modules_install
|
|
|
|
|
2015-05-26 13:54:14 +02:00
|
|
|
vinstall arch/arm/boot/zImage 644 boot
|
2014-01-25 14:25:44 +01:00
|
|
|
|
|
|
|
hdrdest=${DESTDIR}/usr/src/${sourcepkg}-kernel-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}
|
|
|
|
|
|
|
|
# Remove firmware stuff provided by the "linux-firmware" pkg.
|
|
|
|
rm -rf ${DESTDIR}/usr/lib/firmware
|
|
|
|
|
|
|
|
mkdir -p ${hdrdest}/include
|
|
|
|
for i in acpi asm-generic config crypto drm generated linux math-emu \
|
|
|
|
media net pcmcia scsi sound trace 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-exynos
|
|
|
|
mkdir -p ${hdrdest}/arch/arm/plat-samsung
|
|
|
|
|
|
|
|
cp -a arch/arm/include ${hdrdest}/arch/arm
|
|
|
|
cp -a arch/arm/mach-sun7i/include ${hdrdest}/arch/arm/mach-sun7i
|
|
|
|
|
|
|
|
mkdir -p ${hdrdest}/arch/arm/kernel
|
|
|
|
|
|
|
|
cp arch/arm/Makefile ${hdrdest}/arch/arm
|
|
|
|
if [ "$MACHINE_ARCH" = "i686" ]; then
|
|
|
|
cp arch/arm/Makefile_32.cpu ${hdrdest}/arch/arm
|
|
|
|
fi
|
|
|
|
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"
|
2015-05-21 11:35:25 +02:00
|
|
|
find ${DESTDIR} -name '*.ko'|xargs -n1 -P0 gzip -9
|
2014-01-25 14:25:44 +01:00
|
|
|
|
|
|
|
# ... and run depmod again.
|
|
|
|
depmod -b ${DESTDIR}/usr -F System.map ${_kernver}
|
|
|
|
}
|
|
|
|
|
2015-01-19 14:30:54 +01:00
|
|
|
sun7i-kernel-headers_package() {
|
2014-01-25 14:25:44 +01:00
|
|
|
nostrip=yes
|
|
|
|
noverifyrdeps=yes
|
2015-01-19 14:30:54 +01:00
|
|
|
short_desc="Linux kernel headers for sun7i (${version%.*} series [${_gitshort}])"
|
2014-01-25 14:25:44 +01:00
|
|
|
pkg_install() {
|
|
|
|
vmove usr/src
|
|
|
|
vmove usr/lib/modules/${_kernver}/build
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|