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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
|
# Maintainer: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
# Feel free to push modifications or take over maintainership
# Based on the linux-libre package
_replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
_replacesoldkernels=() # '%' gets replaced with kernel suffix
_replacesoldmodules=() # '%' gets replaced with kernel suffix
pkgbase=linux-libre-64
pkgver=5.7.2
pkgrel=3
pkgdesc='64bit Linux-libre for Parabola $CARCH'
rcnver=5.7.2
rcnrel=armv7-x9
url='https://linux-libre.fsfla.org/'
arch=(armv7h i686 )
license=(GPL2)
conflicts_armv7h=('linux-libre-aarch64')
replaces_armv7h=('linux-libre-aarch64')
conflicts_i686=('linux-libre-x86_64')
replaces_i686=('linux-libre-x86_64')
makedepends=(
bc kmod libelf pahole
xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick
)
makedepends_i686+=('x86_64-pc-linux-gnu-gcc')
makedepends_armv7h=(uboot-tools vboot-utils dtc) # required by linux-libre-chromebook
makedepends_armv7h+=('aarch64-linux-gnu-gcc-initial')
options=('!strip')
_srcname=linux-5.7
source=(
"https://linux-libre.fsfla.org/pub/linux-libre/releases/${_srcname##*-}-gnu/linux-libre-${_srcname##*-}-gnu.tar.xz"{,.sign}
"https://linux-libre.fsfla.org/pub/linux-libre/releases/$pkgver-gnu/patch-${_srcname##*-}-gnu-$pkgver-gnu.xz"{,.sign}
"https://repo.parabola.nu/other/linux-libre/logos/logo_linux_"{clut224.ppm,vga16.ppm,mono.pbm}{,.sig}
config.i686 config.x86_64 config.armv7h # the main kernel config files
linux-armv7h.preset # armv7h preset file for mkinitcpio ramdisk
"kernel"{.its,.keyblock,_data_key.vbprivk} # files for signing Chromebooks kernels
# maintain the TTY over USB disconnects
# http://www.coreboot.org/EHCI_Gadget_Debug
0001-usb-serial-gadget-no-TTY-hangup-on-USB-disconnect-WI.patch
# fix Atmel maXTouch touchscreen support
# https://labs.parabola.nu/issues/877
# http://www.fsfla.org/pipermail/linux-libre/2015-November/003202.html
0002-fix-Atmel-maXTouch-touchscreen-support.patch
# extracted patches from Arch Linux kernel sources
0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch
sphinx-workaround.patch
)
source_armv7h=(
# RCN patch (CM3 firmware deblobbed and bloatware removed)
"https://repo.parabola.nu/other/rcn-libre/patches/$rcnver/rcn-libre-$rcnver-$rcnrel.patch"{,.sig}
# Arch Linux ARM patches
0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch
0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch
0003-SMILE-Plug-device-tree-file.patch
0004-fix-mvsdio-eMMC-timing.patch
0005-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
0006-set-default-cubietruck-led-triggers.patch
0007-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch
0008-ARM-dove-enable-ethernet-on-D3Plug.patch
0009-USB-Armory-MkII-support.patch
# ChromiumOS patches
0001-CHROMIUM-block-partitions-efi-Add-support-for-IGNORE.patch
)
source_armv7h+=(config.aarch64)
validpgpkeys=(
'474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva
'6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78' # David P.
)
sha512sums=('4805b2956f628c6581e86d67b1996b5b404e7f4b5d29ecfe708ddca45344571d75018364d8f0049835d4286ca1ba591307be263536d1bed0ea006696a8b8ac73'
'SKIP'
'73051904152f286189a29ee900d8717ae66f16b650a459647bcfb4290aee871e446684114703e59c7cf19fe443d57496af584e756a6efc3659be8f9b811b90fb'
'SKIP'
'13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3'
'SKIP'
'7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78'
'SKIP'
'267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1'
'SKIP'
'571e40f0d7f03fb5162b401ad56b1a865f479cde31b07e052f00b71807f94981d316682b332acfc4ccfdfd64a2b2c6bdcf75c67b10f17b9ccce9c2059fcfc3ad'
'5e416f908d2934c7aa02b47dfaad03a83272f546d6a9b426595c0557908408d00f0637d1dd9a41bbdafec5789524b900eed724d7b49db0c098897db2fa4c551e'
'e0cd4e077ea84ce6b6c3332d78fce49991685b84d9dc2749b061020517fedd425c95ec4b1d2dda98cc647fff1e60bf4f6805ea425118c5aef8a2c71436b87e2b'
'53103bf55b957b657039510527df0df01279dec59cda115a4d6454e4135025d4546167fa30bdc99107f232561c1e096d8328609ab5a876cf7017176f92ad3e0b'
'167bc73c6c1c63931806238905dc44c7d87c5a5c0f6293159f2133dfe717fb44081018d810675716d1605ec7dff5e8333b87b19e09e2de21d0448e447437873b'
'bb6718984a7357c9b00c37e4788480e5b8b75018c172ecc1441bc3fc5d2d42444eb5d8c7f9d2e3a7d6fed6d03acb565e3c0559486e494c40a7fe6bd0570c9ede'
'143dea30c6da00e504c99984a98a0eb2411f558fcdd9dfa7f607d6c14e9e7dffff9cb00121d9317044b07e3e210808286598c785ee854084b993ec9cb14d8232'
'02af4dd2a007e41db0c63822c8ab3b80b5d25646af1906dc85d0ad9bb8bbf5236f8e381d7f91cf99ed4b0978c50aee37cb9567cdeef65b7ec3d91b882852b1af'
'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168'
'cbb533ae0bd68566e10fbf55fedd81374905ab301fc5d2a34a44a93a5346d9a70157a4a3323406c5baf7410841149dd6e0ef98559368623cc96fc2175b7ca5ed'
'98e97155f86bbe837d43f27ec1018b5b6fdc6c372d6f7f2a0fe29da117d53979d9f9c262f886850d92002898682781029b80d4ee923633fc068f979e6c8254be')
sha512sums_armv7h=('e0f456a12a9959ec1d2d670ef16dca7e1878f1d5291ac30c7fbcca8bc7f69e9820c9fe7589a70515a462376dcdb034176a2834bc7b12bc64398e1c66a6e217ae'
'SKIP'
'a3b23a92a6f9ee4c6200244e99b62e77af1f18cc9f9714f671c7e754502d0341a93b0461a4a5562329dc51822ae06ff713208ec7092d480492163862a455377c'
'1919ef4738ce25f405e5c68b13233ce19d821ebb65fcd4f8f55a268a2f25029b8a8c0f7ac1cb2ecb9026fc43a4851eca182001baa2dc32653ec34dbb13106a72'
'd49d464bac530ff6e51ff117dcef046e45440aba6020f6c100958b664417f0a91cd045d3b132d86e8b74928c1a72fcec1ee41c6da8b432f6525a35a6a9c2cad9'
'99c6694d78d3232df078fbe8ec8948c278aea94c1784e27d052d92a3bf23757c4341be3477ef42741bba0f25d11e520def01cdd0cdd24ef9e0005aefff6a90f6'
'd9a22997da50c735090c3b48828cae45ee7e4dac8f54acfa723c8200e94103440e1b30059126c95aea307aa0c344340cc0ce72bd7b0982016707676d2dc0bb63'
'cd35bafeb918a14ffdbf87bc0c056a9e0ec4887827c32dd9889dbdda5c366cbcf0e753f223098c0cc4f7f58234dd6311dd06dbbebca54e86af6d02f96a7bda98'
'0e9200c19666cf9e8f13242ff1d76bc43953f98e3a2dd015c7242d780c856af39c0c24bfe8643ab0492ab4422cc72428c724b429899280ff348c8a5cdb918808'
'22a02ac89eb579b7a1cc581944b16ce946d0a8969418f5162ef9b6bb32b20e545998c74a6f11757ad6514c77d6f825cf2116695bcb97a7f68331ddd8b1fe4080'
'627ececc2ae6d3c50f29ab26e1e74a34c494f520341958d8c1196e52fdeb0cdcb606ebb1bc0be6324b2ca0f64c75fc9707c1825e50c24369c4241da5022e1675'
'7bda2ad7eb81af802873cb6764cb9c675ec50ceeb5adc487881ebc8c316cf55f836e56c2cc67494a2920e86494861db2eb924b7ff9b151ae3c5b0e493c373bf9')
sha512sums_armv7h+=('9d342387b69316460e4a4922bceeb9d8bb134a4fb98fdcf9a4e0a65da0afc00e8f6304bbd7e6ab117ebc970fec52e1e5c6d45201c7212cbc96c84d4506ad47c1')
_replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
_replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
_replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
case "$CARCH" in
i686) KARCH=x86;CROSS_COMPILE=x86_64-pc-linux-gnu-;;
armv7h) KARCH=arm64;CROSS_COMPILE=aarch64-linux-gnu-;;
esac
export KBUILD_BUILD_HOST=parabola
export KBUILD_BUILD_USER=$pkgbase
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
cd $_srcname
if [ "${_srcname##*-}" != "$pkgver" ]; then
echo "Applying upstream patch..."
patch -Np1 < "../patch-${_srcname##*-}-gnu-$pkgver-gnu"
fi
echo "Adding freedo as boot logo..."
install -m644 -t drivers/video/logo \
../logo_linux_{clut224.ppm,vga16.ppm,mono.pbm}
echo "Setting version..."
scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux-libre}" > localversion.20-pkgname
if [ "$CARCH" = "armv7h" ]; then
local src_armv7h
for src_armv7h in "${source_armv7h[@]}"; do
src_armv7h="${src_armv7h%%::*}"
src_armv7h="${src_armv7h##*/}"
[[ $src_armv7h = *.patch ]] || continue
echo "Applying patch $src_armv7h..."
patch -Np1 < "../$src_armv7h"
done
fi
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..."
case "$CARCH" in
i686) cp ../config.x86_64 .config;;
# config.aarch64 comes straight from Arch Linux ARM and doesn't have the
# compatibility for 32bit rootfs enabled. This makes maintenance faster than
# having to modify the configuration file by hand at each new kernel release.
armv7h) cp ../config.aarch64 .config;echo 'CONFIG_COMPAT=y' >> .config;;
esac
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE olddefconfig
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE all
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE htmldocs
}
_package() {
pkgdesc="The $pkgdesc kernel and modules"
depends=(coreutils kmod initramfs)
optdepends=('crda: to set the correct wireless channels of your country'
'linux-libre-firmware: firmware images needed for some devices')
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
replaces=(virtualbox-guest-modules-arch wireguard-arch)
provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver")
conflicts=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}")
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
# The default image target is Image.gz on arm64 but some u-boot
# configurations and/or versions don't support that, so we use Image instead.
if [ "$KARCH" = "arm64" ]; then
install -Dm644 arch/$KARCH/boot/Image "$modulesdir/vmlinuz"
else
install -Dm644 "$(make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE -s image_name)" "$modulesdir/vmlinuz"
fi
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
echo "Installing modules..."
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install
# remove build and source links
rm "$modulesdir"/{source,build}
if [ "$CARCH" = "armv7h" ]; then
echo "Installing device tree binaries..."
make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_DTBS_PATH="$pkgdir/boot/dtbs/$pkgbase" dtbs_install
# armv7h presets only work with ALL_kver=$kernver
backup=("etc/mkinitcpio.d/$pkgbase.preset")
echo "Installing mkinitcpio preset..."
sed "s|%PKGBASE%|$pkgbase|g;s|%KERNVER%|$kernver|g" ../linux-armv7h.preset \
| install -Dm644 /dev/stdin "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset"
fi
}
_package-headers() {
pkgdesc="Headers and scripts for building modules for the $pkgdesc kernel"
provides=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
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/$KARCH" -m644 arch/$KARCH/Makefile
if [[ $CARCH = i686 ]]; then
install -Dt "$builddir/arch/$KARCH" -m644 arch/$KARCH/Makefile_32.cpu
fi
cp -t "$builddir" -a scripts
# add objtool for external module building and enabled VALIDATION_STACK option
if [[ -e tools/objtool/objtool ]]; then
install -Dt "$builddir/tools/objtool" tools/objtool/objtool
fi
# 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/$KARCH" -a arch/$KARCH/include
install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/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
# from linux-armv7
if [ "$KARCH" = "armv7h" ]; then
for i in dove exynos omap2; do
mkdir -p "$builddir/arch/$KARCH/mach-$i"
cp -t "$builddir/arch/$KARCH/mach-$i/" -a arch/$KARCH/mach-$i/include
done
for i in omap orion samsung versatile; do
mkdir -p "$builddir/arch/$KARCH/plat-$i"
cp -t "$builddir/arch/$KARCH/plat-$i/" -a arch/$KARCH/plat-$i/include
done
fi
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
echo "Removing unneeded architectures..."
local arch
for arch in "$builddir"/arch/*/; do
[[ $arch = */$KARCH/ ]] && 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"
provides=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
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"
}
_package-chromebook() {
pkgdesc="Experimental $pkgdesc kernel sign for Chromebooks"
depends=(linux-libre-64=$pkgver)
provides+=("linux-libre-chromebook=$pkgver")
conflicts+=('linux-libre-chromebook')
replaces+=('linux-libre-chromebook')
install=linux-libre-chromebook.install
cd $_srcname
cp ../kernel.its .
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its kernel.signed
dd if=/dev/zero of=bootloader.bin bs=512 count=1
echo 'console=tty0 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootwait rw noinitrd' > cmdline
echo "Creating kernel sign..."
vbutil_kernel \
--pack vmlinux.kpart \
--version 1 \
--vmlinuz kernel.signed \
--arch aarch64 \
--keyblock ../kernel.keyblock \
--signprivate ../kernel_data_key.vbprivk \
--config cmdline \
--bootloader bootloader.bin
echo "Installing kernel sign..."
mkdir -p "$pkgdir/boot"
cp vmlinux.kpart "$pkgdir/boot"
}
pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
# The chromebook package is disabled until the following error is fixed:
# | ==> Starting package_linux-libre-64-chromebook()...
# | FATAL ERROR: Couldn't open "arch/arm/boot/zImage": No such file or directory
# | mkimage: Can't read kernel.signed.tmp: Invalid argument
# [[ $CARCH = armv7h ]] && pkgname+=("$pkgbase-chromebook")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")
_package${_p#$pkgbase}
}"
done
# vim:set ts=8 sts=2 sw=2 et:
|