Skip to content

Commit db60d00

Browse files
feat: initial LiqXanMod hybrid kernel project
Merges XanMod (throughput) and Liquorix/Zen (low-latency) patch sets into a single kernel image with runtime workload autodetection. Key components: - build.sh: unified build driver supporting hybrid/xanmod/liquorix/auto modes - kernel/liqxanmod_autodetect.c: in-kernel kthread that samples RQ depth, wakeup rate, and IRQ rate every 100ms and switches the active CFS tunable set (throughput/balanced/latency) after 500ms of stable classification - patches/hybrid/: three glue patches resolving XanMod<->Zen symbol conflicts and exposing scheduler tunables via /sys/kernel/liqxanmod/ - configs/features/{xanmod,liquorix,hybrid}.config: layered Kconfig fragments with hybrid.config resolving the preemption model conflict - profiles/: desktop, gaming, server, rt, rog, arm64 named build profiles - packaging/: distro installers for debian, arch, fedora, opensuse, gentoo, generic - scripts/: patch fetcher, applier (with 3-way merge fallback), autodetect injector - .github/workflows/: CI matrix across modes x distros x branches Co-authored-by: Ona <no-reply@ona.com>
0 parents  commit db60d00

60 files changed

Lines changed: 2980 additions & 0 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: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
inputs:
10+
mode:
11+
description: "Patch blend mode"
12+
required: false
13+
default: hybrid
14+
type: choice
15+
options: [hybrid, xanmod, liquorix, auto]
16+
branch:
17+
description: "XanMod branch"
18+
required: false
19+
default: MAIN
20+
type: choice
21+
options: [MAIN, EDGE, LTS, RT]
22+
23+
jobs:
24+
shellcheck:
25+
name: Shellcheck
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
- name: Install shellcheck
30+
run: sudo apt-get install -y shellcheck
31+
- name: Lint
32+
run: |
33+
find . -name '*.sh' ! -path './.cache/*' ! -path './kernel/src/*' \
34+
-exec shellcheck -x {} +
35+
36+
build-matrix:
37+
name: Build (${{ matrix.distro }} / ${{ matrix.mode }})
38+
runs-on: ubuntu-latest
39+
needs: shellcheck
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
include:
44+
# Hybrid mode — the primary deliverable
45+
- distro: debian
46+
release: bookworm
47+
mode: hybrid
48+
branch: MAIN
49+
- distro: arch
50+
release: ""
51+
mode: hybrid
52+
branch: MAIN
53+
- distro: fedora
54+
release: "42"
55+
mode: hybrid
56+
branch: MAIN
57+
# XanMod-only (server profile)
58+
- distro: debian
59+
release: bookworm
60+
mode: xanmod
61+
branch: LTS
62+
# Liquorix-only (RT profile)
63+
- distro: debian
64+
release: bookworm
65+
mode: liquorix
66+
branch: RT
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Install build dependencies
72+
run: |
73+
sudo apt-get update -qq
74+
sudo apt-get install -y --no-install-recommends \
75+
build-essential bc bison flex libssl-dev libelf-dev \
76+
libncurses-dev dwarves pahole curl git jq \
77+
shellcheck
78+
79+
- name: Resolve Liquorix version
80+
id: lqx_ver
81+
run: |
82+
ver=$(bash scripts/resolve-lqx-version.sh)
83+
echo "version=${ver}" >> "$GITHUB_OUTPUT"
84+
85+
- name: Fetch XanMod source
86+
run: bash kernel/fetch.sh ${{ matrix.branch }}
87+
env:
88+
XANMOD_NO_API: "0"
89+
90+
- name: Fetch Liquorix patches
91+
if: matrix.mode != 'xanmod'
92+
run: bash scripts/fetch-lqx-patches.sh "${{ steps.lqx_ver.outputs.version }}"
93+
94+
- name: Apply patches
95+
run: |
96+
bash scripts/apply-patches.sh kernel/src patches
97+
env:
98+
MODE: ${{ matrix.mode }}
99+
ENABLE_ZEN_PATCHES: ${{ matrix.mode != 'xanmod' && '1' || '0' }}
100+
ENABLE_LQX_PATCHES: ${{ matrix.mode != 'xanmod' && '1' || '0' }}
101+
ENABLE_NET_PATCHES: "1"
102+
LQX_VER: ${{ steps.lqx_ver.outputs.version }}
103+
104+
- name: Inject autodetect module
105+
if: matrix.mode == 'hybrid' || matrix.mode == 'auto'
106+
run: bash scripts/inject-autodetect.sh kernel/src
107+
108+
- name: Merge config fragments
109+
run: |
110+
MERGE="${PWD}/kernel/src/scripts/kconfig/merge_config.sh"
111+
FRAGS=(configs/base/x86-64-v2.config)
112+
case "${{ matrix.mode }}" in
113+
xanmod) FRAGS+=(configs/features/xanmod.config) ;;
114+
liquorix) FRAGS+=(configs/features/liquorix.config) ;;
115+
hybrid|auto)
116+
FRAGS+=(configs/features/xanmod.config)
117+
FRAGS+=(configs/features/liquorix.config)
118+
FRAGS+=(configs/features/hybrid.config)
119+
;;
120+
esac
121+
FRAGS+=(configs/features/no-debug.config)
122+
cd kernel/src
123+
bash "${MERGE}" -m .config "${FRAGS[@]}"
124+
make ARCH=x86 olddefconfig
125+
126+
- name: Build kernel (allmodconfig smoke test)
127+
run: |
128+
cd kernel/src
129+
make -j"$(nproc)" ARCH=x86 bzImage
130+
timeout-minutes: 90
131+
132+
- name: Upload bzImage artifact
133+
uses: actions/upload-artifact@v4
134+
with:
135+
name: bzImage-${{ matrix.mode }}-${{ matrix.branch }}-${{ matrix.distro }}
136+
path: kernel/src/arch/x86/boot/bzImage
137+
if-no-files-found: error
138+
139+
release:
140+
name: Release
141+
runs-on: ubuntu-latest
142+
needs: build-matrix
143+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
144+
steps:
145+
- uses: actions/checkout@v4
146+
- name: Download all artifacts
147+
uses: actions/download-artifact@v4
148+
with:
149+
path: artifacts/
150+
- name: Create release
151+
uses: softprops/action-gh-release@v2
152+
with:
153+
tag_name: "build-${{ github.run_number }}"
154+
name: "LiqXanMod build ${{ github.run_number }}"
155+
files: artifacts/**/*
156+
generate_release_notes: true
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate architecture config
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
arch:
7+
description: "Target architecture"
8+
required: true
9+
type: choice
10+
options: [arm64, riscv64]
11+
kernel_version:
12+
description: "Kernel version (e.g. 6.12.1)"
13+
required: true
14+
15+
jobs:
16+
gen-config:
17+
name: Generate ${{ inputs.arch }} config
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install cross-compilation toolchain
23+
run: |
24+
sudo apt-get update -qq
25+
if [[ "${{ inputs.arch }}" == "arm64" ]]; then
26+
sudo apt-get install -y gcc-aarch64-linux-gnu
27+
else
28+
sudo apt-get install -y gcc-riscv64-linux-gnu
29+
fi
30+
sudo apt-get install -y build-essential bc bison flex \
31+
libssl-dev libelf-dev libncurses-dev
32+
33+
- name: Fetch kernel source
34+
run: bash kernel/fetch.sh MAIN
35+
36+
- name: Generate defconfig
37+
run: |
38+
cd kernel/src
39+
case "${{ inputs.arch }}" in
40+
arm64)
41+
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
42+
cp .config ../../configs/base/aarch64.config
43+
;;
44+
riscv64)
45+
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig
46+
cp .config ../../configs/base/riscv64.config
47+
;;
48+
esac
49+
50+
- name: Upload generated config
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: config-${{ inputs.arch }}-${{ inputs.kernel_version }}
54+
path: configs/base/${{ inputs.arch == 'arm64' && 'aarch64' || 'riscv64' }}.config

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
kernel/src/
2+
.cache/
3+
*.deb
4+
*.rpm
5+
*.pkg.tar.zst
6+
*.tar.gz
7+
*.tar.xz
8+
*.o
9+
*.ko
10+
*.mod
11+
*.mod.c
12+
*.symvers
13+
*.order
14+
Module.symvers
15+
modules.builtin
16+
modules.builtin.modinfo

CONTRIBUTING.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing
2+
3+
## What belongs here
4+
5+
- **Hybrid glue patches** (`patches/hybrid/`) — conflict resolution between
6+
XanMod and Zen patch sets. Each patch must document the conflict it resolves
7+
in `patches/hybrid/series` and `docs/hybrid-design.md`.
8+
9+
- **New profiles** (`profiles/`) — named build configurations for specific
10+
hardware or use cases.
11+
12+
- **Build system fixes** — improvements to `build.sh`, `Makefile`, or scripts
13+
under `scripts/`.
14+
15+
- **Autodetect tuning** — changes to classification thresholds or the
16+
hysteresis logic in `kernel/liqxanmod_autodetect.c`.
17+
18+
## What does not belong here
19+
20+
- Copies of XanMod or Zen/Liquorix patches. Those are fetched from upstream
21+
at build time. Patch content belongs in the upstream projects.
22+
23+
- Kernel `.config` files generated from a specific machine. Use config
24+
fragments under `configs/` instead.
25+
26+
## Patch submission checklist
27+
28+
- [ ] `shellcheck` passes: `make shellcheck`
29+
- [ ] New patches have a `Subject:` header and explain the motivation
30+
- [ ] Conflict resolution patches update the conflict map in `docs/hybrid-design.md`
31+
- [ ] New series entries are appended to the correct `series` file
32+
- [ ] `build.sh --no-install` completes without errors on x86-64
33+
34+
## Commit style
35+
36+
```
37+
component: short description of what changed and why
38+
39+
Optional longer explanation if the motivation is non-obvious.
40+
```
41+
42+
Examples:
43+
```
44+
patches/hybrid: deduplicate sched_nr_latency between XanMod and Zen
45+
scripts/detect: add Void Linux detection via xbps-install
46+
profiles: add steamdeck profile with ROG patches disabled
47+
```

Makefile

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# LiqXanMod — top-level Makefile
2+
#
3+
# Convenience targets that wrap build.sh.
4+
# All variables can be overridden on the command line, e.g.:
5+
# make build MODE=xanmod BRANCH=LTS VENDOR=amd JOBS=8
6+
7+
SHELL := /bin/bash
8+
JOBS ?= $(shell nproc)
9+
MODE ?= hybrid
10+
BRANCH ?= MAIN
11+
PROFILE ?=
12+
VENDOR ?=
13+
MLEVEL ?=
14+
15+
BUILD_ARGS := --mode $(MODE) --branch $(BRANCH) --jobs $(JOBS)
16+
ifneq ($(PROFILE),)
17+
BUILD_ARGS += --profile $(PROFILE)
18+
endif
19+
ifneq ($(VENDOR),)
20+
BUILD_ARGS += --vendor $(VENDOR)
21+
endif
22+
ifneq ($(MLEVEL),)
23+
BUILD_ARGS += --mlevel $(MLEVEL)
24+
endif
25+
26+
.PHONY: all build build-only fetch clean distclean help \
27+
profile-desktop profile-gaming profile-server profile-rt profile-rog \
28+
lint shellcheck
29+
30+
## Default: full build + install
31+
all: build
32+
33+
## Full build and install
34+
build:
35+
bash build.sh $(BUILD_ARGS)
36+
37+
## Build only, skip install
38+
build-only:
39+
bash build.sh $(BUILD_ARGS) --no-install
40+
41+
## Fetch kernel source only
42+
fetch:
43+
bash kernel/fetch.sh $(BRANCH)
44+
45+
## Named profile shortcuts
46+
profile-desktop:
47+
bash build.sh --profile desktop --jobs $(JOBS)
48+
49+
profile-gaming:
50+
bash build.sh --profile gaming --jobs $(JOBS)
51+
52+
profile-server:
53+
bash build.sh --profile server --jobs $(JOBS)
54+
55+
profile-rt:
56+
bash build.sh --profile rt --jobs $(JOBS)
57+
58+
profile-rog:
59+
bash build.sh --profile rog --jobs $(JOBS)
60+
61+
## Remove cached Liquorix archives
62+
clean:
63+
rm -rf .cache/lqx
64+
65+
## Remove kernel source tree and all caches
66+
distclean: clean
67+
rm -rf kernel/src
68+
69+
## Lint all shell scripts with shellcheck
70+
shellcheck:
71+
@command -v shellcheck >/dev/null || { echo "shellcheck not installed"; exit 1; }
72+
find . -name '*.sh' ! -path './.cache/*' ! -path './kernel/src/*' \
73+
-exec shellcheck -x {} +
74+
75+
lint: shellcheck
76+
77+
help:
78+
@echo ""
79+
@echo "LiqXanMod build targets:"
80+
@echo ""
81+
@echo " make Full build + install (MODE=hybrid BRANCH=MAIN)"
82+
@echo " make build-only Build without installing"
83+
@echo " make fetch Fetch/update kernel source only"
84+
@echo ""
85+
@echo " make profile-desktop Build with desktop profile"
86+
@echo " make profile-gaming Build with gaming profile"
87+
@echo " make profile-server Build with server profile (xanmod-only)"
88+
@echo " make profile-rt Build with RT profile (liquorix-only)"
89+
@echo " make profile-rog Build with ASUS ROG profile"
90+
@echo ""
91+
@echo " make clean Remove cached Liquorix archives"
92+
@echo " make distclean Remove kernel source tree + caches"
93+
@echo " make shellcheck Lint all shell scripts"
94+
@echo ""
95+
@echo "Variables (override on command line):"
96+
@echo " MODE hybrid|xanmod|liquorix|auto (default: hybrid)"
97+
@echo " BRANCH MAIN|EDGE|LTS|RT (default: MAIN)"
98+
@echo " VENDOR amd|intel (default: auto)"
99+
@echo " MLEVEL v1|v2|v3|v4 (default: auto)"
100+
@echo " JOBS N (default: nproc)"
101+
@echo ""

0 commit comments

Comments
 (0)