uboot-mediatek: update to U-Boot 2023.01
[openwrt/openwrt.git] / package / boot / uboot-mediatek / patches / 100-25-cmd-ubi-allow-creating-volume-with-all-free-spaces.patch
1 From f6a4130959af1e6d13d616203e42ed3c894666ad Mon Sep 17 00:00:00 2001
2 From: Weijie Gao <weijie.gao@mediatek.com>
3 Date: Mon, 25 Jul 2022 17:00:00 +0800
4 Subject: [PATCH 60/71] cmd: ubi: allow creating volume with all free spaces
5
6 Allow creating volume with all free spaces by giving a negative size value.
7
8 Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
9 ---
10 cmd/ubi.c | 6 +++++-
11 1 file changed, 5 insertions(+), 1 deletion(-)
12
13 --- a/cmd/ubi.c
14 +++ b/cmd/ubi.c
15 @@ -226,7 +226,11 @@ int ubi_create_vol(char *volume, int64_t
16
17 req.vol_id = vol_id;
18 req.alignment = 1;
19 - req.bytes = size;
20 +
21 + if (size < 0)
22 + req.bytes = ubi->avail_pebs * ubi->leb_size;
23 + else
24 + req.bytes = size;
25
26 strcpy(req.name, volume);
27 req.name_len = strlen(volume);