mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2 1/2] partitions: efi: change first partition number from 1 to 0
@ 2024-02-29  7:18 Sascha Hauer
  2024-02-29  7:18 ` [PATCH v2 2/2] partitions: dos: " Sascha Hauer
  2024-03-01  9:21 ` [PATCH v2 1/2] partitions: efi: " Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-02-29  7:18 UTC (permalink / raw)
  To: Barebox List

Traditionally barebox starts partition numbers at 0. This was changed
in bdc3cb54dc to start at 1. This was done to make the parted numbering
consistent to the Linux tool. This breaks boot scripts though which
assume 0 to be the first partition, so change it back.

Fixes: bdc3cb54dc ("partitions: efi: implement partition manipulation support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/partitions/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 51e92f65c5..703d23c715 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -504,7 +504,7 @@ static struct partition_desc *efi_partition(void *buf, struct block_device *blk)
 		part_set_efi_name(&ptes[i], pentry->name);
 		snprintf(pentry->partuuid, sizeof(pentry->partuuid), "%pUl", &ptes[i].unique_partition_guid);
 		pentry->typeuuid = ptes[i].partition_type_guid;
-		pentry->num = i + 1;
+		pentry->num = i;
 		list_add_tail(&pentry->list, &epd->pd.partitions);
 	}
 out:
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] partitions: dos: change first partition number from 1 to 0
  2024-02-29  7:18 [PATCH v2 1/2] partitions: efi: change first partition number from 1 to 0 Sascha Hauer
@ 2024-02-29  7:18 ` Sascha Hauer
  2024-03-01  8:15   ` Ahmad Fatoum
  2024-03-01  9:21 ` [PATCH v2 1/2] partitions: efi: " Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2024-02-29  7:18 UTC (permalink / raw)
  To: Barebox List

Traditionally barebox starts partition numbers at 0. This was changed
in 8f48e6366c to start at 1. This was done to make the parted numbering
consistent to the Linux tool. This breaks boot scripts though which
assume 0 to be the first partition, so change it back.

Fixes: 8f48e6366c ("partitions: dos: implement partition manipulation support")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

Notes:
    Changes since v1:
    
    - fix partuuid number passed to Linux

 common/partitions/dos.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 47b5764124..1b0051f978 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -127,7 +127,7 @@ static void dos_extended_partition(struct block_device *blk, struct dos_partitio
 	uint8_t *buf = malloc(SECTOR_SIZE);
 	uint32_t ebr_sector = partition->first_sec;
 	struct partition_entry *table = (struct partition_entry *)&buf[0x1be];
-	unsigned partno = 5;
+	unsigned partno = 4;
 	struct dos_partition *dpart;
 	struct partition *pentry;
 
@@ -170,7 +170,7 @@ static void dos_extended_partition(struct block_device *blk, struct dos_partitio
 		pentry->size = get_unaligned_le32(&table[0].partition_size);
 		pentry->dos_partition_type = table[0].type;
 		pentry->num = partno;
-		sprintf(pentry->partuuid, "%08x-%02u", signature, partno);
+		sprintf(pentry->partuuid, "%08x-%02u", signature, partno + 1);
 
 		list_add_tail(&pentry->list, &dpd->pd.partitions);
 
@@ -237,7 +237,7 @@ static struct partition_desc *dos_partition(void *buf, struct block_device *blk)
 		pentry->first_sec = first_sec;
 		pentry->size = get_unaligned_le32(&table[i].partition_size);
 		pentry->dos_partition_type = table[i].type;
-		pentry->num = i + 1;
+		pentry->num = i;
 
 		sprintf(pentry->partuuid, "%08x-%02d", signature, i + 1);
 		dpd->signature = signature;
-- 
2.39.2




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 2/2] partitions: dos: change first partition number from 1 to 0
  2024-02-29  7:18 ` [PATCH v2 2/2] partitions: dos: " Sascha Hauer
@ 2024-03-01  8:15   ` Ahmad Fatoum
  0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2024-03-01  8:15 UTC (permalink / raw)
  To: Sascha Hauer, Barebox List

On 29.02.24 08:18, Sascha Hauer wrote:
> Traditionally barebox starts partition numbers at 0. This was changed
> in 8f48e6366c to start at 1. This was done to make the parted numbering
> consistent to the Linux tool. This breaks boot scripts though which
> assume 0 to be the first partition, so change it back.
> 
> Fixes: 8f48e6366c ("partitions: dos: implement partition manipulation support")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
> 
> Notes:
>     Changes since v1:
>     
>     - fix partuuid number passed to Linux
> 
>  common/partitions/dos.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/common/partitions/dos.c b/common/partitions/dos.c
> index 47b5764124..1b0051f978 100644
> --- a/common/partitions/dos.c
> +++ b/common/partitions/dos.c
> @@ -127,7 +127,7 @@ static void dos_extended_partition(struct block_device *blk, struct dos_partitio
>  	uint8_t *buf = malloc(SECTOR_SIZE);
>  	uint32_t ebr_sector = partition->first_sec;
>  	struct partition_entry *table = (struct partition_entry *)&buf[0x1be];
> -	unsigned partno = 5;
> +	unsigned partno = 4;
>  	struct dos_partition *dpart;
>  	struct partition *pentry;
>  
> @@ -170,7 +170,7 @@ static void dos_extended_partition(struct block_device *blk, struct dos_partitio
>  		pentry->size = get_unaligned_le32(&table[0].partition_size);
>  		pentry->dos_partition_type = table[0].type;
>  		pentry->num = partno;
> -		sprintf(pentry->partuuid, "%08x-%02u", signature, partno);
> +		sprintf(pentry->partuuid, "%08x-%02u", signature, partno + 1);
>  
>  		list_add_tail(&pentry->list, &dpd->pd.partitions);
>  
> @@ -237,7 +237,7 @@ static struct partition_desc *dos_partition(void *buf, struct block_device *blk)
>  		pentry->first_sec = first_sec;
>  		pentry->size = get_unaligned_le32(&table[i].partition_size);
>  		pentry->dos_partition_type = table[i].type;
> -		pentry->num = i + 1;
> +		pentry->num = i;
>  
>  		sprintf(pentry->partuuid, "%08x-%02d", signature, i + 1);
>  		dpd->signature = signature;

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] partitions: efi: change first partition number from 1 to 0
  2024-02-29  7:18 [PATCH v2 1/2] partitions: efi: change first partition number from 1 to 0 Sascha Hauer
  2024-02-29  7:18 ` [PATCH v2 2/2] partitions: dos: " Sascha Hauer
@ 2024-03-01  9:21 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2024-03-01  9:21 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Thu, 29 Feb 2024 08:18:24 +0100, Sascha Hauer wrote:
> Traditionally barebox starts partition numbers at 0. This was changed
> in bdc3cb54dc to start at 1. This was done to make the parted numbering
> consistent to the Linux tool. This breaks boot scripts though which
> assume 0 to be the first partition, so change it back.
> 
> 

Applied, thanks!

[1/2] partitions: efi: change first partition number from 1 to 0
      https://git.pengutronix.de/cgit/barebox/commit/?id=5ea3221bfb55 (link may not be stable)
[2/2] partitions: dos: change first partition number from 1 to 0
      https://git.pengutronix.de/cgit/barebox/commit/?id=c695f0184352 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-01  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-29  7:18 [PATCH v2 1/2] partitions: efi: change first partition number from 1 to 0 Sascha Hauer
2024-02-29  7:18 ` [PATCH v2 2/2] partitions: dos: " Sascha Hauer
2024-03-01  8:15   ` Ahmad Fatoum
2024-03-01  9:21 ` [PATCH v2 1/2] partitions: efi: " Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox