#!/bin/mkpkg # description: Linux kernel # url: https://www.kernel.org/ # # Not in pkg.conf's portdir list, deliberately: `sysup` must never # decide to install a kernel. Build by hand, addpkg/delpkg by hand. # Do not "helpfully" add /usr/src to the portdir list. # # NM wrapper: with CONFIG_MODVERSIONS the symversion gate runs # llvm-nm $obj | grep -q ' __export_symbol_' # grep -q exits on first match, llvm-nm's next write gets EPIPE, and # LLVM 23.1.0 turns that into "LLVM ERROR: IO failure on output stream" # followed by a NULL-deref SIGSEGV instead of exiting quietly. Harmless # -- grep already had its answer, symversions are correct -- but it # prints ~82 "Segmentation fault" lines per build. The wrapper maps # signal death to 0. Drop it when llvm-nm handles EPIPE properly. name=linux-6.18.54 _name=linux version=6.18.54 release=1 source=(https://cdn.kernel.org/pub/linux/kernel/v6.x/$_name-$version.tar.xz config) sha256sums=( "9df30b02dd8102bbd0be52556288ef6889ddbe7f1ddb96fbf847d0becf3eacac" "094361c455ec33eced396ce208b550cf1259c989db65201108786bc3f0dc7445" ) build() { # A kernel controls its own flags; nothing from mkpkg.conf reaches it. unset CFLAGS CXXFLAGS LDFLAGS CPPFLAGS PKG_CONFIG_PATH MAKEFLAGS _nm=$SRC/nm-epipe rm -f $_nm printf '%s\n' \ '#!/bin/sh' \ 'llvm-nm "$@"' \ '_s=$?' \ 'if [ $_s -gt 128 ]; then exit 0; fi' \ 'exit $_s' > $_nm chmod 755 $_nm test -s $_nm || { echo "nm wrapper is empty"; return 1; } cd $_name-$version for _c in /etc/ports/linux/config-$version \ /etc/ports/linux/config-${version%.*} \ /etc/ports/linux/config \ $SRC/config; do [ -f "$_c" ] && { echo "config: $_c"; cp "$_c" .config; break; } done make LLVM=1 olddefconfig make LLVM=1 NM=$_nm -j$(nproc) make LLVM=1 NM=$_nm INSTALL_MOD_PATH=$PKG INSTALL_MOD_STRIP=1 modules_install install -Dm644 arch/x86/boot/bzImage $PKG/boot/vmlinuz-$version install -Dm644 System.map $PKG/boot/System.map-$version install -Dm644 .config $PKG/boot/config-$version rm -f $PKG/lib/modules/$version/build rm -f $PKG/lib/modules/$version/source } signify() { untrusted comment: public key RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3 } # vim: filetype=sh