summaryrefslogtreecommitdiff
path: root/libre/linux-libre-64/PKGBUILD
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-07-21 22:20:40 -0500
committerIván Ávalos <avalos@disroot.org>2022-07-21 22:20:40 -0500
commite4e3858e06dcaf7bf037aa0840a2db43133f5c52 (patch)
tree2eed65fe882a8ade5708145c97ec4505dda26f4b /libre/linux-libre-64/PKGBUILD
parentf05a5e6f29f50988a7906a9953901f9ffade54a6 (diff)
parent51b56166c4547506ad93de453b150bfd4de99d33 (diff)
downloadabslibre-e4e3858e06dcaf7bf037aa0840a2db43133f5c52.tar.gz
abslibre-e4e3858e06dcaf7bf037aa0840a2db43133f5c52.tar.bz2
abslibre-e4e3858e06dcaf7bf037aa0840a2db43133f5c52.zip
Merged upstream
Diffstat (limited to 'libre/linux-libre-64/PKGBUILD')
-rw-r--r--libre/linux-libre-64/PKGBUILD153
1 files changed, 76 insertions, 77 deletions
diff --git a/libre/linux-libre-64/PKGBUILD b/libre/linux-libre-64/PKGBUILD
index 2dcfef4ff..a75d06f1d 100644
--- a/libre/linux-libre-64/PKGBUILD
+++ b/libre/linux-libre-64/PKGBUILD
@@ -1,5 +1,16 @@
+# Contributor: David P. <megver83@parabola.nu>
+# Contributor: André Silva <emulatorman@hyperbola.info>
+# Contributor: Márcio Silva <coadde@hyperbola.info>
+# Contributor: fauno <fauno@parabola.nu>
+# Contributor: Sorin-Mihai Vârgolici <smv@yobicore.org>
+# 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>
+# Based on linux package
+# Based on linux-libre package, actually - megver83 will become maintainer eventually
+
# WIP: This PKGBUILD is derived from the 'linux-libre' PKGBUILD,
# and includes a lot of unused cruft, to minimize the diff.
# Eventually, these differences can be merged into linux-libre,
@@ -12,46 +23,39 @@
# is over-ridden for the special purpose of the cross-compilation.
#
# The makedepends_armv7h, source_armv7h, and sha512sums_armv7h arrays
-# (also source_aarch64 and sha512sums_aarch64 obviously),
-# and any lines with comment: '# aarch64 over-ride',
-# indicate code that would eventually be deleted or associated with
-# $CARCH 'aarch64', if/when aarch64 becomes a valid target.
+# (also source_aarch64 and sha512sums_aarch64 obviously), and the comments:
+# '# cross-compile over-ride' and
+# '# TODO: merge into 'linux-libre' PKGBUILD',
+# indicate code that would eventually be deleted, merged into,
+# or associated with $CARCH: 'aarch64', if/when aarch64 becomes a valid target.
# All other LOCs of consequence in this file,
-# except for the `make` and `strip` commands,
# 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
-# (eg: source_armv7h simply becomes source_aarch64).
-#
-# NOTE: There is no need to upload or publish the generated *.src.tar.gz package.
-# Because this 'pkgbase' is identical to the 'linux-libre' PKGBUILD;
-# the generated *.src.tar.gz package will be identical, in name and contents.
-# After running `librestage`, you can delete the staging/ directory,
-# before running `librerelease`.
-# $ rm -rf $(source /etc/libretools.conf ; echo ${WORKDIR} ;)/staging/sources
+# and it is obvious which parts are intended to become aarch64-specific,
+# or exist only for cross-compiling the aarch64 kernel for armv7h systems.
_replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix
_replacesoldkernels=() # '%' gets replaced with kernel suffix
_replacesoldmodules=() # '%' gets replaced with kernel suffix
-pkgbase=linux-libre
+pkgbase=linux-libre-64 # cross-compile over-ride
pkgver=5.18.5
-pkgrel=1
-pkgdesc='Linux-libre'
-pkgdesc+=' 64-bit (aarch64) for Parabola armv7h' # aarch64 over-ride
+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) # aarch64 over-ride
+arch=(armv7h) # cross-compile over-ride
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 vboot-utils dtc) # required by linux-libre-chromebook
-makedepends_armv7h+=(aarch64-linux-gnu-gcc) # aarch64 over-ride
+makedepends_armv7h+=(aarch64-linux-gnu-gcc-initial) # cross-compile over-ride
options=('!strip')
_srcname=linux-5.18
source=(
@@ -80,7 +84,7 @@ source_i686=(
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
+ # Arch Linux ARM patches (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
@@ -97,7 +101,7 @@ source_aarch64=(
0001-net-smsc95xx-Allow-mac-address-to-be-set-as-a-parame.patch
0002-arm64-dts-rockchip-disable-pwm0-on-rk3399-firefly.patch
)
-source_armv7h=( ${source_aarch64[*]} ) # aarch64 over-ride
+source_armv7h=( ${source_aarch64[*]} ) # cross-compile over-ride
validpgpkeys=(
'474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva
'6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78' # David P.
@@ -134,22 +138,25 @@ sha512sums_armv7h=('5a75b12dd386940a0bf1be630d45a514ef3c32289ec5976988764baa8483
'85b2e16a930b8066990c42f973d386dc3c6d62fdf3d1289bbb51df3df296c26f30051162fba49a42d38f71f05de926aa8c065097f14bd8e9f8e28a52949ead00'
'2e99582d8b670b6c6b27add14b60e957cbcf9cd6aae40491bd9dea6ac455c0ade0bbee21e3bdfb5e06ce83ad27c5a788404b05bf7ac93831ca18d2e60a67017c'
'5b77c587cf2ffb60acf1d9eb43330983548c7e81a53e0ffd2b04962a99441a0000d631ff77c245c7062afc2c8368d996a2456496d42dcb658f330e5083e5e029')
-sha512sums_aarch64=('bc7b70863929737346fe6757373897391b43af36bb6884d5351a95aca0f9120f2d2cf9b9c2c6426a440c6b394e9fb334c280711d64081563322a834ecdfb2ba6'
+sha512sums_aarch64=('0510d1ad02d0ed0dbc03084fa36ae27b869eec8efe74dbe063b76a0b5ff09828c728baa17b89d20d092b310f3142656bcd9c66f006a6b7800ecd36550b6e15be'
'69e81aff3ac5aada75f7330e8c82d0a6aa229585b3f442b2e1a9b86681b0eadc925408d5e2377026599fb0dee72d29043eca4d072b0e2606adc34c872e95c7d6'
'4224779106cc520dc2c431322d9693cc968476706854ae9630611cf2896c48a34ca11bf31a4c3995573a128cf5838a6763bac86eb4cbaf509ade9b6a83a24369')
-sha512sums_armv7h=( ${sha512sums_aarch64[*]} ) # aarch64 over-ride
+sha512sums_armv7h=( ${sha512sums_aarch64[*]} ) # cross-compile over-ride
_replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}")
_replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}")
_replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}")
+_replacesarchkernel=("${_replacesarchkernel[@]/-64/}") # cross-compile over-ride
case "$CARCH" in
- armv7h) KARCH=arm64 ; CROSS_COMPILE=aarch64-linux-gnu- ;; # aarch64 over-ride
+ armv7h) KARCH=arm64 ; CROSS_COMPILE=aarch64-linux-gnu- ;; # cross-compile over-ride
+ aarch64) KARCH=arm64;; # TODO: merge into 'linux-libre' PKGBUILD
i686|x86_64) KARCH=x86;;
armv7h) KARCH=arm;;
esac
export KBUILD_BUILD_HOST=parabola
export KBUILD_BUILD_USER=$pkgbase
+export KBUILD_BUILD_USER=${pkgbase/-64/} # cross-compile over-ride
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
@@ -191,7 +198,8 @@ prepare() {
done
fi
- if [ "$CARCH" = "aarch64" ]; then # TODO: (unused) aarch64 is not yet a valid parabola target
+ if [ "$CARCH" = "aarch64" ]; then # TODO: merge into 'linux-libre' PKGBUILD
+ # TODO: better yet, all of these per-arch patching routines should be DRY-ed out
local src_aarch64
for src_aarch64 in "${source_aarch64[@]}"; do
src_aarch64="${src_aarch64%%::*}"
@@ -216,20 +224,20 @@ prepare() {
# 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.
- if [[ "${KARCH}" == aarch64 ]] # aarch64 over-ride
- then cp ../config.aarch64 .config ; echo 'CONFIG_COMPAT=y' >> .config ; # aarch64 over-ride
- fi # aarch64 over-ride
- make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE olddefconfig
+ if [[ "$KARCH" == 'arm64' ]] # cross-compile over-ride
+ then cp ../config.aarch64 .config ; echo 'CONFIG_COMPAT=y' >> .config ; # cross-compile over-ride
+ fi # cross-compile over-ride
+ make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE olddefconfig # cross-compile over-ride
diff -u ../config.$CARCH .config || :
- make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE -s kernelrelease > version
+ make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE -s kernelrelease > version # cross-compile over-ride
echo "Prepared $pkgbase version $(<version)"
}
build() {
cd $_srcname
- make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE all
- make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE htmldocs
+ make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE all # cross-compile over-ride
+ make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE htmldocs # cross-compile over-ride
}
_package() {
@@ -238,21 +246,22 @@ _package() {
optdepends=('wireless-regdb: to set the correct wireless channels of your country'
'linux-libre-firmware: firmware images needed for some devices')
provides=(VIRTUALBOX-GUEST-MODULES WIREGUARD-MODULE)
- conflicts=() # FIXME: in 'linux-libre', conflicts array is appended before declared
+ conflicts=() # TODO: merge into 'linux-libre' PKGBUILD (conflicts array is appended before declared)
replaces=(virtualbox-guest-modules-arch wireguard-arch)
provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver")
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 obsolete parabola 'linux-libre-aarch64'.
- # These are defined analogougly in _package-headers(), _package-docs(), and _package-chromebook().
- conflicts=( ${conflicts[*]/linux*/} ) # aarch64 over-ride
- replaces=( ${replaces[*]/linux*/} ) # aarch64 over-ride
- provides_armv7h=( linux-libre ) # aarch64 over-ride
- conflicts_armv7h=( linux-libre linux-libre-aarch64 ) # aarch64 over-ride
- replaces_armv7h=( linux-libre linux-libre-aarch64 ) # aarch64 over-ride
+ # Below is providing/replacing 'linux-libre' and the obsoleted parabola 'linux-libre-aarch64'.
+ # 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
cd $_srcname
local kernver="$(<version)"
@@ -263,44 +272,35 @@ _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.
- [[ "$KARCH" == "arm64" ]] && \
+ # TODO: merge into 'linux-libre' PKGBUILD
+ [[ "$KARCH" == 'arm64' ]] && \
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
- if [[ "$KARCH" == "arm64" && ! -f "$pkgdir/boot/Image" ]]
- then echo "FIXME: kernel was not installed to $\pkgdir/boot"
- cp "$modulesdir/vmlinuz" "$pkgdir/boot/Image"
+ if [[ "$KARCH" == 'arm64' && ! -f "$pkgdir/boot/Image" ]]
+ then echo "FIXME: kernel was not installed to \$pkgdir/boot"
+ install -Dm644 "$modulesdir/vmlinuz" "$pkgdir/boot/vmlinuz-${basename}-64"
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
+ make ARCH=$KARCH CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 modules_install # cross-compile over-ride
# remove build and source links
rm "$modulesdir"/{source,build}
-
-# DEBUG BEGIN
-echo "DEBUG: ls -l $pkgdir/etc/mkinitcpio.d/*" ; ls -l $pkgdir/etc/mkinitcpio.d/* ;
-[[ -f "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset" ]] && cat "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset" || echo "DEBUG: $pkgbase.preset does not exist"
-echo "DEBUG: END"
-# DEBUG END
-
-
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
+ 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
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"
- sed -i "s|${pkgbase}|${pkgbase}-64|g" "$pkgdir/etc/mkinitcpio.d/$pkgbase.preset" # aarch64 over-ride
- mv "$pkgdir/etc/mkinitcpio.d/$pkgbase{,-64}.preset" # aarch64 over-ride
fi
}
@@ -310,11 +310,11 @@ _package-headers() {
provides=("${_replacesarchkernel[@]/%/-headers=$pkgver}")
conflicts=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
replaces=("${_replacesarchkernel[@]/%/-headers}" "${_replacesoldkernels[@]/%/-headers}")
- # aarch64 over-rides - see note in _package()
- conflicts=() # aarch64 over-ride
- replaces=() # aarch64 over-ride
- conflicts_armv7h=( linux-libre-headers linux-libre-aarch64-headers ) # aarch64 over-ride
- replaces_armv7h=( linux-libre-headers linux-libre-aarch64-headers ) # aarch64 over-ride
+ # 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
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
@@ -344,8 +344,8 @@ _package-headers() {
cp -t "$builddir/arch/$KARCH" -a arch/$KARCH/include
install -Dt "$builddir/arch/$KARCH/kernel" -m644 arch/$KARCH/kernel/asm-offsets.s
- [[ "$KARCH" == "arm64" ]] || # aarch64 over-ride
# from linux-armv7
+ [[ "$KARCH" != 'arm64' ]] && # aarch64 over-ride
if [ "$CARCH" = "armv7h" ]; then
for i in dove omap2; do
mkdir -p "$builddir/arch/$KARCH/mach-$i"
@@ -391,7 +391,7 @@ _package-headers() {
echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
- alias strip=${CROSS_COMPILE}strip # aarch64 over-ride
+ strip() { ${CROSS_COMPILE}strip "${@}" ; } ; # cross-compile over-ride
echo "Stripping build tools..."
local file
@@ -421,11 +421,11 @@ _package-docs() {
provides=("${_replacesarchkernel[@]/%/-docs=$pkgver}")
conflicts=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
replaces=("${_replacesarchkernel[@]/%/-docs}" "${_replacesoldkernels[@]/%/-docs}")
- # aarch64 over-rides - see note in _package()
- conflicts=() # aarch64 over-ride
- replaces=() # aarch64 over-ride
- conflicts_armv7h=(linux-libre-docs linux-libre-aarch64-docs) # aarch64 over-ride
- replaces_armv7h=( linux-libre-docs linux-libre-aarch64-docs) # aarch64 over-ride
+ # 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
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
@@ -450,12 +450,11 @@ _package-chromebook() {
conflicts=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
replaces=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
install=$pkgbase-chromebook.install
- # aarch64 over-rides - see note in _package()
- depends=( ${depends[*]/${pkgbase}/${pkgbase}-64} ) # aarch64 over-ride
- provides=( ${provides[*]/armv7/aarch64} ) # aarch64 over-ride
- conflicts=( ${conflicts[*]/armv7/aarch64} ) # aarch64 over-ride
- replaces=( ${replaces[*]/armv7/aarch64} ) # aarch64 over-ride
- install=${install/${pkgbase}/${pkgbase}-64} # aarch64 over-ride
+ # NOTE: when aarch64 becomes a supported target, 'armv7' above should be changed to "${CARCH}"
+ depends=( ${depends[*]/linux-libre/${pkgbase}} ) # cross-compile over-ride
+ provides=( ${provides[*]/armv7/aarch64} ) # cross-compile over-ride
+ conflicts=( ${conflicts[*]/armv7/aarch64} ) # cross-compile over-ride
+ replaces=( ${replaces[*]/armv7/aarch64} ) # cross-compile over-ride
cd $_srcname
@@ -464,6 +463,7 @@ _package-chromebook() {
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
+ # TODO: merge into 'linux-libre' PKGBUILD (--arch ${KARCH})
echo "Creating kernel sign..."
vbutil_kernel \
--pack vmlinux.kpart \
@@ -481,12 +481,11 @@ _package-chromebook() {
}
pkgname=("$pkgbase" "$pkgbase-headers" "$pkgbase-docs")
-pkgname=( ${pkgname[*]/${pkgbase}/${pkgbase}-64} ) # aarch64 over-ride
# 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
-# [[ "${KARCH}" != aarch64 ]] || pkgname+=("$pkgbase-chromebook") # aarch64 over-ride
+# [[ $CARCH = armv7h ]] && pkgname+=("$pkgbase-chromebook")
for _p in "${pkgname[@]}"; do
eval "package_$_p() {
$(declare -f "_package${_p#$pkgbase}")