2017-07-25 20:08:35 +00:00
|
|
|
# APKBUILD loosely based on linux-vanilla aport. Changes:
|
|
|
|
#
|
|
|
|
# - Use new kernel config for the postmarketos device support
|
|
|
|
# - Package the device tree files
|
|
|
|
#
|
|
|
|
# Kernel config based on: arch/arm/configs/lineageos_mako_defconfig
|
|
|
|
# Changes:
|
|
|
|
# - enable devtmpfs (needed for udev -> touch support in weston)
|
|
|
|
|
|
|
|
_flavor=postmarketos
|
|
|
|
_hash="7b6fbfd899b4133e4f789843e5967beb139ec4d2"
|
|
|
|
_config="config-${_flavor}.${CARCH}"
|
|
|
|
|
|
|
|
pkgname=linux-${_flavor}
|
|
|
|
|
2017-09-28 17:32:30 +00:00
|
|
|
pkgver=4.13.4
|
2017-08-02 16:48:06 +00:00
|
|
|
case $pkgver in
|
|
|
|
*.*.*) _kernver=${pkgver%.*};;
|
|
|
|
*.*) _kernver=$pkgver;;
|
|
|
|
esac
|
2017-09-28 17:32:30 +00:00
|
|
|
pkgrel=0
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
arch="all"
|
|
|
|
pkgdesc="Mainline Linux for pmOS supported chipsets (OMAP)"
|
|
|
|
url="https://kernel.org/"
|
|
|
|
depends="postmarketos-mkinitfs"
|
|
|
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
|
|
|
|
options="!strip !check !tracedeps"
|
|
|
|
install=
|
|
|
|
source="
|
|
|
|
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
|
|
|
|
config-${_flavor}.armhf
|
2017-08-09 20:26:40 +00:00
|
|
|
config-${_flavor}.aarch64
|
2017-07-25 20:08:35 +00:00
|
|
|
config-${_flavor}.x86_64
|
2017-08-02 16:48:06 +00:00
|
|
|
0001-rx51-drm-regression-workaround.patch
|
2017-07-25 20:08:35 +00:00
|
|
|
"
|
2017-08-02 16:48:06 +00:00
|
|
|
|
|
|
|
if [ "${pkgver%.0}" = "$pkgver" ]; then
|
|
|
|
source="$source
|
|
|
|
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz"
|
|
|
|
fi
|
2017-07-25 20:08:35 +00:00
|
|
|
subpackages="$pkgname-dev::$CBUILD_ARCH"
|
|
|
|
|
2017-08-02 16:48:06 +00:00
|
|
|
license="GPL2"
|
2017-07-25 20:08:35 +00:00
|
|
|
_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}}"
|
|
|
|
|
|
|
|
ksrcdir="$srcdir/linux-$_kernver"
|
|
|
|
|
|
|
|
prepare() {
|
|
|
|
local _patch_failed=
|
|
|
|
cd "$ksrcdir"
|
2017-08-02 16:48:06 +00:00
|
|
|
if [ "$_kernver" != "$pkgver" ]; then
|
|
|
|
msg "Applying patch-$pkgver.xz"
|
|
|
|
unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N || return 1
|
|
|
|
fi
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
# first apply patches in specified order
|
|
|
|
for i in $source; do
|
|
|
|
case $i in
|
|
|
|
*.patch)
|
|
|
|
msg "Applying $i..."
|
|
|
|
if ! patch -s -p1 -N -i "$srcdir"/$i; then
|
|
|
|
echo $i >>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 || return 1
|
|
|
|
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
|
|
|
|
silentoldconfig
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
|
|
|
|
menuconfig() {
|
|
|
|
cd "$srcdir"/build || return 1
|
|
|
|
make ARCH="$_carch" menuconfig
|
|
|
|
cp .config "$startdir"/$_config
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "$srcdir"/build
|
|
|
|
unset LDFLAGS
|
|
|
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
2017-09-07 22:29:15 +00:00
|
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS" \
|
|
|
|
CFLAGS_MODULE=-fno-pic
|
2017-07-25 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
|
|
|
cd "$srcdir/build/arch/${_carch}/boot"
|
|
|
|
|
2017-08-09 20:26:40 +00:00
|
|
|
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
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
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" \
|
2017-07-31 17:44:17 +00:00
|
|
|
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb" \
|
2017-07-25 20:08:35 +00:00
|
|
|
|| return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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 "$srcdir"/linux-$_kernver O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \
|
|
|
|
silentoldconfig 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 "$srcdir"/linux-$_kernver
|
|
|
|
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" || return 1
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2017-09-04 20:43:23 +00:00
|
|
|
sha512sums="a557c2f0303ae618910b7106ff63d9978afddf470f03cb72aa748213e099a0ecd5f3119aea6cbd7b61df30ca6ef3ec57044d524b7babbaabddf8b08b8bafa7d2 linux-4.13.tar.xz
|
2017-09-26 20:52:00 +00:00
|
|
|
ab2b16db1aa1bb7550ac0c98215b549ca5f03db80b226effe05121f8175520f3a3accc4fb2b42c7ba1757282e77b844e11d8350d1a83e23821ae4e70da87996c config-postmarketos.armhf
|
|
|
|
d49d5d01adb7f314d5649cf8d7e917eeca9ec286eff2687c6865a7fac46e18227e278ca8965ad29bd99320a676e167256dc1b4212c5702f819e4cd2cf40c33c9 config-postmarketos.aarch64
|
|
|
|
4a95d0ddbf7023b41a3d438d439951b9878ce92194d3576c0ef3c1f1f8734331728c2aa03e736908d31bfcfd7c03b2760984714beb39573082916bc50c93c199 config-postmarketos.x86_64
|
2017-08-02 16:48:06 +00:00
|
|
|
17c48bb7b4218297bd2be6faa5b6570ce1560a33385237a9962c0884d782c9a722a25a30077b6721d2943a9b98c29dcad6adfef718b0163c559c19a79519319b 0001-rx51-drm-regression-workaround.patch
|
2017-09-28 17:32:30 +00:00
|
|
|
37aa8add92ae23b627c166b878b6d8191b75c2aca3a2eb2d7ae4f55262644731ab51a3ee171186fc0b011c6c8e537686377c3e73e8928797323b0a958eeb4b6b patch-4.13.4.xz"
|