pmaports/device/testing/linux-google-crosshatch-mainline/APKBUILD
Oliver Smith 7463d92293
device/*: clarify "close to mainline" (cosmetic) (MR 1408)
Make it clear, that these kernels are not mainline, but "close to
mainline".

[ci:skip-build] [ci:skip-vercheck]: just changing pkgdesc

Related: https://wiki.postmarketos.org/wiki/(Close_to)_Mainline
2020-07-11 16:06:16 +02:00

163 lines
4.6 KiB
Text

# Kernel config based on: arch/arm64/configs/defconfig
# APKBUILD based on linux-postmarketos-mainline
# See: https://gitlab.com/postmarketOS/pmaports/issues/153
_flavor=google-crosshatch-mainline
_config="config-$_flavor.$CARCH"
pkgname=linux-$_flavor
pkgver=5.3_rc5
_pkgver=${pkgver/_/-}
_kernver=${pkgver%_rc*}
_mainver=${_kernver%.*}
_patchlevel=${_kernver/$_mainver./}
_basever=$_mainver.$((_patchlevel-1))
pkgrel=1
arch="aarch64"
pkgdesc="Google Pixel 3 XL kernel fork, close to mainline"
url="https://kernel.org/"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex"
options="!strip !check !tracedeps pmb:cross-native"
_repository="linux"
_commit="9c9b87cec239101274451cc9c086da60108f9fda"
source="
$pkgname-$_commit.tar.gz::https://github.com/Pixel3Dev/$_repository/archive/$_commit.tar.gz
config-$_flavor.aarch64
"
subpackages="$pkgname-dev"
license="GPL2"
_abi_release=$_pkgver
_carch=$CARCH
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
builddir="$srcdir/linux-$_commit"
prepare() {
local _patch_failed=
# first apply patches in specified order
for i in $source; do
case $i in
*.patch|*.patch::*)
_patch=${i%::*}
msg "Applying $_patch..."
if ! patch -s -p1 -N -i "$srcdir"/$_patch; then
echo $_patch >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
mkdir -p "$srcdir"/build
cp -v "$srcdir"/$_config "$srcdir"/build/.config
make -C "$builddir" O="$srcdir"/build ARCH="$_carch" \
olddefconfig
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \
CFLAGS_MODULE=-fno-pic
}
package() {
cd "$srcdir/build/arch/$_carch/boot"
if [ "$CARCH" == "aarch64" ]; then
install -Dm644 "$srcdir/build/arch/$_carch/boot/Image.gz" \
"$pkgdir/boot/vmlinuz-$_flavor"
else
install -Dm644 "$srcdir/build/arch/$_carch/boot/"*zImage \
"$pkgdir/boot/vmlinuz-$_flavor"
fi
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
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"
}
dev() {
# copy the only the parts that we really need for build 3rd party
# kernel modules and install those as /usr/src/linux-headers,
# similar to what ubuntu does
#
# this way you don't need to install the 300-400 kernel sources to
# build a tiny kernel module
#
pkgdesc="Headers and script for third party modules for postmarketos kernel"
depends="gmp-dev bash perl"
local dir="$subpkgdir"/usr/src/linux-headers-$_abi_release
# first we import config, run prepare to set up for building
# external modules, and create the scripts
mkdir -p "$dir"
cp "$srcdir"/$_config "$dir"/.config
make -j1 -C "$builddir" O="$dir" ARCH="$_carch" \
olddefconfig prepare modules_prepare scripts
# needed for 3rd party modules
# https://bugzilla.kernel.org/show_bug.cgi?id=11143
case "$CARCH" in
ppc*) (cd "$dir" && make arch/powerpc/lib/crtsavres.o);;
esac
# remove the stuff that points to real sources. we want 3rd party
# modules to believe this is the sources
rm "$dir"/Makefile "$dir"/source
# copy the needed stuff from real sources
#
# this is taken from ubuntu kernel build script
# http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk
cd "$builddir"
find . -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pdm "$dir"
cp -a scripts include "$dir"
find $(find arch -name include -type d -print) -type f \
| cpio -pdm "$dir"
install -Dm644 "$srcdir"/build/Module.symvers \
"$dir"/Module.symvers
mkdir -p "$subpkgdir"/lib/modules/$_abi_release
ln -sf /usr/src/linux-headers-$_abi_release \
"$subpkgdir"/lib/modules/$_abi_release/build
}
sha512sums="1ce235689d7ce0b40be203cb16c1bdfe9bc7b2c5e793a942afc5ea4f3268a0a15b684d9c4017a87916d989d8592a96a4223976c95bf7fcca603e71d2f20fee86 linux-google-crosshatch-mainline-9c9b87cec239101274451cc9c086da60108f9fda.tar.gz
e33913137709c3192458fc95f23580e1659b4714bb4031bc2c354c4db790e455df84c104cdb85078d3dc7c3a456f8891f285f4ae480e7751ebfce283346b2924 config-google-crosshatch-mainline.aarch64"