6dd916d6c7
* linux-postmarketos-stable 4.15.6 * linux-postmarketos-lts 4.14.22 * linux-postmarketos-mainline 4.16_rc3
193 lines
6 KiB
Text
193 lines
6 KiB
Text
_flavor=postmarketos-mainline
|
|
_config="config-${_flavor}.${CARCH}"
|
|
|
|
pkgname=linux-${_flavor}
|
|
|
|
pkgver=4.16_rc3
|
|
_pkgver=${pkgver/_/-}
|
|
_kernver=${pkgver%_rc*}
|
|
_mainver=${_kernver%.*}
|
|
_patchlevel=${_kernver/$_mainver./}
|
|
_basever=${_mainver}.$((_patchlevel-1))
|
|
pkgrel=0
|
|
|
|
arch="x86_64 armhf aarch64"
|
|
pkgdesc="Linux for pmOS supported chipsets (mainline, more bleeding-edge than stable)"
|
|
url="https://kernel.org/"
|
|
depends=""
|
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev libressl-dev file bison flex"
|
|
options="!strip !check !tracedeps"
|
|
install=
|
|
source="
|
|
https://cdn.kernel.org/pub/linux/kernel/v$_mainver.x/linux-$_basever.tar.xz
|
|
linux-v$_basever-v$_pkgver.patch::https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v$_pkgver&id2=v$_basever
|
|
config-${_flavor}.armhf
|
|
config-${_flavor}.aarch64
|
|
config-${_flavor}.x86_64
|
|
0001-sony-amami-dts.patch
|
|
"
|
|
|
|
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}}"
|
|
|
|
builddir="$srcdir/linux-$_basever"
|
|
|
|
prepare() {
|
|
local _patch_failed=
|
|
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
|
|
}
|
|
|
|
|
|
|
|
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
|
|
menuconfig() {
|
|
cd "$srcdir"/build
|
|
make ARCH="$_carch" menuconfig
|
|
cp .config "$startdir"/$_config
|
|
}
|
|
|
|
build() {
|
|
cd "$srcdir"/build
|
|
unset LDFLAGS
|
|
make ARCH="$_carch" CC="${CC:-gcc}" \
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-${_flavor}" \
|
|
CFLAGS_MODULE=-fno-pic
|
|
}
|
|
|
|
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"
|
|
|
|
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"
|
|
cd "$dir/scripts"
|
|
local i
|
|
for i in $(find . -type f); do
|
|
local type="$(file -b --mime-type "$i")"
|
|
[ "$type" != "application/x-sharedlib" ] && continue
|
|
local native="/usr/bin/kernel-scripts/$(echo "$i" | cut -d '/' -f 2-)"
|
|
ln -svf "$native" "$i"
|
|
done
|
|
fi
|
|
}
|
|
sha512sums="c00d92659df815a53dcac7dde145b742b1f20867d380c07cb09ddb3295d6ff10f8931b21ef0b09d7156923a3957b39d74d87c883300173b2e20690d2b4ec35ea linux-4.15.tar.xz
|
|
b5b4bc53a245725806d7f46d53e5715e8b8505536c96465cd8ea9dc506ed7b1c02a518114c3025786d10ab72c1454c03e85380bddd753f48946ca71bc0ed6f17 linux-v4.15-v4.16-rc3.patch
|
|
a75225750193cf31c8b6c15e7748699f842ecadc9ed573f0b10f42bb5343b4e092bcb65b359d170a42a102a4ddfe09d63c1d67550f4b99c29295fa22e1d7b995 config-postmarketos-mainline.armhf
|
|
6310035a0a4c028cc98cab92919cca54be9b79ee9fe63211e7a05876d7befdbd8506a2f80548e228e014e99b0f91f63946352789d8d2f2134c66914163f66ab3 config-postmarketos-mainline.aarch64
|
|
3d42c60061d12a436d19ffdf00623ea71ca31f16f690ae82ebf872d35177c283b4038cd5e270f4e610d6cf6861cef73ac63c995f1f4cfe9d6f2a4a8648ba28fb config-postmarketos-mainline.x86_64
|
|
e0fb34032fe70d9a4713ed521b8a5e29cf7f76cb7c56ceb24ed7206a8445ba743226e4873fa2069077952e21f99fb36eabf7c4daa779f565961f0dded4591887 0001-sony-amami-dts.patch"
|