diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-05-22 01:42:51 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2020-05-22 03:10:10 +0200 |
commit | 7b43a753e346a0f16bef2b4db2ed71bac0ae25de (patch) | |
tree | e77b295f3af9dc4e3ca20c9a1660a431813adec4 /libre/linux-libre-64/PKGBUILD | |
parent | 1e6f86bfa9322e7a6fe71e248934aadcb25c4441 (diff) | |
download | abslibre-7b43a753e346a0f16bef2b4db2ed71bac0ae25de.tar.gz abslibre-7b43a753e346a0f16bef2b4db2ed71bac0ae25de.tar.bz2 abslibre-7b43a753e346a0f16bef2b4db2ed71bac0ae25de.zip |
libre: add linux-libre-64 to replace archtecture specific versions
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Diffstat (limited to 'libre/linux-libre-64/PKGBUILD')
-rw-r--r-- | libre/linux-libre-64/PKGBUILD | 376 |
1 files changed, 376 insertions, 0 deletions
diff --git a/libre/linux-libre-64/PKGBUILD b/libre/linux-libre-64/PKGBUILD new file mode 100644 index 000000000..5669964da --- /dev/null +++ b/libre/linux-libre-64/PKGBUILD @@ -0,0 +1,376 @@ +# 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.6.12 +pkgrel=1 +pkgdesc='64bit Linux-libre for Parabola $CARCH' +rcnver=5.6.10 +rcnrel=armv7-x12 +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 + 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.6 +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=('df473a228ca2bbefbcc630aee710c78c83083269b4939adf698a9adf3a5760391b24529704bfc0b108bc67054ebed047746810e1b41be1fd9019a911a563114d' + 'SKIP' + '5214c42e6ccf255b0a7effd0b980a0bbfdb0d68a28ce0c56f7a3df5b3713bd83df7da1c424a79daa34101cfbfe260a14cfa2cca8b77a43b51b723f1142046d63' + 'SKIP' + '13cb5bc42542e7b8bb104d5f68253f6609e463b6799800418af33eb0272cc269aaa36163c3e6f0aacbdaaa1d05e2827a4a7c4a08a029238439ed08b89c564bb3' + 'SKIP' + '7a3716bfe3b9f546da309c7492f3e08f8f506813afeb1c737a474c83313d5c313cf4582b65215c2cfce3b74d9d1021c96e8badafe8f6e5b01fe28d2b5c61ae78' + 'SKIP' + '267295aa0cea65684968420c68b32f1a66a22d018b9d2b2c1ef14267bcf4cb68aaf7099d073cbfefe6c25c8608bdcbbd45f7ac8893fdcecbf1e621abdfe9ecc1' + 'SKIP' + '980260de7e18dcbdd63b57117091f3f286468e5c175e44e0880c6851fdecaded233d6b3280efe20be8601c16f4145a8fe0a1e9baee9ec56d97b669825b78f2dc' + '84c19308477b444454c6f15e9f958c3fcde0fe56e58a655b6d26da55ad55d95ab812beb959bec9eca88e20acac0b23baa90ba08b636dcab4dd3979074ad3aa8f' + 'e4b0210bba48dd432751a7a8d41e3b5ae6f11d05f6551d2987a62011718a3ca706754da02303fe819e064868120e5f963fcf1e07601ff84aa22b9500fce32a4b' + '53103bf55b957b657039510527df0df01279dec59cda115a4d6454e4135025d4546167fa30bdc99107f232561c1e096d8328609ab5a876cf7017176f92ad3e0b' + '167bc73c6c1c63931806238905dc44c7d87c5a5c0f6293159f2133dfe717fb44081018d810675716d1605ec7dff5e8333b87b19e09e2de21d0448e447437873b' + 'bb6718984a7357c9b00c37e4788480e5b8b75018c172ecc1441bc3fc5d2d42444eb5d8c7f9d2e3a7d6fed6d03acb565e3c0559486e494c40a7fe6bd0570c9ede' + '143dea30c6da00e504c99984a98a0eb2411f558fcdd9dfa7f607d6c14e9e7dffff9cb00121d9317044b07e3e210808286598c785ee854084b993ec9cb14d8232' + '02af4dd2a007e41db0c63822c8ab3b80b5d25646af1906dc85d0ad9bb8bbf5236f8e381d7f91cf99ed4b0978c50aee37cb9567cdeef65b7ec3d91b882852b1af' + 'b8fe56e14006ab866970ddbd501c054ae37186ddc065bb869cf7d18db8c0d455118d5bda3255fb66a0dde38b544655cfe9040ffe46e41d19830b47959b2fb168' + 'f340f8beaf2df0970ed592360da8d625ba6be27ed4a0773ff8a6b5dc638b0e7b73e575d3e154c328999dfe9ebf4f18739adade8ddfa89472845318885f9da1c0' + '98e97155f86bbe837d43f27ec1018b5b6fdc6c372d6f7f2a0fe29da117d53979d9f9c262f886850d92002898682781029b80d4ee923633fc068f979e6c8254be') +sha512sums_armv7h=('6e49c501bf866ab156d79aa66149ad5599e0976d2253f32096eeba1c94d1a7ff3fb4bdf51c029b71e73f3c56539cafeaabd9fd343a93ade7632dc76343109784' + 'SKIP' + 'd788dd09cf98e0b014faeba75633c0db0cda7bc26817f09520cafc763ddad25e5c446b3fc19ba22a9abefcb02a4f3d187808f11caba77420b473f88a3f0a281e' + '2010c50048b60f57b4547fdd770a53a26e5d60a40e73c26b4f490e86d0753b6840eade917cb603ef8a7048a175019a921629489e6b9bbce2cc08bde18365934c' + 'e3b0c5f0dded7b14bb884a84cf0b43157cd605890d27224d167ee03af4a6b4dd99195aca7a33e2646926be42ca4d5a26861f72a81caccc5294686360f6592ffa' + '8b4c1c9d10bc81c45bbfaef99e9e49723d25a16ebf87ebf450a1f8f28030d1cb6832f82e228810444548947073a88ceb3b5eb2217d4bb11212e9b8f19aa88684' + 'ad323ad23cb785a58c5c0ad37da940ac8d122dedad1676d10d2956ea4d3480dd22a9c44838966af1f6eb56677334ac5fde890f884f7116f16c20297033a01c71' + '0fb1f5342710ce5f3afce2e50f9adfba6cd84072dacfb4e22c05aef728d0ed9d5b38fed5b1cf1ce3ec5db17a443bfd7e849130d1538b62c457a168d97e9adb6a' + 'a2a777f20638e7dd787b053ede9b62792f6cdd4f6c1507f8cd6bc2fd8b9a32ee37ee96179e117f247a18b525bac7aaf7fdaed54ade93e82e4103e27220477477' + '2210bbf9453c2d593749ca397abd533894fe199ff208b29ad2fd55845e7e7045ddf34a4a298350a7233e78cc8e0e00c0932a4693afa16c0c1699cb81294977cc' + '58203377936bf2b39d64dfbd5f15e0ee532f8dc03a2da4f6ee26115389e9c8a72d784972bd511969bd2c63122c372b2129f6a49263561be3a54e58887adf9720' + '7bda2ad7eb81af802873cb6764cb9c675ec50ceeb5adc487881ebc8c316cf55f836e56c2cc67494a2920e86494861db2eb924b7ff9b151ae3c5b0e493c373bf9') +sha512sums_armv7h+=('db0e6c01b222d1ea035fe4242021d534ca48e09181189fb4e594e000b2ac9340df651cafd65455557b5bb1408c4f343516a9dc3656bfde25ceaa4ad82b9b5532') + +_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;; + armv7h) cp ../config.aarch64 .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 + install -Dm644 "$(make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE -s image_name)" "$modulesdir/vmlinuz" + + # 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" 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 + + 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" + + # Parabola changes + # + # since we don't want to diverge too much from Arch's PKGBUILD, we'll + # start marking our changes as such + if [ "$CARCH" = "armv7h" ]; then + for i in dove exynos omap2; do + mkdir -p "$pkgdir/usr/lib/modules/$kernver/build/arch/$KARCH/mach-$i" + cp -a arch/$KARCH/mach-$i/include "$pkgdir/usr/lib/modules/$kernver/build/arch/$KARCH/mach-$i/" + done + for i in omap orion samsung versatile; do + mkdir -p "$pkgdir/usr/lib/modules/$kernver/build/arch/$KARCH/plat-$i" + cp -a arch/$KARCH/plat-$i/include "$pkgdir/usr/lib/modules/$kernver/build/arch/$KARCH/plat-$i/" + done + fi + # end of Parabola changes + + 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 "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") +[[ $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: |