-
Notifications
You must be signed in to change notification settings - Fork 65
/
package.yml
188 lines (162 loc) · 8 KB
/
package.yml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name : linux-current
version : 6.8.7
release : 286
source :
- https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.8.7.tar.xz : 291d1a1faf4e87b3b0ea9729080db887aafd1ff2fac1430ceca921e46bc22fae
license : GPL-2.0-only
component :
- kernel.image
- headers : kernel.devel
homepage : https://www.kernel.org/
summary :
- Linux kernel image and modules (current)
- headers : Linux kernel headers (current)
description:
- The Linux kernel and modules, the core of the operating system
- headers : Headers required for building out of tree kernel modules
builddeps :
- pkgconfig(devmapper)
- pkgconfig(libelf)
- bc
- btrfs-progs
- cpio
- dracut
- f2fs-tools
- font-terminus-console
- intel-microcode
- kbd
- libfido2
- linux-firmware
- lz4
- nvme-cli
- perl
- sbsigntools
- tpm2-tools
patterns :
- headers : /usr/src
permanent :
- /lib/modules
- /usr/lib/kernel
- /usr/src
replaces :
- kernel
- kernel-modules
- headers : kernel-headers
environment: |
# Maximize ccache efficiency as well as make the build fully reproducible, except for the initrd which needs a timestamp to be signed
export KBUILD_BUILD_USER=root
export KBUILD_BUILD_TIMESTAMP="0"
export SOURCE_DATE_EPOCH=0
export CCACHE_BASEDIR=$workdir
export CCACHE_HASHDIR=yes
setup : |
%apply_patches
# Make sure the kernel version is consistent with the package version, even if we set the package version to something different
# We might do this if we're bisecting and don't want to mess with creating many different module dirs.
major="$( cut -d '.' -f 1 <<< "$version" )"
patch="$( cut -d '.' -f 2 <<< "$version" )"
sub="$( cut -d '.' -f 3 <<< "$version" )"
sed -e "s/^VERSION =.*/VERSION = $major/" -i Makefile
sed -e "s/^PATCHLEVEL =.*/PATCHLEVEL = $patch/" -i Makefile
sed -e "s/^SUBLEVEL =.*/SUBLEVEL = $sub/" -i Makefile
# Set the EXTRAVERSION to the Solus-specific string
extraVersion="-${release}.current"
sed -e "s/^EXTRAVERSION =.*/EXTRAVERSION = $extraVersion/" -i Makefile
# Ensure config is valid
install $pkgfiles/config .config
%make ARCH=x86_64 oldconfig
# Zero stats so that we see how effective the caching is
if [[ " ${PATH[*]} " =~ "ccache" ]]; then
ccache --zero-stats
fi
build : |
%make ARCH=x86_64 CONFIG_DEBUG_SECTION_MISMATCH=y KCFLAGS="-DAMD_PRIVATE_COLOR"
%make -C tools/objtool
if [[ " ${PATH[*]} " =~ "ccache" ]]; then
ccache --show-stats
fi
install : |
# Install kernel blob
kernID="com.solus-project.current"
kversion="${version}-${release}.current"
install -D -m 0755 arch/x86/boot/bzImage $installdir/usr/lib/kernel/$kernID.${version}-${release}
# Install additional files
install -m 00644 .config $installdir/usr/lib/kernel/config-$kversion
install -m 00644 System.map $installdir/usr/lib/kernel/System.map-$kversion
install -m 00644 $pkgfiles/cmdline $installdir/usr/lib/kernel/cmdline-$kversion
# Install kernel modules, disable depmod + firmware install
install -D -d -m 00755 $installdir/lib/modules/$kversion
%make ARCH=x86_64 INSTALL_MOD_PATH=$installdir/ modules_install KERNELRELEASE=$kversion mod-fw= DEPMOD=/bin/true
# Remove broken link
rm -v $installdir/lib/modules/${kversion}/build
# Mark this as the default "current" kernel
ln -sv $kernID.${version}-${release} $installdir/usr/lib/kernel/default-current
# For virtiofs VMs, make a handy symlink that always points to the current kernel initrd and vmlinux
ln -sv $kernID.${version}-${release} $installdir/usr/lib/kernel/current-vmlinux
ln -sv initrd-$kernID.${version}-${release} $installdir/usr/lib/kernel/current-initrd
# Fix mods
depmod -b $installdir/ $kversion -a
# Strip the kernel modules for the initramfs. We can eke out some slight size improvements by keeping the modules
# uncompressed before we compress the entire initramfs.
mkdir -p dracut-modules/lib/modules/
cp -ra $installdir/lib/modules/${kversion} dracut-modules/lib/modules/
find "dracut-modules" -name '*.ko' -exec strip --strip-unneeded {} \;
# Create a directory structure that we'll merge with the initrd. This is because we can't use symlinks with --include
# By creating symlinks here we can reference modules outside of the ordinary directory. This is needed for injecting
# modules from a secondary initramfs. We'll likely need to create such a symlink for every extra initramfs we intend to support
mkdir -p initramfs/lib64/modules/${kversion}/extra-modules/
mkdir -p initramfs/lib64/firmware
ln -sv /nvidia initramfs/lib64/modules/${kversion}/extra-modules/nvidia
ln -sv /nvidia-firmware initramfs/lib64/firmware/nvidia
# Store vendor initrd within the kernel package, prevent mangling from fakeroot
# 2021-01-20: Force early KMS for everything except Nouveau (this will not work with Nvidia propretary)
LD_PRELOAD='' dracut --tmpdir /tmp -N -f \
--kmoddir dracut-modules/lib/modules/${kversion} --kver $kversion \
--add "bash systemd lvm dm rescue resume fido2 tpm2-tss virtiofs" --omit "nvmf" \
--strip --hardlink --zstd --reproducible --nomdadmconf --early-microcode \
--add-drivers "amdgpu hyperv_drm i915 qxl radeon simpledrm virtio-gpu xe" \
--include $pkgfiles/initrd/timeouts.conf /usr/lib/systemd/system.conf.d/timeouts.conf \
--include initramfs / \
$installdir/usr/lib/kernel/initrd-$kernID.${version}-${release}
# Sign with our MOK if we have the secureboot-keys submodule checked out.
if [[ -e $pkgfiles/secureboot-keys/MOK.key ]]; then
sbsign --key $pkgfiles/secureboot-keys/MOK.key \
--cert $pkgfiles/secureboot-keys/MOK.crt \
--output $installdir/usr/lib/kernel/$kernID.${version}-${release} \
$installdir/usr/lib/kernel/$kernID.${version}-${release}
fi
# Install the headers
tgtDir="/usr/src/linux-headers-$kversion"
export dstDir="$installdir/$tgtDir"
install -D -d -m 00755 $dstDir
find . -path './include/*' -prune -o -path './scripts/*' -prune -o -path './Documentation/*' -prune -o -type f \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o -name '*.sh' -o -name '*.pl' -o -name '*.lds' \) -print | cpio -pVd --preserve-modification-time $dstDir/
# Necessary for out of tree modules
for h in "drivers/media/dvb-frontends" "drivers/media/tuners"; do
install -D -d -m 00755 $dstDir/$h
cp -a $h/*.h $dstDir/$h
done
find drivers/media/platform/ -type f -name "*.h" | xargs -i sh -c 'install -D -d -m 00755 $dstDir/$(dirname {}); cp -a {} $dstDir/{}'
# For a full headers pkg
for p in "include" "scripts" "Documentation"; do
cp -a $p $dstDir
done
# Nuke any unneeded bits.
rm -f $dstDir/scripts/*.o
rm -f $dstDir/scripts/*/*.o
rm -rf $dstDir/Documentation/DocBook
# Fix an issue that would otherwise require us to have fakeroot during the build (which makes the build MUCH slower expecially if you're using ccache)
chmod +x $dstDir/scripts/basic/fixdep
# Copy remaining include dirs
(find arch -name include -type d -print | xargs -n1 -i: find : -type f) | cpio -pd --preserve-modification-time "$dstDir"
# Shove last bits needed for out of tree kernel builds
install -m 00644 Module.symvers $dstDir/.
install -m 00644 System.map $dstDir/.
install -m 00644 .config $dstDir/.config
# Add objtool binary for CONFIG_STACK_VALIDATION (T5607)
install -m 00755 tools/objtool/objtool $dstDir/tools/objtool/objtool
# Fix up build/source links
ln -svf build $installdir/lib/modules/$kversion/source
ln -srvf ${dstDir} $installdir/lib/modules/$kversion/build
# Compress modules with zstd and strip them in the process
# TODO remove this once the kernel module compression w/ dbginfo is fixed
find "$installdir/lib/modules" -name '*.ko' -exec strip --strip-debug {} \; -exec zstd {} \; -exec rm -v {} \;