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}
|
|
|
|
|
2018-08-23 01:15:57 +00:00
|
|
|
pkgver=4.18.4
|
2017-08-02 16:48:06 +00:00
|
|
|
case $pkgver in
|
|
|
|
*.*.*) _kernver=${pkgver%.*};;
|
|
|
|
*.*) _kernver=$pkgver;;
|
|
|
|
esac
|
2018-12-22 19:03:50 +00:00
|
|
|
pkgrel=2
|
2017-07-25 20:08:35 +00:00
|
|
|
|
2018-02-17 17:26:31 +00:00
|
|
|
arch="x86_64 armhf aarch64"
|
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/"
|
2018-02-17 17:26:31 +00:00
|
|
|
depends=""
|
2018-12-22 19:03:50 +00:00
|
|
|
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev openssl-dev file bison flex"
|
2017-07-25 20:08:35 +00:00
|
|
|
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
|
2018-02-14 23:20:40 +00:00
|
|
|
subpackages="$pkgname-dev"
|
2017-07-25 20:08:35 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
Package kernel-scripts separately (#1234)
We have two methods of cross-compiling:
* native: everything runs with the host architecture, QEMU is not
involved. This is the fastest, but requires the build system to be
working with it. We use this for all linux-* packages currently.
* distcc: everything runs through QEMU emulating the target arch,
*except* for the compiler. This is the most compatible approach
working with all packages.
When compiling `linux-*` packages natively, kernel scripts needed
during the build process get generated. Some of these are C files that
get compiled as executables. In native mode, these get compied to the
native architecture, in distcc mode to the target architecture.
The problem is, that we need these scripts compiled for the target
architecture in the kernel's dev package in order to compile kernel
modules outside of the kernel's package (e.g. wireguard).
It is not possible to just rewrite this logic to generate target-arch
binaries when running in native mode, because these binaries require
musl-dev, linux-headers and some other packages to be installed for the
target architecture inside the native chroot.
We solve this by introducing a new `kernel-scripts` package. which
contains just the binary scripts. In case the dev package was
cross-compiled, it depends on `kernel-scripts` and symlinks these
binaries. The `kernel-scripts` package always gets compiled in distcc
mode since it does not have a `linux-` prefix.
Fixes #1230.
2018-02-16 21:00:37 +00:00
|
|
|
|
|
|
|
# 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"
|
Package kernel-scripts separately (#1234)
We have two methods of cross-compiling:
* native: everything runs with the host architecture, QEMU is not
involved. This is the fastest, but requires the build system to be
working with it. We use this for all linux-* packages currently.
* distcc: everything runs through QEMU emulating the target arch,
*except* for the compiler. This is the most compatible approach
working with all packages.
When compiling `linux-*` packages natively, kernel scripts needed
during the build process get generated. Some of these are C files that
get compiled as executables. In native mode, these get compied to the
native architecture, in distcc mode to the target architecture.
The problem is, that we need these scripts compiled for the target
architecture in the kernel's dev package in order to compile kernel
modules outside of the kernel's package (e.g. wireguard).
It is not possible to just rewrite this logic to generate target-arch
binaries when running in native mode, because these binaries require
musl-dev, linux-headers and some other packages to be installed for the
target architecture inside the native chroot.
We solve this by introducing a new `kernel-scripts` package. which
contains just the binary scripts. In case the dev package was
cross-compiled, it depends on `kernel-scripts` and symlinks these
binaries. The `kernel-scripts` package always gets compiled in distcc
mode since it does not have a `linux-` prefix.
Fixes #1230.
2018-02-16 21:00:37 +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
|
Package kernel-scripts separately (#1234)
We have two methods of cross-compiling:
* native: everything runs with the host architecture, QEMU is not
involved. This is the fastest, but requires the build system to be
working with it. We use this for all linux-* packages currently.
* distcc: everything runs through QEMU emulating the target arch,
*except* for the compiler. This is the most compatible approach
working with all packages.
When compiling `linux-*` packages natively, kernel scripts needed
during the build process get generated. Some of these are C files that
get compiled as executables. In native mode, these get compied to the
native architecture, in distcc mode to the target architecture.
The problem is, that we need these scripts compiled for the target
architecture in the kernel's dev package in order to compile kernel
modules outside of the kernel's package (e.g. wireguard).
It is not possible to just rewrite this logic to generate target-arch
binaries when running in native mode, because these binaries require
musl-dev, linux-headers and some other packages to be installed for the
target architecture inside the native chroot.
We solve this by introducing a new `kernel-scripts` package. which
contains just the binary scripts. In case the dev package was
cross-compiled, it depends on `kernel-scripts` and symlinks these
binaries. The `kernel-scripts` package always gets compiled in distcc
mode since it does not have a `linux-` prefix.
Fixes #1230.
2018-02-16 21:00:37 +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"
|
Package kernel-scripts separately (#1234)
We have two methods of cross-compiling:
* native: everything runs with the host architecture, QEMU is not
involved. This is the fastest, but requires the build system to be
working with it. We use this for all linux-* packages currently.
* distcc: everything runs through QEMU emulating the target arch,
*except* for the compiler. This is the most compatible approach
working with all packages.
When compiling `linux-*` packages natively, kernel scripts needed
during the build process get generated. Some of these are C files that
get compiled as executables. In native mode, these get compied to the
native architecture, in distcc mode to the target architecture.
The problem is, that we need these scripts compiled for the target
architecture in the kernel's dev package in order to compile kernel
modules outside of the kernel's package (e.g. wireguard).
It is not possible to just rewrite this logic to generate target-arch
binaries when running in native mode, because these binaries require
musl-dev, linux-headers and some other packages to be installed for the
target architecture inside the native chroot.
We solve this by introducing a new `kernel-scripts` package. which
contains just the binary scripts. In case the dev package was
cross-compiled, it depends on `kernel-scripts` and symlinks these
binaries. The `kernel-scripts` package always gets compiled in distcc
mode since it does not have a `linux-` prefix.
Fixes #1230.
2018-02-16 21:00:37 +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
|
Package kernel-scripts separately (#1234)
We have two methods of cross-compiling:
* native: everything runs with the host architecture, QEMU is not
involved. This is the fastest, but requires the build system to be
working with it. We use this for all linux-* packages currently.
* distcc: everything runs through QEMU emulating the target arch,
*except* for the compiler. This is the most compatible approach
working with all packages.
When compiling `linux-*` packages natively, kernel scripts needed
during the build process get generated. Some of these are C files that
get compiled as executables. In native mode, these get compied to the
native architecture, in distcc mode to the target architecture.
The problem is, that we need these scripts compiled for the target
architecture in the kernel's dev package in order to compile kernel
modules outside of the kernel's package (e.g. wireguard).
It is not possible to just rewrite this logic to generate target-arch
binaries when running in native mode, because these binaries require
musl-dev, linux-headers and some other packages to be installed for the
target architecture inside the native chroot.
We solve this by introducing a new `kernel-scripts` package. which
contains just the binary scripts. In case the dev package was
cross-compiled, it depends on `kernel-scripts` and symlinks these
binaries. The `kernel-scripts` package always gets compiled in distcc
mode since it does not have a `linux-` prefix.
Fixes #1230.
2018-02-16 21:00:37 +00:00
|
|
|
fi
|
2017-07-25 20:08:35 +00:00
|
|
|
}
|
|
|
|
|
2018-08-23 01:15:57 +00:00
|
|
|
sha512sums="950eb85ac743b291afe9f21cd174d823e25f11883ee62cecfbfff8fe8c5672aae707654b1b8f29a133b1f2e3529e63b9f7fba4c45d6dacccc8000b3a9a9ae038 linux-4.18.tar.xz
|
2018-07-04 01:15:08 +00:00
|
|
|
a428ce2a9c65bae3e7f88a43b0112e2524298ba068cf85732b25f18c5f92d101089ab3589582050c0dc9fca3571ea7fb89f9398d0c9dede03f1754b3f5fe455c config-postmarketos-stable.armhf
|
|
|
|
b24240f2c8e011ffa1ff141cf8d623dcbe4cbde389322e59e264edf1b01985b3527576a06c1f0d8e5ef67519f95cc9a9ff9f2636178d00e4272cd472e268f1ec config-postmarketos-stable.aarch64
|
2018-07-04 01:12:00 +00:00
|
|
|
77ae0b80272d871475043cc17ae54e20d5456da8c729ea832906c2881389c53e4d800aaeab38090f3f878f15045b2c70dc4912b62742753c40f80ad69ed51599 config-postmarketos-stable.x86_64
|
2018-08-23 01:15:57 +00:00
|
|
|
f8a4a1056bd29c29361f5529f711318fdb7546ff7469a3592601ae2d69d84b7d62ff4f75cf9d5aad4c1523ae71a7c1a88d9ee33bfce719e91686ca219ad13ed8 patch-4.18.4.xz"
|