-
Notifications
You must be signed in to change notification settings - Fork 78
ptgen fixes and improvements #58
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
Open
mkshevetskiy
wants to merge
4
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
+105
−16
Conversation
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
Contributor
Author
|
@dangowrt could you look on it? |
Contributor
Author
The commit 0782d24 (Revert "ptgen: do not create stub partition to fill a gap if gap caused by alignment") fixes one issue but introduce another. If "-e <gpt_entry_offs>" option is used and there is no gap between GPT Entry Table and 1-st partition, then 1) A GPT stub partition will be created, but this should not be done because of no space for it. 2) A stub partition will be incorrect (start_sector > end_sector) This patch fixes an issue. Fixes: 0782d24 (Revert "ptgen: do not create stub partition to fill a gap if gap caused by alignment") Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
This patch allows to specify the GPT entry index to use. Subsequent partitions will use sequential indexes, starting with the specified one. This will continue until a new starting index is specified. The patch ensures that the same index will never be used twice. [Explanation within example] ptgen creates gpt partitions using consecutive indexes starting from zero. For example the following command ptgen -o mmc.img -g -d 32M \ -p 2M \ # describe /dev/mmcblk0p1 (index=0) -p 4M \ # describe /dev/mmcblk0p2 (index=1) -p 25M # describe /dev/mmcblk0p3 (index=2) will create $ /sbin/fdisk mmc.img ... Device Start End Sectors Size Type mmc.img1 34 4129 4096 2M Linux filesystem <= see here mmc.img2 4130 12321 8192 4M Linux filesystem mmc.img3 12322 63521 51200 25M Linux filesystem Sometimes it's necessary to create one or more partitions whose indexes don't follow above rule. For example, we might want the partition located at the very beginning of the mmc flash to be named as /dev/mmcblk0p7. Within a patch this can be achieved by a command ptgen -o mmc.img -g -d 32M \ -i 6 -p 2M \ # describe /dev/mmcblk0p7 (index=6) -i 0 -p 4M \ # describe /dev/mmcblk0p1 (index=0) -p 20M # describe /dev/mmcblk0p2 (index=1) $ /sbin/fdisk mmc.img ... Device Start End Sectors Size Type mmc.img1 4130 12321 8192 4M Linux filesystem mmc.img2 12322 63521 51200 25M Linux filesystem mmc.img7 34 4129 4096 2M Linux filesystem <== see here So we done it. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
ptgen tends to create stub partitions between the end of GPT entry table and the start of the first disk. This patch adds an option to disable this behavior. Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
ptgen help is bad: - there are a lot of single letter options (so the option name tells nothing) - some options does not mentioned in the ptgen help - there are no any options explanations This patch - adds long option support - provides more usefull help - add description for missed options Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
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 MR is a collection of small improvements to ptgen utility that touch mostly the same code - they are not split into different MRs to avoid unnecessary merge conflicts.
The improvements are as follows: