2019-10-05 14:09:52 +00:00
|
|
|
_flavor=postmarketos-qcom-msm8974
|
2020-01-21 23:11:47 +00:00
|
|
|
_config="config-$_flavor.$CARCH"
|
2018-04-16 12:47:52 +00:00
|
|
|
|
2020-01-21 23:11:47 +00:00
|
|
|
pkgname=linux-$_flavor
|
2018-04-16 12:47:52 +00:00
|
|
|
|
2020-03-22 17:46:06 +00:00
|
|
|
pkgver=5.6.0_rc6
|
2020-03-29 18:19:10 +00:00
|
|
|
pkgrel=1
|
2018-04-16 12:47:52 +00:00
|
|
|
|
2019-06-20 12:47:40 +00:00
|
|
|
arch="armv7"
|
2019-10-05 14:09:52 +00:00
|
|
|
pkgdesc="Kernel close to mainline with extra patches for Qualcomm MSM8974 devices"
|
2018-04-16 12:47:52 +00:00
|
|
|
url="https://kernel.org/"
|
2020-03-29 18:19:10 +00:00
|
|
|
makedepends="dtbtool perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex findutils"
|
2018-04-16 12:47:52 +00:00
|
|
|
options="!strip !check !tracedeps"
|
2020-03-22 17:46:06 +00:00
|
|
|
_commit="5e47680b0bbc71dbc093123790951cc81eb2b84e"
|
2018-04-16 12:47:52 +00:00
|
|
|
source="
|
2020-03-22 17:46:06 +00:00
|
|
|
https://gitlab.com/postmarketOS/linux-postmarketos/-/archive/$_commit/linux-postmarketos-$_commit.tar.gz
|
2020-01-21 23:11:47 +00:00
|
|
|
config-$_flavor.armv7
|
2018-04-16 12:47:52 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
subpackages="$pkgname-dev"
|
|
|
|
|
|
|
|
license="GPL2"
|
|
|
|
_abi_release=$_pkgver
|
2020-01-21 23:11:47 +00:00
|
|
|
_carch=$CARCH
|
2018-04-16 12:47:52 +00:00
|
|
|
case "$_carch" in
|
|
|
|
aarch64*) _carch="arm64" ;;
|
|
|
|
arm*) _carch="arm" ;;
|
|
|
|
ppc*) _carch="powerpc" ;;
|
|
|
|
s390*) _carch="s390" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
HOSTCC="${CC:-gcc}"
|
|
|
|
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
|
|
|
|
|
2020-03-22 17:46:06 +00:00
|
|
|
builddir="$srcdir/linux-postmarketos-$_commit"
|
2018-04-16 12:47:52 +00:00
|
|
|
|
|
|
|
prepare() {
|
|
|
|
local _patch_failed=
|
2018-09-03 07:45:32 +00:00
|
|
|
ls "$srcdir"
|
2018-04-16 12:47:52 +00:00
|
|
|
# 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" HOSTCC="$HOSTCC" \
|
|
|
|
olddefconfig
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "$srcdir"/build
|
|
|
|
unset LDFLAGS
|
|
|
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
2020-01-21 23:11:47 +00:00
|
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-$_flavor" \
|
2018-04-16 12:47:52 +00:00
|
|
|
CFLAGS_MODULE=-fno-pic
|
2018-04-30 17:54:26 +00:00
|
|
|
|
|
|
|
dtbTool -s 2048 -p scripts/dtc/ -o arch/arm/boot/dt.img arch/arm/boot/dts --version=2
|
2018-04-16 12:47:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2020-01-21 23:11:47 +00:00
|
|
|
cd "$srcdir/build/arch/$_carch/boot"
|
2018-04-16 12:47:52 +00:00
|
|
|
|
|
|
|
if [ "$CARCH" == "aarch64" ]; then
|
2020-01-21 23:11:47 +00:00
|
|
|
install -Dm644 "$srcdir/build/arch/$_carch/boot/Image" \
|
2018-04-16 12:47:52 +00:00
|
|
|
"$pkgdir/boot/vmlinuz-$_flavor"
|
|
|
|
else
|
2020-01-21 23:11:47 +00:00
|
|
|
install -Dm644 "$srcdir/build/arch/$_carch/boot/"*zImage \
|
2018-04-16 12:47:52 +00:00
|
|
|
"$pkgdir/boot/vmlinuz-$_flavor"
|
|
|
|
fi
|
|
|
|
|
|
|
|
install -D "$srcdir/build/include/config/kernel.release" \
|
|
|
|
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
|
|
|
|
|
2018-04-30 17:54:26 +00:00
|
|
|
install -Dm644 "$srcdir/build/arch/arm/boot/dt.img" \
|
|
|
|
"$pkgdir/boot/dt.img"
|
|
|
|
|
2018-04-16 12:47:52 +00:00
|
|
|
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,
|
2019-06-25 07:12:10 +00:00
|
|
|
# similar to what ubuntu does
|
2018-04-16 12:47:52 +00:00
|
|
|
#
|
2019-06-25 07:12:10 +00:00
|
|
|
# this way you don't need to install the 300-400 kernel sources to
|
2018-04-16 12:47:52 +00:00
|
|
|
# build a tiny kernel module
|
|
|
|
#
|
|
|
|
pkgdesc="Headers and script for third party modules for postmarketos kernel"
|
|
|
|
depends="gmp-dev bash perl"
|
2020-01-21 23:11:47 +00:00
|
|
|
local dir="$subpkgdir"/usr/src/linux-headers-$_abi_release
|
2018-04-16 12:47:52 +00:00
|
|
|
|
|
|
|
# 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" HOSTCC="$HOSTCC" \
|
|
|
|
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
|
2019-06-25 07:12:10 +00:00
|
|
|
# modules to believe this is the sources
|
2018-04-16 12:47:52 +00:00
|
|
|
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
|
|
|
|
|
2020-01-21 23:11:47 +00:00
|
|
|
mkdir -p "$subpkgdir"/lib/modules/$_abi_release
|
|
|
|
ln -sf /usr/src/linux-headers-$_abi_release \
|
|
|
|
"$subpkgdir"/lib/modules/$_abi_release/build
|
2018-04-16 12:47:52 +00:00
|
|
|
}
|
2019-05-30 12:00:31 +00:00
|
|
|
|
2020-03-22 17:46:06 +00:00
|
|
|
sha512sums="946ef7133dd980a969afd0cfbaae55652cb3ddff588511cd5396f8a9a997e7e36b18e93f197917b3a0ba4b6e73f069ee248f8b26dfcb6acdd0bd3a9e093b775e linux-postmarketos-5e47680b0bbc71dbc093123790951cc81eb2b84e.tar.gz
|
2020-03-22 17:54:11 +00:00
|
|
|
366dca7607624aab3079230d6be9018e08ca9f38a254500fae2279a9560e773a4446118a0a2c4c064feebf640a3f4e827cc8b40041649015c0e66089622a24fe config-postmarketos-qcom-msm8974.armv7"
|