summaryrefslogtreecommitdiff
path: root/linux/linux-6.18.52/MAKEPKG
blob: 3b2bc8b9be4f75cf2a7c6bcb76fcc78960348494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/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.52
_name=linux
version=6.18.52
release=1
source=(https://cdn.kernel.org/pub/linux/kernel/v6.x/$_name-$version.tar.xz
        config)

sha256sums=(
    "2b69564f7d4fea0c859b1959ba33709ee6e9139bd100e30a853b57159a8221b8"
    "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