diff options
author | Otavio Salvador <otavio.salvador@gmail.com> | 2020-06-12 15:08:09 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-15 14:53:46 +0100 |
commit | b146adce363451e19eda713ccf2466fe4ee1ec20 (patch) | |
tree | 07f63d91279e5fc033c28b53f4bcbbb646c32e02 /meta/recipes-devtools | |
parent | 48a883bb6e144a176d36188cb38b7fc6e3fd1d9d (diff) | |
download | poky-b146adce363451e19eda713ccf2466fe4ee1ec20.tar.gz |
mtd-utils: Fix return value of ubiformat
This changeset fixes a feature regression in ubiformat. Older versions
of ubiformat, when invoked with a flash-image, would return 0 in the
case no error was encountered. Upon upgrading to latest, it was
discovered that ubiformat returned 255 even without encountering an
error condition.
This changeset corrects the above issue and causes ubiformat, when given an
image file, to return 0 when no errors are detected.
Backport fix from 2.1.2
(From OE-Core rev: 7ebacd9cbaec98fbc406e8ae99c9805a24fdadc6)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch | 62 | ||||
-rw-r--r-- | meta/recipes-devtools/mtd/mtd-utils_git.bb | 1 |
2 files changed, 63 insertions, 0 deletions
diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch new file mode 100644 index 0000000000..d43f7e1a7a --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-Fix-return-value-of-ubiformat.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 4d19bffcfd66e25d3ee74536ae2d2da7ad52e8e2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Barry Grussling <barry@grussling.com> | ||
3 | Date: Sun, 12 Jan 2020 12:33:32 -0800 | ||
4 | Subject: [PATCH] mtd-utils: Fix return value of ubiformat | ||
5 | Organization: O.S. Systems Software LTDA. | ||
6 | |||
7 | This changeset fixes a feature regression in ubiformat. Older versions of | ||
8 | ubiformat, when invoked with a flash-image, would return 0 in the case no error | ||
9 | was encountered. Upon upgrading to latest, it was discovered that ubiformat | ||
10 | returned 255 even without encountering an error condition. | ||
11 | |||
12 | This changeset corrects the above issue and causes ubiformat, when given an | ||
13 | image file, to return 0 when no errors are detected. | ||
14 | |||
15 | Tested by running through my loading scripts and verifying ubiformat returned | ||
16 | 0. | ||
17 | |||
18 | Upstream-Status: Backport [2.1.2] | ||
19 | |||
20 | Signed-off-by: Barry Grussling <barry@grussling.com> | ||
21 | Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> | ||
22 | Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> | ||
23 | --- | ||
24 | ubi-utils/ubiformat.c | 7 +++++-- | ||
25 | 1 file changed, 5 insertions(+), 2 deletions(-) | ||
26 | |||
27 | diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c | ||
28 | index a90627c..5377b12 100644 | ||
29 | --- a/ubi-utils/ubiformat.c | ||
30 | +++ b/ubi-utils/ubiformat.c | ||
31 | @@ -550,6 +550,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd, | ||
32 | struct ubi_vtbl_record *vtbl; | ||
33 | int eb1 = -1, eb2 = -1; | ||
34 | long long ec1 = -1, ec2 = -1; | ||
35 | + int ret = -1; | ||
36 | |||
37 | write_size = UBI_EC_HDR_SIZE + mtd->subpage_size - 1; | ||
38 | write_size /= mtd->subpage_size; | ||
39 | @@ -643,8 +644,10 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd, | ||
40 | if (!args.quiet && !args.verbose) | ||
41 | printf("\n"); | ||
42 | |||
43 | - if (novtbl) | ||
44 | + if (novtbl) { | ||
45 | + ret = 0; | ||
46 | goto out_free; | ||
47 | + } | ||
48 | |||
49 | if (eb1 == -1 || eb2 == -1) { | ||
50 | errmsg("no eraseblocks for volume table"); | ||
51 | @@ -669,7 +672,7 @@ static int format(libmtd_t libmtd, const struct mtd_dev_info *mtd, | ||
52 | |||
53 | out_free: | ||
54 | free(hdr); | ||
55 | - return -1; | ||
56 | + return ret; | ||
57 | } | ||
58 | |||
59 | int main(int argc, char * const argv[]) | ||
60 | -- | ||
61 | 2.27.0 | ||
62 | |||
diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb index 810fe40f4e..d1658a739b 100644 --- a/meta/recipes-devtools/mtd/mtd-utils_git.bb +++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb | |||
@@ -15,6 +15,7 @@ PV = "2.1.1" | |||
15 | SRCREV = "4443221ce9b88440cd9f5bb78e6fe95621d36c8a" | 15 | SRCREV = "4443221ce9b88440cd9f5bb78e6fe95621d36c8a" |
16 | SRC_URI = "git://git.infradead.org/mtd-utils.git \ | 16 | SRC_URI = "git://git.infradead.org/mtd-utils.git \ |
17 | file://add-exclusion-to-mkfs-jffs2-git-2.patch \ | 17 | file://add-exclusion-to-mkfs-jffs2-git-2.patch \ |
18 | file://0001-mtd-utils-Fix-return-value-of-ubiformat.patch \ | ||
18 | " | 19 | " |
19 | 20 | ||
20 | S = "${WORKDIR}/git/" | 21 | S = "${WORKDIR}/git/" |