[PATCH v2 7/8] cmd: ubi: allow creating volume with all free spaces in ubi_create_vol
Weijie Gao
weijie.gao at mediatek.com
Tue Apr 21 10:36:34 CEST 2026
Although the ubi command itself supports creating volume with all
free spaces, the api ubi_create_vol() does not.
Since negative size is invalid, this patch replaces negative size
with all free space size in ubi_create_vol().
Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
---
v2: not changed
---
cmd/ubi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmd/ubi.c b/cmd/ubi.c
index aae33d4bca3..95642736cef 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -226,7 +226,11 @@ int ubi_create_vol(const char *volume, int64_t size, int dynamic, int vol_id,
req.vol_id = vol_id;
req.alignment = 1;
- req.bytes = size;
+
+ if (size < 0)
+ req.bytes = ubi->avail_pebs * ubi->leb_size;
+ else
+ req.bytes = size;
strcpy(req.name, volume);
req.name_len = strlen(volume);
--
2.45.2
More information about the U-Boot
mailing list