Skip to content

Commit 5c4d7d3

Browse files
authored
feat(gaming): add gaming variant and adopt the OGC kernel for all variants (#1212)
1 parent 9b56130 commit 5c4d7d3

48 files changed

Lines changed: 4535 additions & 70 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,21 @@ jobs:
6363
image_suffix: "-nvidia"
6464
publish: true
6565
continue: true
66+
- variant: gaming
67+
element: oci/bluefin.bst
68+
image_suffix: "-gaming"
69+
publish: true
70+
continue: true
71+
gaming: "true"
72+
- variant: nvidia-gaming
73+
element: oci/bluefin-nvidia.bst
74+
image_suffix: "-nvidia-gaming"
75+
publish: true
76+
continue: true
77+
gaming: "true"
6678
continue-on-error: ${{ matrix.continue }}
79+
env:
80+
BUILD_GAMING: ${{ matrix.gaming || 'false' }}
6781
permissions:
6882
contents: read
6983
steps:

.github/workflows/publish.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ jobs:
100100
image_suffix: '-nvidia'
101101
sbom_filename: dakota-nvidia.spdx.json
102102
continue: true
103+
# Gaming variants: same elements built with `-o gaming true`
104+
# (BUILD_GAMING). No SBOM entries yet; publish-sbom stays two-variant.
105+
- variant: gaming
106+
export_variant: default
107+
element: oci/bluefin.bst
108+
image_suffix: '-gaming'
109+
gaming: 'true'
110+
continue: true
111+
- variant: nvidia-gaming
112+
export_variant: nvidia
113+
element: oci/bluefin-nvidia.bst
114+
image_suffix: '-nvidia-gaming'
115+
gaming: 'true'
116+
continue: true
103117
continue-on-error: ${{ matrix.continue }}
104118
permissions:
105119
contents: read
@@ -142,10 +156,11 @@ jobs:
142156
env:
143157
BST_FLAGS: -o x86_64_v3 false --no-interactive --config /src/buildstream-ci.conf
144158
BUILD_IMAGE_NAME: ${{ env.IMAGE_NAME }}
159+
BUILD_GAMING: ${{ matrix.gaming || 'false' }}
145160
OCI_IMAGE_CREATED: ${{ steps.timestamp.outputs.created }}
146161
OCI_IMAGE_REVISION: ${{ needs.setup.outputs.sha }}
147162
OCI_IMAGE_VERSION: latest
148-
run: just export ${{ matrix.variant }}
163+
run: just export ${{ matrix.export_variant || matrix.variant }}
149164

150165
- name: Chunkify image layers
151166
# BST images need physical xattr injection before chunkah runs — BST strips
@@ -382,6 +397,10 @@ jobs:
382397
continue: false
383398
- image_suffix: '-nvidia'
384399
continue: true
400+
- image_suffix: '-gaming'
401+
continue: true
402+
- image_suffix: '-nvidia-gaming'
403+
continue: true
385404
continue-on-error: ${{ matrix.continue }}
386405
permissions:
387406
contents: write

Justfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ default:
66
# ── Configuration ─────────────────────────────────────────────────────
77
export image_name := env("BUILD_IMAGE_NAME", "dakota")
88
export image_tag := env("BUILD_IMAGE_TAG", "latest")
9+
10+
# Gaming variant: adds the gaming/ stack (the OGC kernel ships in ALL
11+
# variants regardless). Applies to every bst invocation here; exported
12+
# podman refs get a -gaming suffix so builds don't collide.
13+
export gaming := env("BUILD_GAMING", "false")
914
export base_dir := env("BUILD_BASE_DIR", ".")
1015
export filesystem := env("BUILD_FILESYSTEM", "btrfs")
1116

@@ -47,6 +52,9 @@ bst *ARGS:
4752
if [[ ! " ${EFFECTIVE_BST_FLAGS} " =~ [[:space:]]--no-interactive([[:space:]]|$) ]]; then
4853
EFFECTIVE_BST_FLAGS="${EFFECTIVE_BST_FLAGS} --no-interactive"
4954
fi
55+
if [[ ! " ${EFFECTIVE_BST_FLAGS} " =~ [[:space:]]-o[[:space:]]+gaming[[:space:]]+(true|false)([[:space:]]|$) ]]; then
56+
EFFECTIVE_BST_FLAGS="${EFFECTIVE_BST_FLAGS} -o gaming {{gaming}}"
57+
fi
5058
fi
5159
5260
# BST_FLAGS allows appending --no-interactive, --config, etc.
@@ -218,6 +226,9 @@ export variant="default":
218226
nvidia) ELEMENT="oci/bluefin-nvidia.bst"; FINAL_NAME="{{image_name}}-nvidia" ;;
219227
*) echo "ERROR: unknown variant '{{variant}}' (expected: default | nvidia)" >&2; exit 1 ;;
220228
esac
229+
if [ "{{gaming}}" = "true" ]; then
230+
FINAL_NAME="${FINAL_NAME}-gaming"
231+
fi
221232
FINAL_TAG="{{image_tag}}"
222233
223234
# Use sudo unless already root (CI runners are root)
@@ -332,6 +343,9 @@ generate-bootable-image variant="default" $base_dir=base_dir $filesystem=filesys
332343
nvidia) FINAL_NAME="{{image_name}}-nvidia" ;;
333344
*) echo "ERROR: unknown variant '{{variant}}' (expected: default | nvidia)" >&2; exit 1 ;;
334345
esac
346+
if [ "{{gaming}}" = "true" ]; then
347+
FINAL_NAME="${FINAL_NAME}-gaming"
348+
fi
335349
336350
REF="${FINAL_NAME}:{{image_tag}}"
337351
if ! sudo podman image exists "$REF"; then

elements/bluefin-nvidia/deps.bst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
kind: stack
22

33
depends:
4+
- bluefin-nvidia/os-release.bst
45
- bluefin-nvidia/nvidia-drivers.bst
56
- bluefin-nvidia/nvidia-vaapi-driver.bst
67
- bluefin-nvidia/nvidia-kargs.bst
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nvidia os-release: shadows the base identity files in the nvidia
2+
# layer. The dep on the base element makes it stage first, so these
3+
# files win the whitelisted overlap.
4+
kind: manual
5+
6+
(@):
7+
- include/os-release.yml
8+
9+
depends:
10+
(>):
11+
- oci/os-release.bst
12+
13+
variables:
14+
os-release-repo: dakota-nvidia
15+
(?):
16+
- gaming == true:
17+
os-release-repo: dakota-nvidia-gaming
18+
19+
public:
20+
bst:
21+
overlap-whitelist:
22+
- /usr/lib/os-release
23+
- /etc/os-release
24+
- /usr/share/ublue-os/image-info.json

elements/core/linux-ogc.bst

Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
# Open Gaming Collective (OGC) kernel, the project kernel for ALL
2+
# Dakota variants, wired in unconditionally via the junction override in
3+
# elements/freedesktop-sdk.bst. Reproduces FDSDK's artifact contract
4+
# exactly: vmlinuz/config at %{bootdir}, modules at
5+
# /usr/lib/modules/<kver>/ with a `build` symlink into
6+
# /usr/src/linux-<kver> (nvidia-drivers.bst compiles against it).
7+
#
8+
# The recipe is FDSDK 25.08 components/linux.bst with three deltas:
9+
# 1. Source: OGC's stable-tree fork; FDSDK's patch queue is dropped,
10+
# the OGC tree carries its own gaming patchset.
11+
# 2. Config: FDSDK's fdsdk-config.sh pass (vendored at
12+
# files/linux-ogc/, keep in sync when bumping the junction), then
13+
# OGC's ogc.config.set/unset fragments (sched_ext, ntsync, BTF).
14+
# 3. Modules stripped (INSTALL_MOD_STRIP=1) and vmlinux to the devel
15+
# split: OGC forces DEBUG_INFO=y for BTF.
16+
#
17+
# Bumps: `just bst source track core/linux-ogc.bst` follows v*-ogc*
18+
# tags; update the ogc-localversion variable to match the new tag. On a
19+
# stable-series jump, nvidia-drivers.bst must compile against the new
20+
# tree before shipping.
21+
kind: make
22+
description: OGC Linux kernel (all Dakota variants)
23+
24+
build-depends:
25+
- freedesktop-sdk.bst:public-stacks/buildsystem-make.bst
26+
- freedesktop-sdk.bst:components/bison.bst
27+
- freedesktop-sdk.bst:components/cpio.bst
28+
- freedesktop-sdk.bst:components/flex.bst
29+
- freedesktop-sdk.bst:components/bc.bst
30+
- freedesktop-sdk.bst:components/gzip.bst
31+
- freedesktop-sdk.bst:components/pahole.bst
32+
- freedesktop-sdk.bst:components/python3.bst
33+
- freedesktop-sdk.bst:components/rsync.bst
34+
- freedesktop-sdk.bst:components/rust.bst
35+
- freedesktop-sdk.bst:components/rust-bindgen.bst
36+
- freedesktop-sdk.bst:components/rust-src.bst
37+
- freedesktop-sdk.bst:components/util-linux.bst
38+
- freedesktop-sdk.bst:components/zstd.bst
39+
# Provides /keys/linux-module-cert.crt; fdsdk-config.sh wires it into
40+
# SYSTEM_TRUSTED_KEYS when present.
41+
- filename: freedesktop-sdk.bst:components/linux-module-cert.bst
42+
strict: true
43+
44+
variables:
45+
# OGC patchset revision of the pinned tag; keep in sync with the
46+
# `ref:` under sources (v<kver>-ogcN-...). Not derivable at build
47+
# time: the tree ships no EXTRAVERSION or localversion files.
48+
ogc-localversion: '-ogc1'
49+
bootdir: /boot
50+
indep-libdir: '%{prefix}/lib'
51+
# Modules are stripped by kbuild (INSTALL_MOD_STRIP=1) *before* the
52+
# module signature is appended; a post-build strip pass would tear
53+
# the signatures off again.
54+
strip-binaries: ''
55+
kernel_arch: '%{arch}'
56+
src-arch: '%{kernel_arch}'
57+
image-name: '$(make -s image_name)'
58+
(?):
59+
- arch == "x86_64":
60+
src-arch: x86
61+
- arch == "aarch64":
62+
kernel_arch: arm64
63+
- arch == "riscv64":
64+
kernel_arch: riscv
65+
66+
environment:
67+
ARCH: '%{kernel_arch}'
68+
# compile.h has hardcoded timestamp, let's seed it
69+
KBUILD_BUILD_TIMESTAMP: 'Thu Nov 10 15:00:00 UTC 2011'
70+
KBUILD_BUILD_USER: 'tomjon'
71+
MAXJOBS: "%{max-jobs}"
72+
73+
environment-nocache:
74+
- MAXJOBS
75+
76+
config:
77+
configure-commands:
78+
- |
79+
# Generate the default kernel config for the target architecture
80+
make defconfig
81+
82+
- |
83+
. ./config-utils.sh
84+
rm -f expected-configs
85+
. ./fdsdk-config.sh "%{arch}"
86+
87+
- |
88+
# Layer the OGC gaming fragments over the FDSDK config. Format:
89+
# ogc.config.set holds CONFIG_X=y|m|"str"|<int> lines, unset holds
90+
# bare CONFIG names. Options whose dependencies aren't met on this
91+
# config are dropped by olddefconfig below, same as OGC's own
92+
# cross-distro packaging.
93+
while IFS= read -r line; do
94+
case "$line" in ''|'#'*) continue ;; esac
95+
name=${line%%=*}
96+
val=${line#*=}
97+
case "$val" in
98+
y) scripts/config --keep-case -e "$name" ;;
99+
m) scripts/config --keep-case -m "$name" ;;
100+
\"*\")
101+
val=${val#\"}; val=${val%\"}
102+
scripts/config --keep-case --set-str "$name" "$val"
103+
;;
104+
*) scripts/config --keep-case --set-val "$name" "$val" ;;
105+
esac
106+
done < ogc.config.set
107+
while IFS= read -r name; do
108+
case "$name" in ''|'#'*) continue ;; esac
109+
scripts/config --keep-case -d "$name"
110+
# The fragment wins over FDSDK's pass: if fdsdk-config.sh marked
111+
# this option expected (module/enable), stop requiring it. FDSDK
112+
# records names without the CONFIG_ prefix; match both forms.
113+
sed -i "/^\(CONFIG_\)\{0,1\}${name#CONFIG_}\$/d" expected-configs
114+
done < ogc.config.unset
115+
# OGC's fragment enables the C binder (+ binderfs, which needs it);
116+
# the Rust binder FDSDK expects is mutually exclusive with it
117+
# (depends on !ANDROID_BINDER_IPC), so olddefconfig drops it.
118+
# Waydroid only needs *a* binder providing binder/hwbinder/vndbinder
119+
# -- swap the expectation to the C driver OGC configures.
120+
sed -i '/^\(CONFIG_\)\{0,1\}ANDROID_BINDER_IPC_RUST$/d' expected-configs
121+
echo CONFIG_ANDROID_BINDER_IPC >> expected-configs
122+
echo CONFIG_ANDROID_BINDERFS >> expected-configs
123+
# The gaming point of this kernel; fail the build if these regress.
124+
echo CONFIG_SCHED_CLASS_EXT >> expected-configs
125+
echo CONFIG_NTSYNC >> expected-configs
126+
127+
- |
128+
# Stamp `uname -r` with the OGC revision (e.g. 7.1.4-ogc1).
129+
# kernelrelease drives the modules dir, build tree and NVIDIA
130+
# module build alike, so co-versioning holds.
131+
scripts/config --keep-case --set-str LOCALVERSION "%{ogc-localversion}"
132+
scripts/config --keep-case -d LOCALVERSION_AUTO
133+
134+
- |
135+
# Keep fdsdk's expected SP800-90A DRBGs: linux 7.1 dropped the
136+
# RNG_DEFAULT select that used to switch this menu on, and with it
137+
# off olddefconfig discards the child options.
138+
scripts/config --keep-case -e CRYPTO_DRBG_MENU
139+
140+
- |
141+
# The zswap.compressor=zstd karg needs the compressor built in, not =m.
142+
scripts/config --keep-case -e CRYPTO_ZSTD
143+
144+
- |
145+
# Drop expectations for options this tree no longer offers (the
146+
# vendored fdsdk config pass targets an older kernel era). Gaming-
147+
# critical symbols are exempt: losing them must fail the build.
148+
find . -name 'Kconfig*' -exec grep -h '^\(menu\)\{0,1\}config ' {} + \
149+
| awk '{print $2}' | sort -u > .kconfig-symbols
150+
cp expected-configs expected-configs.orig
151+
while IFS= read -r cfg; do
152+
sym=${cfg#CONFIG_}
153+
case "$sym" in
154+
SCHED_CLASS_EXT|NTSYNC|ANDROID_BINDER_IPC|ANDROID_BINDERFS) continue ;;
155+
esac
156+
if ! grep -qx "$sym" .kconfig-symbols; then
157+
echo "note: pruning expectation for ${cfg} (absent from this tree)" 1>&2
158+
sed -i "/^\(CONFIG_\)\{0,1\}${sym}\$/d" expected-configs
159+
fi
160+
done < expected-configs.orig
161+
rm -f expected-configs.orig
162+
163+
- |
164+
make -j1 olddefconfig
165+
166+
- |
167+
. ./config-utils.sh
168+
169+
missing_configs=0
170+
for config in $(cat expected-configs); do
171+
if ! has "${config}"; then
172+
echo "Missing ${config}" 1>&2
173+
missing_configs=1
174+
fi
175+
done
176+
# Only fail for...
177+
case "%{arch}" in
178+
x86_64|aarch64)
179+
[ "${missing_configs}" = 0 ]
180+
;;
181+
esac
182+
183+
# has() accepts =m; the zswap karg requires =y.
184+
grep -q '^CONFIG_CRYPTO_ZSTD=y$' .config
185+
186+
install-commands:
187+
- |
188+
install -Dm644 "%{image-name}" '%{install-root}%{bootdir}/vmlinuz'
189+
install -Dm644 vmlinux '%{install-root}%{bootdir}/vmlinux'
190+
install -Dm644 System.map '%{install-root}%{bootdir}/System.map'
191+
install -Dm644 .config '%{install-root}%{bootdir}/config'
192+
make -j1 INSTALL_MOD_PATH='%{install-root}%{prefix}' INSTALL_MOD_STRIP=1 modules_install
193+
194+
- |
195+
release=$(make -s kernelrelease)
196+
targetdir="%{install-root}%{prefix}/src/linux-${release}"
197+
198+
rm "%{install-root}%{indep-libdir}/modules/${release}"/build
199+
200+
to_copy=(
201+
Makefile
202+
Module.symvers
203+
.config
204+
"arch/%{src-arch}/include"
205+
"arch/%{src-arch}/Makefile"
206+
scripts
207+
include
208+
)
209+
if [ "$(scripts/config -s OBJTOOL)" = y ]; then
210+
to_copy+=(tools/objtool/objtool)
211+
fi
212+
for file in "${to_copy[@]}"
213+
do
214+
targetfile="${targetdir}/${file}"
215+
dir="$(dirname "${targetfile}")"
216+
[ -d "${dir}" ] || install -d "${dir}"
217+
cp -aT "${file}" "${targetfile}"
218+
done
219+
220+
ln -sr "${targetdir}" "%{install-root}%{indep-libdir}/modules/${release}/build"
221+
222+
(?):
223+
- arch in ["aarch64", "riscv64"]:
224+
install-commands:
225+
(>):
226+
- |
227+
make -j1 INSTALL_DTBS_PATH='%{install-root}%{bootdir}/dtbs' dtbs_install
228+
229+
public:
230+
bst:
231+
split-rules:
232+
devel:
233+
(>):
234+
- '%{bootdir}/System.map'
235+
# DEBUG_INFO=y (forced by OGC for BTF) makes vmlinux ~0.5 GB;
236+
# runtime consumers (scx schedulers) read /sys/kernel/btf/vmlinux,
237+
# not this file, so keep it out of the composed images.
238+
- '%{bootdir}/vmlinux'
239+
240+
sources:
241+
- kind: git_repo
242+
url: github:OpenGamingCollective/linux.git
243+
track: v*-ogc*
244+
ref: v7.1.4-ogc1-0-g29e5cbbcc123d68c41fc41b9c15afc3a2a98469e
245+
- kind: local
246+
path: files/linux-ogc/config-utils.sh
247+
- kind: local
248+
path: files/linux-ogc/fdsdk-config.sh
249+
- kind: local
250+
path: files/linux-ogc/ogc.config.set
251+
- kind: local
252+
path: files/linux-ogc/ogc.config.unset

0 commit comments

Comments
 (0)