# Maintainers: Parabola hackers # WIP - Based on the linux-libre package. # this PKGBUILD includes a lot of cruft, to minimize the diff. # eventually, these chanegs can be merged into linux-libre # once parabola has an 'aarch64' build target and repos. _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.18.5 pkgrel=1 pkgdesc="64bit Linux-libre for Parabola $CARCH" rcnver=5.18.2 rcnrel=armv7-x6 url='https://linux-libre.fsfla.org/' arch=(armv7h i686) license=(GPL2) makedepends=( bc libelf pahole cpio perl tar xz xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick texlive-latexextra ) makedepends_armv7h=(uboot-tools dtc) # required by linux-libre-chromebook options=('!strip') _srcname=linux-5.18 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 # Arch Linux patches 0001-ZEN-Add-sysctl-and-CONFIG-to-disallow-unprivileged-C.patch 0002-HID-apple-Properly-handle-function-keys-on-Keychron-.patch ) source_i686=( # avoid using zstd compression in ultra mode (exhausts virtual memory) no-ultra-zstd.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 (for armv7h) 0001-ARM-atags-add-support-for-Marvell-s-u-boot.patch 0002-ARM-atags-fdt-retrieve-MAC-addresses-from-Marvell-bo.patch 0003-fix-mvsdio-eMMC-timing.patch 0004-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch 0005-set-default-cubietruck-led-triggers.patch 0006-exynos4412-odroid-set-higher-minimum-buck2-regulator.patch 0007-USB-Armory-MkII-support.patch # Arch Linux ARM patches (for aarch64) # ./0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch 0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.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=('13be3762fffd74c63eeb23b0d34b994a3e5198bfdbda4f013b38f8d3edd24b9bbebe5a4bfde0f5191aa1cf2678e4517f3b5540a40b30ebc05da1f6708cbb98bb' 'SKIP' '9355c0f22606c0401e8a01d6e22f0fa6e97b69a9fce6d991235da6430907fb6a788fca30bd48e5cbb743cc4a211a40806c896f660db7432e7bc85ba7634b5d06' 'SKIP' '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3' 'SKIP' '7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78' 'SKIP' '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1' 'SKIP' 'bcec71d3bd1daaa27bdf4c9a10f0b302b915e8236ef47b5e6d6eaf65bfd0b34644d8d3ff6c25d894ae21dedbece3c1f1ff152fbf8525b77100bc790d0541f3f1' 'e141c387e8045030278d683a1294bfd3d13197bf3466a9c89c4f72a53aafed606acc8e42e528479527c638af895bce2303944b5d8b8a29040f5aae8a9581dd5a' '47d16ffc94510d4a8773146a46cfb35aca8cfdae38d17283334cd62d92de36250fbec90e9892357033398ecc7d970127b1a41b703a8372972422ca4af7c90c70' '53103bf55b957b657039510527df0df01279dec59cda115a4d6454e4135025d4546167fa30bdc99107f232561c1e096d8328609ab5a876cf7017176f92ad3e0b' 'f10af02f0cb2d31259d9633e1ba845f555f525789f750fc2ddc51bd18c5ff64fcdd242dae801623887f5ce5cdb5528bce890459f0fab9fd31a28868bb7f6bba5' 'bb6718984a7357c9b00c37e4788480e5b8b75018c172ecc1441bc3fc5d2d42444eb5d8c7f9d2e3a7d6fed6d03acb565e3c0559486e494c40a7fe6bd0570c9ede' '143dea30c6da00e504c99984a98a0eb2411f558fcdd9dfa7f607d6c14e9e7dffff9cb00121d9317044b07e3e210808286598c785ee854084b993ec9cb14d8232' '02af4dd2a007e41db0c63822c8ab3b80b5d25646af1906dc85d0ad9bb8bbf5236f8e381d7f91cf99ed4b0978c50aee37cb9567cdeef65b7ec3d91b882852b1af' 'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168' '1b6c3108d5628ca6db20c2bc3431e560ab2a274aaf863e7a796f1931a35982d175247f47cbfbb7d643ffc6b742442806755bb10339e5b0577c3f232b38288891' 'bf6d9a66be49c2cc67b0a0f3cfb61734adf7a3b032b5ed133e1e0afbf4a6ddbd3e8231e4b85fef2e3aeb7274a60f7572a4469c057ff13d81134613f01767d3b2') sha512sums_i686=('bca15cc96f64c38adcd13a46752866b5b30555ac21e19b3f7afcd20fcb7ec585c9d990fe8f842f44d5f69d477d72867fe6a9102729f26f93f5a80b372e41ce85') sha512sums_armv7h=('5a75b12dd386940a0bf1be630d45a514ef3c32289ec5976988764baa8483b254e5dcc879337556bfa041b6dbf9ac16debbe4b57bf86db30089661e9536ffaa0a' 'SKIP' '8da996a42249672893fa532ccbd096347580a0dc1698c45e9c865646e2765789553b1bb42793e721de30aea70340fdc116d2e4a50580fef999ca5fc627aaf4c3' '0e6ddc24011d77a2e422b642c4507317fc2d26b20f5649818a2f11acac165ccab2cf2e64ab50d44ce7affcfe12c2ef5158790e499058831e7995400b2087df78' '5d2f228151148358b07744a9c09cf6e2420c4284735d4ce7dc925a1deb3970298cc95dd766ee13e094e2853847b016c3ebc2d61bb423e370b4bc33938367ebda' 'a206c3dc678839831d72eefee997cbe1bb877af7f6f90dfe5cab0bd7d9686a3b13a2aba74c8fbe5533872e12306ac9ea1b5eede18ef3cf10b8d01361afd67e9c' 'a1072dd808c63592178cc01ea3c36de946f277fb451b13c34f51a5ac134cde4a8a4d57487132af1c6d7b5820842cdda9dc4edb3da85d33bd02bf87a032c3263a' '85b2e16a930b8066990c42f973d386dc3c6d62fdf3d1289bbb51df3df296c26f30051162fba49a42d38f71f05de926aa8c065097f14bd8e9f8e28a52949ead00' '2e99582d8b670b6c6b27add14b60e957cbcf9cd6aae40491bd9dea6ac455c0ade0bbee21e3bdfb5e06ce83ad27c5a788404b05bf7ac93831ca18d2e60a67017c' '4224779106cc520dc2c431322d9693cc968476706854ae9630611cf2896c48a34ca11bf31a4c3995573a128cf5838a6763bac86eb4cbaf509ade9b6a83a24369' '5b77c587cf2ffb60acf1d9eb43330983548c7e81a53e0ffd2b04962a99441a0000d631ff77c245c7062afc2c8368d996a2456496d42dcb658f330e5083e5e029' 'bc7b70863929737346fe6757373897391b43af36bb6884d5351a95aca0f9120f2d2cf9b9c2c6426a440c6b394e9fb334c280711d64081563322a834ecdfb2ba6') _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 STRIP=${CROSS_COMPILE}strip 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 if [ "$CARCH" = "i686" ]; then local src_i686 for src_i686 in "${source_i686[@]}"; do src_i686="${src_i686%%::*}" src_i686="${src_i686##*/}" [[ $src_i686 = *.patch ]] || continue echo "Applying patch $src_i686..." patch -Np1 < "../$src_i686" 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 $( 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: