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
|
|
|
pkgname=kernel-scripts
|
|
|
|
pkgver=4.15.0
|
2018-11-08 06:49:36 +00:00
|
|
|
pkgrel=2
|
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
|
|
|
pkgdesc="Binary scripts needed to build kernel packages"
|
|
|
|
url="http://kernel.org"
|
|
|
|
depends=""
|
|
|
|
makedepends="perl gmp-dev elfutils-dev bash sed bc linux-headers file openssl-dev"
|
|
|
|
options="!check"
|
2018-07-22 21:57:39 +00:00
|
|
|
arch="x86_64 armhf aarch64"
|
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
|
|
|
license="GPL-2.0"
|
|
|
|
|
|
|
|
# Sources
|
|
|
|
case $pkgver in
|
|
|
|
*.*.*) _kernver=${pkgver%.*};;
|
|
|
|
*.*) _kernver=$pkgver;;
|
|
|
|
esac
|
|
|
|
source="https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz"
|
|
|
|
if [ "${pkgver%.0}" = "$pkgver" ]; then
|
|
|
|
source="$source
|
|
|
|
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Arch
|
|
|
|
_carch=${CARCH}
|
|
|
|
case "$_carch" in
|
|
|
|
aarch64*) _carch="arm64" ;;
|
|
|
|
arm*) _carch="arm" ;;
|
|
|
|
mips*) _carch="mips" ;;
|
|
|
|
ppc*) _carch="powerpc" ;;
|
|
|
|
s390*) _carch="s390" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
builddir="$srcdir/linux-$_kernver"
|
|
|
|
prepare() {
|
|
|
|
cd "$builddir"
|
|
|
|
|
|
|
|
# Apply patch
|
2018-11-08 06:49:36 +00:00
|
|
|
local patch="$srcdir/patch-$pkgver.xz"
|
|
|
|
if [ -e "$patch" ]; then
|
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
|
|
|
msg "Applying patch-$pkgver.xz"
|
|
|
|
unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
unset LDFLAGS
|
|
|
|
mkdir -p "$srcdir/build"
|
|
|
|
make -j1 -C "$builddir" O="$srcdir/build" ARCH="$_carch" \
|
|
|
|
HOSTCC="${CC:-gcc}" defconfig scripts
|
|
|
|
}
|
|
|
|
|
|
|
|
package() {
|
2018-11-08 06:49:36 +00:00
|
|
|
local type_bin="application/x-pie-executable"
|
|
|
|
msg "Finding and installing $type_bin files..."
|
|
|
|
|
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 i
|
2018-11-08 06:49:36 +00:00
|
|
|
local found=false
|
|
|
|
cd "$srcdir/build/scripts"
|
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
|
|
|
for i in $(find . -type f); do
|
|
|
|
local type="$(file -b --mime-type "$i")"
|
2018-11-08 06:49:36 +00:00
|
|
|
if [ "$type" != "$type_bin" ]; then
|
|
|
|
echo "$i: different mime-type ($type)"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
echo "$i: matched!"
|
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
|
|
|
install -Dm755 "$i" "$pkgdir/usr/bin/kernel-scripts/$i"
|
2018-11-08 06:49:36 +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-11-08 06:49:36 +00:00
|
|
|
if [ "$found" = "false" ]; then
|
|
|
|
error "Could not find any binaries! 'file' probably prints out a"
|
|
|
|
error "different mime-type now. This is easy to fix, just figure out"
|
|
|
|
error "the correct one from the output above (look at the"
|
|
|
|
error "./basic/fixdep line for example) then adjust type_bin= in"
|
|
|
|
error "package()."
|
|
|
|
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
|
|
|
}
|
|
|
|
sha512sums="c00d92659df815a53dcac7dde145b742b1f20867d380c07cb09ddb3295d6ff10f8931b21ef0b09d7156923a3957b39d74d87c883300173b2e20690d2b4ec35ea linux-4.15.tar.xz"
|