diff --git a/main/kernel-scripts/APKBUILD b/main/kernel-scripts/APKBUILD new file mode 100644 index 000000000..6993e36b8 --- /dev/null +++ b/main/kernel-scripts/APKBUILD @@ -0,0 +1,62 @@ +pkgname=kernel-scripts +pkgver=4.15.0 +pkgrel=0 +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" +arch="all" +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 + if [ "$_kernver" != "$pkgver" ]; then + 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() { + cd "$srcdir/build/scripts" + msg "Finding and installing binaries..." + local i + for i in $(find . -type f); do + local type="$(file -b --mime-type "$i")" + [ "$type" != "application/x-sharedlib" ] && continue + echo "$i" + install -Dm755 "$i" "$pkgdir/usr/bin/kernel-scripts/$i" + done +} +sha512sums="c00d92659df815a53dcac7dde145b742b1f20867d380c07cb09ddb3295d6ff10f8931b21ef0b09d7156923a3957b39d74d87c883300173b2e20690d2b4ec35ea linux-4.15.tar.xz" diff --git a/main/linux-postmarketos-lts/APKBUILD b/main/linux-postmarketos-lts/APKBUILD index 5b1c345d2..9f304efc5 100644 --- a/main/linux-postmarketos-lts/APKBUILD +++ b/main/linux-postmarketos-lts/APKBUILD @@ -8,13 +8,13 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=1 +pkgrel=2 arch="all" pkgdesc="Linux for pmOS supported chipsets (LTS)" url="https://kernel.org/" depends="postmarketos-mkinitfs" -makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev file" options="!strip !check !tracedeps" install= source=" @@ -174,6 +174,21 @@ dev() { 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="bf67ff812cc3cb7e5059e82cc5db0d9a7c5637f7ed9a42e4730c715bf7047c81ed3a571225f92a33ef0b6d65f35595bc32d773356646df2627da55e9bc7f1f1a linux-4.9.tar.xz diff --git a/main/linux-postmarketos-mainline/APKBUILD b/main/linux-postmarketos-mainline/APKBUILD index 62e2f887c..4e9d807cf 100644 --- a/main/linux-postmarketos-mainline/APKBUILD +++ b/main/linux-postmarketos-mainline/APKBUILD @@ -9,13 +9,13 @@ _kernver=${pkgver%_rc*} _mainver=${_kernver%.*} _patchlevel=${_kernver/$_mainver./} _basever=${_mainver}.$((_patchlevel-1)) -pkgrel=1 +pkgrel=2 arch="all" pkgdesc="Linux for pmOS supported chipsets (mainline, more bleeding-edge than stable)" url="https://kernel.org/" depends="postmarketos-mkinitfs" -makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev libressl-dev" +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev libressl-dev file" options="!strip !check !tracedeps" install= source=" @@ -170,6 +170,21 @@ dev() { 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="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz 5d05754adc696f180405acda79e2678075f99d12252fc1f7e6af46f5ab39076de926db6de900c28b2e05dd3753df60d3515bb805b71d3bff991a5ed040b91167 linux-v4.14-v4.15-rc6.patch diff --git a/main/linux-postmarketos-stable/APKBUILD b/main/linux-postmarketos-stable/APKBUILD index f53ee4768..2d5128872 100644 --- a/main/linux-postmarketos-stable/APKBUILD +++ b/main/linux-postmarketos-stable/APKBUILD @@ -9,13 +9,13 @@ case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac -pkgrel=1 +pkgrel=2 arch="all" pkgdesc="Linux for pmOS supported chipsets (stable)" url="https://kernel.org/" depends="postmarketos-mkinitfs" -makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev" +makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev file" options="!strip !check !tracedeps" install= source=" @@ -175,6 +175,21 @@ dev() { 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="77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 linux-4.14.tar.xz