2017-10-23 20:15:32 +00:00
|
|
|
_flavor=postmarketos-stable
|
2017-07-25 20:08:35 +00:00
|
|
|
_hash="7b6fbfd899b4133e4f789843e5967beb139ec4d2"
|
|
|
|
_config="config-${_flavor}.${CARCH}"
|
|
|
|
|
|
|
|
pkgname=linux-${_flavor}
|
|
|
|
|
2017-12-29 13:51:52 +00:00
|
|
|
pkgver=4.14.9
|
2017-08-02 16:48:06 +00:00
|
|
|
case $pkgver in
|
|
|
|
*.*.*) _kernver=${pkgver%.*};;
|
|
|
|
*.*) _kernver=$pkgver;;
|
|
|
|
esac
|
2017-11-14 16:13:35 +00:00
|
|
|
pkgrel=0
|
2017-07-25 20:08:35 +00:00
|
|
|
|
|
|
|
arch="all"
|
2017-10-23 20:15:32 +00:00
|
|
|
pkgdesc="Linux for pmOS supported chipsets (stable)"
|
2017-07-25 20:08:35 +00:00
|
|
|
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
|
|
|
|
|
|
|
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"
|
2017-10-04 15:05:00 +00:00
|
|
|
unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
|
2017-08-02 16:48:06 +00:00
|
|
|
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
|
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-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-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
|
|
|
|
make -j1 -C "$srcdir"/linux-$_kernver 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
|
|
|
|
|
|
|
|
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' \) \
|
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-11-14 16:13:35 +00:00
|
|
|
sha512sums="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz
|
|
|
|
7de482169eb64cca001c298091471d803421dfef5835fa9a693840bd96083bdc42bc12a5217ececb5780ac285cf23674f2bd008183e651b81a7fc2882b819f01 config-postmarketos-stable.armhf
|
|
|
|
f7dcf05c3c3042c6105748bcbe60ff8c02fac91c7de260a51b568c983df7f2a69c2bde6ebc3ddc4b7283e4aba7e1a8b0e9e4baff6ab863553dc3767679f54f62 config-postmarketos-stable.aarch64
|
|
|
|
d1e6ca8faee80641a2e882b3b9b0009b05a73adee8e939ace17be7879f8a87f4f2e7cb7bbbb9590e9b6c1491ed076505dbef599c0dc9e71fe71a8d451a7b635e config-postmarketos-stable.x86_64
|
2017-12-29 13:51:52 +00:00
|
|
|
8085944e5b8d49b07075776a1604a25ba87efe8b5a8a1a276a75dc47a87de4e487e72d9ace605166be977340b81a10a3cbc25c84b857509da8bba6d9184513fa patch-4.14.9.xz"
|