2017-10-23 20:15:32 +00:00
|
|
|
_flavor=postmarketos-mainline
|
2017-07-25 20:08:35 +00:00
|
|
|
_config="config-${_flavor}.${CARCH}"
|
|
|
|
|
|
|
|
pkgname=linux-${_flavor}
|
|
|
|
|
2017-11-04 02:13:25 +00:00
|
|
|
pkgver=4.14_rc7
|
|
|
|
_pkgver=${pkgver/_/-}
|
|
|
|
_kernver=${pkgver%_rc*}
|
2017-10-23 20:15:32 +00:00
|
|
|
_mainver=${_kernver%.*}
|
|
|
|
_patchlevel=${_kernver/$_mainver./}
|
|
|
|
_basever=${_mainver}.$((_patchlevel-1))
|
2017-11-08 20:24:02 +00:00
|
|
|
pkgrel=2
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
arch="all"
|
2017-10-23 20:15:32 +00:00
|
|
|
pkgdesc="Linux for pmOS supported chipsets (mainline, more bleeding-edge than stable)"
|
2017-07-25 20:08:35 +00:00
|
|
|
url="https://kernel.org/"
|
|
|
|
depends="postmarketos-mkinitfs"
|
2017-11-08 20:24:02 +00:00
|
|
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev libressl-dev"
|
2017-07-25 20:08:35 +00:00
|
|
|
options="!strip !check !tracedeps"
|
|
|
|
install=
|
|
|
|
source="
|
2017-10-23 20:15:32 +00:00
|
|
|
https://cdn.kernel.org/pub/linux/kernel/v$_mainver.x/linux-$_basever.tar.xz
|
2017-10-24 16:41:33 +00:00
|
|
|
linux-v$_basever-v$_kernver-rc1.patch::https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v$_kernver-rc1&id2=v$_basever
|
2017-11-04 02:13:25 +00:00
|
|
|
linux-v$_kernver-rc1-v$_pkgver.patch::https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v$_pkgver&id2=v$_kernver-rc1
|
2017-07-25 20:08:35 +00:00
|
|
|
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-10-23 20:15:32 +00:00
|
|
|
001-sony-amami-dts.patch
|
2017-07-25 20:08:35 +00:00
|
|
|
"
|
2017-08-02 16:48:06 +00:00
|
|
|
|
2017-07-25 20:08:35 +00:00
|
|
|
subpackages="$pkgname-dev::$CBUILD_ARCH"
|
|
|
|
|
2017-08-02 16:48:06 +00:00
|
|
|
license="GPL2"
|
2017-11-04 02:13:25 +00:00
|
|
|
_abi_release=$_pkgver
|
2017-07-25 20:08:35 +00:00
|
|
|
_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}}"
|
|
|
|
|
2017-10-23 20:15:32 +00:00
|
|
|
ksrcdir="$srcdir/linux-$_basever"
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
prepare() {
|
|
|
|
local _patch_failed=
|
|
|
|
cd "$ksrcdir"
|
|
|
|
# first apply patches in specified order
|
|
|
|
for i in $source; do
|
|
|
|
case $i in
|
2017-10-23 20:15:32 +00:00
|
|
|
*.patch|*.patch::*)
|
|
|
|
_patch=${i%::*}
|
|
|
|
msg "Applying $_patch..."
|
|
|
|
if ! patch -s -p1 -N -i "$srcdir"/$_patch; then
|
|
|
|
echo $_patch >>failed
|
2017-07-25 20:08:35 +00:00
|
|
|
_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
|
2017-10-04 15:05:00 +00:00
|
|
|
cp -v "$srcdir"/$_config "$srcdir"/build/.config
|
2017-07-25 20:08:35 +00:00
|
|
|
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
|
2017-10-06 18:45:47 +00:00
|
|
|
olddefconfig
|
2017-07-25 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
|
|
|
|
menuconfig() {
|
2017-10-04 15:05:00 +00:00
|
|
|
cd "$srcdir"/build
|
2017-07-25 20:08:35 +00:00
|
|
|
make ARCH="$_carch" menuconfig
|
|
|
|
cp .config "$startdir"/$_config
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "$srcdir"/build
|
|
|
|
unset LDFLAGS
|
|
|
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
2017-10-23 20:15:32 +00:00
|
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-${_flavor}" \
|
2017-09-07 22:29:15 +00:00
|
|
|
CFLAGS_MODULE=-fno-pic
|
2017-07-25 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
|
|
|
cd "$srcdir/build/arch/${_carch}/boot"
|
2017-10-04 15:05:00 +00:00
|
|
|
|
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-10-04 15:05:00 +00:00
|
|
|
INSTALL_DTBS_PATH="$pkgdir/usr/share/dtb"
|
2017-07-25 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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
|
2017-10-23 20:15:32 +00:00
|
|
|
make -j1 -C "$ksrcdir" O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \
|
2017-10-06 18:45:47 +00:00
|
|
|
olddefconfig prepare modules_prepare scripts
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2017-10-23 20:15:32 +00:00
|
|
|
cd "$ksrcdir"
|
2017-07-25 20:08:35 +00:00
|
|
|
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' \) \
|
2017-10-04 15:05:00 +00:00
|
|
|
-print | cpio -pdm "$dir"
|
2017-07-25 20:08:35 +00:00
|
|
|
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-10-24 16:41:33 +00:00
|
|
|
ec42158f59f105995a3ccde025085343b5e6ba60de778c14cacf9aa34c40ae2e23058a03a1e6545f174c694620bbb0e423947f784c43e1474adfdcb7f866b3b6 linux-v4.13-v4.14-rc1.patch
|
2017-11-04 02:13:25 +00:00
|
|
|
f120fc30e759c5c1dfd391c13bfdfa05675fbef02afdad3dce0fd22f02455f4d2ed545c1d4bddf2ada26827f5d54adc6813e2f927df3ebe18cd78ad1c99e0098 linux-v4.14-rc1-v4.14-rc7.patch
|
2017-10-23 20:15:32 +00:00
|
|
|
a75225750193cf31c8b6c15e7748699f842ecadc9ed573f0b10f42bb5343b4e092bcb65b359d170a42a102a4ddfe09d63c1d67550f4b99c29295fa22e1d7b995 config-postmarketos-mainline.armhf
|
|
|
|
6310035a0a4c028cc98cab92919cca54be9b79ee9fe63211e7a05876d7befdbd8506a2f80548e228e014e99b0f91f63946352789d8d2f2134c66914163f66ab3 config-postmarketos-mainline.aarch64
|
|
|
|
3d42c60061d12a436d19ffdf00623ea71ca31f16f690ae82ebf872d35177c283b4038cd5e270f4e610d6cf6861cef73ac63c995f1f4cfe9d6f2a4a8648ba28fb config-postmarketos-mainline.x86_64
|
|
|
|
e34315167868c2539b2cb548b4305a5e16527b8d5b39843945bf3b0c2a67d70f7d9c93443bac2d28a744aa85012c241c68c5a4f09f0ad3e35ba8945bdaed2e2d 001-sony-amami-dts.patch"
|