cmd: gpt: fix the wrong size parse for the last partition
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
The calculation of "dev_desc->lba - 34 - 1 - offset" is not correct for size '-', because both fist_usable_lba and last_usable_lba will remain 34 sectors.
We can simply use 0 for size '-' because the part_efi module will decode the size and auto extend the size to maximum available size.
---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
cmd/gpt.c +2 -2
@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the size */ + parts[i].size =0 ; }else { size_ll =ustrtoull (p, &p,0 ); parts[i].size =lldiv (size_ll, dev_desc->blksz);
Signature · 1 line
1.9.1
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
Hi
Quoted 18 lines · Kever Yang
The calculation of "
dev_desc->lba- 34 - 1 - offset" is not correct for size '-', because bothfist_usable_lbaandlast_usable_lbawill remain 34 sectors.We can simply use 0 for size '-' because the
part_efimodule will decode the size and auto extend the size to maximum available size.Signed-off-by Kever Yang <[email protected]>---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)cmd/gpt.c +0
-0
cmd/gpt.c static int set_gpt_info(struct blk_desc *dev_desc, · line 302
Quoted 7 lines
cmd/gpt.c +2
-2@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the size */ + parts[i].size =0 ;
gpt verify give you success?
Michael
Quoted 7 lines
cmd/gpt.c +0
-1}else { size_ll =ustrtoull (p, &p,0 ); parts[i].size =lldiv (size_ll, dev_desc->blksz); --1.9.1
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
Hi Michael,
Quoted 16 lines · Michael Trimarchi
Hi
Quoted 13 lines · Kever Yang
The calculation of "
dev_desc->lba- 34 - 1 - offset" is not correct for size '-', because bothfist_usable_lbaandlast_usable_lbawill remain 34 sectors.We can simply use 0 for size '-' because the
part_efimodule will decode the size and auto extend the size to maximum available size.Signed-off-by Kever Yang <[email protected]>---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 13 lines
cmd/gpt.c static int set_gpt_info(struct blk_desc *dev_desc, · line 302
Quoted 12 lines
cmd/gpt.c +2
-2@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the size */ + parts[i].size =0 ;gpt verify give you success?
Yes.
I use below gpt table and "gpt write mmc 0 $partitions" command to do the test:
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=boot,size=32M,uuid=${uuid_gpt_boot};" \
"name=rootfs,size=-,uuid=${uuid_gpt_rootfs};"Without this patch, I get message:
=> gpt write mmc 0 $partitions
Writing GPT: Partitions layout exceds disk size
error!
After I apply this patch, I get below message:
Writing GPT: success!
Thanks,
- Kever
Quoted 12 lines
Michael
Quoted 7 lines
cmd/gpt.c +0
-1}else { size_ll =ustrtoull (p, &p,0 ); parts[i].size =lldiv (size_ll, dev_desc->blksz); --1.9.1
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
Hi
Quoted 48 lines · Kever Yang
Hi Michael,
Quoted 19 lines · Michael Trimarchi
Hi
Quoted 14 lines · Kever Yang
The calculation of "
dev_desc->lba- 34 - 1 - offset" is not correct for size '-', because bothfist_usable_lbaandlast_usable_lbawill remain 34 sectors.We can simply use 0 for size '-' because the
part_efimodule will decode the size and auto extend the size to maximum available size.Signed-off-by Kever Yang <[email protected]>---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 14 lines
cmd/gpt.c static int set_gpt_info(struct blk_desc *dev_desc, · line 302
Quoted 12 lines
cmd/gpt.c +2
-2@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the size */ + parts[i].size =0 ;gpt verify give you success?
Yes.
I use below gpt table and "gpt write mmc 0 $partitions" command to do the test:
#define PARTS_DEFAULT \ "uuid_disk=${uuid_gpt_disk};" \ "name=boot,size=32M,uuid=${uuid_gpt_boot};" \ "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};"
Quoted 8 lines
Without this patch, I get message:
=> gpt write mmc 0 $partitions
Writing GPT: Partitions layout exceds disk size
error!After I apply this patch, I get below message:
Writing GPT: success!
gpt read back does give you success?
Michael
Quoted 18 lines
Thanks,
- KeverQuoted 12 lines
Michael
Quoted 7 lines
cmd/gpt.c +0
-1}else { size_ll =ustrtoull (p, &p,0 ); parts[i].size =lldiv (size_ll, dev_desc->blksz); --1.9.1
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
Hi Michael,
Quoted 52 lines · Michael Trimarchi
Hi
Quoted 49 lines · Kever Yang
Hi Michael,
Quoted 17 lines · Michael Trimarchi
Hi
Quoted 13 lines · Kever Yang
The calculation of "
dev_desc->lba- 34 - 1 - offset" is not correct for size '-', because bothfist_usable_lbaandlast_usable_lbawill remain 34 sectors.We can simply use 0 for size '-' because the
part_efimodule will decode the size and auto extend the size to maximum available size.Signed-off-by Kever Yang <[email protected]>---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 13 lines
cmd/gpt.c static int set_gpt_info(struct blk_desc *dev_desc, · line 302
Quoted 12 lines
cmd/gpt.c +2
-2@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the size */ + parts[i].size =0 ;gpt verify give you success?
Yes.
I use below gpt table and "gpt write mmc 0 $partitions" command to do the test:
#define PARTS_DEFAULT \ "uuid_disk=${uuid_gpt_disk};" \ "name=boot,size=32M,uuid=${uuid_gpt_boot};" \ "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};"Without this patch, I get message:
=> gpt write mmc 0 $partitions
Writing GPT: Partitions layout exceds disk size
error!
Quoted 4 lines
Quoted 3 lines
After I apply this patch, I get below message:
Writing GPT: success!gpt read back does give you success?
Sorry, I misunderstand your mean about verify.
Here is the result with verify command, it do failed. => gpt verify mmc 0 $partitions
ERROR: Partition rootfs size: 30679007 does not match 0!
at disk/part_efi.c:660/gpt_verify_partitions()
Verify GPT: error!
So I get size check failed for the last partition, can we update the size check for
the last partition, or update the partition size after extend to maximum?
Thanks,
- Kever
Quoted 20 lines
Michael
Quoted 15 lines
Thanks,
- KeverQuoted 10 lines
Michael
Quoted 7 lines
cmd/gpt.c +0
-1}else { size_ll =ustrtoull (p, &p,0 ); parts[i].size =lldiv (size_ll, dev_desc->blksz); --1.9.1
PATCH 1/1 cmd: gpt: fix the wrong size parse for the last partition
Hi Michael, all,
Quoted 72 lines · Kever Yang
Hi Michael,
Quoted 58 lines · Michael Trimarchi
Hi
Quoted 54 lines · Kever Yang
Hi Michael,
Quoted 19 lines · Michael Trimarchi
Hi
Quoted 15 lines · Kever Yang
The calculation of "
dev_desc->lba- 34 - 1 - offset" is not correct for
size '-', because bothfist_usable_lbaandlast_usable_lbawill remain 34 sectors.We can simply use 0 for size '-' because the
part_efimodule will decode
the size and auto extend the size to maximum available size.Signed-off-by Kever Yang <[email protected]>---
cmd/gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
Quoted 12 lines
cmd/gpt.c +1
-2@@ -298,8 +298,8 @@ static int set_gpt_info(struct blk_desc *dev_desc,if (extract_env (val, &p)) p = val;if ((strcmp (p,"-" ) ==0 )) { -/* remove first usable lba and last block */ - parts[i].size = dev_desc->lba -34 -1 - offset; +/* Let part efi module to auto extend the Quoted 2 lines
size */
+ parts[i].size = 0;gpt verify give you success?
Yes.
I use below gpt table and "gpt write mmc 0 $partitions" command to do the
test:#define PARTS_DEFAULT \ "uuid_disk=${uuid_gpt_disk};" \ "name=boot,size=32M,uuid=${uuid_gpt_boot};" \ "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};"Without this patch, I get message:
=> gpt write mmc 0 $partitions
Writing GPT: Partitions layout exceds disk size
error!Quoted 4 lines
Quoted 3 lines
After I apply this patch, I get below message:
Writing GPT: success!gpt read back does give you success?
Sorry, I misunderstand your mean about verify.
Here is the result with verify command, it do failed. => gpt verify mmc 0 $partitions
ERROR: Partition rootfs size: 30679007 does not match 0!
Quoted 6 lines
at disk/part_efi.c:660/gpt_verify_partitions()
Verify GPT: error!So I get size check failed for the last partition, can we update the size check for
the last partition, or update the partition size after extend to maximum?
The size check obviously fails when no size was given. I would propose to simply disable the size check for partitions with no given size. There is no point in computing the desired size just to allow a check which does the same computation backwards to pass.
-Julian
Quoted 30 lines
Thanks,
- KeverQuoted 21 lines
Michael
Quoted 16 lines
Thanks,
- KeverQuoted 11 lines
Michael
Quoted 8 lines
} else { size_ll = ustrtoull(p, &p, 0); parts[i].size = lldiv(size_ll,
dev_desc->blksz);
--
1.9.1_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot