-
Notifications
You must be signed in to change notification settings - Fork 20
/
PKGBUILD
318 lines (271 loc) · 13.4 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
# Maintainer: James Lambert (jamlam) <jamesl@mbert.onmicrosoft.com>
# Contributor: Aun-Ali Zaidi <admin@kodeit.net>
# Contributor: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
pkgbase=linux-t2
pkgver=5.16.1
_srcname=linux-${pkgver}
pkgrel=1
pkgdesc='Linux for MBP 16.1 Wifi'
_srctag=v${pkgver%.*}-${pkgver##*.}
url="https://git.archlinux.org/linux.git/log/?h=v$_srctag"
arch=(x86_64)
license=(GPL2)
makedepends=(
bc kmod libelf pahole cpio perl tar xz
xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
git
)
options=('!strip')
source=(
https://www.kernel.org/pub/linux/kernel/v${pkgver//.*}.x/linux-${pkgver}.tar.xz
https://www.kernel.org/pub/linux/kernel/v${pkgver//.*}.x/linux-${pkgver}.tar.sign
config # the main kernel config file
# Arch Linux patches
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
0002-HID-quirks-Add-Apple-Magic-Trackpad-2-to-hid_have_sp.patch
# Hack for AMD DC eDP link rate bug
2001-drm-amd-display-Force-link_rate-as-LINK_RATE_RBR2-fo.patch
# Apple SMC ACPI support
3001-applesmc-convert-static-structures-to-drvdata.patch
3002-applesmc-make-io-port-base-addr-dynamic.patch
3003-applesmc-switch-to-acpi_device-from-platform.patch
3004-applesmc-key-interface-wrappers.patch
3005-applesmc-basic-mmio-interface-implementation.patch
3006-applesmc-fan-support-on-T2-Macs.patch
# T2 USB Keyboard/Touchpad support
4001-HID-apple-Add-support-for-keyboard-backlight-on-supp.patch
4002-HID-apple-Add-support-for-MacbookAir8-1-keyboard-tra.patch
4003-HID-apple-Add-support-for-MacBookPro15-2-keyboard-tr.patch
4004-HID-apple-Add-support-for-MacBookPro15-1-keyboard-tr.patch
4005-HID-apple-Add-support-for-MacBookPro15-4-keyboard-tr.patch
4006-HID-apple-Add-support-for-MacBookPro16-2-keyboard-tr.patch
4007-HID-apple-Add-support-for-MacBookPro16-3-keyboard-tr.patch
4008-HID-apple-Add-support-for-MacBookAir9-1-keyboard-tra.patch
4009-HID-apple-Add-support-for-MacBookPro16-1-keyboard-tr.patch
# MBP Peripheral support
6001-media-uvcvideo-Add-support-for-Apple-T2-attached-iSi.patch # UVC Camera support
# Hack for i915 overscan issues
7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch
# Broadcom WIFI/BT device support
8001-brcmfmac-pcie-Declare-missing-firmware-files-in-pcie.patch
8002-brcmfmac-firmware-Support-having-multiple-alt-paths.patch
8003-brcmfmac-firmware-Handle-per-board-clm_blob-files.patch
8004-brcmfmac-pcie-sdio-usb-Get-CLM-blob-via-standard-fir.patch
8005-brcmfmac-firmware-Support-passing-in-multiple-board_.patch
8006-brcmfmac-pcie-Read-Apple-OTP-information.patch
8007-brcmfmac-of-Fetch-Apple-properties.patch
8008-brcmfmac-pcie-Perform-firmware-selection-for-Apple-p.patch
8009-brcmfmac-firmware-Allow-platform-to-override-macaddr.patch
8010-brcmfmac-msgbuf-Increase-RX-ring-sizes-to-1024.patch
8011-brcmfmac-pcie-Fix-crashes-due-to-early-IRQs.patch
8012-brcmfmac-pcie-Support-PCIe-core-revisions-64.patch
8013-brcmfmac-pcie-Add-IDs-properties-for-BCM4378.patch
8014-ACPI-property-Support-strings-in-Apple-_DSM-props.patch
8015-brcmfmac-acpi-Add-support-for-fetching-Apple-ACPI-pr.patch
8016-brcmfmac-pcie-Provide-a-buffer-of-random-bytes-to-th.patch
8017-brcmfmac-pcie-Add-IDs-properties-for-BCM4355.patch
8018-brcmfmac-pcie-Add-IDs-properties-for-BCM4377.patch
8019-brcmfmac-pcie-Perform-correct-BCM4364-firmware-selec.patch
8020-brcmfmac-chip-Only-disable-D11-cores-handle-an-arbit.patch
8021-brcmfmac-chip-Handle-1024-unit-sizes-for-TCM-blocks.patch
8022-brcmfmac-cfg80211-Add-support-for-scan-params-v2.patch
8023-brcmfmac-feature-Add-support-for-setting-feats-based.patch
8024-brcmfmac-cfg80211-Add-support-for-PMKID_V3-operation.patch
8025-brcmfmac-cfg80211-Pass-the-PMK-in-binary-instead-of-.patch
8026-brcmfmac-pcie-Add-IDs-properties-for-BCM4387.patch
8027-brcmfmac-pcie-Replace-brcmf_pcie_copy_mem_todev-with.patch
8028-brcmfmac-pcie-Read-the-console-on-init-and-shutdown.patch
8029-brcmfmac-pcie-Release-firmwares-in-the-brcmf_pcie_se.patch
efi.patch
)
validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
)
export KBUILD_BUILD_HOST=archlinux
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd $_srcname
echo "Setting version..."
scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname
local src
for src in "${source[@]}"; do
src="${src%%::*}"
src="${src##*/}"
[[ $src = *.patch ]] || continue
echo "Applying patch $src..."
patch -Np1 < "../$src"
done
echo "Setting config..."
cp ../config .config
make olddefconfig
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make all
make htmldocs
}
_package() {
pkgdesc="The $pkgdesc kernel and modules"
depends=(coreutils kmod initramfs)
optdepends=('crda: to set the correct wireless channels of your country'
'linux-firmware: firmware images needed for some devices')
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
replaces=(virtualbox-guest-modules-arch wireguard-arch)
provides=("linux=$pkgver")
cd $_srcname
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz"
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
# remove build and source links
rm "$modulesdir"/{source,build}
}
_package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
provides=("linux-headers=$pkgver")
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version vmlinux
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/x86" -m644 arch/x86/Makefile
cp -t "$builddir" -a scripts
# add objtool for external module building and enabled VALIDATION_STACK option
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
# add xfs and shmem for aufs building
mkdir -p "$builddir"/{fs/xfs,mm}
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/x86" -a arch/x86/include
install -Dt "$builddir/arch/x86/kernel" -m644 arch/x86/kernel/asm-offsets.s
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
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */x86/ ]] && continue
echo "Removing $(basename "$arch")"
rm -r "$arch"
done
echo "Removing documentation..."
rm -r "$builddir/Documentation"
echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
echo "Stripping build tools..."
local file
while read -rd '' file; do
case "$(file -bi "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
strip -v $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
strip -v $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;;
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}
_package-docs() {
pkgdesc="Documentation for the $pkgdesc kernel"
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
echo "Installing documentation..."
local src dst
while read -rd '' src; do
dst="${src#Documentation/}"
dst="$builddir/Documentation/${dst#output/}"
install -Dm644 "$src" "$dst"
done < <(find Documentation -name '.*' -prune -o ! -type d -print0)
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/share/doc"
ln -sr "$builddir/Documentation" "$pkgdir/usr/share/doc/$pkgbase"
}
pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")
_package${_p#$pkgbase}
}"
done
sha256sums=('c7bf36231c6ea1e67283802a005430d14fe3f8a3498c0724ba3439afaf723545'
'SKIP'
'7cbba374356a189faac71001c5344ce8f02434684b1ce1accefc0cc4bd6718e5'
'6b4da532421cac5600d09c0c52742aa52d848af098f7853abe60c02e9d0a3752'
'2184069ab00ef43d9674756e9b7a56d15188bc4494d34425f04ddc779c52acd8'
'786dfc22e4c6ece883e7dedd0ba3f6c14018584df95450b2cb78f3da8b01f7cb'
'cfd23a06797ac86575044428a393dd7f10f06eff7648d0b78aedad82cbe41279'
'8d8401a99a9dfbc41aa2dc5b6a409a19860b1b918465e19de4a4ff18de075ea3'
'08d165106fe35b68a7b48f216566951a5db0baac19098c015bcc81c5fcba678d'
'62f6d63815d4843ca893ca76b84a9d32590a50358ca0962017ccd75a40884ba8'
'2827dab6eeb2d2a08034938024f902846b5813e967a0ea253dc1ea88315da383'
'398dec7d54c6122ae2263cd5a6d52353800a1a60fd85e52427c372ea9974a625'
'1366719f62b2d698693b31916569f1178f3d1b0a66e747b7f40f1389edceff07'
'83f4be6849ba4d5f9fad647ad2eb78bf6409ee98a40ac62e8a5b80496233d70a'
'44bd3643b2b22fedc59d79511199f30ce6759fa0acdd9a66262a53c5e046da6b'
'eb04a492197783643b3e72b1d0cf0e856290381997bd165a14fbc63ac1489c25'
'69d56d42473526f7dbd4fb18c5e1baafe4e6d32995b2506bd48ff981c53b5385'
'1deeacae1875cf9075b858a8bfb2463ebc531c9030b7c2ab46bbb8e4c3b974db'
'40eff5e88bb30c51c6b97e85c2e7b8dec5f97916f768e6c07618d9c5afe68574'
'cac035fe07663a319185c644c5b39b34bef89ada348881fa4a02d15290260445'
'9dfa9f02d17c5cd9620fa2c1d43ca967b81b6a56d33c2bafae14e0c64e498baa'
'89076d6a3cb77704025dae8bd33522afcbf8bc6d7fcdf9463f98be06c86797ea'
'90a6012cdd8a64ede8e0bbaf7331960bd68f628e0973b65459188eb1ccb5b829'
'1ce089059058b1e514f1768f97178c6f4426f920b6737a73ef2eec4c8f14aada'
'de8ddf27596e57697bb6f259758efc44f03b0737d27ae9273762727fa043ba79'
'86dfb440034127bf37b4f2de2749bd65c0a870f6578e08a962cc177421881ff6'
'5d6b671a9d41d73702e93bd7d69506a5fa364a39f8e376775b59e10a4a02f137'
'07831d408eaed40931eff321b6cd02ce5fcbe508578db2921aa572e8b6a9d912'
'4cb854894f6dbf8bd33a1d6c1efdf1585975187acec963b1789e8355adca6f1b'
'46f1d655d85c8434420622b42d631ed79da53ede52c08e4610933545d8606a2c'
'c84a45ea91ad72d4264a96b7aefe42b16841d239b3b20156dd72310bc7483815'
'aa4d747f10a7af375473f0bf914c1ca17c76183c495f2eabedeb16083509ccde'
'bdecb89ed084a6c1a5a4b0386accfb17a9daefa4cf32602e82b12f57d0bd8310'
'f933c8c4d35845dd987db1168d65d6b3bc545a0b1937a6e67d2c974a8b4e276e'
'e6b64db9f07d36ae482d880caef567d369719cb9205c09fb0c21ed780ec36d87'
'bea0a94969b488e03679034ed072f3d26f208a03096e7a4609f01b94c7a50b3b'
'fc899329773452ac7d17c8c6efa4ade8b522dfdfb0316e203bf2e21bfd49420a'
'04001dfadc6a59fa25b5589da442978617b22d96d1778916c822b45948d3579b'
'916cc9c24dfb2c8bbd7f4b5dc3c6e65bcab1d581da9716ce77e21a9889057cff'
'fbdf79a09a26f7f59cac01b24c721d9246ae58e4366b0e31054fbbf17eb3b618'
'cc99dd569506748969934855d7fa14ea82b0903c09550b80ceeede91e03b7224'
'cbdccfb7d67e42cb6865763ccc89c99da0932763f8c1660759f69c52b003fb44'
'6e6b1638cc9836021980a096638985d2c3f2f6ed12279b03980e1f9f18659ca4'
'ef64c0c357b59fb437d2dba76faedf67f22ec2ab565ebc5283473a7a6ed1ff95'
'434f466a4e80e08698467feedb121b3ffe46affd09980eb4accc29fdaba66927'
'00ee4cd515a7004e1da382b7c441ab3818ed858f3f55c9b23c07eee04278d7e6'
'0c2439ccef7aff7c44995cb692fe5e4f5f2192226b55d3f4a291c97fc51a27cc'
'7a8ada03d2504fe11108bfd691b93acd3f8ac5bfedc843f129037eac380ae3b5'
'fc485aff4d0ff28ac8fa9700244ac41c3834c11f5c5d7485cf0ef4d404a65823'
'f11c4db01c578202b9bdd79e9cd8d3207c10bbabc619a2af0734cc455805ec88'
'713ce3cbda4c53f319bcfeab7e63e8ecf7938109de024f2d99b443fe664ecbd8'
'd0dd1ae3b08d9eb39bc094d86022c68f74bf903aac1d202e16853e1f0a5ade93'
'31c3260d35d6c51bff231179e6210876142d4c333d6f4a5963fd8b49f4dc61ab')