-
Notifications
You must be signed in to change notification settings - Fork 3
/
PKGBUILD
318 lines (267 loc) · 13.5 KB
/
PKGBUILD
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# Based on the file created for Arch Linux by:
# Tobias Powalowski <tpowa@archlinux.org>
# Thomas Baechler <thomas@archlinux.org>
# Maintainer: Philip Müller (x86_64) <philm@manjaro.org>
# Maintainer: Jonathon Fernyhough (i686) <jonathon@manjaro.org>
# Contributor: Helmut Stult <helmut[at]manjaro[dot]org>
pkgbase=linux54
pkgname=('linux54' 'linux54-headers')
_kernelname=-MANJARO-DELLXPS7390-2IN1
_basekernel=5.4
_basever=54
_aufs=20191014
_sub=0
_rc=rc7
_commit=31f4f5b495a62c9a8b15b1c3581acd5efeb9af8c
_shortcommit=${_rc}.d1110.g${_commit:0:7}
pkgver=${_basekernel}${_shortcommit}
#pkgver=${_basekernel}.${_sub}
pkgrel=1
arch=('i686' 'x86_64')
url="http://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'elfutils' 'git')
options=('!strip')
source=(#"https://www.kernel.org/pub/linux/kernel/v5.x/linux-${_basekernel}.tar.xz"
#"https://www.kernel.org/pub/linux/kernel/v5.x/patch-${pkgver}.xz"
#https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/snapshot/linux-stable-rc-$_commit.tar.gz
#"linux-${pkgver}.tar.gz::https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot/linux-$_commit.tar.gz"
"linux-${pkgver}.zip::https://codeload.github.com/torvalds/linux/zip/$_commit"
# the main kernel config files
'config.x86_64' 'config' 'config.aufs'
# AUFS Patches
"aufs5.x-rcN-${_aufs}.patch"
'aufs5-base.patch'
'aufs5-kbuild.patch'
'aufs5-loopback.patch'
'aufs5-mmap.patch'
'aufs5-standalone.patch'
'tmpfs-idr.patch'
'vfs-ino.patch'
# ARCH Patches
0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
# MANJARO Patches
'0001-apparmor-patch-to-provide-compatibility-with-v2-net-rules.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/6408dbde30855bb9a2af44c9053ba2329db57c7f.patch'
'0002-apparmor-af_unix-mediation.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/7a291673471aa583694ee760aa33e5a3f5ae9a9e.patch'
'0003-apparmor-fix-use-after-free-in-sk_peer_label.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/9ae046ed7b54b01078e33227fa266282c41f981d.patch'
'0004-apparmor-fix-apparmor-mediating-locking-non-fs-unix-sockets.patch::https://gitlab.com/apparmor/apparmor-kernel/commit/b6a5dfbaa728854457570bf72b693a89550cc1f8.patch'
# Bootsplash
'0001-bootsplash.patch'
'0002-bootsplash.patch'
'0003-bootsplash.patch'
'0004-bootsplash.patch'
'0005-bootsplash.patch'
'0006-bootsplash.patch'
'0007-bootsplash.patch'
'0008-bootsplash.patch'
'0009-bootsplash.patch'
'0010-bootsplash.patch'
'0011-bootsplash.patch'
'0012-bootsplash.patch'
'0013-bootsplash.patch'
# Dell XPS 7390 2-in-1 fixes
'dellxps-fixlpss.patch'
'dellxps-suspend.patch'
'dellxps-icelake-screencorruptionfix.patch')
sha256sums=('276e68128d4d3a0af1adaf23b0c53dc591284d0f2f40b60c9158b0706c875b50'
'120cd07da46f0b07a29a53cd7f9cae88ce3231f127b6254233461fa10366b77b'
'f5903377d29fc538af98077b81982efdc091a8c628cb85566e88e1b5018f12bf'
'b44d81446d8b53d5637287c30ae3eb64cae0078c3fbc45fcf1081dd6699818b5'
'0470163b186b8a9e71bd96a0a29091c78a7551b6574363023ed462110d00831d'
'7ff57fd146dc4c8f5fd37062e44cbf7e70164df5a684d3b4bb3e8a787c060503'
'92787f126e40069f7179e63f9949cc8848f595afbe89208bc9d6285ee76f590b'
'16e981ac6beedd3bc264e03c1e8d25681d8ad9e5ad469e3630b3e2e6ba76e8ec'
'a44fb19196c2e63e2733a210358afb309f598d8155488424a8620ec7f309de08'
'1060cceb84a7d178d4a0e1946d06055ddab0b5b110d385e9d087557143c6659f'
'55dc8df3a3d3e248eb93f5878f567428f77acb72f6243934bd6980cfede3b6ca'
'e2d75e11a2c220e5d3a450bb226e7e19d62a871764da5f76034fbc135fe6c749'
'37b86ca3de148a34258e3176dbf41488d9dbd19e93adbd22a062b3c41332ce85'
'4b4146786e68af3bd49e9fabdbc92232e51cb2da179ba8037287b96d8addd17c'
'ac2cff4d3b04dde98bafc67e1a898fa8628f3bacba08531ce473edc43ddcccff'
'749ac28edc2cd2ac3a4406becc13327a1ece3445196ca41cbfca460454fa01bf'
'e55e88fe22256f079f5ac7b015c2d510912cae6f48a27a0f768b8f5f6acfc11b'
'a504f6cf84094e08eaa3cc5b28440261797bf4f06f04993ee46a20628ff2b53c'
'e096b127a5208f56d368d2cb938933454d7200d70c86b763aa22c38e0ddb8717'
'8c1c880f2caa9c7ae43281a35410203887ea8eae750fe8d360d0c8bf80fcc6e0'
'1144d51e5eb980fceeec16004f3645ed04a60fac9e0c7cf88a15c5c1e7a4b89e'
'dd4b69def2efacf4a6c442202ad5cb93d492c03886d7c61de87696e5a83e2846'
'028b07f0c954f70ca37237b62e04103e81f7c658bb8bd65d7d3c2ace301297dc'
'c8b0cb231659d33c3cfaed4b1f8d7c8305ab170bdd4c77fce85270d7b6a68000'
'8dbb5ab3cb99e48d97d4e2f2e3df5d0de66f3721b4f7fd94a708089f53245c77'
'a7aefeacf22c600fafd9e040a985a913643095db7272c296b77a0a651c6a140a'
'e9f22cbb542591087d2d66dc6dc912b1434330ba3cd13d2df741d869a2c31e89'
'27471eee564ca3149dd271b0817719b5565a9594dc4d884fe3dc51a5f03832bc'
'60e295601e4fb33d9bf65f198c54c7eb07c0d1e91e2ad1e0dd6cd6e142cb266d'
'035ea4b2a7621054f4560471f45336b981538a40172d8f17285910d4e0e0b3ef'
'd43a8a6b0a8847ad3cb423bdf084f42198a76d96532c3856d70b2cb005979aec'
'0706518daee7e44301de980e2e5bf29c00e1bcbf48ba24d2d72ccae0f5911e3d'
'2eb0c8b27e09e086e37cc9023440611fbfe2f72578bb380b653f6aa14908840a')
prepare() {
#mv "${srcdir}/linux-stable-rc-${_commit}" "${srcdir}/linux-${_basekernel}"
mv "${srcdir}/linux-${_commit}" "${srcdir}/linux-${_basekernel}"
cd "${srcdir}/linux-${_basekernel}"
# add upstream patch
#patch -p1 -i "${srcdir}/patch-${pkgver}"
# add latest fixes from stable queue, if needed
# http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
# enable only if you have "gen-stable-queue-patch.sh" executed before
#patch -Np1 -i "${srcdir}/prepatch-${_basekernel}`date +%Y%m%d`"
# disable USER_NS for non-root users by default
patch -Np1 -i ../0001-add-sysctl-to-disallow-unprivileged-CLONE_NEWUSER-by.patch
# add patches for snapd
# https://gitlab.com/apparmor/apparmor-kernel/tree/5.2-outoftree
patch -Np1 -i "${srcdir}/0001-apparmor-patch-to-provide-compatibility-with-v2-net-rules.patch"
patch -Np1 -i "${srcdir}/0002-apparmor-af_unix-mediation.patch"
patch -Np1 -i "${srcdir}/0003-apparmor-fix-use-after-free-in-sk_peer_label.patch"
patch -Np1 -i "${srcdir}/0004-apparmor-fix-apparmor-mediating-locking-non-fs-unix-sockets.patch"
# Add bootsplash - http://lkml.iu.edu/hypermail/linux/kernel/1710.3/01542.html
patch -Np1 -i "${srcdir}/0001-bootsplash.patch"
patch -Np1 -i "${srcdir}/0002-bootsplash.patch"
patch -Np1 -i "${srcdir}/0003-bootsplash.patch"
patch -Np1 -i "${srcdir}/0004-bootsplash.patch"
patch -Np1 -i "${srcdir}/0005-bootsplash.patch"
patch -Np1 -i "${srcdir}/0006-bootsplash.patch"
patch -Np1 -i "${srcdir}/0007-bootsplash.patch"
patch -Np1 -i "${srcdir}/0008-bootsplash.patch"
patch -Np1 -i "${srcdir}/0009-bootsplash.patch"
patch -Np1 -i "${srcdir}/0010-bootsplash.patch"
patch -Np1 -i "${srcdir}/0011-bootsplash.patch"
patch -Np1 -i "${srcdir}/0012-bootsplash.patch"
# use git-apply to add binary files
git apply -p1 < "${srcdir}/0013-bootsplash.patch"
# add aufs5 support
# patch -Np1 -i "${srcdir}/aufs5.x-rcN-${_aufs}.patch"
# patch -Np1 -i "${srcdir}/aufs5-base.patch"
# patch -Np1 -i "${srcdir}/aufs5-kbuild.patch"
# patch -Np1 -i "${srcdir}/aufs5-loopback.patch"
# patch -Np1 -i "${srcdir}/aufs5-mmap.patch"
# patch -Np1 -i "${srcdir}/aufs5-standalone.patch"
# patch -Np1 -i "${srcdir}/tmpfs-idr.patch"
# patch -Np1 -i "${srcdir}/vfs-ino.patch"
# apply Dell XPS patches
patch -Np1 -i "${srcdir}/dellxps-fixlpss.patch"
patch -Np1 -i "${srcdir}/dellxps-suspend.patch"
patch -Np1 -i "${srcdir}/dellxps-icelake-screencorruptionfix.patch"
if [ "${CARCH}" = "x86_64" ]; then
cat "${srcdir}/config.x86_64" > ./.config
else
cat "${srcdir}/config" > ./.config
fi
# cat "${srcdir}/config.aufs" >> ./.config
if [ "${_kernelname}" != "" ]; then
sed -i "s|CONFIG_LOCALVERSION=.*|CONFIG_LOCALVERSION=\"${_kernelname}\"|g" ./.config
sed -i "s|CONFIG_LOCALVERSION_AUTO=.*|CONFIG_LOCALVERSION_AUTO=n|" ./.config
fi
# set patchlevel to 4
sed -ri "s|^(PATCHLEVEL =).*|\1 4|" Makefile
# set extraversion to pkgrel
sed -ri "s|^(EXTRAVERSION =).*|\1 -${pkgrel}|" Makefile
# don't run depmod on 'make install'. We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh
# get kernel version
make prepare
# load configuration
# Configure the kernel. Replace the line below with one of your choice.
#make menuconfig # CLI menu for configuration
#make nconfig # new CLI menu for configuration
#make xconfig # X-based configuration
#make oldconfig # using old config from previous kernel version
# ... or manually edit .config
# rewrite configuration
yes "" | make config >/dev/null
}
build() {
cd "${srcdir}/linux-${_basekernel}"
# build!
make ${MAKEFLAGS} LOCALVERSION= bzImage modules
}
package_linux54() {
pkgdesc="The ${pkgbase/linux/Linux} kernel and modules"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=27')
optdepends=('crda: to set the correct wireless channels of your country')
provides=("linux=${pkgver}")
cd "${srcdir}/linux-${_basekernel}"
KARCH=x86
# get kernel version
_kernver="$(make LOCALVERSION= kernelrelease)"
mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
make LOCALVERSION= INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
cp arch/$KARCH/boot/bzImage "${pkgdir}/usr/lib/modules/${_kernver}/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "${pkgbase}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_kernver}/pkgbase"
echo "${_basekernel}-${CARCH}" | install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_kernver}/kernelbase"
# add kernel version
if [ "${CARCH}" = "x86_64" ]; then
echo "${pkgver}-${pkgrel}-MANJARO x64" > "${pkgdir}/boot/${pkgbase}-${CARCH}.kver"
else
echo "${pkgver}-${pkgrel}-MANJARO x32" > "${pkgdir}/boot/${pkgbase}-${CARCH}.kver"
fi
# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname:--MANJARO}"
ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
# add real version for building modules and running depmod from hook
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
# remove build and source links
rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}
# now we call depmod...
depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"
# add vmlinux
install -Dt "${pkgdir}/usr/lib/modules/${_kernver}/build" -m644 vmlinux
}
package_linux54-headers() {
pkgdesc="Header files and scripts for building modules for ${pkgbase/linux/Linux} kernel"
provides=("linux-headers=$pkgver")
cd "${srcdir}/linux-${_basekernel}"
local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
mkdir "${_builddir}/.tmp_versions"
cp -t "${_builddir}" -a include scripts
install -Dt "${_builddir}/arch/${KARCH}" -m644 "arch/${KARCH}/Makefile"
install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 "arch/${KARCH}/kernel/asm-offsets.s"
#install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 "arch/${KARCH}/kernel/macros.s"
if [ "${CARCH}" = "i686" ]; then
install -Dt "${_builddir}/arch/${KARCH}" -m644 "arch/${KARCH}/Makefile_32.cpu"
fi
cp -t "${_builddir}/arch/${KARCH}" -a "arch/${KARCH}/include"
install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
# http://bugs.archlinux.org/task/13146
install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# http://bugs.archlinux.org/task/20402
install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# add xfs and shmem for aufs building
mkdir -p "${_builddir}"/{fs/xfs,mm}
# copy in Kconfig files
find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;
if [ "${CARCH}" = "x86_64" ]; then
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "${_builddir}/tools/objtool" tools/objtool/objtool
fi
# remove unneeded architectures
local _arch
for _arch in "${_builddir}"/arch/*/; do
[[ ${_arch} == */x86/ ]] && continue
rm -r "${_arch}"
done
# remove files already in linux-docs package
rm -r "${_builddir}/Documentation"
# Fix permissions
chmod -R u=rwX,go=rX "${_builddir}"
# strip scripts directory
local _binary _strip
while read -rd '' _binary; do
case "$(file -bi "${_binary}")" in
*application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so)
*application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a)
*application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
*) continue ;;
esac
/usr/bin/strip ${_strip} "${_binary}"
done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
}