Skip to content

Conversation

@rpardini
Copy link
Member

@rpardini rpardini commented Oct 26, 2025

armbian-kernel: remove inconsistent conditionals

  • armbian-kernel: fix inconsistency in the ZRAM_BACKEND stuff; add a rant
  • armbian-kernel: shfmt + trim whitespace; no changes
  • armbian-kernel: BTRFS_FS & EXT4_FS as built-in, not modules
  • armbian-kernel: remove inconsistent conditionals
    • one shall NOT use the contents of .config to determine what's in the .config
    • also: introduce opts_m for armbian_kernel_config_apply_opts_from_arrays()
  • armbian-kernel: rework everything into arrays + armbian_kernel_config_apply_opts_from_arrays
    • so hashes and changes are consistent
  • armbian-kernel: standardize on opts_y/opts_n/opts_m + opts_val arrays
    • call_extensions_kernel_config() now declares the vars and calls
      armbian_kernel_config_apply_opts_from_arrays() at the end
    • so each individual hook doesn't need to
    • adapt family code using the old way too
  • armbian-kernel: drop CONFIG_ prefix, fix comments
    • also fix for opt_m logging mismatch caught by the AI
  • armbian-kernel: remove forced EXT4/BTRFS as builtins (let each kernel .config decide)
    • some families want builtin, some want modules, let each decide

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 26, 2025

Walkthrough

The diff centralizes kernel-config edits by introducing in-memory option accumulators (indexed arrays opts_y, opts_n, opts_m and associative opts_val) and defers actual .config changes to a single apply step armbian_kernel_config_apply_opts_from_arrays. Many functions in lib/functions/compilation/armbian-kernel.sh were converted to populate these arrays instead of editing .config or calling kernel_config_set_* directly. lib/functions/compilation/kernel-config.sh initializes the option arrays and invokes the apply step. Family configs: config/sources/families/include/meson64_common.inc now appends CONFIG_RTL8822CS to opts_m (removing prior hash manipulation and conditional warning), and config/sources/families/meson-s4t7.conf was changed to emit a display_alert, add opts_y entries for DEBUG_KERNEL, EMBEDDED, and EXPERT, retain first-call SHA1 recording, and remove the previous second-call injection/else-branch logic.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–60 minutes

  • Files needing extra attention:
    • lib/functions/compilation/armbian-kernel.sh — core opt-array implementation and many migrated helpers.
    • lib/functions/compilation/kernel-config.sh — opts_* initialization and integration point.
    • config/sources/families/include/meson64_common.inc — replacement of in-function hash/edit behavior with opts_m.
    • config/sources/families/meson-s4t7.conf — alert addition and migration of kernel-option logic; verify first-call SHA1/side-effect preservation and removed branches.
    • Verify that deferred application preserves previous hashing, ordering, and behavior when .config is absent.

Possibly related issues

Possibly related PRs

Suggested reviewers

  • chraac
  • leggewie
  • EvilOlaf
  • igorpecovnik
  • teknoid
  • pyavitz

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 68.75% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "armbian-kernel: remove inconsistent conditionals" directly addresses the core objective of the pull request, which is to eliminate inconsistent conditional logic that relied on reading .config to determine what should be written to .config. The raw_summary shows that the implementation involves replacing direct kernel_config_set_* calls with an opt-array system (opts_m, opts_y, opts_n) to achieve this goal of removing inconsistencies. The title is concise, specific, and a teammate reviewing the repository history would understand that this PR refactors the kernel configuration handling to be more deterministic and consistent.
Description Check ✅ Passed The pull request description is comprehensive and clearly related to the changeset. It lists multiple specific changes including fixing ZRAM_BACKEND inconsistency, applying code formatting, refactoring kernel configuration into arrays, standardizing on opts_y/opts_n/opts_m/opts_val arrays, and removing forced EXT4/BTRFS built-in settings. Each point corresponds to actual changes visible in the raw_summary across multiple files (meson64_common.inc, meson-s4t7.conf, armbian-kernel.sh, and kernel-config.sh). The description is neither vague nor generic, and it directly describes aspects of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7a8802a and d517f9d.

📒 Files selected for processing (4)
  • config/sources/families/include/meson64_common.inc (1 hunks)
  • config/sources/families/meson-s4t7.conf (1 hunks)
  • lib/functions/compilation/armbian-kernel.sh (8 hunks)
  • lib/functions/compilation/kernel-config.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/kernel-config.sh
🧰 Additional context used
🧠 Learnings (41)
📓 Common learnings
Learnt from: EvilOlaf
PR: armbian/build#8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.
Learnt from: EvilOlaf
PR: armbian/build#8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.
Learnt from: EvilOlaf
PR: armbian/build#8328
File: lib/functions/compilation/patch/drivers_network.sh:542-545
Timestamp: 2025-06-24T10:08:40.313Z
Learning: In the Armbian build system, when a PR removes build support for a specific kernel version, version check issues for that removed version become practically irrelevant even if they appear incorrect in isolation. Context about which kernel versions are being deprecated/removed is important for understanding the impact of version-related code changes.
Learnt from: igorpecovnik
PR: armbian/build#8705
File: .github/workflows/rewrite-kernel-configs.yml:96-169
Timestamp: 2025-10-03T11:42:46.660Z
Learning: In the Armbian build repository's kernel config rewrite workflow (.github/workflows/rewrite-kernel-configs.yml), deletion of kernel config files does not need to be handled. The workflow intentionally only captures ACMR (added/copied/modified/renamed) changes and does not need to propagate deletions to the aggregator.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.
Learnt from: rpardini
PR: armbian/build#8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.
Learnt from: igorpecovnik
PR: armbian/build#8705
File: .github/workflows/rewrite-kernel-configs.yml:217-220
Timestamp: 2025-10-04T17:59:19.369Z
Learning: In the Armbian build repository's kernel config rewrite workflow (.github/workflows/rewrite-kernel-configs.yml), the workflow is designed to rewrite existing kernel configs only. New/untracked files can be safely ignored, so using `git diff --quiet` (which ignores untracked files) is the correct approach for detecting changes rather than `git status --porcelain`.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: rpardini
PR: armbian/build#8820
File: config/sources/families/include/meson64_common.inc:51-53
Timestamp: 2025-10-26T12:56:29.185Z
Learning: In the Armbian build framework, scripts/config correctly handles kernel configuration option names both with and without the CONFIG_ prefix, so opts_m+=("CONFIG_RTL8822CS") and opts_m+=("RTL8822CS") are both valid and will work correctly.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-06-25T03:40:52.109Z
Learnt from: EvilOlaf
PR: armbian/build#8330
File: config/sources/families/sun55iw3.conf:32-36
Timestamp: 2025-06-25T03:40:52.109Z
Learning: In Armbian build system configuration files like config/sources/families/*.conf, when KERNELSOURCE is not explicitly declared in a case branch, the system falls back to a default KERNELSOURCE value, so missing KERNELSOURCE declarations are not critical issues.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-06-25T03:42:09.086Z
Learnt from: EvilOlaf
PR: armbian/build#8330
File: config/sources/families/sun55iw3.conf:32-36
Timestamp: 2025-06-25T03:42:09.086Z
Learning: In Armbian build system configuration files like config/sources/families/*.conf, KERNELSOURCE is explicitly declared when using unofficial or 3rd party kernel repositories (like the "dev" branch using https://github.com/apritzel/linux), but can be omitted when using the standard mainline kernel (like the "edge" branch) since it will fall back to the default mainline source.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-26T12:56:29.185Z
Learnt from: rpardini
PR: armbian/build#8820
File: config/sources/families/include/meson64_common.inc:51-53
Timestamp: 2025-10-26T12:56:29.185Z
Learning: In the Armbian build framework, scripts/config correctly handles kernel configuration option names both with and without the CONFIG_ prefix, so opts_m+=("CONFIG_RTL8822CS") and opts_m+=("RTL8822CS") are both valid and will work correctly.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the modern recommended approach for kernel configuration is to use the kernel-config command via "./compile.sh BOARD=boardname BRANCH=branchname kernel-config" instead of the deprecated KERNEL_CONFIGURE=yes flag. This provides a two-step workflow: configure using menuconfig, then build, with better transparency and control over configuration changes.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:59:36.334Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:200-200
Timestamp: 2025-09-22T21:59:36.334Z
Learning: Functions named with the pattern `armbian_kernel_config__*` in lib/functions/compilation/armbian-kernel.sh are automatically discovered and invoked by Armbian's extension system via metaprogramming using `compgen -A function`, without requiring explicit registration or calls.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T04:13:16.457Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-22T07:56:19.424Z
Learnt from: igorpecovnik
PR: armbian/build#8789
File: config/kernel/linux-sunxi64-edge.config:839-839
Timestamp: 2025-10-22T07:56:19.424Z
Learning: In Linux kernel configuration, some `=y` (builtin) options are infrastructure or feature flags that enable subsystems or features for modular drivers, rather than directly compiling code into the kernel. For example, in Armbian wireless configs, options like CONFIG_SPARD_WLAN_SUPPORT=y, CONFIG_SC23XX=y, CONFIG_WCN_BSP_DRIVER_BUILDIN=y, CONFIG_UNISOC_WIFI_PS=y are module infrastructure/feature enablers, while the actual drivers (CONFIG_WLAN_UWE5621=m, CONFIG_WLAN_UWE5622=m) remain as loadable modules. These infrastructure options don't cause kernel bloat.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:49:27.188Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-k3-edge.config:97-99
Timestamp: 2025-09-27T21:49:27.188Z
Learning: make oldconfig preserves existing deprecated kernel options and only prompts for new configuration options, unlike make defconfig which would auto-correct by removing deprecated options. This explains why deprecated options like CONFIG_ZSWAP_ZPOOL_DEFAULT_ZBUD might persist through the automated Armbian kernel configuration generation process.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T06:48:09.091Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T06:48:09.091Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the user prefers flexible grep patterns over anchored ones for BTRFS configuration checks, but agrees to use quiet grep (-q) to avoid polluting build logs.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-25T18:37:00.330Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-21T04:12:02.439Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-07-21T04:12:02.439Z
Learning: In the Armbian build system, for recurring maintenance tasks like kernel version bumping, TODO comments should use generic version formats (e.g., "MAJOR.MINOR-rc1") rather than specific version numbers (e.g., "6.17-rc1") to avoid the need for frequent comment updates that would create unnecessary maintenance overhead.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-06-12T21:08:11.318Z
Learnt from: djurny
PR: armbian/build#8287
File: config/bootscripts/boot-sunxi.cmd:13-23
Timestamp: 2025-06-12T21:08:11.318Z
Learning: In config/bootscripts/boot-sunxi.cmd the variable name `align_overlap_oboe_avoidance` intentionally uses the acronym “OBOE” (Off-By-One Error); it is not a typo and should not be renamed.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-06-24T10:08:40.313Z
Learnt from: EvilOlaf
PR: armbian/build#8328
File: lib/functions/compilation/patch/drivers_network.sh:542-545
Timestamp: 2025-06-24T10:08:40.313Z
Learning: In the Armbian build system, when a PR removes build support for a specific kernel version, version check issues for that removed version become practically irrelevant even if they appear incorrect in isolation. Context about which kernel versions are being deprecated/removed is important for understanding the impact of version-related code changes.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-03T11:42:46.660Z
Learnt from: igorpecovnik
PR: armbian/build#8705
File: .github/workflows/rewrite-kernel-configs.yml:96-169
Timestamp: 2025-10-03T11:42:46.660Z
Learning: In the Armbian build repository's kernel config rewrite workflow (.github/workflows/rewrite-kernel-configs.yml), deletion of kernel config files does not need to be handled. The workflow intentionally only captures ACMR (added/copied/modified/renamed) changes and does not need to propagate deletions to the aggregator.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-25T03:51:50.830Z
Learnt from: EvilOlaf
PR: armbian/build#8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub or the PR API to get the complete picture of what files are being added or modified.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-25T03:51:50.830Z
Learnt from: EvilOlaf
PR: armbian/build#8428
File: config/boards/lckfb-taishanpi.csc:5-9
Timestamp: 2025-07-25T03:51:50.830Z
Learning: When reviewing PRs in the Armbian build system, U-Boot defconfig files and patches may be added as part of the PR changes but might not be visible in the current repository clone state during review. It's important to check the actual PR file changes directly via GitHub API (https://api.github.com/repos/armbian/build/pulls/{pr_number}/files) to get the complete picture of what files are being added or modified, especially for U-Boot patches that will be applied during the build process.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-04T17:59:19.369Z
Learnt from: igorpecovnik
PR: armbian/build#8705
File: .github/workflows/rewrite-kernel-configs.yml:217-220
Timestamp: 2025-10-04T17:59:19.369Z
Learning: In the Armbian build repository's kernel config rewrite workflow (.github/workflows/rewrite-kernel-configs.yml), the workflow is designed to rewrite existing kernel configs only. New/untracked files can be safely ignored, so using `git diff --quiet` (which ignores untracked files) is the correct approach for detecting changes rather than `git status --porcelain`.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-12T15:46:16.772Z
Learnt from: amazingfate
PR: armbian/build#8619
File: config/bootscripts/boot-rk3506.cmd:46-47
Timestamp: 2025-09-12T15:46:16.772Z
Learning: In Armbian boot scripts, uInitrd is always packaged by the build system, so unconditional loading of uInitrd without existence checks is acceptable and won't cause boot failures.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-01T06:11:43.476Z
Learnt from: wei633
PR: armbian/build#8557
File: config/bootscripts/boot-xpressreal-t3.cmd:0-0
Timestamp: 2025-09-01T06:11:43.476Z
Learning: In Armbian boot scripts without initramfs support, UUID= and LABEL= style device paths cannot be used for rootdev as they require initramfs to resolve during boot. Only direct device paths (/dev/mmcblkXpY) or PARTUUID= references (which U-Boot can resolve) will work.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-27T15:53:30.629Z
Learnt from: pyavitz
PR: armbian/build#8421
File: config/kernel/linux-sunxi64-edge.config:805-825
Timestamp: 2025-07-27T15:53:30.629Z
Learning: In the Armbian build system, kernel configurations prioritize broad hardware compatibility over optimization concerns. Even when including numerous legacy/obsolete drivers causes technical issues like increased initramfs size and slower enumeration, the project philosophy is to "appease the masses" by ensuring maximum device compatibility rather than optimizing for specific use cases.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-27T13:03:53.146Z
Learnt from: pyavitz
PR: armbian/build#8421
File: config/kernel/linux-sunxi64-edge.config:2664-2671
Timestamp: 2025-07-27T13:03:53.146Z
Learning: In the Armbian build system's kernel configuration, when CONFIG_EXT2_FS=y and CONFIG_EXT3_FS=y are both set to built-in, EXT4 filesystem support becomes automatically available/hard-coded without requiring an explicit CONFIG_EXT4_FS line in the configuration file. This is specific to how Armbian handles kernel configuration and differs from typical standalone Linux kernel configuration behavior.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T06:56:33.372Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T06:56:33.372Z
Learning: In Armbian kernel configuration, the BTRFS configuration logic preserves existing settings (whether built-in 'y' or module 'm') and only sets BTRFS_FS to module when it was previously disabled or not set, achieving "allow but not require" flexibility while maintaining backward compatibility.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-01T06:12:19.251Z
Learnt from: wei633
PR: armbian/build#8557
File: config/bootscripts/boot-xpressreal-t3.cmd:49-53
Timestamp: 2025-09-01T06:12:19.251Z
Learning: For XpressReal T3 (Realtek RTD1619B platform), initramfs support is intentionally not implemented in the boot script due to known problems when booting with initramfs. This needs to be fixed in a future update.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-12T19:28:38.491Z
Learnt from: Grippy98
PR: armbian/build#8622
File: config/sources/families/k3.conf:66-66
Timestamp: 2025-09-12T19:28:38.491Z
Learning: In the Armbian k3 family build system (config/sources/families/k3.conf), builds do not fail when TIBOOT3_BOOTCONFIG is unset, even though tiboot3.bin is still listed in UBOOT_TARGET_MAP. The gating mechanism in pre_config_uboot_target__build_first_stage function works as intended to conditionally build/copy tiboot3.bin only when TIBOOT3_BOOTCONFIG is defined.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-11T12:39:22.861Z
Learnt from: pyavitz
PR: armbian/build#8481
File: config/kernel/linux-spacemit-edge.config:492-494
Timestamp: 2025-08-11T12:39:22.861Z
Learning: The SpacemiT platform requires esos.elf firmware to be embedded in the kernel image for boot. The Armbian build system handles this by copying esos.elf from $SRC/packages/blobs/riscv64/spacemit/ to ${kernel_work_dir}/firmware/ via the custom_kernel_config__spacemit_k1_firmware() function in config/sources/families/spacemit.conf, ensuring CONFIG_EXTRA_FIRMWARE="esos.elf" can successfully embed it during kernel build.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-03-31T22:20:48.475Z
Learnt from: rpardini
PR: armbian/build#8044
File: patch/u-boot/v2025.04/cmd-fileenv-read-string-from-file-into-env.patch:76-86
Timestamp: 2025-03-31T22:20:48.475Z
Learning: For the Armbian build project, maintaining consistency with existing patches across U-Boot versions (such as between 2025.01 and 2025.04) is prioritized over refactoring individual patches for code improvements.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-27T13:03:53.146Z
Learnt from: pyavitz
PR: armbian/build#8421
File: config/kernel/linux-sunxi64-edge.config:2664-2671
Timestamp: 2025-07-27T13:03:53.146Z
Learning: In Linux kernel configuration for the Armbian build system, when CONFIG_EXT2_FS and CONFIG_EXT3_FS are both set to =y (built-in), CONFIG_EXT4_FS is automatically enabled/hard-coded and does not need to be explicitly specified in the configuration file. This dependency relationship means that EXT4 support is implicitly included when EXT2 and EXT3 are built into the kernel.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-24T04:46:22.901Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-10-24T04:46:22.901Z
Learning: In lib/functions/rootfs/rootfs-create.sh, the FIXME comment about mmdebstrap usage with --aptopt is a future note related to PR #8785, which hasn't been merged yet.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-23T10:01:41.310Z
Learnt from: amazingfate
PR: armbian/build#8419
File: lib/functions/host/prepare-host.sh:272-275
Timestamp: 2025-07-23T10:01:41.310Z
Learning: In the Armbian build system, the design philosophy is to fail fast when host dependencies are not met rather than gracefully skipping unsupported architectures. This ensures build environment consistency and prevents silent failures. Host dependency checks should be explicit and non-negotiable.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-14T06:29:18.958Z
Learnt from: amazingfate
PR: armbian/build#8619
File: config/sources/families/rockchip.conf:64-70
Timestamp: 2025-09-14T06:29:18.958Z
Learning: In the Armbian build system, vendor branch configurations in family files are designed to be shared across multiple SoCs within the same family that use the same vendor kernel tree. For example, rk35xx and rockchip-rk3588 families both use identical vendor branch settings (same KERNELSOURCE, KERNELBRANCH, and KERNELPATCHDIR), demonstrating that vendor branches are intentionally generic rather than SoC-specific.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-19T00:03:42.995Z
Learnt from: lanefu
PR: armbian/build#8377
File: config/kernel/linux-uefi-arm64-cloud.config:165-170
Timestamp: 2025-07-19T00:03:42.995Z
Learning: CONFIG_NETKIT was introduced in Linux kernel 4.14.330 (November 2023) and enables BPF-programmable network devices that can operate in Layer 3 or Layer 2 mode. It's a valid configuration option in modern kernels including 6.12.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-11T22:00:13.411Z
Learnt from: rafayahmed317
PR: armbian/build#8484
File: config/kernel/linux-rk35xx-vendor.config:904-906
Timestamp: 2025-08-11T22:00:13.411Z
Learning: In the linux-rk35xx-vendor kernel, the LTE driver options (CONFIG_LTE, CONFIG_LTE_RM310, CONFIG_LTE_EM05) are defined as boolean in drivers/net/lte/Kconfig and cannot be built as modules - they must be either built-in (=y) or disabled.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-19T00:03:42.995Z
Learnt from: lanefu
PR: armbian/build#8377
File: config/kernel/linux-uefi-arm64-cloud.config:165-170
Timestamp: 2025-07-19T00:03:42.995Z
Learning: CONFIG_NETKIT is a valid kernel configuration option in Linux kernel 6.12 and later versions, despite not being present in earlier versions like 6.9/6.10-rc.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
🧬 Code graph analysis (1)
lib/functions/compilation/armbian-kernel.sh (2)
.github/generate_CODEOWNERS.sh (1)
  • display_alert (6-6)
lib/functions/logging/runners.sh (1)
  • run_host_command_logged (204-206)
🔇 Additional comments (4)
config/sources/families/meson-s4t7.conf (1)

123-145: LGTM! Clean refactoring to array-based approach.

The function now correctly uses the opts_y array to accumulate configuration options (DEBUG_KERNEL, EMBEDDED, EXPERT) instead of conditionally modifying the .config. The opts_y entries are added unconditionally, ensuring consistency between the hashing call (first) and the application call (second). The SHA1 recording for khadas_common_drivers dependency tracking is properly retained.

lib/functions/compilation/armbian-kernel.sh (3)

10-28: Excellent documentation of the refactored approach.

The updated comments clearly explain the new array-based mechanism and emphasize the critical consistency requirement: configuration hooks must not depend on .config contents during version calculation. This documentation will help maintainers understand and correctly use the opts_* arrays going forward.


32-437: Comprehensive and consistent refactoring of all configuration functions.

All kernel configuration functions have been successfully converted to use the array-based approach. Each function now populates opts_n/opts_y/opts_m/opts_val arrays consistently, with no conditional logic based on .config presence. This ensures deterministic versioning and proper change detection. The conversion maintains functional equivalence while establishing a clean, maintainable pattern.


476-517: Central application function correctly implements two-phase approach.

The armbian_kernel_config_apply_opts_from_arrays() function properly handles both phases of the new mechanism:

  1. Hashing phase: Always adds all accumulated options to kernel_config_modifying_hashes for version calculation
  2. Application phase: When .config exists, applies options via the kernel_config_set_* helpers

All four option types (opts_n, opts_y, opts_m, opts_val) are handled consistently with correct loop variables and clear debug alerts.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Framework Framework components 11 Milestone: Fourth quarter release labels Oct 26, 2025
@rpardini rpardini marked this pull request as ready for review October 26, 2025 09:30
@rpardini rpardini requested review from a team and igorpecovnik as code owners October 26, 2025 09:30
@rpardini
Copy link
Member Author

This should mostly address the inconsistencies we accumulated over the last year.
rewrites should be consistent now.

@rpardini
Copy link
Member Author

Most impactful change is probably reverting #8276 but also other inconsistency-introducing changes.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
lib/functions/compilation/armbian-kernel.sh (1)

126-152: Remove CONFIG_ prefix from all option names.

All options in this function incorrectly include the CONFIG_ prefix.

Apply this diff:

 	if [[ "${KERNEL_BTF}" == "no" ]]; then # If user is explicit by passing "KERNEL_BTF=no", then actually disable all debug info.
 		display_alert "Disabling eBPF and BTF info for kernel" "as requested by KERNEL_BTF=no" "info"
-		opts_y+=("CONFIG_DEBUG_INFO_NONE")                                                                               # Enable the "none" option
-		opts_n+=("CONFIG_DEBUG_INFO" "CONFIG_DEBUG_INFO_DWARF5" "CONFIG_DEBUG_INFO_BTF" "CONFIG_DEBUG_INFO_BTF_MODULES") # BTF & CO-RE == off
+		opts_y+=("DEBUG_INFO_NONE")                                                                               # Enable the "none" option
+		opts_n+=("DEBUG_INFO" "DEBUG_INFO_DWARF5" "DEBUG_INFO_BTF" "DEBUG_INFO_BTF_MODULES") # BTF & CO-RE == off
 		# We don't disable the eBPF options, as eBPF itself doesn't require BTF (debug info) and doesnt' consume as much memory during build as BTF debug info does.
 	else
 		declare -i available_physical_memory_mib
 		available_physical_memory_mib=$(($(awk '/MemAvailable/ {print $2}' /proc/meminfo) / 1024)) # MiB
 		display_alert "Considering available RAM for BTF build" "${available_physical_memory_mib} MiB" "info"
 
 		if [[ ${available_physical_memory_mib} -lt 6451 ]]; then # If less than 6451 MiB of RAM is available, then exit with an error, telling the user to avoid pain and set KERNEL_BTF=no ...
 			if [[ "${KERNEL_BTF}" == "yes" ]]; then                 # ... except if the user knows better, and has set KERNEL_BTF=yes, then we'll just warn.
 				display_alert "Not enough RAM available (${available_physical_memory_mib}Mib) for BTF build" "but KERNEL_BTF=yes is set; enabling BTF" "warn"
 			else
 				exit_with_error "Not enough RAM available (${available_physical_memory_mib}Mib) for BTF build. Please set 'KERNEL_BTF=no' to avoid running out of memory during the kernel LD/BTF build step; or ignore this check by setting 'KERNEL_BTF=yes' -- that might put a lot of load on your swap disk, if any."
 			fi
 		fi
 
 		display_alert "Enabling eBPF and BTF info" "for fully BTF & CO-RE enabled kernel" "info"
-		opts_n+=("CONFIG_DEBUG_INFO_NONE") # Make sure the "none" option is disabled
+		opts_n+=("DEBUG_INFO_NONE") # Make sure the "none" option is disabled
 		opts_y+=(
-			"CONFIG_BPF_JIT" "CONFIG_BPF_JIT_DEFAULT_ON" "CONFIG_FTRACE_SYSCALLS" "CONFIG_PROBE_EVENTS_BTF_ARGS" "CONFIG_BPF_KPROBE_OVERRIDE" # eBPF == on
-			"CONFIG_DEBUG_INFO" "CONFIG_DEBUG_INFO_DWARF5" "CONFIG_DEBUG_INFO_BTF" "CONFIG_DEBUG_INFO_BTF_MODULES"                            # BTF & CO-RE == off
+			"BPF_JIT" "BPF_JIT_DEFAULT_ON" "FTRACE_SYSCALLS" "PROBE_EVENTS_BTF_ARGS" "BPF_KPROBE_OVERRIDE" # eBPF == on
+			"DEBUG_INFO" "DEBUG_INFO_DWARF5" "DEBUG_INFO_BTF" "DEBUG_INFO_BTF_MODULES"                            # BTF & CO-RE == off
 		)
 	fi
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6cb8cb3 and 0c213cf.

📒 Files selected for processing (4)
  • config/sources/families/include/meson64_common.inc (1 hunks)
  • config/sources/families/meson-s4t7.conf (1 hunks)
  • lib/functions/compilation/armbian-kernel.sh (12 hunks)
  • lib/functions/compilation/kernel-config.sh (2 hunks)
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the modern recommended approach for kernel configuration is to use the kernel-config command via "./compile.sh BOARD=boardname BRANCH=branchname kernel-config" instead of the deprecated KERNEL_CONFIGURE=yes flag. This provides a two-step workflow: configure using menuconfig, then build, with better transparency and control over configuration changes.
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Applied to files:

  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/armbian-kernel.sh
  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-09-22T21:59:36.334Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:200-200
Timestamp: 2025-09-22T21:59:36.334Z
Learning: Functions named with the pattern `armbian_kernel_config__*` in lib/functions/compilation/armbian-kernel.sh are automatically discovered and invoked by Armbian's extension system via metaprogramming using `compgen -A function`, without requiring explicit registration or calls.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
  • lib/functions/compilation/kernel-config.sh
📚 Learning: 2025-08-30T04:13:16.457Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-22T07:56:19.424Z
Learnt from: igorpecovnik
PR: armbian/build#8789
File: config/kernel/linux-sunxi64-edge.config:839-839
Timestamp: 2025-10-22T07:56:19.424Z
Learning: In Linux kernel configuration, some `=y` (builtin) options are infrastructure or feature flags that enable subsystems or features for modular drivers, rather than directly compiling code into the kernel. For example, in Armbian wireless configs, options like CONFIG_SPARD_WLAN_SUPPORT=y, CONFIG_SC23XX=y, CONFIG_WCN_BSP_DRIVER_BUILDIN=y, CONFIG_UNISOC_WIFI_PS=y are module infrastructure/feature enablers, while the actual drivers (CONFIG_WLAN_UWE5621=m, CONFIG_WLAN_UWE5622=m) remain as loadable modules. These infrastructure options don't cause kernel bloat.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-10-23T19:48:42.948Z
Learnt from: igorpecovnik
PR: armbian/build#8812
File: config/kernel/linux-sm8250-edge.config:498-501
Timestamp: 2025-10-23T19:48:42.948Z
Learning: For Armbian EDGE kernel configs, CONFIG_ATH12K=m alone is sufficient for PCI-based Wi-Fi 7 devices (e.g., WCN785x/QCN9274). A separate CONFIG_ATH12K_PCI option is not required, as confirmed by maintainer testing.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-09T07:30:22.419Z
Learnt from: amazingfate
PR: armbian/build#8595
File: lib/functions/compilation/patch/drivers_network.sh:0-0
Timestamp: 2025-09-09T07:30:22.419Z
Learning: RTW_WARN_LMT sed workaround in driver_rtl8852bs() function in lib/functions/compilation/patch/drivers_network.sh is necessary for kernel 6.1 compatibility, even when the upstream wifi-rtl8852bs driver has the macro defined for newer kernels. The workaround ensures cross-kernel compatibility from 6.1 to 6.16+.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-19T00:03:42.995Z
Learnt from: lanefu
PR: armbian/build#8377
File: config/kernel/linux-uefi-arm64-cloud.config:165-170
Timestamp: 2025-07-19T00:03:42.995Z
Learning: CONFIG_NETKIT is a valid kernel configuration option in Linux kernel 6.12 and later versions, despite not being present in earlier versions like 6.9/6.10-rc.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-07-19T00:03:42.995Z
Learnt from: lanefu
PR: armbian/build#8377
File: config/kernel/linux-uefi-arm64-cloud.config:165-170
Timestamp: 2025-07-19T00:03:42.995Z
Learning: CONFIG_NETKIT was introduced in Linux kernel 4.14.330 (November 2023) and enables BPF-programmable network devices that can operate in Layer 3 or Layer 2 mode. It's a valid configuration option in modern kernels including 6.12.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-14T06:19:06.828Z
Learnt from: amazingfate
PR: armbian/build#8619
File: config/kernel/linux-rockchip-vendor.config:0-0
Timestamp: 2025-09-14T06:19:06.828Z
Learning: CONFIG_ZSWAP has an implicit kernel-level dependency on CONFIG_SWAP, so when CONFIG_ZSWAP=y is set in Armbian overlay configs, CONFIG_SWAP gets automatically enabled during kernel build configuration processing, even if not explicitly specified in the overlay file.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T06:56:33.372Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T06:56:33.372Z
Learning: In Armbian kernel configuration, the BTRFS configuration logic preserves existing settings (whether built-in 'y' or module 'm') and only sets BTRFS_FS to module when it was previously disabled or not set, achieving "allow but not require" flexibility while maintaining backward compatibility.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
🧬 Code graph analysis (3)
lib/functions/compilation/armbian-kernel.sh (2)
.github/generate_CODEOWNERS.sh (1)
  • display_alert (6-6)
lib/functions/logging/runners.sh (1)
  • run_host_command_logged (204-206)
config/sources/families/include/meson64_common.inc (1)
lib/functions/compilation/patch/drivers_network.sh (1)
  • driver_rtl88x2cs (435-479)
lib/functions/compilation/kernel-config.sh (1)
lib/functions/compilation/armbian-kernel.sh (1)
  • armbian_kernel_config_apply_opts_from_arrays (532-571)
🔇 Additional comments (10)
lib/functions/compilation/kernel-config.sh (2)

89-94: LGTM! Clean initialization of the opt-arrays mechanism.

The initialization of the option arrays and dictionary is correctly structured. The shellcheck disables are appropriate since these variables are populated by extension hooks.


119-120: LGTM! Correct placement of the centralized apply function.

The call to armbian_kernel_config_apply_opts_from_arrays is correctly placed after both the core and custom kernel config hooks, ensuring all accumulated options are applied consistently.

config/sources/families/include/meson64_common.inc (1)

51-53: LGTM! Excellent simplification that removes inconsistent conditionals.

The function now correctly accumulates the option without checking .config contents, ensuring consistency between version hashing and actual configuration. This aligns perfectly with the PR objectives.

lib/functions/compilation/armbian-kernel.sh (6)

11-26: LGTM! Excellent documentation of the new opt-arrays mechanism.

The comment clearly explains the dual-call nature of kernel config hooks and the consistency requirement. This will help prevent future bugs where developers might be tempted to check .config contents.


59-63: LGTM! Correct option naming without CONFIG_ prefix.


169-182: LGTM! Correct option naming throughout.

All options correctly omit the CONFIG_ prefix.


190-387: LGTM! Extensive nftables configuration correctly formatted.

All options throughout this large function correctly omit the CONFIG_ prefix.


400-472: LGTM! Docker support options correctly formatted.

All options correctly omit the CONFIG_ prefix.


484-491: Remove CONFIG_ prefix from option names.

Apply this diff:

 function armbian_kernel_config__enable_config_access_in_live_system() {
-	opts_y+=("CONFIG_IKCONFIG")      # This information can be extracted from the kernel image file with the script scripts/extract-ikconfig and used as input to rebuild the current kernel or to build another kernel
-	opts_y+=("CONFIG_IKCONFIG_PROC") # This option enables access to the kernel configuration file through /proc/config.gz
+	opts_y+=("IKCONFIG")      # This information can be extracted from the kernel image file with the script scripts/extract-ikconfig and used as input to rebuild the current kernel or to build another kernel
+	opts_y+=("IKCONFIG_PROC") # This option enables access to the kernel configuration file through /proc/config.gz
 }
 
 function armbian_kernel_config__restore_enable_gpio_sysfs() {
-	opts_y+=("CONFIG_GPIO_SYSFS") # This was a victim of not having EXPERT=y due to some _DEBUG conflicts in old times. Re-enable it forcefully.
+	opts_y+=("GPIO_SYSFS") # This was a victim of not having EXPERT=y due to some _DEBUG conflicts in old times. Re-enable it forcefully.
 }
⛔ Skipped due to learnings
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
config/sources/families/meson-s4t7.conf (1)

123-144: Dismiss the CONFIG_ prefix concern — scripts/config handles both formats correctly.

The original review comment's critical issue is based on a misunderstanding. The Linux kernel's scripts/config tool automatically accepts option names with or without the CONFIG_ prefix, strips the prefix if present, and normalizes the entry when writing to .config. The inconsistency across opts_y, opts_n, and opts_m arrays in the codebase does not cause failures; it is handled transparently by the tool.

The code in config/sources/families/meson-s4t7.conf (lines 123-144) is correct as-is. The kernel_config_modifying_hashes entry for tracking git source changes is appropriately scoped within the if [[ ! -f .config ]] condition.

Likely an incorrect or invalid review comment.

@rpardini rpardini force-pushed the pr/armbian-kernel-remove-inconsistent-conditionals branch from 0c213cf to 4b486f5 Compare October 26, 2025 12:36
@rpardini
Copy link
Member Author

@coderabbitai re-review as I've fixed and force-pushed

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 26, 2025

@rpardini: I'll re-review the changes now.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 0c213cf and 4b486f5.

📒 Files selected for processing (4)
  • config/sources/families/include/meson64_common.inc (1 hunks)
  • config/sources/families/meson-s4t7.conf (1 hunks)
  • lib/functions/compilation/armbian-kernel.sh (8 hunks)
  • lib/functions/compilation/kernel-config.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/kernel-config.sh
  • config/sources/families/meson-s4t7.conf
🧰 Additional context used
🧠 Learnings (10)
📓 Common learnings
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:59:36.334Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:200-200
Timestamp: 2025-09-22T21:59:36.334Z
Learning: Functions named with the pattern `armbian_kernel_config__*` in lib/functions/compilation/armbian-kernel.sh are automatically discovered and invoked by Armbian's extension system via metaprogramming using `compgen -A function`, without requiring explicit registration or calls.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T04:13:16.457Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
🔇 Additional comments (2)
lib/functions/compilation/armbian-kernel.sh (2)

12-27: Clear documentation of the new mechanism. This comment block effectively explains the opt-array approach and its importance for consistency. Helpful context for future maintainers.


32-41: Previous CONFIG_ prefix issues resolved. All option names across config functions are now correctly unprefixed. Past critical feedback has been incorporated.

Also applies to: 56-70, 72-77, 100-126, 136-149, 151-349, 355-427

@rpardini rpardini force-pushed the pr/armbian-kernel-remove-inconsistent-conditionals branch from 4b486f5 to 5aa5ea6 Compare October 26, 2025 12:45
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4b486f5 and 5aa5ea6.

📒 Files selected for processing (4)
  • config/sources/families/include/meson64_common.inc (1 hunks)
  • config/sources/families/meson-s4t7.conf (1 hunks)
  • lib/functions/compilation/armbian-kernel.sh (8 hunks)
  • lib/functions/compilation/kernel-config.sh (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/sources/families/meson-s4t7.conf
  • lib/functions/compilation/kernel-config.sh
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: In lib/functions/compilation/armbian-kernel.sh, the kernel_config_modifying_hashes array is not universally required for all kernel configuration functions - some functions like armbian_kernel_config__netkit() operate without it, and adding entries with '=m' would be incorrect when the actual result might be '=y' for options already built-in.

Applied to files:

  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-201
Timestamp: 2025-09-22T21:52:01.225Z
Learning: The kernel_config_set_m function in lib/functions/compilation/armbian-kernel.sh preserves existing 'y' (built-in) settings and only sets options to 'm' (module) when they are not already built-in, achieving "prefer modules but allow built-ins" behavior.

Applied to files:

  • config/sources/families/include/meson64_common.inc
  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-edge.config:80-82
Timestamp: 2025-09-27T21:50:04.845Z
Learning: In the Armbian build system, kernel configuration files are generated through this automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sunxi64-current.config:94-94
Timestamp: 2025-09-27T21:50:15.915Z
Learning: When kernel config files are generated through Armbian's automated process (previous config → armbian-kernel.sh changes → make oldconfig → Armbian machinery processing), manual config file edits are not appropriate since they would be overwritten. Deprecated option handling should be implemented in the automated tooling instead.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-sm8250-current.config:78-80
Timestamp: 2025-09-27T21:49:55.796Z
Learning: In the Armbian build system, kernel configuration files are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
PR: armbian/build#8678
File: config/kernel/linux-bcm2711-edge.config:859-861
Timestamp: 2025-09-27T21:47:58.020Z
Learning: In the Armbian build system, kernel configuration files in config/kernel/ are generated through an automated process: taking previous config → applying scripted changes from armbian-kernel.sh → running kernel's `make oldconfig` → processing by Armbian machinery back into config files. This automated process properly handles kernel configuration dependencies and reduces the likelihood of manual configuration errors.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-22T21:59:36.334Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:200-200
Timestamp: 2025-09-22T21:59:36.334Z
Learning: Functions named with the pattern `armbian_kernel_config__*` in lib/functions/compilation/armbian-kernel.sh are automatically discovered and invoked by Armbian's extension system via metaprogramming using `compgen -A function`, without requiring explicit registration or calls.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-30T04:13:16.457Z
Learnt from: tabrisnet
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-30T04:13:16.457Z
Learning: Armbian kernel configuration files like linux-filogic-current.config are autogenerated overlays on top of arch defconfig. Comments added manually will be lost during future updates by maintainers, and explicit "CONFIG_OPTION is not set" statements aren't needed for mutually exclusive options since these are overlay configs that only specify changes from the base configuration.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-09-25T18:37:00.330Z
Learnt from: tabrisnet
PR: armbian/build#8661
File: lib/functions/compilation/armbian-kernel.sh:194-199
Timestamp: 2025-09-25T18:37:00.330Z
Learning: In PR armbian/build#8661, line 235 of lib/functions/compilation/armbian-kernel.sh already contains the corrected comment "BPF link support for netfilter hooks" for NETFILTER_BPF_LINK, not the misleading "BPF_SYSCALL" comment that was flagged during review.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
📚 Learning: 2025-08-02T05:46:10.664Z
Learnt from: EvilOlaf
PR: armbian/build#0
File: :0-0
Timestamp: 2025-08-02T05:46:10.664Z
Learning: In the Armbian build system, the KERNEL_CONFIGURE=yes switch is deprecated. The recommended approach for kernel configuration is now to use the `kernel-config` build command, which provides a more structured way to configure kernel options.

Applied to files:

  • lib/functions/compilation/armbian-kernel.sh
🧬 Code graph analysis (2)
config/sources/families/include/meson64_common.inc (1)
lib/functions/compilation/patch/drivers_network.sh (2)
  • driver_rtl88x2cs (435-479)
  • driver_rtl8822cs_bt (780-792)
lib/functions/compilation/armbian-kernel.sh (2)
.github/generate_CODEOWNERS.sh (1)
  • display_alert (6-6)
lib/functions/logging/runners.sh (1)
  • run_host_command_logged (204-206)
🔇 Additional comments (1)
lib/functions/compilation/armbian-kernel.sh (1)

12-517: LGTM! Comprehensive refactoring successfully implemented.

The refactoring to use opt-arrays (opts_n, opts_y, opts_m, opts_val) for kernel configuration is well-executed:

  • Documentation clearly explains the consistency requirements and deferred-application approach
  • All CONFIG_ prefix issues from previous reviews have been resolved
  • The armbian_kernel_config_apply_opts_from_arrays function correctly handles all array types including the newly added opts_m support
  • Loop variables are consistently declared and used throughout
  • The approach eliminates the inconsistency of reading .config to determine what should be in .config

@rpardini rpardini force-pushed the pr/armbian-kernel-remove-inconsistent-conditionals branch 2 times, most recently from 25b17a2 to 7a8802a Compare October 28, 2025 07:57
@coderabbitai coderabbitai bot requested a review from chraac October 28, 2025 07:58
@tabrisnet
Copy link
Contributor

Most impactful change is probably reverting #8276 but also other inconsistency-introducing changes.

I missed this initially... this feels like a problem. How do we, e.g in re the docker function, make sure something is enabled but not strictly care whether module or built-in.

@rpardini
Copy link
Member Author

I missed this initially... this feels like a problem. How do we, e.g in re the docker function, make sure something is enabled but not strictly care whether module or built-in.

We don't. Changes are supposed to be deterministic. If something can be either module or builtin, they should either be omitted (left to the .config itself, as done for EXT4 and BTRFS in the recent commits here), or some other consistent conditional implemented.

@tabrisnet
Copy link
Contributor

I missed this initially... this feels like a problem. How do we, e.g in re the docker function, make sure something is enabled but not strictly care whether module or built-in.

We don't. Changes are supposed to be deterministic. If something can be either module or builtin, they should either be omitted (left to the .config itself, as done for EXT4 and BTRFS in the recent commits here), or some other consistent conditional implemented.

how are you defining "deterministic" here? having it be if-already-built-in, do nothing, that still sounds deterministic to me. Determinism is still dependent on the inputs. If we choose to not have full information available when we need it, that sounds less like we want determinism and more prescience.

You did mention that this runs twice, once without .config and once with.
Can we just grep/append the config/kernel/foo.config [albeit we should probably check the defconfig too] if we're working without a .config ?

I think the issue here is that "once for obtaining the version via hashing" [from the top of lib/functions/compilation/armbian-kernel.sh] means doing so before cloning the kernel tree, which is definitely a challenge, cuz defconfig isn't available then either. but given that config/kernel/foo.config is an overlay, all we're doing is moving the edge-case, not eliminating it. No amount of opts_y or opts_m makes the config/kernel/foo.config fully authoritative for what's in the resultant .config.

@rpardini
Copy link
Member Author

Determinism is still dependent on the inputs.

Indeed. I'm removing the .config itself from the inputs, so the only inputs (afaik) are ${KERNEL_MAJOR_MINOR}, ${ARCH}, and ${KERNEL_BTF}.

@tabrisnet
Copy link
Contributor

alternative: only include .config in the inputs for rewrite-kernel-config which doesn't involve the versioning, but can still dtrt [m not override y, still set the desired policy defaults].

@rpardini
Copy link
Member Author

inputs for rewrite-kernel-config which

This is not only for rewrite-kernel-config - it is actually used for every kernel-related cli command, incl kernel (build) and kernel-config. What is special about rewrite-... is that it does (after all hooks are done) make savedefconfig, thus eliminating all the defaults and environment-specific info that are un-needed and unwanted for versioning.

What I think could be a compromise is to (during the second run / when .config is actually present) do checks like is EXT4 either enabled or built-in? and then emit warnings or even errors; that way we can enforce certain sanity checks without compromising on consistency.

(Although I wonder how long before we find a niche kernel that wants out of EXT4 completely.)

- one shall NOT use the contents of .config to determine what's in the .config
- also: introduce `opts_m` for armbian_kernel_config_apply_opts_from_arrays()
…g_apply_opts_from_arrays`

- so hashes and changes are consistent
- call_extensions_kernel_config() now declares the vars and calls
  armbian_kernel_config_apply_opts_from_arrays() at the end
- so each individual hook doesn't need to
- adapt family code using the old way too
- also fix for opt_m logging mismatch caught by the AI
… .config decide)

- some families want builtin, some want modules, let each decide
@rpardini rpardini force-pushed the pr/armbian-kernel-remove-inconsistent-conditionals branch from 7a8802a to d517f9d Compare October 30, 2025 17:10
@tabrisnet
Copy link
Contributor

inputs for rewrite-kernel-config which

This is not only for rewrite-kernel-config - it is actually used for every kernel-related cli command, incl kernel (build) and kernel-config. What is special about rewrite-... is that it does (after all hooks are done) make savedefconfig, thus eliminating all the defaults and environment-specific info that are un-needed and unwanted for versioning.

What I think could be a compromise is to (during the second run / when .config is actually present) do checks like is EXT4 either enabled or built-in? and then emit warnings or even errors; that way we can enforce certain sanity checks without compromising on consistency.

(Although I wonder how long before we find a niche kernel that wants out of EXT4 completely.)

I realize it is used for everything. but using that logic [m not override y, still set the desired policy defaults] for rewrite- should allow the expected sanity.

as to the opt-out, yes a similar discussion was made around #8839 [albeit not about ext4 but rather allowing opt-out of armbian-kernel.sh hooks for special-needs boards]. That is, sane defaults are a need, but also this must not block special-cases.
I'm not precisely happy about the idea of warnings [they'll get lost/ignored because, statistically, nobody reads the logs], and errors aren't very friendly without again a way to opt-out [but not so that the opt-out is cargo-culted in the forum/community].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

11 Milestone: Fourth quarter release Framework Framework components Hardware Hardware related like kernel, U-Boot, ... Needs review Seeking for review size/large PR with 250 lines or more

Development

Successfully merging this pull request may close these issues.

4 participants