Skip to content

kernel-dtb: fatal if BOOT_FDT_FILE is unset (fixes #8083)#9700

Open
iav wants to merge 1 commit intoarmbian:mainfrom
iav:fix/8083-kernel-dtb-missing-boot-fdt-file
Open

kernel-dtb: fatal if BOOT_FDT_FILE is unset (fixes #8083)#9700
iav wants to merge 1 commit intoarmbian:mainfrom
iav:fix/8083-kernel-dtb-missing-boot-fdt-file

Conversation

@iav
Copy link
Copy Markdown
Contributor

@iav iav commented Apr 19, 2026

Summary

  • Fixes [Bug]: kernel-dtb does not output when unset BOOT_FDT_FILE is present #8083: kernel-dtb silently produced an empty package when BOOT_FDT_FILE was unset (typical case: board config relies on a post_family_config_branch_* hook that unsets it for some kernel branches — e.g. orangepi5-max on edge).
  • kernel_dtb_only_build() now fails fast with a diagnostic pointing at both likely sources (board config, post-family hook).
  • Regular kernel artifact is unaffected — it does not go through kernel_dtb_only_build().

Test plan

  • ./compile.sh kernel-dtb BOARD=orangepi5-max BRANCH=edge — fatal, rc=43, message references post_family_config_* hook (this board unsets BOOT_FDT_FILE in an edge-specific hook).
  • ./compile.sh kernel-dtb BOARD=orangepi5-max BRANCH=current — non-fatal path, .deb produced with preprocessed DTS (stays set on current).
  • bash -n lib/functions/compilation/kernel.sh — OK.
  • shellcheck --severity=error lib/functions/compilation/kernel.sh — OK.

Summary by CodeRabbit

  • Bug Fixes
    • Elevated the message for missing kernel device-tree configuration to an error with clearer guidance, making the issue more visible during builds.
    • Prevents silent skipping of device-tree processing when configuration is unset, ensuring misconfigurations are surfaced early and easier to resolve.

@iav iav requested a review from a team as a code owner April 19, 2026 19:41
@iav iav requested review from ColorfulRhino and ShravanSingh64 and removed request for a team April 19, 2026 19:41
@github-actions github-actions bot added the size/small PR with less then 50 lines label Apr 19, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c0892c7d-5537-4af2-8d56-47d1e8021551

📥 Commits

Reviewing files that changed from the base of the PR and between be4dab5 and be4858d.

📒 Files selected for processing (1)
  • lib/functions/compilation/kernel.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • lib/functions/compilation/kernel.sh

📝 Walkthrough

Walkthrough

kernel_dtb_only_build now emits an error-level diagnostic (expanded explanatory text including package and preprocessing note) when BOOT_FDT_FILE is unset, but still returns success (return 0); .dts convenience processing remains gated on BOOT_FDT_FILE being set.

Changes

Cohort / File(s) Summary
Kernel DTB build logic
lib/functions/compilation/kernel.sh
Changed handling for unset BOOT_FDT_FILE: replaced a prior warning message with an error-level/expanded diagnostic about producing linux-dtb while skipping preprocessed DTS copy, but retained return 0. .dts convenience processing still only runs when BOOT_FDT_FILE is set.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I nudged the build at break of day,

Found BOOT_FDT_FILE had gone astray.
I shouted loud (but left the flow),
A gentle error — on we go.
Hops and patches, all okay!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: converting a warning into a fatal error when BOOT_FDT_FILE is unset, and references the specific issue being fixed.
Linked Issues check ✅ Passed The PR successfully addresses all objectives from #8083: detects BOOT_FDT_FILE unset condition, emits diagnostic alert, preserves .deb creation, and enables users to identify and fix board config/hook issues.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing #8083; only kernel_dtb_only_build control-flow is modified with no alterations to exported entities or other functions.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 05 Milestone: Second quarter release Needs review Seeking for review Framework Framework components labels Apr 19, 2026
Copy link
Copy Markdown
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.

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/kernel.sh (1)

175-190: ⚠️ Potential issue | 🟡 Minor

Move the BOOT_FDT_FILE guard before the DTB build.

Line 180 still runs kernel_build before the new fatal validation, so an unset BOOT_FDT_FILE can spend time building/installing DTBs—or fail earlier for an unrelated build reason—before showing the intended diagnostic. Moving the guard to the top makes this path truly fail-fast.

Suggested change
 function kernel_dtb_only_build() {
 	display_alert "Kernel DTB-only for development" "KERNEL_DTB_ONLY: ${KERNEL_DTB_ONLY}" "info"
+
+	# kernel-dtb needs BOOT_FDT_FILE to know which .dtb to preprocess into a .dts.
+	# If it is unset (board config, or a post_family_config_* hook that unset it),
+	# we cannot continue — bail out loudly instead of silently producing an empty package.
+	if [[ -z "${BOOT_FDT_FILE}" ]]; then
+		exit_with_error "Board '${BOARD}' branch '${BRANCH}' has no BOOT_FDT_FILE set; kernel-dtb cannot produce a preprocessed DTS. Check the board config and any post_family_config_* hook that may unset it."
+	fi
+
 	# Do it in two separate steps, first build the dtbs then install them.
 	build_targets_build=("dtbs")
 	build_targets_install=("dtbs_install")
 	LOG_SECTION="kernel_build" do_with_logging do_with_hooks kernel_build
 
 	display_alert "Kernel DTB-only .deb, for development/convenience" "kernel dtb build done" "info"
 
 	display_alert "Considering further .dts convenience processing" "for board '${BOARD}' branch '${BRANCH}'" "info"
-
-	# kernel-dtb needs BOOT_FDT_FILE to know which .dtb to preprocess into a .dts.
-	# If it is unset (board config, or a post_family_config_* hook that unset it),
-	# we cannot continue — bail out loudly instead of silently producing an empty package.
-	if [[ -z "${BOOT_FDT_FILE}" ]]; then
-		exit_with_error "Board '${BOARD}' branch '${BRANCH}' has no BOOT_FDT_FILE set; kernel-dtb cannot produce a preprocessed DTS. Check the board config and any post_family_config_* hook that may unset it."
-	fi
 
 	display_alert "Kernel DTB-only for development" "Copying preprocessed versions of ${BOOT_FDT_FILE}" "info"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@lib/functions/compilation/kernel.sh` around lines 175 - 190, The
BOOT_FDT_FILE existence check should run before any build starts to fail-fast;
inside kernel_dtb_only_build, move the current BOOT_FDT_FILE guard so it
executes before setting build_targets_build/build_targets_install and before
invoking kernel_build (LOG_SECTION and do_with_logging/do_with_hooks). Ensure
the guard still logs the same clear fatal message and uses exit_with_error when
BOOT_FDT_FILE is empty, preventing unnecessary dtb build/install work by
kernel_build.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@lib/functions/compilation/kernel.sh`:
- Around line 175-190: The BOOT_FDT_FILE existence check should run before any
build starts to fail-fast; inside kernel_dtb_only_build, move the current
BOOT_FDT_FILE guard so it executes before setting
build_targets_build/build_targets_install and before invoking kernel_build
(LOG_SECTION and do_with_logging/do_with_hooks). Ensure the guard still logs the
same clear fatal message and uses exit_with_error when BOOT_FDT_FILE is empty,
preventing unnecessary dtb build/install work by kernel_build.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f1795001-5d0a-49e1-916b-081cb77d0f67

📥 Commits

Reviewing files that changed from the base of the PR and between 3814034 and 9eb62bc.

📒 Files selected for processing (1)
  • lib/functions/compilation/kernel.sh

@iav iav force-pushed the fix/8083-kernel-dtb-missing-boot-fdt-file branch from 9eb62bc to be4dab5 Compare April 19, 2026 20:23
@iav
Copy link
Copy Markdown
Contributor Author

iav commented Apr 19, 2026

Moved the guard to the top of kernel_dtb_only_build() — before kernel_build — so we fail fast without wasting time on the dtbs target. Dropped the inline comment since the exit_with_error message already spells out the cause and the places to check.

@rpardini
Copy link
Copy Markdown
Member

I'm probably missing something, but I guess kernel-dtb can produce a linux-dtb package no matter if it knows the exact DTB for the board or not. The "extra stuff" (preprocessed, etc) done for a board does depend on the FDT being set, but I guess it's a separate concern?

…mbian#8083)

When BOOT_FDT_FILE is unset, kernel_dtb_only_build() still produces the
linux-dtb .deb (from `make dtbs` + dtbs_install) but the convenience
preprocessed-DTS copy into output/ is skipped. The previous warn-level
message was easy to miss, which is what led to the original report of
"no output of the preprocessed dts files".

Change the skip message to err-level and spell out that the package
itself is fine and point at both likely config sources.
@iav iav force-pushed the fix/8083-kernel-dtb-missing-boot-fdt-file branch from be4dab5 to be4858d Compare April 20, 2026 16:24
@iav
Copy link
Copy Markdown
Contributor Author

iav commented Apr 20, 2026

You're right — linux-dtb package comes from make dtbs + dtbs_install and doesn't need BOOT_FDT_FILE at all; only the convenience preprocessed-DTS copy in output/ does. My fatal breaks the package build, which is a regression.

The original complaint in #8083 was about silent behaviour: a warn-level message is easy to miss, and the reporter saw an empty output/ with no obvious reason. I'll switch to: keep kernel-dtb producing the .deb as before, but emit an err-level alert (package OK, preprocessed DTS skipped, with a hint about the board config / post_family_config_* hook) before return 0.

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

Labels

05 Milestone: Second 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.

[Bug]: kernel-dtb does not output when unset BOOT_FDT_FILE is present

2 participants