Skip to content

Conversation

@igorpecovnik
Copy link
Member

@igorpecovnik igorpecovnik commented Dec 4, 2025

Description

Enable block device flasher in armbian-install. Related to armbian/configng#705

image

Documentation summary for feature / change

armbian/configng#705

How Has This Been Tested?

  • Tested on x86 device
  • Tested on Nanopi M6 flashing to eMMC

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

Release Notes

  • New Features
    • Added a new menu option to armbian-install for downloading and flashing a clean image when block devices are detected.

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

@igorpecovnik igorpecovnik requested a review from a team as a code owner December 4, 2025 15:21
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

Walkthrough

The armbian-install script now includes a new menu option (option 8) to download and flash a clean image. A pre-check queries armbian-config for available module_images status; if available, the option is appended to the menu. Selecting it invokes armbian-config --cmd FLASH1 before exiting.

Changes

Cohort / File(s) Summary
New flash option
packages/bsp/common/usr/bin/armbian-install
Added pre-check query for module_images availability, appended option 8 ("Download and flash clean image") to menu, and implemented corresponding case handler calling armbian-config --cmd FLASH1

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single-file modification with straightforward additions (pre-check condition, menu option, case handler)
  • No complex logic or multi-component interactions
  • Control flow extension is linear and predictable

Poem

🐰✨ A fresh new option hops into view,
Option eight for flashing anew—
Clean images downloaded with ease,
Our little script now aims to please!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Enable direct flashing method in armbian-install menu' is directly related to the main change which adds a UI option to download and flash a clean image. It clearly summarizes the primary enhancement.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch flasher

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.

@igorpecovnik igorpecovnik added the Work in progress Unfinished / work in progress label Dec 4, 2025
@github-actions github-actions bot added 02 Milestone: First quarter release Needs review Seeking for review BSP Board Support Packages size/small PR with less then 50 lines labels Dec 4, 2025
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: 0

🧹 Nitpick comments (2)
packages/bsp/common/usr/bin/armbian-install (2)

932-936: Consider verifying command existence before execution.

While the current implementation safely falls back if armbian-config is missing (the option simply won't appear), explicitly checking for the command's existence would make the intent clearer and provide better diagnostics if needed.

Apply this diff to add explicit command verification:

 	# show flasher if there are available block devices
-	armbian-config --api module_images status >/dev/null
-	if [[ $? -eq 0 ]]; then
+	if command -v armbian-config >/dev/null 2>&1 && \
+	   armbian-config --api module_images status >/dev/null 2>&1; then
 		options+=("8" "Download and flash clean image")
 	fi

Note: The comment on line 932 states "if there are available block devices" but the code checks module_images status. Consider updating the comment to accurately reflect what's being checked, such as "show flasher if module is available."


1021-1024: Add error handling and user feedback for the flash operation.

The current implementation calls armbian-config --cmd FLASH1 without checking its exit status or providing user feedback. If the command fails, the user won't know what went wrong.

Apply this diff to add error handling:

 		8)
-			armbian-config --cmd FLASH1
-			return
+			if armbian-config --cmd FLASH1; then
+				dialog --backtitle "$backtitle" --title 'Flash operation' --msgbox '\n          Done.' 7 30
+			else
+				dialog --backtitle "$backtitle" --title 'Flash operation' --msgbox '\n          Failed. Check logs for details.' 7 40
+			fi
+			return
 			;;
📜 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 6f4e67b and 6f9df54.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/bin/armbian-install (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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:

  • packages/bsp/common/usr/bin/armbian-install
📚 Learning: 2025-11-20T18:20:11.985Z
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.

Applied to files:

  • packages/bsp/common/usr/bin/armbian-install
📚 Learning: 2025-07-17T04:12:33.125Z
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.

Applied to files:

  • packages/bsp/common/usr/bin/armbian-install
📚 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:

  • packages/bsp/common/usr/bin/armbian-install
📚 Learning: 2025-09-14T06:32:29.806Z
Learnt from: amazingfate
Repo: armbian/build PR: 8619
File: config/sources/families/rockchip.conf:222-230
Timestamp: 2025-09-14T06:32:29.806Z
Learning: In the Armbian build system, the write_uboot_platform() function implementations follow different patterns across Rockchip family files. The newer standard (used in rockchip64_common.inc and rk3506) includes 'status=none' parameter in dd commands, while older implementations (rk3288, rk322x) use an older pattern without this parameter. The rk3506 implementation correctly follows the current Rockchip family standard.

Applied to files:

  • packages/bsp/common/usr/bin/armbian-install

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: 0

🧹 Nitpick comments (1)
packages/bsp/common/usr/bin/armbian-install (1)

932-937: Pre-check for flasher option is sound; consider inlining command for robustness.

The gating on armbian-config --api module_images status is a good way to only show option 8 when supported. You can simplify and harden this a bit by inlining the command in the if and silencing stderr, which avoids depending on $? and keeps the dialog output clean if armbian-config emits warnings:

-	# show flasher if there are available block devices
-	armbian-config --api module_images status >/dev/null
-	if [[ $? -eq 0 ]]; then
-		options+=("8" "Download and flash clean image")
-	fi
+	# show flasher if armbian-config reports module_images as available
+	if armbian-config --api module_images status >/dev/null 2>&1; then
+		options+=("8" "Download and flash clean image")
+	fi

Please double-check against the current armbian-config API that module_images status is the right health check for enabling direct flashing.

📜 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 6f4e67b and 6f9df54.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/bin/armbian-install (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: EvilOlaf
Repo: armbian/build PR: 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.
📚 Learning: 2025-09-27T21:50:15.915Z
Learnt from: tabrisnet
Repo: armbian/build PR: 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:

  • packages/bsp/common/usr/bin/armbian-install
🔇 Additional comments (1)
packages/bsp/common/usr/bin/armbian-install (1)

1021-1024: New option 8 wiring is consistent; ensure FLASH1 flow is safe in this context.

The integration of option 8 into the menu and dispatcher looks correct, and using return here matches the pattern of other early-exit actions (5–7) while propagating armbian-config’s status.

One thing to verify is that armbian-config --cmd FLASH1 is safe to invoke from here (no recursive call back into armbian-install, and its TUI flow doesn’t assume it was started “from scratch” in a conflicting way).

Please confirm that the FLASH1 command in the corresponding armbian-config/configng version does not call back into armbian-install and behaves correctly when launched from within this script.

fi

# show flasher if there are available block devices
armbian-config --api module_images status >/dev/null
Copy link
Collaborator

Choose a reason for hiding this comment

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

kindly preface this with a test for the executability of armbian-config

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

Labels

02 Milestone: First quarter release BSP Board Support Packages Needs review Seeking for review size/small PR with less then 50 lines Work in progress Unfinished / work in progress

Development

Successfully merging this pull request may close these issues.

3 participants