Skip to content

Offer the OTAFIX bootloader factory-erase file for nRF52 - #431

Draft
jamesarich wants to merge 1 commit into
meshtastic:mainfrom
jamesarich:feat/bootloader-factory-erase
Draft

jamesarich wants to merge 1 commit into
meshtastic:mainfrom
jamesarich:feat/bootloader-factory-erase

Conversation

@jamesarich

Copy link
Copy Markdown
Contributor

Description

Adds public/uf2/meshtastic_factory_erase.uf2 (512 bytes, one UF2 block, family 0x4D455348, from meshtastic/Adafruit_nRF52_Bootloader_OTAFIX#41 at c8ccd1d7, MIT) and a checkbox in the nRF52 erase dialog: "My bootloader's INFO_UF2.TXT shows a Factory-Erase line". When checked, the download link serves that file and the serial-monitor step is replaced by a note that the drive comes back on its own; the installed firmware stays. Unchecked, nothing changes: the SoftDevice-specific images and the serial monitor as today. RP2040 untouched.

The flasher cannot read the DFU drive, so it cannot detect the line itself; hence the attestation. Older bootloaders ignore the file silently, which the hint says.

Open product question: whether to ship this before an OTAFIX release carrying the feature is common, or hold the PR. Draft until then. Related: meshtastic/api#136, meshtastic/Meshtastic-Android#7058, meshtastic/Meshtastic-Apple#2433, meshtastic/meshtastic#2650.

Two pre-existing strings on this path are now inaccurate for the new file (flash.erase_uf2.dfu_warning "erase your device completely", flash.uf2.copy_instructions "will start with the new firmware"); left for a follow-up.

Type of Change

  • New feature

Testing

  • I have tested these changes locally
  • I have added/updated tests as appropriate
  • All existing tests pass

vitest run: 277 passed including 4 new deviceStore cases. eslint .: no new problems (the tree has 282 pre-existing). Ran the binaries directly: the workspace's pnpm 11 fails pnpm lint/pnpm test:run before they start with ERR_PNPM_IGNORED_BUILDS; CI does not pin a pnpm major. Not exercised in a browser.

…tion

public/uf2/meshtastic_factory_erase.uf2 is a single 512-byte UF2 block with
family ID 0x4D455348 ("MESH") and an all-zero payload, copied from
Adafruit_nRF52_Bootloader_OTAFIX tools/meshtastic_factory_erase.uf2 at
c8ccd1d (PR meshtastic#41, MIT). No OTAFIX release contains it yet; swap the copy for
a release asset once one exists. sha256
6ef3146505c40079ee9e7e692448e40a793dad636f55d1545063299d28908f0d.

A bootloader that recognises the family erases its own App Data reservation
(LittleFS config, keys, bonds, node DB) and keeps the installed firmware, so
one file fits every nRF52 board and no SoftDevice 6.1.1/7.3.0 choice is
needed. The old serial-monitor step goes away with it: there is no sketch
waiting on CDC, the port is the bootloader's own.

Attestation instead of detection: the bootloader advertises support with a
"Factory-Erase:" line in INFO_UF2.TXT, but the flasher has no way to read the
DFU drive (no File System Access API here), and an older bootloader ignores
the file silently, leaving the user thinking the erase happened. So the file
is served only when the user ticks a checkbox saying the line is there;
unticked, today's SoftDevice-specific path is unchanged. The checkbox resets
on target change.

Open product question: whether to ship this before an OTAFIX release
carrying the feature is widespread. Until then nearly every device will lack
the line and the checkbox is a promise almost nobody can keep.
@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

@jamesarich is attempting to deploy a commit to the Meshtastic Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

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.

1 participant