mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-06-07 11:45:36 +02:00
249 lines
8.2 KiB
Text
249 lines
8.2 KiB
Text
# Maintainer: Ariadne Conill <ariadne@dereferenced.org>
|
|
# Contributor: Milan P. Stanić <mps@arvanta.net>
|
|
|
|
_flavor=openpax
|
|
pkgname=linux-${_flavor}
|
|
# NOTE: this kernel is intended for testing
|
|
# please resist urge to upgrade it blindly
|
|
pkgver=6.11.2
|
|
_kernver=${pkgver%.*}
|
|
pkgrel=0
|
|
pkgdesc="Linux latest stable kernel with OpenPaX patches"
|
|
url="https://www.kernel.org"
|
|
depends="initramfs-generator"
|
|
_depends_dev="perl gmp-dev elfutils-dev flex bison"
|
|
makedepends="$_depends_dev sed installkernel bc linux-headers linux-firmware-any
|
|
openssl-dev diffutils findutils xz python3"
|
|
options="!strip !check" # no tests
|
|
_config=${config:-config-openpax.${CARCH}}
|
|
|
|
subpackages="$pkgname-dev:_dev:$CBUILD_ARCH $pkgname-doc:_doc"
|
|
source="https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
|
|
https://distfiles.ariadne.space/openpax/openpax-$pkgver-20241009165538.patch"
|
|
case $pkgver in
|
|
*.*.0) source="$source";;
|
|
*.*.*) source="
|
|
patch-$pkgver.patch.xz::https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz
|
|
$source" ;;
|
|
esac
|
|
|
|
source="$source
|
|
config-openpax.aarch64
|
|
config-openpax.armv7
|
|
config-openpax.x86_64
|
|
config-openpax.riscv64
|
|
config-openpax.loongarch64
|
|
"
|
|
|
|
builddir="$srcdir/linux-${_kernver}"
|
|
arch="armv7 aarch64 x86_64 riscv64 loongarch64"
|
|
license="GPL-2.0"
|
|
|
|
_flavors=
|
|
for _i in $source; do
|
|
case $_i in
|
|
config-*.$CARCH)
|
|
_f=${_i%.$CARCH}
|
|
_f=${_f#config-}
|
|
_flavors="$_flavors ${_f}"
|
|
if [ "linux-$_f" != "$pkgname" ]; then
|
|
subpackages="$subpackages linux-${_f}::$CBUILD_ARCH linux-${_f}-dev:_dev:$CBUILD_ARCH"
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
_carch=${CARCH}
|
|
case "$_carch" in
|
|
aarch64*) _carch="arm64" ;;
|
|
arm*) _carch="arm" ;;
|
|
riscv64) _carch="riscv" ;;
|
|
loongarch64) _carch="loongarch" ;;
|
|
esac
|
|
|
|
prepare() {
|
|
default_prepare
|
|
|
|
# remove localversion from patch if any
|
|
rm -f localversion*
|
|
oldconfig
|
|
}
|
|
|
|
oldconfig() {
|
|
for i in $_flavors; do
|
|
local _config=config-$i.${CARCH}
|
|
mkdir -p "$builddir"
|
|
echo "-$pkgrel-$i" > "$builddir"/localversion-alpine \
|
|
|| return 1
|
|
|
|
cp "$srcdir"/$_config "$builddir"/.config
|
|
make -C $builddir \
|
|
O="$builddir" \
|
|
ARCH="$_carch" \
|
|
listnewconfig olddefconfig
|
|
done
|
|
}
|
|
|
|
build() {
|
|
unset LDFLAGS
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
|
for i in $_flavors; do
|
|
make ARCH="$_carch" DTC_FLAGS="-@" CC="${CC:-gcc}" \
|
|
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
|
|
done
|
|
}
|
|
|
|
_package() {
|
|
local _buildflavor="$1" _outdir="$2"
|
|
local _abi_release=${pkgver}-${pkgrel}-${_buildflavor}
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
|
|
|
# modules_install seems to regenerate a defect Modules.symvers on s390x. Work
|
|
# around it by backing it up and restore it after modules_install
|
|
cp Module.symvers Module.symvers.backup
|
|
|
|
mkdir -p "$_outdir"/boot "$_outdir"/lib/modules
|
|
|
|
local _install
|
|
case "$CARCH" in
|
|
arm*|aarch64) _install="zinstall dtbs_install";;
|
|
riscv64) _install="install dtbs_install";;
|
|
*) _install=install;;
|
|
esac
|
|
|
|
make -j1 modules_install $_install \
|
|
ARCH="$_carch" \
|
|
INSTALL_MOD_PATH="$_outdir" \
|
|
INSTALL_PATH="$_outdir"/boot \
|
|
INSTALL_DTBS_PATH="$_outdir/boot/dtbs-$_buildflavor"
|
|
|
|
cp Module.symvers.backup Module.symvers
|
|
|
|
rm -f "$_outdir"/lib/modules/${_abi_release}/build \
|
|
"$_outdir"/lib/modules/${_abi_release}/source
|
|
rm -rf "$_outdir"/lib/firmware
|
|
|
|
install -D -m644 include/config/kernel.release \
|
|
"$_outdir"/usr/share/kernel/$_buildflavor/kernel.release
|
|
}
|
|
|
|
# main flavor installs in $pkgdir
|
|
package() {
|
|
depends="$depends linux-firmware-any"
|
|
|
|
_package edge "$pkgdir"
|
|
}
|
|
|
|
_dev() {
|
|
local _flavor=$(echo $subpkgname | sed -E 's/(^linux-|-dev$)//g')
|
|
local _abi_release=${pkgver}-${pkgrel}-$_flavor
|
|
# 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 $_flavor kernel"
|
|
depends="$_depends_dev"
|
|
local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
|
|
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
|
|
|
|
# first we import config, run prepare to set up for building
|
|
# external modules, and create the scripts
|
|
mkdir -p "$dir"
|
|
cp "$srcdir"/config-$_flavor.${CARCH} "$dir"/.config
|
|
echo "-$pkgrel-$_flavor" > "$dir"/localversion-alpine
|
|
cd $builddir
|
|
|
|
echo "Installing headers..."
|
|
case "$_carch" in
|
|
x86_64)
|
|
_carch="x86"
|
|
install -Dt "${dir}/tools/objtool" tools/objtool/objtool
|
|
;;
|
|
esac
|
|
cp -t "$dir" -a include
|
|
|
|
install -Dt "${dir}" -m644 Makefile
|
|
install -Dt "${dir}" -m644 Module.symvers
|
|
install -Dt "${dir}" -m644 System.map
|
|
cp -t "$dir" -a scripts
|
|
|
|
install -Dt "${dir}/arch/${_carch}" -m644 arch/${_carch}/Makefile
|
|
install -Dt "${dir}/arch/${_carch}/kernel" -m644 arch/${_carch}/kernel/asm-offsets.s
|
|
cp -t "${dir}/arch/${_carch}" -a arch/${_carch}/include
|
|
|
|
install -Dt "$dir/drivers/md" -m644 drivers/md/*.h
|
|
install -Dt "$dir/net/mac80211" -m644 net/mac80211/*.h
|
|
|
|
# https://bugs.archlinux.org/task/13146
|
|
install -Dt "$dir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
|
|
|
|
# https://bugs.archlinux.org/task/20402
|
|
install -Dt "$dir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
|
|
install -Dt "$dir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
|
|
install -Dt "$dir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
|
|
|
|
# https://bugs.archlinux.org/task/71392
|
|
install -Dt "$dir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
|
|
|
|
echo "Installing KConfig files..."
|
|
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
|
|
|
|
echo "Removing unneeded architectures..."
|
|
local arch
|
|
for arch in "$dir"/arch/*/; do
|
|
case $(basename "$arch") in $_carch) continue ;; esac
|
|
echo "Removing $(basename "$arch")"
|
|
rm -r "$arch"
|
|
done
|
|
|
|
echo "Removing broken symlinks..."
|
|
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
|
|
|
|
echo "Removing loose objects..."
|
|
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
|
|
|
|
echo "Stripping build tools..."
|
|
local file
|
|
while read -rd '' file; do
|
|
case "$(file -bi "$file")" in
|
|
application/x-sharedlib\;*) # Libraries (.so)
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
application/x-archive\;*) # Libraries (.a)
|
|
strip -v $STRIP_STATIC "$file" ;;
|
|
application/x-executable\;*) # Binaries
|
|
strip -v $STRIP_BINARIES "$file" ;;
|
|
application/x-pie-executable\;*) # Relocatable binaries
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
esac
|
|
done < <(find "$builddir" -type f -perm -u+x ! -name vmlinux -print0)
|
|
|
|
echo "Stripping vmlinux..."
|
|
strip -v $STRIP_STATIC "$builddir/vmlinux"
|
|
|
|
echo "Adding symlink..."
|
|
mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
|
|
ln -sf /usr/src/linux-headers-${_abi_release} \
|
|
"$subpkgdir"/lib/modules/${_abi_release}/build
|
|
}
|
|
|
|
_doc() {
|
|
pkgdesc="documentation for $_flavor kernel"
|
|
mkdir -p "$subpkgdir"/usr/share/doc/linux-edge-doc
|
|
cp -r "$builddir"/Documentation \
|
|
"$subpkgdir"/usr/share/doc/linux-edge-doc/
|
|
|
|
}
|
|
|
|
sha512sums="
|
|
329c1f94008742e3f0c2ce7e591a16316d1b2cb9ea4596d4f45604097e07b7aa2f64afa40630a07f321a858455c77aa32ba57b271932ddcf4dc27863f9081cea linux-6.11.tar.xz
|
|
fde1adfe69b65e3eb1f6f98dcd0aaeeee8d48fa02e35a21a05b176c6fc951e9c7f71fce2a4f2ed0cdac2ffa9678cf1d3dc47aa34c36e0109abe3f12b62ffb496 openpax-6.11.2-20241009165538.patch
|
|
a75a5b8b08d3c4f90329d0c18c1b3f08d8eca81c07bfb1966a34a84b2743ebdcabda39d7189b7681ee6e60dbf4d2ac996d3f6bc13a14eb4fea3b4eca9b4ea56a patch-6.11.2.patch.xz
|
|
2717d4f12b6e3fed9ce0f6bff2df7fbf6ba6560b7a85121962375fe9ad89d3cb50dc720277e1310c639f958baaa37586a768d83fd19724a82ee97215cc550711 config-openpax.aarch64
|
|
856ff6ed3f24aa51d8aa7f2c099db1b770f949f9da7eafc0bb54c06a39de3ea77bdf87cb66006913724c0372a1246bcb8b6464329e5458d9af7a2f775741a118 config-openpax.armv7
|
|
7df779c07fbb1621c792febd1fd7da07c677f06c69494b38c5a5e021921c2f19a6f1ed636e162ad2b2d3e7bef51bb364eb831102c18c8399303b346b7a64e11a config-openpax.x86_64
|
|
c6a89ff300c96b5b7fbbaf426b6c61c5296b752d9aecc2da97575fc3b628d753c3cd284ce82141f000171888a90f97dd6ceff7f623efee668564dbd563906216 config-openpax.riscv64
|
|
18f246c95497a56732d25631090c2ec7108ca19521aa1980dbcb9e49d46057a377579523c4ff765ccb47b1c209b5214bb6f8caab1a30874e17bec021354c8a35 config-openpax.loongarch64
|
|
"
|