APKBUILD 4.4 KB
Newer Older
1
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2

3
_flavor=grsec
4
pkgname=linux-${_flavor}
5
pkgver=2.6.32.11
6
_kernver=2.6.32
7
pkgrel=1
8
9
pkgdesc="Linux kernel with grsecurity"
url=http://grsecurity.net
10
depends="mkinitfs linux-firmware"
11
makedepends="perl installkernel"
12
options="!strip"
13
_config=${config:-kernelconfig.${CARCH:-x86}}
14
install=
15
16
source="ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_kernver.tar.bz2
	ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-$pkgver.bz2
17
	grsecurity-2.1.14-2.6.32.11-201004071936.patch
18
	ip_gre.patch
19
	ip_gre2.patch
20
	arp.patch
21
	xfrm-cache-size-revert.patch
Natanael Copa's avatar
Natanael Copa committed
22
23
	net-git-78f1cd-r8169-fix-broken-register-writes.patch
	net-git-c0cd88-r8169-offical-fix-for-CVE-2009-4537-overlength-frame-DMAs.patch
24
	kernelconfig.x86
25
	"
26
subpackages="$pkgname-dev linux-firmware:firmware"
27
license="GPL-2"
Natanael Copa's avatar
Natanael Copa committed
28

29
30
_abi_release=${pkgver}-${_flavor}

31
prepare() {
32
33
	cd "$srcdir"/linux-$_kernver
	if [ "$_kernver" != "$pkgver" ]; then
34
		bunzip2 -c < ../patch-$pkgver.bz2 | patch -p1 -N || return 1
35
36
	fi

37
	for i in ../*.diff ../*.patch; do
38
		[ -f $i ] || continue
39
		msg "Applying $i..."
40
		patch -s -p1 -N < $i || return 1
41
42
43
44
	done

	mkdir -p "$srcdir"/build
	cp "$srcdir"/$_config "$srcdir"/build/.config
45
	make -C "$srcdir"/linux-$_kernver O="$srcdir"/build HOSTCC="$CC" \
46
		silentoldconfig
47
48
49
50
}

# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
51
	cd "$srcdir"/build || return 1
52
53
54
55
56
57
	make menuconfig
	cp .config "$startdir"/$_config
}

build() {
	cd "$srcdir"/build
58
	make CC="$CC" || return 1
59
}
Natanael Copa's avatar
Natanael Copa committed
60

61
62
package() {
	cd "$srcdir"/build
63
	mkdir -p "$pkgdir"/boot "$pkgdir"/lib/modules
Natanael Copa's avatar
Natanael Copa committed
64
	make modules_install install \
65
66
67
		INSTALL_MOD_PATH="$pkgdir" \
		INSTALL_PATH="$pkgdir"/boot

68
69
	rm -f "$pkgdir"/lib/modules/${_abi_release}/build \
		"$pkgdir"/lib/modules/${_abi_release}/source
70
	install -D include/config/kernel.release \
71
		"$pkgdir"/usr/share/kernel/$_flavor/kernel.release
Natanael Copa's avatar
Natanael Copa committed
72
73
}

74
75
76
77
78
79
80
81
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
	#
82
	pkgdesc="Headers and script for third party modules for grsec kernel"
83
	local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
84
85
86

	# first we import config, run prepare to set up for building 
	# external modules, and create the scripts
87
	mkdir -p "$dir"
88
	cp "$srcdir"/$_config "$dir"/.config
89
	make -j1 -C "$srcdir"/linux-$_kernver O="$dir" HOSTCC="$CC" \
90
91
		silentoldconfig prepare scripts

92
93
	# remove the stuff that poits to real sources. we want 3rd party
	# modules to believe this is the soruces
94
95
	rm "$dir"/Makefile "$dir"/source

96
97
	# copy the needed stuff from real sources
	#
98
	# this is taken from ubuntu kernel build script
99
	# http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-jaunty.git;a=blob;f=debian/rules.d/3-binary-indep.mk;hb=HEAD
100
101
102
103
104
105
106
107
108
109
110
	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"
111
112
113

	install -Dm644 "$srcdir"/build/Module.symvers \
		"$dir"/Module.symvers
114
115
116
117

	mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
	ln -sf /usr/src/linux-headers-${_abi_release} \
		"$subpkgdir"/lib/modules/${_abi_release}/build
118
119
}

120
121
122
123
124
125
126
firmware() {
	pkgdesc="Firmware for linux kernel"
	replaces="linux-grsec linux-vserver"
	mkdir -p "$subpkgdir"/lib
	mv "$pkgdir"/lib/firmware "$subpkgdir"/lib/
}

127
md5sums="260551284ac224c3a43c4adac7df4879  linux-2.6.32.tar.bz2
128
855c248334a71ef5ca3d8cb89d51334f  patch-2.6.32.11.bz2
129
6eabb0c08a988a97a823b5462d1c5018  grsecurity-2.1.14-2.6.32.11-201004071936.patch
130
3ef822f3a2723b9a80c3f12954457225  ip_gre.patch
131
13ca9e91700e459da269c957062bbea7  ip_gre2.patch
132
4c39a161d918e7f274292ecfd168b891  arp.patch
133
329fcab881425e001d3243caa4648478  xfrm-cache-size-revert.patch
Natanael Copa's avatar
Natanael Copa committed
134
135
21ed38773d846097b7315e1e0801d87a  net-git-78f1cd-r8169-fix-broken-register-writes.patch
962a6dd7c639612fc8bdaeb836388b0b  net-git-c0cd88-r8169-offical-fix-for-CVE-2009-4537-overlength-frame-DMAs.patch
136
7f442049b29ab749180e54ff8f20f1d0  kernelconfig.x86"