diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2017-10-18 15:11:08 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2017-10-23 17:28:11 -0400 |
commit | 3a2605fa875bc02962d62b5a21c795640621bf45 (patch) | |
tree | 86d87bda4b5945780c8d06ebc700c23a759c5aaf /cmd | |
parent | 0cf02ff612c05800cb65fb496ac55454c36df64b (diff) | |
download | u-boot-3a2605fa875bc02962d62b5a21c795640621bf45.zip u-boot-3a2605fa875bc02962d62b5a21c795640621bf45.tar.gz u-boot-3a2605fa875bc02962d62b5a21c795640621bf45.tar.bz2 |
cmd: gpt: solve issue for swap and rename command
don't use prettyprint_part_size() in create_gpt_partitions_list()
that avoid to align offset and size to 1 MiB and increase precision for
start and size.
This patch avoid the risk to change partition size and lost data during
rename or swap.
Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/gpt.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -282,14 +282,14 @@ static int create_gpt_partitions_list(int numparts, const char *guid, strcat(partitions_list, "name="); strncat(partitions_list, (const char *)curr->gpt_part_info.name, PART_NAME_LEN + 1); - strcat(partitions_list, ",start="); - prettyprint_part_size(partstr, (unsigned long)curr->gpt_part_info.start, - (unsigned long) curr->gpt_part_info.blksz); + sprintf(partstr, ",start=0x%llx", + (unsigned long long)curr->gpt_part_info.start * + curr->gpt_part_info.blksz); /* one extra byte for NULL */ strncat(partitions_list, partstr, PART_NAME_LEN + 1); - strcat(partitions_list, ",size="); - prettyprint_part_size(partstr, curr->gpt_part_info.size, - curr->gpt_part_info.blksz); + sprintf(partstr, ",size=0x%llx", + (unsigned long long)curr->gpt_part_info.size * + curr->gpt_part_info.blksz); strncat(partitions_list, partstr, PART_NAME_LEN + 1); strcat(partitions_list, ",uuid="); |