[PATCH 26/26] commands: parted: exit if block size if not 512
Ahmad Fatoum
a.fatoum at barebox.org
Fri Jun 26 01:42:37 PDT 2026
While the partition parser can now deal with non-512-byte block sizes,
the partition writer still needs some more love beyond just replacing
SECTOR_SIZE/SECTOR_SHIFT.
Until that is afforded, exit with a descriptive error message.
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
commands/createnv.c | 7 +++++++
commands/parted.c | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/commands/createnv.c b/commands/createnv.c
index 6083ab7c2c8f..5d9dc5732c8a 100644
--- a/commands/createnv.c
+++ b/commands/createnv.c
@@ -69,6 +69,13 @@ static int do_createnv(int argc, char *argv[])
goto err;
}
+ if (BLOCKSIZE(blk) != SECTOR_SIZE) {
+ printf("parted: device has block size of %u, but only 512 currently supported\n",
+ BLOCKSIZE(blk));
+ ret = -ENOTSUPP;
+ goto err;
+ }
+
buf = xzalloc(2 * BLOCKSIZE(blk));
ret = cdev_read(cdev, buf, 2 * BLOCKSIZE(blk), 0, 0);
diff --git a/commands/parted.c b/commands/parted.c
index 3f531faaef3f..829796748827 100644
--- a/commands/parted.c
+++ b/commands/parted.c
@@ -392,6 +392,13 @@ static int do_parted(int argc, char *argv[])
goto err;
}
+ if (BLOCKSIZE(blk) != SECTOR_SIZE) {
+ printf("parted: device has block size of %u, but only 512 currently supported\n",
+ BLOCKSIZE(blk));
+ ret = -ENOTSUPP;
+ goto err;
+ }
+
argc -= 2;
argv += 2;
--
2.47.3
More information about the barebox
mailing list