[U-Boot] [PATCH v1 3/3] cmd: gpt: solve issue for swap
Patrick Delaunay
patrick.delaunay at st.com
Mon Oct 9 07:47:19 UTC 2017
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 and lost data during swap
Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
---
cmd/gpt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cmd/gpt.c b/cmd/gpt.c
index d4406e3..38d09c6 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -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=");
--
2.7.4
More information about the U-Boot
mailing list