summaryrefslogtreecommitdiff
path: root/system/easy-kernel/APKBUILD
blob: f31d370f27cdca8bab13c0ff0c3c1ee8d785a499 (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
55f0e4007f255670fc7a462c311020d45ea33d479776015dd824134be1bf5d96bd6c95ec663126a368388df6a8c52cb2c477487b18899e90d6b85c0639ecf0ab  config-ppc64
8fd86dd4c753ce21a28f7ac58728e55eccc3bdf7cc9d5249053cf095e75337dcc031837256af28260a1a507140a3e13e0fa0b4131864e127d5ed2700c04c683a  config-ppc
6ae5ebd56e5743c9fc081023d89d732b13f26ef5db33de5754fea0c4f76234f5bbf62e67b8a9913c966e3d6d8972e9f303539324642907b82e91a8aa19fa38c3  config-x86_64
4d9796985ee7e031bffb4d35260e21c1cfee3f49da1afe6587cfd4f9b70b7ba2e7ac148b98640277afb062c650e39b26d04cd200601c99787ec40470d7432dd5  config-pmmx
378120b61b6809a44a5bde9049b2f90345df8fe93caf2091887a5278bcd7bf002ba57565b73ec618e6029543f251d12136ef5094b594a78be652a2273ecc31b3  config-aarch64
93456f06225ac67edd697dfa46e4ec38293e8da4dd67fe6cd3f4a7f961956fe35e27d506ef3481f2a49ad73f2b736a88b37ceaa17e9e8c94f99346268bc1ea9d  config-sparc64
9be2ec1b09cf233c4259fb1dd1a9afa89b873ebc51bea9f15443180cba1968a905c6333cb2ed5a7976120a67e1b9848cd0aaaf7596a88f2c388328c48a487134  config-m68k
fdd94b9de7b374f1812dec0f9971c05f5e52177ca4a16c8071daa620c18265b38f656f528e7045a24f30af01f05e53e54546fb0a9e93773cf191866e87de505d  kernel.h"