summaryrefslogtreecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: 7fccf2f76adf109b055413b3ef07a47d41784813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
# KEEP THIS IN SYNC with the other easy-kernel packages.
_kflavour=""
_pkgname=easy-kernel$_kflavour
pkgver=4.14.138
pkgrel=15
pkgname=$_pkgname-$pkgver-mc$pkgrel
pkgdesc="The Linux kernel, packaged for your convenience"
url="https://kernel.org/"
arch="all"
options="!check !dbg !strip !tracedeps"
license="GPL-2.0-only"
depends=""
makedepends="bc gzip kmod lzop openssl-dev xz"
provides="easy-kernel$_kflavour=$pkgver-r$pkgrel"
subpackages="$_pkgname-modules-$pkgver-mc$pkgrel:modules
	$_pkgname-src-$pkgver-mc$pkgrel:src
	linux-headers:headers"
_pkgmajver=${pkgver%%.*}
_pkgminver=${pkgver%.*}
source="https://cdn.kernel.org/pub/linux/kernel/v${_pkgmajver}.x/linux-${_pkgminver}.tar.xz
	https://distfiles.adelielinux.org/source/linux-${_pkgminver}-mc$pkgrel-patches.tar.xz
	ast-endianness.patch
	config-ppc64
	config-ppc
	config-x86_64
	config-pmmx
	config-aarch64
	config-sparc64
	config-m68k
	kernel.h
	"
builddir="$srcdir/linux-${_pkgminver}"

# secfixes: linux_kernel
#   4.14.0-r0:
#     - CVE-2017-1000410
#   4.14.8-r2:
#     - CVE-2018-14619
#     - CVE-2017-1000407
#   4.14.33-r6:
#     - CVE-2018-1068
#     - CVE-2018-1130
#     - CVE-2018-8781
#   4.14.48-r8:
#     - CVE-2018-1120
#     - CVE-2018-10021
#     - CVE-2018-10940
#     - CVE-2018-11508
#     - CVE-2018-1000204
#   4.14.56-r9:
#     - CVE-2018-1118
#     - CVE-2018-10853
#     - CVE-2018-10878
#     - CVE-2018-10879
#     - CVE-2018-10880
#     - CVE-2018-10881
#     - CVE-2018-11412
#     - CVE-2018-12904
#     - CVE-2018-13406
#     - CVE-2018-16276
#     - CVE-2018-20856
#   4.14.76-r11:
#     - CVE-2017-18216
#     - CVE-2017-18224
#     - CVE-2018-5390
#     - CVE-2018-5391
#     - CVE-2018-6554
#     - CVE-2018-6555
#     - CVE-2018-15572
#     - CVE-2018-15594
#     - CVE-2018-16658
#     - CVE-2018-16871
#     - CVE-2018-18021
#     - CVE-2018-20511
#   4.14.127-r14:
#     - CVE-2018-18281
#     - CVE-2018-18397
#     - CVE-2018-18690
#     - CVE-2018-19854
#     - CVE-2018-20169
#     - CVE-2018-20784
#     - CVE-2018-20836
#     - CVE-2018-1000026
#     - CVE-2019-6974
#     - CVE-2019-10638
#     - CVE-2019-10639
#     - CVE-2019-11486
#     - CVE-2019-11599
#     - CVE-2019-11810
#     - CVE-2019-11815
#     - CVE-2019-11884
#     - CVE-2019-12818
#     - CVE-2019-12819
#   4.14.138-mc15:
#     - CVE-2018-20855
#     - CVE-2019-1125
#     - CVE-2019-3900
#     - CVE-2019-13272
#     - CVE-2019-13631
#     - CVE-2019-13648
#     - CVE-2019-14283
#     - CVE-2019-14284

prepare() {
	for patch in "$srcdir/linux-${_pkgminver}-mc$pkgrel-patches"/*; do
		patch -p1 -i "$patch"
	done
	default_prepare

	cd "$srcdir"
	cp config-$CARCH linux-${_pkgminver}/.config
	cp -pr linux-${_pkgminver} linux-src
}

build() {
	make LDFLAGS=""

	cd "$srcdir/linux-src"
	make LDFLAGS="" modules_prepare clean
	cp "$builddir/Module.symvers" .

	# Kernel bug: crtsavres.o is required to build modules, but modules_prepare doesn't create it.
	if [ $CARCH = ppc ]; then
		cp "$builddir/arch/powerpc/lib/crtsavres.o" arch/powerpc/lib/
	fi
}

package() {
	mkdir -p "$pkgdir"/boot
	make INSTALL_PATH="$pkgdir"/boot \
		INSTALL_MOD_PATH="$pkgdir" \
		install modules_install

	if [ -f "$pkgdir"/boot/vmlinuz ]; then
		mv "$pkgdir"/boot/vmlinuz \
			"$pkgdir"/boot/vmlinuz-$pkgver-mc$pkgrel-easy$_kflavour
	fi
	if [ -f "$pkgdir"/boot/vmlinux ]; then
		mv "$pkgdir"/boot/vmlinux \
			"$pkgdir"/boot/vmlinux-$pkgver-mc$pkgrel-easy$_kflavour
	fi

	if [ -f "$pkgdir"/boot/System.map ]; then
		mv "$pkgdir"/boot/System.map \
			"$pkgdir"/boot/System.map-$pkgver-mc$pkgrel-easy$_kflavour
	fi

	case $CARCH in
	aarch64|arm*)	make INSTALL_PATH="$pkgdir"/boot dtbs_install ;;
	esac

	install -D "$builddir"/include/config/kernel.release \
		"$pkgdir"/usr/share/kernel/easy-$pkgver-mc$pkgrel$_kflavour/kernel.release
}

modules() {
	pkgdesc="Modules / device drivers for easy-kernel"
	provides="easy-kernel$_kflavour-modules=$pkgver-r$pkgrel"
	autodeps=0  # modules should not depend on src just for symlink
	mkdir -p "$subpkgdir"/lib
	mv "$pkgdir"/lib/modules "$subpkgdir"/lib/
	rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build
	rm "$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/build
	ln -s "../../../usr/src/linux-$pkgver-mc$pkgrel$_kflavour" \
		"$subpkgdir"/lib/modules/$pkgver-mc$pkgrel-easy$_kflavour/source
}

headers() {
	pkgdesc="System headers provided by the Linux kernel"
	cd "$builddir"
	patch -Np1 -i "$srcdir"/../revert-broken-uapi.patch

	mkdir -p "$subpkgdir"/usr
	make headers_install INSTALL_HDR_PATH="$subpkgdir/usr"

	find "$subpkgdir/usr" \( -name .install -o -name ..install.cmd \) -exec \
		rm -f {} \;

	# provided by libdrm
	rm -rf "$subpkgdir"/usr/include/drm

	# needed for spl, VMware on x86, etc
	install -D -m644 "$builddir"/include/generated/utsrelease.h \
		"$subpkgdir"/usr/include/linux/utsrelease.h

	cp "$srcdir"/kernel.h "$subpkgdir"/usr/include/linux/
}

src() {
	pkgdesc="Kernel source code used to build the kernel"
	provides="easy-kernel$_kflavour-src=$pkgver-r$pkgrel"
	mkdir -p "$subpkgdir"/usr/src
	mv "$srcdir"/linux-src "$subpkgdir"/usr/src/linux-$pkgver-mc$pkgrel$_kflavour
}

sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8  linux-4.14.tar.xz
f81ad5ed82bc1141b97be22c3767d3c1984bed50ff847f3596609bdece05a70ba8e73fb7d5aa3163898b7e77c8b5eb4d8be4f2e9f84f17579f8b70c96f465317  linux-4.14-mc15-patches.tar.xz
e41d9111219342ad13367902242444ecdd847a93575c3f9709d6c6a075bc650f4a15be9db1a8798435fc0a0b56d41705829bfe0d2c2d88f8d1c28931e27ef5be  ast-endianness.patch
169bfc8cf7463e22e67477907ba2f02593178db8a04d1d0f4f52d834087cbd3d504328960849e90532e95d16dc7f29fdbcc55d231696dcd6dbb0df4b0a337ce6  config-ppc64
d939115ee69713efd4ac47fa75e30536fbefe90dcfdfcba38ec31ed97afe53a4cdacb4750946bf2841ddd5d8d1fa34ec2c6c0207a9efef5110a23cae67ff34c8  config-ppc
dbda29dd1dba54713d27e73e25b67fcd54ca9af1e18b50fd174628dccf15af7a8a604bf795d8da381f9c299889ce5cfb8fd3cefddf7cbbbaad78fb028c04facb  config-x86_64
85aef081cefb13ab319e5fbccc47b90a439dbb7be00895681569420339dc34c55e42278c471ca15144e84e6fc8a57a3a0899c2caee7e00dab9e369a5dea90e3b  config-pmmx
378120b61b6809a44a5bde9049b2f90345df8fe93caf2091887a5278bcd7bf002ba57565b73ec618e6029543f251d12136ef5094b594a78be652a2273ecc31b3  config-aarch64
93456f06225ac67edd697dfa46e4ec38293e8da4dd67fe6cd3f4a7f961956fe35e27d506ef3481f2a49ad73f2b736a88b37ceaa17e9e8c94f99346268bc1ea9d  config-sparc64
9be2ec1b09cf233c4259fb1dd1a9afa89b873ebc51bea9f15443180cba1968a905c6333cb2ed5a7976120a67e1b9848cd0aaaf7596a88f2c388328c48a487134  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"