# Reference: # Kernel config based on: arch/arm64/configs/librem5-devkit_defconfig pkgname="linux-purism-librem5" pkgver=5.3 pkgrel=0 pkgdesc="Purism Librem 5 phone kernel fork" arch="aarch64" _carch="arm64" _flavor="purism-librem5" url="https://kernel.org" license="GPL-2.0-only" options="!strip !check !tracedeps" makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev bison flex openssl-dev" # Compiler: latest GCC from Alpine HOSTCC="${CC:-gcc}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}" # Source _repository="linux-next" # imx8-current-librem5 branch: _commit="943e968dc344b7a5535f299b12b462aaecb60a75" _config="config-$_flavor.$arch" source=" $pkgname-$_commit.tar.gz::https://source.puri.sm/Librem5/$_repository/-/archive/$_commit.tar.gz $_config " builddir="$srcdir/$_repository-$_commit" prepare() { default_prepare REPLACE_GCCH=0 \ downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC" } build() { unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" } package() { # kernel.release install -D "$builddir/include/config/kernel.release" \ "$pkgdir/usr/share/kernel/$_flavor/kernel.release" # zImage (find the right one) cd "$builddir/arch/$_carch/boot" _target="$pkgdir/boot/vmlinuz-$_flavor" for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do [ -e "$_zimg" ] || continue msg "zImage found: $_zimg" install -Dm644 "$_zimg" "$_target" break done if ! [ -e "$_target" ]; then error "Could not find zImage in $PWD!" return 1 fi cd "$builddir" local _install case "$CARCH" in aarch64*|arm*) _install="modules_install dtbs_install" ;; *) _install="modules_install" ;; esac make -j1 $_install \ ARCH="$_carch" \ INSTALL_MOD_PATH="$pkgdir" \ INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb" } sha512sums="895ace8d703c7c2123086a2958eabfb64ebbe19a21a2b7f4d669635f0c8e49148125555681754e949a26c940f4ff8d0ce0efea451cebd7dc6d224bdeba24d936 linux-purism-librem5-943e968dc344b7a5535f299b12b462aaecb60a75.tar.gz 3d17eb02738bc364e3ff892581eca3528ed10949dd7ad43530735256abaef6af76309508292443d79c0651bbbf24508c01c38296ea189931a849f161bac308f7 config-purism-librem5.aarch64"