Skip to content

Conversation

@pyavitz
Copy link
Collaborator

@pyavitz pyavitz commented Nov 25, 2025

Ubuntu Resolute

  • Requires that there be a "scripts/mod/modpost" binary during header compilation

Fail: https://paste.armbian.com/bacifoqope.bash

Success: https://paste.armbian.com/picelafexa.bash

NOTE: For reasons I am unable to generate a Ubuntu Resolute Armbian Image. Tests were run in a chroot after debootstraping Ubuntu Resolute.

Summary by CodeRabbit

  • Chores
    • Improved kernel headers packaging process to ensure proper build compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

… during header compilation

Signed-off-by: Patrick Yavitz <[email protected]>
@pyavitz pyavitz requested a review from a team as a code owner November 25, 2025 15:08
@github-actions github-actions bot added 11 Milestone: Fourth quarter release size/small PR with less then 50 lines labels Nov 25, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

A conditional copy operation is added to the linux-headers packaging process in lib/functions/compilation/kernel-debs.sh. If the kernel build directory contains scripts/mod/modpost, the binary is copied to headers/scripts/mod/modpost to satisfy Ubuntu Resolute requirements during header compilation.

Changes

Cohort / File(s) Summary
Linux Headers Packaging
lib/functions/compilation/kernel-debs.sh
Added conditional step to copy scripts/mod/modpost binary into headers packaging directory

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Single, localized file modification with straightforward conditional copy logic
  • No architectural changes or complex interdependencies

Poem

🐰 A modpost binary hops with care,
Into headers, a journey rare,
Ubuntu Resolute's quest complete,
Build scripts and headers, now they meet!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding the scripts/mod/modpost binary to linux-headers packaging as required by Ubuntu Resolute.
✨ 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: Path: .coderabbit.yaml

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 e4db83a and dbc00af.

📒 Files selected for processing (1)
  • lib/functions/compilation/kernel-debs.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: amazingfate
Repo: armbian/build PR: 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.
Learnt from: EvilOlaf
Repo: armbian/build PR: 8968
File: patch/u-boot/u-boot-sunxi/arm64-dts-sun50i-h6-orangepi.dtsi-Rollback-r_rsb-to-r_i2c.patch:36-36
Timestamp: 2025-11-20T18:20:11.985Z
Learning: The rewrite-patches tool (REWRITE_PATCHES=yes) in the Armbian build system can inadvertently introduce semantic changes when the u-boot/kernel git base revision differs from expected state. The tool applies patches, commits them, and re-exports them using git format-patch, which can cause the re-exported patch to reflect the base revision's state rather than preserving the original patch intent. This is particularly problematic for device tree changes like interrupt specifications. The tool currently lacks validation mechanisms to detect such semantic drift, and affected patches must be manually corrected after rewriting.
Learnt from: EvilOlaf
Repo: armbian/build PR: 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
Repo: armbian/build PR: 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: djurny
Repo: armbian/build PR: 8315
File: lib/functions/rootfs/distro-agnostic.sh:54-68
Timestamp: 2025-06-22T00:45:26.182Z
Learning: In Armbian build system, external command dependencies like envsubst are handled by adding the required packages (e.g., gettext for envsubst) to host_dependencies in adaptative_prepare_host_dependencies function in lib/functions/host/prepare-host.sh, rather than checking command availability at runtime.
Learnt from: glneo
Repo: armbian/build PR: 8913
File: config/sources/families/include/k3_common.inc:57-60
Timestamp: 2025-11-11T20:56:20.303Z
Learning: In config/sources/families/include/k3_common.inc, the OP-TEE build command at line 59 should be updated in a future PR to explicitly set CROSS_COMPILE64=aarch64-linux-gnu- and CROSS_COMPILE32=arm-linux-gnueabihf- instead of relying on OP-TEE's internal defaults, for better clarity and maintainability. User glneo agreed to address this in a separate PR.
Learnt from: pyavitz
Repo: armbian/build PR: 8388
File: config/boards/kickpik2b.conf:1-14
Timestamp: 2025-07-17T04:12:33.125Z
Learning: In the Armbian build system, board configuration files (*.conf) follow a project standard of not including shebang lines, even though they contain bash code and are sourced by the build system. This is an established Armbian convention that individual contributors are expected to follow, and changes to this standard would require broader project maintainer approval.
Learnt from: tabrisnet
Repo: armbian/build PR: 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
Repo: armbian/build PR: 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: Grippy98
Repo: armbian/build PR: 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.
Learnt from: pyavitz
Repo: armbian/build PR: 8455
File: config/sources/families/sun50iw1.conf:19-24
Timestamp: 2025-08-03T15:21:20.148Z
Learning: In the Armbian build system, when copying firmware files during family_tweaks_s(), use /lib/firmware/updates/ instead of /lib/firmware/ to avoid conflicts with the Armbian firmware package. The /lib/firmware/updates directory takes precedence in Linux firmware loading hierarchy and is the proper location for user-installed firmware files.
📚 Learning: 2025-09-27T21:50:04.845Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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/kernel-debs.sh
📚 Learning: 2025-09-27T21:47:58.020Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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/kernel-debs.sh
📚 Learning: 2025-09-27T21:49:55.796Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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/kernel-debs.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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/kernel-debs.sh
📚 Learning: 2025-09-22T21:52:01.225Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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/kernel-debs.sh
🧬 Code graph analysis (1)
lib/functions/compilation/kernel-debs.sh (1)
lib/functions/logging/runners.sh (1)
  • run_host_command_logged (204-206)
🔇 Additional comments (1)
lib/functions/compilation/kernel-debs.sh (1)

476-478: Solid follow-up pattern for Ubuntu Resolute modpost requirement.

The change correctly applies the established pattern from the scripts/module.lds copy (lines 471–474), maintaining consistency with the codebase. The conditional check ensures the binary only copies if present, and run_host_command_logged provides proper logging and error handling.

Optional: Consider defensive directory creation. If scripts/mod/ doesn't reliably exist in headers_target_dir after the tar operation (line 429), you could add mkdir -p to ensure the destination directory exists:

  # Ubuntu Resolute requires that there be a "scripts/mod/modpost" binary during header compilation
+ [[ -f "${kernel_work_dir}/scripts/mod/modpost" ]] && {
+   mkdir -p "${headers_target_dir}/scripts/mod" &&
-  [[ -f "${kernel_work_dir}/scripts/mod/modpost" ]] &&
    run_host_command_logged cp -v "${kernel_work_dir}/scripts/mod/modpost" "${headers_target_dir}/scripts/mod/modpost"
+ }

However, since the provided test logs confirm this works and the existing module.lds copy uses the same pattern without this safeguard, the current approach is acceptable.

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • ARM-001: Request failed with status code 404

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 Needs review Seeking for review Framework Framework components labels Nov 25, 2025
@pyavitz
Copy link
Collaborator Author

pyavitz commented Nov 25, 2025

@rpardini

@igorpecovnik
Copy link
Member

After reverting previously mentioned problem, i get further, but then it fails:

[🔨]   Setting up linux-headers-vendor-rk35xx (25.11.0-trunk) ...
[🔨]   Armbian 'linux-headers-vendor-rk35xx' for '6.1.115-vendor-rk35xx': 'postinst' starting.
[🔨]   Configuring kernel-headers (6.1.115-vendor-rk35xx) - please wait ...
[🔨]     HOSTCC  scripts/basic/fixdep
[🔨]     HOSTCC  scripts/kconfig/conf.o
[🔨]     HOSTCC  scripts/kconfig/confdata.o
[🔨]     HOSTCC  scripts/kconfig/expr.o
[🔨]     LEX     scripts/kconfig/lexer.lex.c
[🔨]     YACC    scripts/kconfig/parser.tab.[ch]
[🔨]     HOSTCC  scripts/kconfig/lexer.lex.o
[🔨]     HOSTCC  scripts/kconfig/menu.o
[🔨]     HOSTCC  scripts/kconfig/parser.tab.o
[🔨]     HOSTCC  scripts/kconfig/preprocess.o
[🔨]     HOSTCC  scripts/kconfig/symbol.o
[🔨]     HOSTCC  scripts/kconfig/util.o
[🔨]     HOSTLD  scripts/kconfig/conf
[🔨]   #
[🔨]   # configuration written to .config
[🔨]   #
[🔨]   Compiling kernel-headers scripts (6.1.115-vendor-rk35xx) using 64 CPUs - please wait ...
[🔨]     SYNC    include/config/auto.conf
[🔨]     HOSTCC  scripts/dtc/dtc.o
[🔨]     HOSTCC  scripts/dtc/flattree.o
[🔨]     HOSTCC  scripts/dtc/fstree.o
[🔨]     HOSTCC  scripts/dtc/data.o
[🔨]     HOSTCC  scripts/dtc/livetree.o
[🔨]     HOSTCC  scripts/dtc/treesource.o
[🔨]     HOSTCC  scripts/dtc/srcpos.o
[🔨]     HOSTCC  scripts/dtc/checks.o
[🔨]     HOSTCC  scripts/dtc/util.o
[🔨]     LEX     scripts/dtc/dtc-lexer.lex.c
[🔨]     YACC    scripts/dtc/dtc-parser.tab.[ch]
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_ro.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_wip.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_sw.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_rw.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_strerror.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_empty_tree.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_addresses.o
[🔨]     HOSTCC  scripts/dtc/libfdt/fdt_overlay.o
[🔨]     HOSTCC  scripts/dtc/fdtoverlay.o
[🔨]     HOSTCC  scripts/dtc/dtc-lexer.lex.o
[🔨]     HOSTCC  scripts/dtc/dtc-parser.tab.o
[🔨]     HOSTLD  scripts/dtc/fdtoverlay
[🔨]     HOSTLD  scripts/dtc/dtc
[🔨]     HOSTCC  scripts/kallsyms
[🔨]     HOSTCC  scripts/resource_tool
[🔨]     HOSTCC  scripts/sorttable
[🔨]     HOSTCC  scripts/asn1_compiler
[🔨]     HOSTCC  scripts/genksyms/genksyms.o
[🔨]     YACC    scripts/genksyms/parse.tab.[ch]
[🔨]     LEX     scripts/genksyms/lex.lex.c
[🔨]     HOSTCC  scripts/selinux/genheaders/genheaders
[🔨]     HOSTCC  scripts/selinux/mdp/mdp
[🔨]     HOSTCC  scripts/genksyms/parse.tab.o
[🔨]     HOSTCC  scripts/genksyms/lex.lex.o
[🔨]     HOSTLD  scripts/genksyms/genksyms
[🔨]   Compiling kernel-headers scripts/mod (6.1.115-vendor-rk35xx) using 64 CPUs - please wait ...
[🔨]     MODPOST scripts/Module.symvers
[🔨]   /bin/sh: 1: scripts/mod/modpost: not found
[🔨]   make[1]: *** [scripts/Makefile.modpost:127: scripts/Module.symvers] Error 127
[🔨]   make: *** [Makefile:1961: modpost] Error 2
[🔨]   dpkg: error processing package linux-headers-vendor-rk35xx (--configure):
[🔨]    installed linux-headers-vendor-rk35xx package post-installation script subprocess returned error exit status 2
[🔨]   Processing triggers for man-db (2.13.1-1) ...
[🔨]   Processing triggers for libc-bin (2.42-2ubuntu2) ...
[🔨]   Errors were encountered while processing:
[🔨]    linux-headers-vendor-rk35xx
[🔨]   E: Sub-process /usr/bin/dpkg returned an error code (1)


# Ubuntu Resolute requires that there be a "scripts/mod/modpost" binary during header compilation
[[ -f "${kernel_work_dir}/scripts/mod/modpost" ]] &&
run_host_command_logged cp -v "${kernel_work_dir}/scripts/mod/modpost" "${headers_target_dir}/scripts/mod/modpost"
Copy link
Member

Choose a reason for hiding this comment

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

The problem here is under cross-compilation: if kernel is for arm64 but is built say on amd64, the headers package will end up with a wrong architecture binary.

Instead, we would need to ship enough sources so that the modpost binary can be built board-side during linux-headers install, like the others.

I've very similar issue with resolve_btfids, but that one is easy since we already ship enough sources to build it there.

Or: just wait until all Armbian kernels are 6.12+, and get rid of this whole packaging code (instead just do make bindeb).

Copy link
Collaborator Author

@pyavitz pyavitz Nov 26, 2025

Choose a reason for hiding this comment

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

The problem here is under cross-compilation: if kernel is for arm64 but is built say on amd64, the headers package will end up with a wrong architecture binary.

Hmm. Ur right. So this isn't gonna work as is. I'm not sure how using make bindeb would change anything, as I already use make bindeb-pkg on my personal builds.

I am curious, which is something Igor touched on... "why Resolute"? Doesn't appear to be an issue on other releases.

Copy link
Member

Choose a reason for hiding this comment

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

I meant "one day we can make Armbian use the kernel's own .deb packaging", as 6.12 landed support for cross-compiled headers -- the whole reason Armbian re-invented deb packaging square. (Originally, each Armbian kernel had patches for the packaging, and bumping kernels was hell).

I'll take a look to see if I can make the linux-headers install produce modpost and resolve_btfids binaries on install without having to ship the whole of linux source in linux-headers.

Ref resolute: no idea. I've not touched Ubuntu since noble.

Copy link
Collaborator Author

@pyavitz pyavitz Nov 26, 2025

Choose a reason for hiding this comment

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

I see what you mean. I just ran a test doing it the new way which requires debhelper and libssl-dev:$arch to be installed and the headers came out clean.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They have also removed the *-static suffix from qemu; `https://git.launchpad.net/ubuntu/+source/qemu/tree/debian/qemu-user-static.NEWS?h=ubuntu/plucky

Current package lineup; binfmt-support qemu-user qemu-user-binfmt

Of course this only relates to using Questing and Resolute as a host.

@pyavitz pyavitz closed this Nov 30, 2025
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 Needs review Seeking for review size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

3 participants