blob: c5b2cea8240e8f68f66f20012ac7a52c044be17b (
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
|
#!/bin/sh
. "${0%/*}/common.sh" "$@"
cmd cd "$HOME/linux"
[ "$1" = -p ] || cmd git pull --rebase=merges
cmd mkdir -p /tmp/linux-build
cmd cp "$HOME/kernel-configs/current" /tmp/linux-build/.config
export PATH="/usr/lib/ccache/bin:$PATH"
export CCACHE_BASEDIR=/tmp/linux-build
export CCACHE_DIR=${XDG_CACHE_HOME:-$HOME/.cache}/kernel-ccache
cmd make O=/tmp/linux-build oldconfig
KCFLAGS=${KCFLAGS-'-pipe -fgraphite-identity -floop-nest-optimize -fipa-pta -fno-ipa-cp-clone -fno-align-jumps -fno-align-functions -fno-align-loops -fno-align-labels -fno-prefetch-loop-arrays'}
cmd make O=/tmp/linux-build KCFLAGS="${KCFLAGS}"
cd /tmp/linux-build
kernelrelease=$(make -s kernelrelease)
bas=/boot/vmlinuz
new=$bas.new
ins=$bas-${kernelrelease}
cmd doas cp arch/x86/boot/bzImage "$new"
cmd doas mv "$new" "$ins"
loader_entry=linux-${kernelrelease}
cmd doas sh -c "cat > /boot/loader/entries/$loader_entry.conf << EOF
title Linux
version ${kernelrelease}
linux /vmlinuz-${kernelrelease}
options libahci.ignore_sss=1 vfio-pci.ids=1002:aaf0 amdgpu.ppfeaturemask=0xffffffff amdgpu.dcfeaturemask=0xb quiet
initrd /amd-uc.img
initrd /initramfs.img
EOF"
cmd doas bootctl set-default $loader_entry.conf
cmd doas rm -rf /lib/modules/$kernelrelease
cmd doas make modules_install
builddir=/lib/modules/$kernelrelease/build
cmd doas rm -rf "$builddir"
cmd doas install -Dt "$builddir" -m644 .config
cmd doas install -Dt "$builddir" -m644 $HOME/linux/Makefile
cmd doas sh -c "xz -9c vmlinux > '$builddir/vmlinux.xz'"
cmd doas sh -c "xz -9c System.map > '$builddir/System.map.xz'"
cmd doas rm -f /usr/src/linux
cmd doas ln -sr "$builddir" /usr/src/linux
cd /
cmd rm -rf /tmp/linux-build
|