Repository navigation
gpt: skip unused partition entries instead of stopping at the first one - #840
Open
robbinjanssen wants to merge 1 commit into
Open
robbinjanssen wants to merge 1 commit into
robbinjanssen wants to merge 1 commit into
Conversation
The GPT parser stopped at the first entry with an all-zero unique GUID. The UEFI spec allows used entries after unused ones (a partition table where some partitions were deleted), so every partition after such a gap was missing from printgpt and from the commands that look a partition up by name. Seen on a Lenovo ThinkSmart View (MSM8953) after the common Linux repartitioning: entries 25 and 26 are empty and persist is entry 27, so printgpt listed 24 of 25 partitions and persist could not be found. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
m0s4ik
pushed a commit
to m0s4ik/thinksmart-view-debian
that referenced
this pull request
Nov 14, 2026
…DL tips - hardware.md: a unit with the FocalTech FT8201 panel runs the v0.4 image unchanged (lk2nd patches the DT, the kernel has the panel driver): what was checked, the multi-touch input device, warnings seen in the kernel log, and what was not tested (touch after blanking). install.md, kernel.md and README follow. - flashing.md: the repartitioning removes p25-p51 and creates a new, empty persist at the end of the eMMC; how to copy the original persist from the backup, by sector because edl does not see p27 (bkerler/edl#840). - flashing.md: adb reboot edl; EDL mode times out when idle; a resumable backup in parts with edl rs when edl rf stops halfway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
gpt.parse()stops at the first partition entry whose unique GUID is all zeros (break). The UEFI spec allows used entries after unused ones, for example after some partitions were deleted, so every partition after such a gap is missing:printgptdoes not list it, and commands that look a partition up by name (r,w,e, …) cannot find it.Where it showed up
A Lenovo ThinkSmart View (APQ8053/MSM8953) after the repartitioning commonly used to install Linux on it (rickx/ubuntu-thinksmart's
ubuntu_layout.sfdisk): entries 25 and 26 are empty andpersistis entry 27, at the end of the eMMC.printgptlists 24 partitions, ending withsystem;persistis not there.persistat sector 15204319 with 65536 sectors (whatsfdisk -lshows on the device).Change
break→continue.entryoffsetis already computed from the entry index, so later entries keep their correct offsets.Testing
Parsed the primary GPT of both layouts with
gpt().parse(data, 512): the stock one (51 partitions, unchanged) and one created bysfdiskfrom that layout on an image file of the same size (persist found only with the fix). On the device itself,printgptafter repartitioning did not listpersist(that is how this was found); the fix is tested on the parser with that layout, not yet against the device.🤖 Generated with Claude Code