pmaports/device/community/linux-postmarketos-qcom-sdm845/APKBUILD
Caleb Connolly 5fa718644e
linux-postmarketos-qcom-sdm845: use ZBOOT (MR 4542)
EFI booting with systemd-boot requires building the kernel with ZBOOT -
the EFI decompressor stub. However, this breaks the old Android booting.
Detect when ZBOOT is enabled and install both vmlinuz.efi as well as the
old gzipped kernel image.

To help make this upgrade more seamless, continue to support building
the kernel with ZBOOT disabled and just print a warning.

Disable module stripping - we compress them anyway and a recent kernel
change seems to have caused some bug here.

This is a packaging change that doesn't require rebuilding the kernel.
[ci:skip-vercheck]
2023-11-29 20:32:48 +01:00

71 lines
2.2 KiB
Text

# Maintainer: Caleb Connolly <caleb@connolly.tech>
# Co-Maintainer: Joel Selvaraj <joelselvaraj.oss@gmail.com>
# Stable Linux kernel with patches for SDM845 devices
# Kernel config based on: arch/arm64/configs/defconfig and sdm845.config
_flavor="postmarketos-qcom-sdm845"
pkgname=linux-$_flavor
pkgver=6.5.5
pkgrel=1
pkgdesc="Mainline Kernel fork for SDM845 devices"
arch="aarch64"
_carch="arm64"
url="https://gitlab.com/sdm845-mainline/linux"
license="GPL-2.0-only"
options="!check !tracedeps
pmb:cross-native
pmb:kconfigcheck-community"
makedepends="bash bison findutils flex installkernel openssl-dev perl zstd"
_config="config-$_flavor.$arch"
_tag="sdm845-6.5.5"
# Source
source="
linux-$_tag.tar.gz::https://gitlab.com/sdm845-mainline/linux/-/archive/$_tag/linux-$_tag.tar.gz
$_config
"
builddir="$srcdir/linux-$_tag"
prepare() {
default_prepare
cp "$srcdir/config-$_flavor.$arch" .config
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor"
}
package() {
if [ -e "$builddir/arch/$_carch/boot/vmlinuz.efi" ]; then
# ZBOOT EFI decompressor for EFI booting
install -Dm644 "$builddir/arch/$_carch/boot/vmlinuz.efi" \
"$pkgdir/boot/linux.efi"
# Old GZIP'd kernel image for boot.img compatibility
install -Dm644 "$builddir/arch/$_carch/boot/vmlinuz" \
"$pkgdir/boot/vmlinuz"
else
echo "WARNING: CONFIG_ZBOOT not enabled!"
install -Dm644 "$builddir/arch/$_carch/boot/Image.gz" \
"$pkgdir/boot/vmlinuz"
fi
make modules_install dtbs_install \
ARCH="$_carch" \
INSTALL_PATH="$pkgdir"/boot/ \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_MOD_STRIP=1 \
INSTALL_DTBS_PATH="$pkgdir"/boot/dtbs
rm -f "$pkgdir"/lib/modules/*/build "$pkgdir"/lib/modules/*/source
install -D "$builddir"/include/config/kernel.release \
"$pkgdir"/usr/share/kernel/$_flavor/kernel.release
}
sha512sums="
97d7c4dad9f780ea34c875cd32cfc7bb3d9c5ad9c779f10a079db3ed9b5250aaf4641b11266772b41a38004ea6e1b65200bf75bd410e682206d0ddc81ab47588 linux-sdm845-6.5.5.tar.gz
d1f22202d12a6ba169f261992f4708f6c4957e7483ce6b55d668a019a50a4d64fc4d7a2d862bb290d8f667ca4107fa878133e61e133b518d74cfe4eba1b8d4b8 config-postmarketos-qcom-sdm845.aarch64
"