[RFC] Refactor PKGBUILD build options - #941
Conversation
Fixes: #894 Signed-off-by: Eric Naim <dnaim@cachyos.org>
linux-cachyos-lto is no longer in repos, so noone should have this obsolete package anymore. Signed-off-by: Eric Naim <dnaim@cachyos.org>
The values to set BBR3 as default can be set at runtime. No good reason to have an option to set it by default at compile time. Signed-off-by: Eric Naim <dnaim@cachyos.org>
$_features is a set of build options to configure the kernel. It's purpose is to remove most of the boolean build options we have in the PKGBUILD and make it declarative in the PKGBUILD. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Adds a cachy value to $_features that replaces the boolean $_cachy_config. No function changes intended. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Converts the boolean $_cc_harder to a value in $_features. No functional changes intended. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Setting the performance governor as default is possible via the kernel commandline `cpufreq.default_governor=performance`. Clean up the PKGBUILD by removing this arguably redundant build configuration. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Converts the boolean $_use_kcfi to a value in $_features. No functional changes intended. Signed-off-by: Eric Naim <dnaim@cachyos.org>
For a more generic PKGBUILD, refactor pkgsuffix construction to use known variables and not hardcode information. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Instead of making PREEMPT_RT a $_cpusched, make it a "feature" instead. This doesn't lock it down to only EEVDF and BORE and makes it possible to use PREEMPT_RT on other schedulers if supported. As an additional change, allow setting preemption mode on PREEMPT_RT builds. They are configurable in runtime anyway. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Allow building a handheld kernel from a single PKGBUILD by passing the "handheld" feature. This will override the pkgsuffix to -deckify, add the needed patches and enable the corresponding Kconfigs. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Add the CachyOS server kernel preset as a feature. When has_feature server, this will override the existing build options to the server kernel preset. This is only intended for CachyOS use as it doesn't respect previously set build options, but users are also free to use it knowing the implications. Signed-off-by: Eric Naim <dnaim@cachyos.org>
pkgdesc currently has hardcoded information. This is clearly undesirable for a generic PKGBUILD. Solve this by parsing information from build options and create a description based on those options. $_kernel_pkgdesc is only used for the kernel package as it is where most people would check for what the kernel is configured with. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Both of these options are mutually exclusive, so it makes sense to merge them together to a single variable. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Refactor the build scripts to make use of the newly written PKGBUILD. This removes 6 PKGBUILDs that are just there for different build configurations. LTS, RC and hardened PKGBUILDs are still kept because they differ by version and not configuration. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Like with $_features, convert the boolean build_modules options to a string of modules to build. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Having hardened in $_cpusched is fundamentally incorrect because, well, it's not a CPU scheduler! Regardless, having that as an option is also not possible to do correctly since: 1. version can lag behind current stable 2. it needs a different config that isn't easily toggleable so a different file must be provided With that in mind, remove it from $_cpusched. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
also @ptr1337 i didn't put autofdo and propeller to $_features because i thought it would affect your workflow, let me know if its okay to merge it if the impl. is okay |
There was a problem hiding this comment.
Pull request overview
This RFC consolidates multiple kernel flavor PKGBUILDs into a single configurable linux-cachyos/PKGBUILD by switching from many boolean build toggles to two whitespace-delimited selectors (_features and _modules), and updates local/CI build scripts accordingly. It also removes several now-redundant flavor packages (server/deckify/eevdf/bore/bmq/rt-bore) that are intended to be reproduced via environment-driven builds.
Changes:
- Refactor
linux-cachyos/PKGBUILDto use_features(kernel feature set) and_modules(extra module builds) plus_package_suffix, and adjust pkg naming/description generation. - Update build helper scripts to build remaining standalone PKGBUILDs and build former “flavor” variants by passing environment variables into Docker builds.
- Remove several flavor PKGBUILD/.SRCINFO pairs and update GitHub Actions workflow to use
_modulesenv.
Reviewed changes
Copilot reviewed 18 out of 24 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| script.sh | Refactors local Docker build loop into build_pkg() and builds former flavors via env vars. |
| script-znver4.sh | Same as script.sh, but targets the znver4 Docker image and repo output path. |
| script-v3-v4.sh | Deduplicates v3/v4 build logic via docker_build() and shared env arrays. |
| linux-cachyos/PKGBUILD | Core refactor: replaces multiple booleans with _features/_modules, updates suffix logic, sources, and pkgdesc generation. |
| linux-cachyos-server/PKGBUILD | Removed flavor PKGBUILD (server variant intended to be produced via _features=server). |
| linux-cachyos-server/.SRCINFO | Removed corresponding metadata for the server flavor. |
| linux-cachyos-rt-bore/PKGBUILD | Removed flavor PKGBUILD (RT+Bore intended to be produced via _features=... rt + _cpusched=bore). |
| linux-cachyos-rt-bore/.SRCINFO | Removed corresponding metadata for rt-bore flavor. |
| linux-cachyos-rc/PKGBUILD | Adds maintainer line. |
| linux-cachyos-eevdf/PKGBUILD | Removed flavor PKGBUILD (EEVDF intended to be produced via _cpusched=eevdf). |
| linux-cachyos-eevdf/.SRCINFO | Removed corresponding metadata for eevdf flavor. |
| linux-cachyos-deckify/PKGBUILD | Removed flavor PKGBUILD (handheld intended to be produced via _features=... handheld). |
| linux-cachyos-deckify/.SRCINFO | Removed corresponding metadata for deckify flavor. |
| linux-cachyos-bore/PKGBUILD | Removed flavor PKGBUILD (BORE intended to be produced via _cpusched=bore). |
| linux-cachyos-bore/.SRCINFO | Removed corresponding metadata for bore flavor. |
| linux-cachyos-bmq/PKGBUILD | Removed flavor PKGBUILD (BMQ intended to be produced via _cpusched=bmq). |
| linux-cachyos-bmq/.SRCINFO | Removed corresponding metadata for bmq flavor. |
| .github/workflows/build.yml | Switches CI to _modules env and changes makepkg integrity-skipping behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| has_feature() { | ||
| local feature | ||
| for feature in $_features; do | ||
| [[ $feature == "$1" ]] && return 0 | ||
| done | ||
| return 1 | ||
| } | ||
|
|
||
| has_module() { | ||
| local module | ||
| for module in $_modules; do | ||
| [[ $module == "$1" ]] && return 0 | ||
| done | ||
| return 1 | ||
| } |
There was a problem hiding this comment.
will wait for @ventureoo to chime in for this.
|
I also thought about merging all into a single PKGBUILD, but I imagined it as just a |
so we have a lot of PKGBUILDs... this is an attempt at reducing them. here i opted to use a string to specify what features the kernel will be built with. The default _features="cachy o3" is equivalent to $_cachy_config=yes and $_cc_harder=yes. Overall, _features currently saves around 7 variables. There's also _modules for extra modules (zfs, nvidia, r8125).
Having these be space separated string is quite dubious and I did consider a real array, but that would require an array parser if we want to pass build options from environment/GUI and I didn't think that was worth it.
I'm open to other solutions too, maybe the booleans are okay after all?
This would obviously need changes in kernel manager.
Closes #750
Closes #894