summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2022-07-11 17:41:43 -0400
committerbill-auger <mr.j.spam.me@gmail.com>2022-07-16 01:41:40 -0400
commitd6fe52fca5397414cc8b0a3dd124bb5f57769cb1 (patch)
tree4b5c0409b6de0fde85d8a9598a2b3fac10dfaadc
parent820827a4ad5a22a904b05bf8622ca1823014907f (diff)
downloadabslibre-d6fe52fca5397414cc8b0a3dd124bb5f57769cb1.tar.gz
abslibre-d6fe52fca5397414cc8b0a3dd124bb5f57769cb1.tar.bz2
abslibre-d6fe52fca5397414cc8b0a3dd124bb5f57769cb1.zip
[linux-libre-64]: restrict build to armv7h
-rw-r--r--libre/linux-libre-64/PKGBUILD147
1 files 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 <dev@lists.parabola.nu>
-# 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="$(<version)"
@@ -242,12 +261,18 @@ _package() {
echo "Installing boot image..."
# systemd expects to find the kernel here to allow hibernation
# https://github.com/systemd/systemd/commit/edda44605f06a41fb86b7ab8128dcf99161d2344
- # The default arm64 image target is 'Image.gz'; but some u-boot
- # configurations and/or versions don't support that, so we use 'Image' instead.
+ # 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" ]] && \
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"
+ fi
+
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
@@ -257,6 +282,14 @@ _package() {
# 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
@@ -266,6 +299,8 @@ _package() {
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
}
@@ -275,6 +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
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
@@ -304,6 +344,7 @@ _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
if [ "$CARCH" = "armv7h" ]; then
for i in dove omap2; do
@@ -350,23 +391,25 @@ _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
+
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" ;;
+ strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
- ${STRIP} -v $STRIP_STATIC "$file" ;;
+ strip -v $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
- ${STRIP} -v $STRIP_BINARIES "$file" ;;
+ strip -v $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
- ${STRIP} -v $STRIP_SHARED "$file" ;;
+ strip -v $STRIP_SHARED "$file" ;;
esac
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
echo "Stripping vmlinux..."
- ${STRIP} -v $STRIP_STATIC "$builddir/vmlinux"
+ strip -v $STRIP_STATIC "$builddir/vmlinux"
echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
@@ -378,6 +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
cd $_srcname
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
@@ -398,12 +446,16 @@ _package-docs() {
_package-chromebook() {
pkgdesc="$pkgdesc kernel sign for Veyron Chromebooks"
depends=(linux-libre=$pkgver)
- depends=( ${depends[*]/linux-libre/linux-libre-64} ) # aarch64 over-ride
- provides+=("linux-libre-chromebook=$pkgver") # TODO: these provides, conflicts, repalces,
- conflicts+=('linux-libre-chromebook') # will not needed once parabola has
- replaces+=('linux-libre-chromebook') # an 'aarch64' build target and repos
+ provides=("${_replacesarchkernel[@]/%/-armv7-chromebook=$pkgver}")
+ conflicts=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
+ replaces=("${_replacesarchkernel[@]/%/-armv7-chromebook}" "${_replacesoldkernels[@]/%/-armv7-chromebook}")
install=$pkgbase-chromebook.install
- install=linux-libre-chromebook.install # aarch64 over-ride
+ # 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
cd $_srcname
@@ -429,11 +481,12 @@ _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
-# [[ $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}")