From f05a5e6f29f50988a7906a9953901f9ffade54a6 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Mon, 11 Jul 2022 17:41:43 -0400 Subject: [linux-libre-64]: restrict build to armv7h --- libre/linux-libre-64/PKGBUILD | 147 ++++++++++++++++++++++++++++-------------- 1 file changed, 100 insertions(+), 47 deletions(-) diff --git a/libre/linux-libre-64/PKGBUILD b/libre/linux-libre-64/PKGBUILD index 6077b7f33..2dcfef4ff 100644 --- a/libre/linux-libre-64/PKGBUILD +++ b/libre/linux-libre-64/PKGBUILD @@ -1,48 +1,57 @@ # 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. - -# NOTE: aarch64 is not yet a valid parabola target. -# This PKGBUILD is inteneded to be cross-compiled -# only from an x86_64 librechroot. The x86_64 build of linux-libre -# does not have any specail per-arch treatments; so that mechanism is -# over-ridden for the special purpose of the cross-compilation. +# 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, +# once parabola has an 'aarch64' build target and repos. # -# The makedepends_x86_64, source_x86_64, and sha512sums_x86_64 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 that target exists. -# 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 should become aarch64-specific -# (eg: source_x86_64 simpliy becomes source_aarch64). +# For now, 'aarch64' is not yet a valid parabola target. +# This PKGBUILD exists only for making an 'aarch64' kernel for use with +# parabola armv7h systems. This PKGBUILD is intended to be cross-compiled +# only from an armv7h librechroot. The per-arch mechanism for armv7h +# 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. +# 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 _replacesarchkernel=('linux%') # '%' gets replaced with kernel suffix _replacesoldkernels=() # '%' gets replaced with kernel suffix _replacesoldmodules=() # '%' gets replaced with kernel suffix -pkgbase=linux-libre-64 +pkgbase=linux-libre pkgver=5.18.5 pkgrel=1 -pkgdesc='Linux-libre 64-bit (aarch64) for Parabola armv7h' +pkgdesc='Linux-libre' +pkgdesc+=' 64-bit (aarch64) for Parabola armv7h' # aarch64 over-ride rcnver=5.18.2 rcnrel=armv7-x6 url='https://linux-libre.fsfla.org/' -arch=(x86_64) # aarch64 over-ride +arch=(i686 x86_64 armv7h) +arch=(armv7h) # aarch64 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_x86_64=(aarch64-linux-gnu-gcc) # aarch64 over-ride +makedepends_armv7h+=(aarch64-linux-gnu-gcc) # aarch64 over-ride options=('!strip') _srcname=linux-5.18 source=( @@ -88,7 +97,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_x86_64=( ${source_aarch64[*]} ) # aarch64 over-ride +source_armv7h=( ${source_aarch64[*]} ) # aarch64 over-ride validpgpkeys=( '474402C8C582DAFBE389C427BCB7CF877E7D47A7' # Alexandre Oliva '6DB9C4B4F0D8C0DC432CF6E4227CA7C556B2BA78' # David P. @@ -128,18 +137,17 @@ sha512sums_armv7h=('5a75b12dd386940a0bf1be630d45a514ef3c32289ec5976988764baa8483 sha512sums_aarch64=('bc7b70863929737346fe6757373897391b43af36bb6884d5351a95aca0f9120f2d2cf9b9c2c6426a440c6b394e9fb334c280711d64081563322a834ecdfb2ba6' '69e81aff3ac5aada75f7330e8c82d0a6aa229585b3f442b2e1a9b86681b0eadc925408d5e2377026599fb0dee72d29043eca4d072b0e2606adc34c872e95c7d6' '4224779106cc520dc2c431322d9693cc968476706854ae9630611cf2896c48a34ca11bf31a4c3995573a128cf5838a6763bac86eb4cbaf509ade9b6a83a24369') -sha512sums_x86_64=( ${sha512sums_aarch64[*]} ) # aarch64 over-ride +sha512sums_armv7h=( ${sha512sums_aarch64[*]} ) # aarch64 over-ride _replacesarchkernel=("${_replacesarchkernel[@]/\%/${pkgbase#linux-libre}}") _replacesoldkernels=("${_replacesoldkernels[@]/\%/${pkgbase#linux-libre}}") _replacesoldmodules=("${_replacesoldmodules[@]/\%/${pkgbase#linux-libre}}") case "$CARCH" in - x86_64) KARCH=arm64 ; CROSS_COMPILE=aarch64-linux-gnu- ;; # aarch64 over-ride + armv7h) KARCH=arm64 ; CROSS_COMPILE=aarch64-linux-gnu- ;; # aarch64 over-ride i686|x86_64) KARCH=x86;; armv7h) KARCH=arm;; 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})" @@ -183,7 +191,7 @@ prepare() { done fi - if [ "$CARCH" = "x86_64" ]; then # aarch64 over-ride + if [ "$CARCH" = "aarch64" ]; then # TODO: (unused) aarch64 is not yet a valid parabola target local src_aarch64 for src_aarch64 in "${source_aarch64[@]}"; do src_aarch64="${src_aarch64%%::*}" @@ -205,10 +213,10 @@ prepare() { echo "Setting config..." cp ../config.$CARCH .config - if [[ "$CARCH" == x86_64 ]] # aarch64 over-ride - # 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. + # 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 @@ -230,10 +238,21 @@ _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 replaces=(virtualbox-guest-modules-arch wireguard-arch) provides+=("${_replacesarchkernel[@]/%/=$pkgver}" "LINUX-ABI_VERSION=$pkgver") conflicts+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") replaces+=("${_replacesarchkernel[@]}" "${_replacesoldkernels[@]}" "${_replacesoldmodules[@]}") + # 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 cd $_srcname local kernver="$( 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 != x86_64 ]] || pkgname+=("$pkgbase-chromebook") # aarch64 over-ride +# [[ "${KARCH}" != aarch64 ]] || pkgname+=("$pkgbase-chromebook") # aarch64 over-ride for _p in "${pkgname[@]}"; do eval "package_$_p() { $(declare -f "_package${_p#$pkgbase}") -- cgit v1.2.3