2018-04-16 12:47:52 +00:00
|
|
|
_flavor=postmarketos-qcom
|
|
|
|
_config="config-${_flavor}.${CARCH}"
|
|
|
|
|
|
|
|
pkgname=linux-${_flavor}
|
|
|
|
|
2018-04-30 18:39:12 +00:00
|
|
|
pkgver=4.17_rc3
|
2018-12-22 19:03:50 +00:00
|
|
|
pkgrel=8
|
2018-04-16 12:47:52 +00:00
|
|
|
|
|
|
|
arch="armhf"
|
|
|
|
pkgdesc="Kernel close to mainline with extra patches for Qualcomm devices"
|
|
|
|
url="https://kernel.org/"
|
|
|
|
depends=""
|
2018-12-22 19:03:50 +00:00
|
|
|
makedepends="dtbtool perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex"
|
2018-04-16 12:47:52 +00:00
|
|
|
options="!strip !check !tracedeps"
|
|
|
|
install=
|
2018-05-13 19:47:32 +00:00
|
|
|
_commit="09efb4857f1a4119eced855912043817bd96e064"
|
2018-04-16 12:47:52 +00:00
|
|
|
source="
|
2018-06-30 14:08:43 +00:00
|
|
|
linux-${_commit}.tar.gz::https://gitlab.com/postmarketOS/linux-postmarketos/-/archive/${_commit}/linux-postmarketos-${_commit}.tar.gz
|
2018-04-16 12:47:52 +00:00
|
|
|
config-${_flavor}.armhf
|
2018-10-03 18:49:38 +00:00
|
|
|
0001-Fix-Hammerhead-backlight.patch
|
2018-04-16 12:47:52 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
HOSTCC="${CC:-gcc}"
|
|
|
|
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
|
|
|
|
|
2018-04-30 18:39:12 +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
|
|
|
cd "$builddir"
|
|
|
|
# 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}" \
|
|
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-${_flavor}" \
|
|
|
|
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() {
|
|
|
|
cd "$srcdir/build/arch/${_carch}/boot"
|
|
|
|
|
|
|
|
if [ "$CARCH" == "aarch64" ]; then
|
|
|
|
install -Dm644 "$srcdir/build/arch/${_carch}/boot/Image" \
|
|
|
|
"$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"
|
|
|
|
|
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,
|
|
|
|
# simlar to what ubuntu does
|
|
|
|
#
|
|
|
|
# this way you dont 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" 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
|
|
|
|
# modules to believe this is the soruces
|
|
|
|
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
|
|
|
|
|
|
|
|
# cross-compiling: delete binaries with host arch and replace them with
|
|
|
|
# symlinks to binaries with the target arch (packaged in kernel-scripts)
|
|
|
|
if [ -n "$CROSS_COMPILE" ]; then
|
|
|
|
msg "Symlinking binary scripts..."
|
|
|
|
depends="$depends kernel-scripts"
|
2018-09-03 07:45:32 +00:00
|
|
|
local found="false"
|
2018-04-16 12:47:52 +00:00
|
|
|
cd "$dir/scripts"
|
|
|
|
local i
|
|
|
|
for i in $(find . -type f); do
|
|
|
|
local type="$(file -b --mime-type "$i")"
|
2018-09-03 07:45:32 +00:00
|
|
|
[ "$type" != "application/x-pie-executable" ] && continue
|
2018-04-16 12:47:52 +00:00
|
|
|
local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)"
|
|
|
|
ln -svf "$native" "$i"
|
2018-09-03 07:45:32 +00:00
|
|
|
found="true"
|
2018-04-16 12:47:52 +00:00
|
|
|
done
|
2018-09-03 07:45:32 +00:00
|
|
|
if [ "$found" = "false" ]; then
|
|
|
|
error "Failed to symlink binary scripts!"
|
|
|
|
error "Did the mime-type change (see #1659)?"
|
|
|
|
return 1
|
|
|
|
fi
|
2018-04-16 12:47:52 +00:00
|
|
|
fi
|
|
|
|
}
|
2018-05-13 19:47:32 +00:00
|
|
|
sha512sums="02fd136d24914e30decd207c3b2e0168cc9d6e4a0fc981abf8d537cd95c70583f5239d0dc7f2ae94a2ddd2ba82d822933159167801a035731a24aa1300c5ceec linux-09efb4857f1a4119eced855912043817bd96e064.tar.gz
|
2018-10-03 18:49:38 +00:00
|
|
|
fc151402f33f947fdfb1a0f60f7dee621b2299678c14bbc2d3425c22b3300795cddfba8635f3d2d9a409ea506e825d00957bffe14d54cd14612d364a1d03529a config-postmarketos-qcom.armhf
|
|
|
|
caf6d5615548dda58261c1d0fb571b93f0bd057a7dd071980e2402bae62bb951e40375693776b846a431c9ea47b8e6098f292b83b3744b23f2e5663f830b3548 0001-Fix-Hammerhead-backlight.patch"
|