summaryrefslogtreecommitdiffstats
path: root/common/partitions/dos.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2024-02-29 08:18:25 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-01 10:21:39 +0100
commitc695f0184352e2d1e0b970df40f36510b7e0ed43 (patch)
treef9cafc74ce763edb53bc81be4eff933dcbfa4464 /common/partitions/dos.c
parent5ea3221bfb5512118ac08702c6384df948752ad6 (diff)
downloadbarebox-c695f0184352e2d1e0b970df40f36510b7e0ed43.tar.gz
barebox-c695f0184352e2d1e0b970df40f36510b7e0ed43.tar.xz
partitions: dos: change first partition number from 1 to 0
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") Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240229071825.1624411-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/partitions/dos.c')
-rw-r--r--common/partitions/dos.c6
1 files 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;