Skip to content

Fix create-recore-config to actually provision the eMMC config - #98

Merged
eliasbakken merged 1 commit into
mainfrom
fix/create-recore-config-provisioning
Aug 10, 2026
Merged

Fix create-recore-config to actually provision the eMMC config#98
eliasbakken merged 1 commit into
mainfrom
fix/create-recore-config-provisioning

Conversation

@eliasbakken

Copy link
Copy Markdown
Contributor

Summary

Three bugs, all reported in #85:

  1. Formatted a nonexistent partition node - mkfs.ext4 targeted /dev/mmcblk2boot0p1, but the kernel doesn't create child partition nodes for eMMC boot partitions. mount-config and every other reader loop-mount the raw device directly at offset 17408 - the filesystem is now created the same way, via a loop device at that offset, not via fdisk/a partition node that never existed.
  2. metadata_csum (default-on in e2fsprogs 1.47) left no room for the dir-leaf checksum once the filesystem picked a 1K block size at this tiny size, so reads failed with Bad message. Disabled via -O ^metadata_csum,^64bit.
  3. Wrote through a read-only mount - the create path used mount-config, which always mounts read-only (it's meant for readers). Now mounts the loop device directly, read-write, for the create path only.

Also fixed a related bug in get-recore-serial-number: it called plain umount instead of unmount-config to tear down the transient mount mount-config sets up via systemd-mount. Plain umount unmounts the filesystem but doesn't deregister the transient systemd unit, so a later mount-config call can fail with Unit mnt-config.mount was already loaded.

Testing

  • make test-bats - all 13 pass (updated the existing get-recore-serial-number test to stub unmount-config instead of umount, matching the fix).
  • go test ./... - no regressions.
  • Live-tested on real hardware: extracted and backed up the board's existing (already-provisioned) config partition first, ran the fixed create-recore-config against the same serial number, and confirmed get-recore-revision/get-recore-serial-number both work and the downloaded calibration.json is byte-identical to the original.

Closes #85

Three bugs, all reported in #85:

1. Formatted a nonexistent partition node - mkfs.ext4 targeted
   /dev/mmcblk2boot0p1, but the kernel doesn't create child partition
   nodes for eMMC boot partitions. mount-config and every other reader
   loop-mount the raw device directly at offset 17408 instead - the
   filesystem now gets created the same way, via a loop device at that
   offset, not via fdisk/a partition node that never existed.

2. metadata_csum (default-on in e2fsprogs 1.47) left no room for the
   dir-leaf checksum once the filesystem picked a 1K block size at
   this tiny size, so reads failed with "Bad message". Disabled via
   -O ^metadata_csum,^64bit.

3. The create path wrote through mount-config, which always mounts
   read-only (it's meant for readers) - the echo > serial_number would
   fail even with a valid filesystem. The create path now mounts the
   loop device directly, read-write, instead.

Also fixed a related bug in get-recore-serial-number: it called plain
umount instead of unmount-config to tear down the transient mount
mount-config sets up via systemd-mount. Plain umount unmounts the
filesystem but doesn't deregister the transient systemd unit, so a
later mount-config call can fail with "Unit mnt-config.mount was
already loaded".

Live-tested on real hardware: extracted and backed up the board's
existing (already-provisioned) config partition first, ran the fixed
create-recore-config against the same serial, and confirmed
get-recore-revision/get-recore-serial-number both work and the
downloaded calibration.json is byte-identical to the original.

Closes #85
@eliasbakken
eliasbakken merged commit 0573c59 into main Aug 10, 2026
2 checks passed
@eliasbakken
eliasbakken deleted the fix/create-recore-config-provisioning branch August 10, 2026 19:12
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.

create-recore-config fails to provision config on eMMC boot partition

1 participant