diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-07-28 00:38:51 -0500 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-07-28 00:38:51 -0500 |
commit | 3c5694e2fc30a846f438b05579ba827725e04c11 (patch) | |
tree | 30f5e5c14fee09d77dc2c54e1c87bcbe40002232 /libre/linux-libre-64 | |
parent | e4e3858e06dcaf7bf037aa0840a2db43133f5c52 (diff) | |
parent | 2187e3ffefad9f0133cede7f90cdda88c955b44d (diff) | |
download | abslibre-wip-linux-libre-64.tar.gz abslibre-wip-linux-libre-64.tar.bz2 abslibre-wip-linux-libre-64.zip |
Merge branch 'wip-linux-libre-64' of git://git.parabola.nu/abslibre/abslibre into wip-linux-libre-64wip-linux-libre-64
Diffstat (limited to 'libre/linux-libre-64')
-rw-r--r-- | libre/linux-libre-64/PKGBUILD | 142 |
1 files changed, 113 insertions, 29 deletions
diff --git a/libre/linux-libre-64/PKGBUILD b/libre/linux-libre-64/PKGBUILD index a75d06f1d..12c942541 100644 --- a/libre/linux-libre-64/PKGBUILD +++ b/libre/linux-libre-64/PKGBUILD @@ -1,4 +1,7 @@ # Contributor: David P. <megver83@parabola.nu> +# Maintainer (arch32): Erich Eckner <deep42thought@archlinux32.org> +# Maintainer (arch32): Andreas Baumann <mail@andreasbaumann.cc> +# Maintainer (archarm): Kevin Mihelich <kevin@archlinuxarm.org> # Contributor: André Silva <emulatorman@hyperbola.info> # Contributor: Márcio Silva <coadde@hyperbola.info> # Contributor: fauno <fauno@parabola.nu> @@ -6,10 +9,58 @@ # Contributor: Michał Masłowski <mtjm@mtjm.eu> # Contributor: Luke R. <g4jc@openmailbox.org> # Contributor: Andreas Grapentin <andreas@grapentin.org> -# Maintainers: Parabola hackers <dev@lists.parabola.nu> +# Maintainer: Parabola Hackers <dev@lists.parabola.nu> # Based on linux package -# Based on linux-libre package, actually - megver83 will become maintainer eventually + +# Rationale: This package enables to run 64bit kernels with 32bit rootfs. +# +# For armv7k/aarch64, we have no aarch64 port yet, and the 32bit +# kernels don't work for 64bit computers (no 64bit DTB files, etc). +# +# In turn if we can boot Parabola on these computers, it enables +# people to work on an aarch64 port more easily as chrooting in 64bit +# rootfs from 32bit rootfs work when we have a 64bit kernel (tested on +# an x86_64 computer with a Parabola i686 rootfs and a Parabola x86_64 +# chroot). +# +# This enable to make rootfs that work on both 64bit and 32bit +# computers. In that case the user will still need to select the right +# kernel at boot. +# +# Generally speaking it also enable users to benefit from many of the +# improvements of 64bit kernels (ability to chroot in 64bit rootfs, +# better security, 4GiB address space per process instead of 3GiB for +# 32bit rootfs, etc) without having to reinstall everything. In +# addition, there was and is still no conversion guide to convert a +# 32bit Parabola installation to 64bit), and in some cases (lot of +# self-built software in /usr/local, PostgreSQL database, etc) the +# migration to 64bit requires some work. +# +# As for using i686 for new installation on x86_64 computers, it can +# enable people doing that to find and fix bugs on Parabola i686 to +# enable people with 32bit-only computers (like Libreboot compatible +# I945 Thinkpads) to still be able to use Parabola. +# +# Having both architectures (arm and x86) in the same PKGBUILD enables +# to more widely test this package (if we find issues on x86, they'll +# most likely apply to arm as well). Though it can become a problem if +# we need different kernel versions for both architectures. +# +# Status: +# - Tested on both arm and x86. +# - The build is currently broken on ARM due to a missing cross +# compiler for armv7h (it was accidentally removed and it doesn't +# build anymore). +# - External modules (like Wireguard or tp_smapi) also need to be +# cross compiled. So modules for linux-libre-64 need to be added +# (like tp_smapi-64) and dkms packages need to be adapted to also +# work for this kernel. +# - Some software (like building Guix) break with 32bit rootfs and +# 64bit kernels due to wrong assumption about the number of bits, +# through other software (like building rust with mrustc) work +# better (here because we have 3GiB instead of 3GiB of memory per +# process). Most software is not affected though. # WIP: This PKGBUILD is derived from the 'linux-libre' PKGBUILD, # and includes a lot of unused cruft, to minimize the diff. @@ -32,9 +83,26 @@ # should be identical to the linux-libre PKGBUILD. # In this way, the diff is minimal against the linux-libre PKGBUILD; # and it is obvious which parts are intended to become aarch64-specific, -# or exist only for cross-compiling the aarch64 kernel for armv7h systems. - - +# or exist only for cross-compiling the 64-bit foreign kernels for armv7h and i686. +# After that, this PKGBUILD could be simplified, to focus only on the cross-compiled kernels. +# comments: +# TODO: repalce in 'linux-libre' PKGBUILD +# cross-compile over-ride +# TODO: merge into 'linux-libre' PKGBUILD + + +# TODO: This is a bug (in the 'linux-libre' PKGBUILD) for migrations from archlinuxarm. +# _replacesarchkernel assumes that the upstream kernel packages are named like: +# - 'linux' 'linux-headers' +# - 'linux-hardened' 'linux-hardened-headers' +# - 'linux-lts' 'linux-lts-headers' +# That is true for arch and arch32; but archlinuxarm has no packages by those names. +# Archlinuxarm systems would have a kernel package named like: +# - 'linux-armv7' 'linux-armv7-headers' +# - 'linux-armv7-chromebook' +# - 'linux-veyron' 'linux-veyron-headers' +# - 'linux-aarch64' 'linux-aarch64-headers' +# so Parabola armv7h and aarch64 kernels would not replace any archlinuxarm kernel. _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix _replacesoldkernels=() # '%' gets replaced with kernel suffix _replacesoldmodules=() # '%' gets replaced with kernel suffix @@ -43,18 +111,22 @@ pkgbase=linux-libre-64 # cross-compile over-ride pkgver=5.18.5 pkgrel=2 pkgdesc="The Linux-libre kernel and modules" # TODO: merge into 'linux-libre' PKGBUILD -pkgdesc+=' 64-bit (aarch64) for Parabola armv7h' # cross-compile over-ride rcnver=5.18.2 rcnrel=armv7-x6 url='https://linux-libre.fsfla.org/' arch=(i686 x86_64 armv7h) -arch=(armv7h) # cross-compile over-ride +arch=(armv7h i686) # cross-compile over-ride license=(GPL2) +conflicts_armv7h=(linux-libre-aarch64) # cross-compile over-ride +replaces_armv7h=( linux-libre-aarch64) # cross-compile over-ride +conflicts_i686=( linux-libre-x86_64 ) # cross-compile over-ride +replaces_i686=( linux-libre-x86_64 ) # cross-compile over-ride makedepends=( bc libelf pahole cpio perl tar xz xmlto python-sphinx python-sphinx_rtd_theme graphviz imagemagick texlive-latexextra ) -makedepends_armv7h=(uboot-tools vboot-utils dtc) # required by linux-libre-chromebook +makedepends_i686+=('x86_64-pc-linux-gnu-gcc') +makedepends_armv7h=(kmod uboot-tools vboot-utils dtc) # required by linux-libre-chromebook makedepends_armv7h+=(aarch64-linux-gnu-gcc-initial) # cross-compile over-ride options=('!strip') _srcname=linux-5.18 @@ -62,6 +134,10 @@ 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} + # TODO: Move (in linux-libre) config.i686 config.armv7h, linux-armv7h.preset, + # and "kernel"{.its,.keyblock,_data_key.vbprivk} + # into their respective source_<CARCH> arrays. + # Rename linux-armv7h.preset to linux-arm.preset, or add a new one for aarch64. 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 @@ -79,6 +155,7 @@ source=( ) source_i686=( # avoid using zstd compression in ultra mode (exhausts virtual memory) + # Arch Linux 32 patches no-ultra-zstd.patch ) source_armv7h=( @@ -150,9 +227,11 @@ _replacesarchkernel=("${_replacesarchkernel[@]/-64/}") # cross-compile over-ride case "$CARCH" in armv7h) KARCH=arm64 ; CROSS_COMPILE=aarch64-linux-gnu- ;; # cross-compile over-ride aarch64) KARCH=arm64;; # TODO: merge into 'linux-libre' PKGBUILD + i686) KARCH=x86;CROSS_COMPILE=x86_64-pc-linux-gnu-;; # cross-compile over-ride i686|x86_64) KARCH=x86;; armv7h) KARCH=arm;; esac +pkgdesc+=" 64-bit (${CROSS_COMPILE%%-*}) for Parabola ${CARCH}" # cross-compile over-ride export KBUILD_BUILD_HOST=parabola export KBUILD_BUILD_USER=$pkgbase @@ -252,16 +331,18 @@ _package() { conflicts+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") # cross-compile over-rides - # NOTE: Above is providing/replacing the archarm armv7h 'linux' with the armv7h 'linux-libre'. - # We do not want this aarch64 'linux-libre-64' to provide nor replace the archarm armv7h 'linux'; - # for the obvious reason. Anyways, the parabola armv7h 'linux-libre' serves that purpose. - # Below is providing/replacing 'linux-libre' and the obsoleted parabola 'linux-libre-aarch64'. + # NOTE: Above is providing an upstream 'linux{,-*}' (eg: linux, linux-hardened), + # and replacing the same during migration to Parabola. + # Below is providing 'linux-libre' for 'parabola-base', + # and replacing the obsoleted parabola 'linux-libre-{aarch64,x86_64}'. # These are defined analogously in _package-headers(), _package-docs(), and _package-chromebook(). - conflicts=( ${conflicts[*]/linux*/} ) # cross-compile over-ride - replaces=( ${replaces[*]/linux*/} ) # cross-compile over-ride - provides_armv7h=( linux-libre ) # cross-compile over-ride - conflicts_armv7h=( linux-libre linux-libre-aarch64 ) # cross-compile over-ride - replaces_armv7h=( linux-libre linux-libre-aarch64 ) # cross-compile over-ride + provides+=( linux-libre ) # cross-compile over-ride + conflicts=( ${conflicts[*]/linux*/} ) # cross-compile over-ride + replaces=( ${replaces[*]/linux*/} ) # cross-compile over-ride + conflicts_armv7h=( linux-libre-aarch64 ) # cross-compile over-ride + replaces_armv7h=( linux-libre-aarch64 ) # cross-compile over-ride + conflicts_i686=( linux-libre-x86_64 ) # cross-compile over-ride + replaces_i686=( linux-libre-x86_64 ) # cross-compile over-ride cd $_srcname local kernver="$(<version)" @@ -272,9 +353,9 @@ _package() { # https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344 # The default arm64 image target is 'Image.gz' (per `make -s image_name`); # but some u-boot configs/versions don't support that, so we build 'Image' instead. - # TODO: merge into 'linux-libre' PKGBUILD - [[ "$KARCH" == 'arm64' ]] && \ - install -Dm644 arch/$KARCH/boot/Image "$modulesdir/vmlinuz" || \ + # TODO: merge into 'linux-libre' PKGBUILD (actually [[ "$CARCH" == 'aarch64' ]]) + [[ "$KARCH" == 'arm64' ]] && # cross-compile over-ride + install -Dm644 arch/$KARCH/boot/Image "$modulesdir/vmlinuz" || install -Dm644 "$(make -s image_name)" "$modulesdir/vmlinuz" # FIXME: aarch64 - the kernel is not installed under /boot @@ -297,6 +378,9 @@ _package() { make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_DTBS_PATH="$pkgdir/boot/dtbs/$pkgbase" dtbs_install # cross-compile over-ride # armv7h presets only work with ALL_kver=$kernver + # TODO: kernel version auto-detection does not work for ARM kernels. + # it may be best to not use auto-detection at all, and use the same mechanism + # for all arches, eg: System.map or somthing simple like this below. backup=("etc/mkinitcpio.d/$pkgbase.preset") echo "Installing mkinitcpio preset..." sed "s|%PKGBASE%|$pkgbase|g;s|%KERNVER%|$kernver|g" ../linux-armv7h.preset \ @@ -311,10 +395,10 @@ _package-headers() { conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}") replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}") # cross-compile over-rides - see note in _package() - conflicts=() # cross-compile over-ride - replaces=() # cross-compile over-ride - conflicts_armv7h=( linux-libre-headers linux-libre-aarch64-headers ) # cross-compile over-ride - replaces_armv7h=( linux-libre-headers linux-libre-aarch64-headers ) # cross-compile over-ride + conflicts=() # cross-compile over-ride + replaces=() # cross-compile over-ride + conflicts_armv7h=( linux-libre-aarch64-headers ) # cross-compile over-ride + replaces_armv7h=( linux-libre-aarch64-headers ) # cross-compile over-ride cd $_srcname local builddir="$pkgdir/usr/lib/modules/$(<version)/build" @@ -345,7 +429,7 @@ _package-headers() { install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s # from linux-armv7 - [[ "$KARCH" != 'arm64' ]] && # aarch64 over-ride + [[ "$KARCH" != 'arm64' ]] && # cross-compile over-ride if [ "$CARCH" = "armv7h" ]; then for i in dove omap2; do mkdir -p "$builddir/arch/$KARCH/mach-$i" @@ -422,10 +506,10 @@ _package-docs() { conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}") replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}") # cross-compile over-rides - see note in _package() - conflicts=() # cross-compile over-ride - replaces=() # cross-compile over-ride - conflicts_armv7h=(linux-libre-docs linux-libre-aarch64-docs) # cross-compile over-ride - replaces_armv7h=( linux-libre-docs linux-libre-aarch64-docs) # cross-compile over-ride + conflicts=() # cross-compile over-ride + replaces=() # cross-compile over-ride + conflicts_armv7h=(linux-libre-aarch64-docs) # cross-compile over-ride + replaces_armv7h=( linux-libre-aarch64-docs) # cross-compile over-ride cd $_srcname local builddir="$pkgdir/usr/lib/modules/$(<version)/build" |