Skip to content

fix: Added many checks to flash-sd.sh to prevent regular files from being created accidentally where a block device was supposed to be.#1778

Open
JacobPease wants to merge 4 commits into
openhwgroup:mainfrom
JacobPease:fix/flashsd-file-check
Open

fix: Added many checks to flash-sd.sh to prevent regular files from being created accidentally where a block device was supposed to be.#1778
JacobPease wants to merge 4 commits into
openhwgroup:mainfrom
JacobPease:fix/flashsd-file-check

Conversation

@JacobPease
Copy link
Copy Markdown
Contributor

@JacobPease JacobPease commented Jun 2, 2026

This PR resolves #1614 by adding extra checks for the block device. This will prevent accidentally creating regular files instead of block device partitions when an SD card is not inserted and present in the block device.

…eing created accidentally where a block device was supposed to be.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR strengthens linux/sdcard/flash-sd.sh safety checks to reduce the risk of accidentally creating regular files in /dev when a block device (SD card) was intended, by validating the target device and related partition nodes before flashing.

Changes:

  • Introduces additional device identification (DEVNAME) and sysfs size-based checks to detect “no card inserted” scenarios.
  • Adds validation that the target path (and any existing partition-like paths) are block devices, failing fast otherwise.
  • Makes GPT info printing conditional on detecting partitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread linux/sdcard/flash-sd.sh
Comment thread linux/sdcard/flash-sd.sh Outdated
Comment thread linux/sdcard/flash-sd.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issues with micro SD cards in zsbl

2 participants