-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ptgen GPT improvements #37
Open
mkshevetskiy
wants to merge
7
commits into
openwrt:master
Choose a base branch
from
mkshevetskiy:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
mkshevetskiy
force-pushed
the
master
branch
4 times, most recently
from
January 9, 2025 10:25
8e08aca
to
ba6a377
Compare
@Ansuel This is useful for AN7581 mostly |
2 << ((10 * exp) - 1) is equal to 1 << (10 * exp). This allows us simplify a formula and remove extra if. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
This is necessary to support large disks. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
Creating gpt partition with ptgen results in invalid PMBR. Steps to reproduce: 1) compile ptgen with WANT_ALTERNATE_PTABLE gcc -Wall -DWANT_ALTERNATE_PTABLE -o ptgen ptgen.c cyg_crc32.c 2) Create an image with ptgen ./ptgen -g -o s.img -p 509m 3) Investigate an image with /sbin/fdisk /sbin/fdisk s.img 4) fdisk reports GPT PMBR size mismatch Welcome to fdisk (util-linux 2.40.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. GPT PMBR size mismatch (1042497 != 1042498) will be corrected by write. Command (m for help): Signed-off-by: Mikhail Kshevetskiy <[email protected]>
…ignment ptgen tends to create stub partitions between the end of GPT entry table and the start of the first disk. Normally fdisk/gdisk aligns partition to 1MB boundary, so there is 2014 sectors gap before the first partition. It is absolutely normal. This patch somehow mimics fdisk/gdisk behavior and does NOT create stub partition in the gap caused by alignment. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
Usually, the primary GPT entries places in the sector 2 (next sector after the primary GPT header). The boot ROM of some SoCs (like Airoha AN7581) on the other hand reads the bootloader code from only one fixed offset which overlaps with the normal position of the primary GPT entries. This patch adds a parameter to ptgen to customise the position of the primary GPT entries. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
Sometimes we know an exact size of the disk and want to create a proper disk image. This patch allows such operation. A special case of zero disk size is supported. In this case the disk size will be automatically calculated on the base of provided partitions list. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
This patch creates 2 or 3 gpt images: image.start: PMBR + GPT Header image.entry: GPT Entry Table image.end: GPT Entry Table + Alternative GPT HEADER If GPT Entry table follow GPT Header without gap, then image.entry will be joined to the end of image.start file. Signed-off-by: Mikhail Kshevetskiy <[email protected]>
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.
This patch series improves GPT support by ptgen utility.
The most focus is done on specific case where primary GPT entry table placed with a gap from GPT header.
The gap is used by a vendor for bootloader code.
Also one ptgen bug was fixed.
Mikhail Kshevetskiy (5):