aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-virtgrsec/APKBUILD
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2015-02-03 09:38:38 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2015-02-03 09:38:50 +0000
commit8eee05cbbaca2f797bbeee6bcebf03c6642fe332 (patch)
treee5930fd10c5e7fcc2ac68f72c3077d19e055b024 /main/linux-virtgrsec/APKBUILD
parent9ead6fda9e4f10a9faaf19965410400bbb985bfc (diff)
downloadaports-8eee05cbbaca2f797bbeee6bcebf03c6642fe332.tar.bz2
aports-8eee05cbbaca2f797bbeee6bcebf03c6642fe332.tar.xz
main/linux-virt-grsec: rename into linux-virtgrsec. Fixes #3846
Diffstat (limited to 'main/linux-virtgrsec/APKBUILD')
-rw-r--r--main/linux-virtgrsec/APKBUILD168
1 files changed, 168 insertions, 0 deletions
diff --git a/main/linux-virtgrsec/APKBUILD b/main/linux-virtgrsec/APKBUILD
new file mode 100644
index 0000000000..b2c4ec1e92
--- /dev/null
+++ b/main/linux-virtgrsec/APKBUILD
@@ -0,0 +1,168 @@
+# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
+# Maintainer: <bpiotrowski@alpinelinux.org>
+
+_flavor=virtgrsec
+pkgname=linux-${_flavor}
+pkgver=3.14.30
+case $pkgver in
+*.*.*) _kernver=${pkgver%.*};;
+*.*) _kernver=${pkgver};;
+esac
+pkgrel=1
+pkgdesc="Linux kernel for virtual guests with grsecurity"
+url="http://grsecurity.net"
+depends="mkinitfs linux-firmware"
+makedepends="perl sed installkernel bash gmp-dev bc"
+options="!strip"
+_config=${config:-kernelconfig.${CARCH}}
+install=
+source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz
+ http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz
+ grsecurity-3.0-$pkgver-201501272307.patch
+ fix-memory-map-for-PIE-applications.patch
+ imx6q-no-unclocked-sleep.patch
+
+ kernelconfig.x86
+ kernelconfig.x86_64
+ "
+subpackages="$pkgname-dev"
+arch="x86 x86_64"
+license="GPL-2"
+
+_abi_release=${pkgver}-${pkgrel}-${_flavor}
+
+prepare() {
+ local _patch_failed=
+ cd "$srcdir"/linux-$_kernver
+ if [ "${pkgver%.0}" = "$pkgver" ]; then
+ msg "Applying patch-$pkgver.xz"
+ unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N || return 1
+ fi
+
+ # first apply patches in specified order
+ for i in $source; do
+ case $i in
+ *.patch)
+ msg "Applying $i..."
+ if ! patch -s -p1 -N -i "$srcdir"/$i; then
+ echo $i >>failed
+ _patch_failed=1
+ fi
+ ;;
+ esac
+ done
+
+ if ! [ -z "$_patch_failed" ]; then
+ error "The following patches failed:"
+ cat failed
+ return 1
+ fi
+
+ rm -f localversion*
+ echo "-$pkgrel-$_flavor" > localversion-alpine
+
+ mkdir -p "$srcdir"/build
+ cp "$srcdir"/$_config "$srcdir"/build/.config || return 1
+ make -C "$srcdir"/linux-$_kernver O="$srcdir"/build HOSTCC="${CC:-gcc}" \
+ silentoldconfig
+}
+
+# this is so we can do: 'abuild menuconfig' to reconfigure kernel
+menuconfig() {
+ cd "$srcdir"/build || return 1
+ make menuconfig
+ cp .config "$startdir"/$_config
+}
+
+build() {
+ cd "$srcdir"/build
+ export GCC_SPECS=hardenednopie.specs
+ make CC="${CC:-gcc}" \
+ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
+ || return 1
+}
+
+package() {
+ cd "$srcdir"/build
+ mkdir -p "$pkgdir"/boot "$pkgdir"/lib/modules
+ make -j1 modules_install firmware_install install \
+ INSTALL_MOD_PATH="$pkgdir" \
+ INSTALL_PATH="$pkgdir"/boot \
+ || return 1
+
+ rm -f "$pkgdir"/lib/modules/${_abi_release}/build \
+ "$pkgdir"/lib/modules/${_abi_release}/source
+ rm -rf "$pkgdir"/lib/firmware
+
+ install -D include/config/kernel.release \
+ "$pkgdir"/usr/share/kernel/$_flavor/kernel.release
+}
+
+dev() {
+ # copy the only the parts that we really need for build 3rd party
+ # kernel modules and install those as /usr/src/linux-headers,
+ # simlar to what ubuntu does
+ #
+ # this way you dont need to install the 300-400 kernel sources to
+ # build a tiny kernel module
+ #
+ pkgdesc="Headers and script for third party modules for grsec kernel"
+ depends="gmp-dev bash"
+ local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
+
+ # first we import config, run prepare to set up for building
+ # external modules, and create the scripts
+ mkdir -p "$dir"
+ cp "$srcdir"/$_config "$dir"/.config
+ make -j1 -C "$srcdir"/linux-$_kernver O="$dir" HOSTCC="${CC:-gcc}" \
+ silentoldconfig prepare modules_prepare scripts
+
+ # remove the stuff that poits to real sources. we want 3rd party
+ # modules to believe this is the soruces
+ rm "$dir"/Makefile "$dir"/source
+
+ # copy the needed stuff from real sources
+ #
+ # this is taken from ubuntu kernel build script
+ # http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-jaunty.git;a=blob;f=debian/rules.d/3-binary-indep.mk;hb=HEAD
+ cd "$srcdir"/linux-$_kernver
+ find . -path './include/*' -prune -o -path './scripts/*' -prune \
+ -o -type f \( -name 'Makefile*' -o -name 'Kconfig*' \
+ -o -name 'Kbuild*' -o -name '*.sh' -o -name '*.pl' \
+ -o -name '*.lds' \) | cpio -pdm "$dir"
+ cp -a drivers/media/dvb/dvb-core/*.h "$dir"/drivers/media/dvb/dvb-core
+ cp -a drivers/media/video/*.h "$dir"/drivers/media/video
+ cp -a drivers/media/dvb/frontends/*.h "$dir"/drivers/media/dvb/frontends
+ cp -a scripts include "$dir"
+ find $(find arch -name include -type d -print) -type f \
+ | cpio -pdm "$dir"
+
+ install -Dm644 "$srcdir"/build/Module.symvers \
+ "$dir"/Module.symvers
+
+ mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
+ ln -sf /usr/src/linux-headers-${_abi_release} \
+ "$subpkgdir"/lib/modules/${_abi_release}/build
+}
+
+md5sums="b621207b3f6ecbb67db18b13258f8ea8 linux-3.14.tar.xz
+d4e6b893a18953a9a908e0559d2b32e0 patch-3.14.30.xz
+679bd4b74910bda35e0f5d5bacbd76eb grsecurity-3.0-3.14.30-201501272307.patch
+c6a4ae7e8ca6159e1631545515805216 fix-memory-map-for-PIE-applications.patch
+1a307fc1d63231bf01d22493a4f14378 imx6q-no-unclocked-sleep.patch
+6b30dd8284f37ecc244d556bebf32046 kernelconfig.x86
+8df8378d305bdd302b01293ff44e982d kernelconfig.x86_64"
+sha256sums="61558aa490855f42b6340d1a1596be47454909629327c49a5e4e10268065dffa linux-3.14.tar.xz
+d49803d1d4d99f8b984d8512d4413b7f03cc140be62de29c8cb7b10e40ae0a66 patch-3.14.30.xz
+8da6bbf7eb97012e27875e0b19075bde4c5c23baff1272e7a97b449c53e5475f grsecurity-3.0-3.14.30-201501272307.patch
+500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7 fix-memory-map-for-PIE-applications.patch
+21179fbb22a5b74af0a609350ae1a170e232908572b201d02e791d2ce0a685d3 imx6q-no-unclocked-sleep.patch
+5e06e22ca723e50ae9f4bfabdda2e738f7b28cbbfe77b6be295285d6cd75c916 kernelconfig.x86
+0ec1e1eb4445bd9751cb98a55afd4a430bed08e8d8c3c0a107d2f14ec5746dd2 kernelconfig.x86_64"
+sha512sums="5730d83a7a81134c1e77c0bf89e42dee4f8251ad56c1ac2be20c59e26fdfaa7bea55f277e7af156b637f22e1584914a46089af85039177cb43485089c74ac26e linux-3.14.tar.xz
+3f68a2131bbd8b91f13974c8c70453c0a3cece930e91a942d175d080be97cf917b85ab3552b39bd480aa803feedd3838717e262e698c555507be92c4d9144a9c patch-3.14.30.xz
+fcb17d4fb3118a406ad9cbb7e412a244e837cb60a3e0b065deef4a39121db7d1b28efba50cd5cd6ed8ea64338e1e69863da10d0077555f4d54094c68e34a9aa5 grsecurity-3.0-3.14.30-201501272307.patch
+4665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7 fix-memory-map-for-PIE-applications.patch
+87d1ad59732f265a5b0db54490dc1762c14ea4b868e7eb1aedc3ce57b48046de7bbc08cf5cfcf6f1380fa84063b0edb16ba3d5e3c5670be9bbb229275c88b221 imx6q-no-unclocked-sleep.patch
+29dc4bbde6052bb16200d87b7137717a053ad3c716a305a51d2b523531f35c1a7e144099f7a251c85849c9117a65ed961262dd314e0832f58750f489aeb1440e kernelconfig.x86
+74b647b4a05414fac76068869aa8a84e2a5c6e571dc40abb1532b8d2ac7c6577011be3ae5fb307fa63bd9f1ee184f993ded5ed15dd94311cbbf9086f12a79de8 kernelconfig.x86_64"