diff options
10 files changed, 212 insertions, 43 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch index 6e1b9ff100..6ac2cca9d6 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0001-Makefile-only-build-ubi-utils.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From c4e6bd9378645d577e9d9f85da85f1438afe7c50 Mon Sep 17 00:00:00 2001 | 1 | From 1c989e4c36d0bf76ab444f984bc73b98eeacd03f Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sun, 29 Jun 2014 00:32:29 +0200 | 3 | Date: Sun, 29 Jun 2014 00:32:29 +0200 |
| 4 | Subject: [PATCH 1/6] Makefile: build ubi-utils only | 4 | Subject: [PATCH 1/9] Makefile: build ubi-utils only |
| 5 | 5 | ||
| 6 | We build all the static ubi-utils but actually only ubiattach is needed in | 6 | We build all the static ubi-utils but actually only ubiattach is needed in |
| 7 | a minimalistic initramfs for the mount of ubi volumes. | 7 | a minimalistic initramfs for the mount of ubi volumes. |
| @@ -22,13 +22,13 @@ Upstream-Status: Inappropriate [embedded specific] | |||
| 22 | 22 | ||
| 23 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 23 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 24 | --- | 24 | --- |
| 25 | Makefile | 24 ++---------------------- | 25 | Makefile | 26 ++------------------------ |
| 26 | 1 file changed, 2 insertions(+), 22 deletions(-) | 26 | 1 file changed, 2 insertions(+), 24 deletions(-) |
| 27 | 27 | ||
| 28 | Index: git/Makefile | 28 | diff --git a/Makefile b/Makefile |
| 29 | =================================================================== | 29 | index 3ce8587..8b79f71 100644 |
| 30 | --- git.orig/Makefile | 30 | --- a/Makefile |
| 31 | +++ git/Makefile | 31 | +++ b/Makefile |
| 32 | @@ -16,28 +16,11 @@ endif | 32 | @@ -16,28 +16,11 @@ endif |
| 33 | 33 | ||
| 34 | TESTS = tests | 34 | TESTS = tests |
| @@ -82,3 +82,6 @@ Index: git/Makefile | |||
| 82 | # | 82 | # |
| 83 | # Common libmtd | 83 | # Common libmtd |
| 84 | # | 84 | # |
| 85 | -- | ||
| 86 | 2.7.4 | ||
| 87 | |||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch index f46824b5cd..c23d11f0b4 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0002-common.mk-for-klibc-CC-is-klcc.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | From f3609c7c0450b4c31e1d4603fcf2cfb1ba46f994 Mon Sep 17 00:00:00 2001 | 1 | From 89c76bbe82a2029a25b0654eb0a1d0b22d6e6877 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sun, 29 Jun 2014 00:37:28 +0200 | 3 | Date: Sun, 29 Jun 2014 00:37:28 +0200 |
| 4 | Subject: [PATCH 2/6] common.mk: for klibc $(CC) is klcc | 4 | Subject: [PATCH 2/9] common.mk: for klibc $(CC) is klcc |
| 5 | 5 | ||
| 6 | Do not hardcode: assign the value to the variable if it is not already defined. | 6 | Do not hardcode: assign the value to the variable if it is not already defined. |
| 7 | 7 | ||
| 8 | Upstream-Status: Pending | 8 | Upstream-Status: Submitted |
| 9 | 9 | ||
| 10 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 10 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 11 | --- | 11 | --- |
| @@ -13,7 +13,7 @@ Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | |||
| 13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 14 | 14 | ||
| 15 | diff --git a/common.mk b/common.mk | 15 | diff --git a/common.mk b/common.mk |
| 16 | index ba87377..59c56df 100644 | 16 | index ba87377..126d11a 100644 |
| 17 | --- a/common.mk | 17 | --- a/common.mk |
| 18 | +++ b/common.mk | 18 | +++ b/common.mk |
| 19 | @@ -1,4 +1,4 @@ | 19 | @@ -1,4 +1,4 @@ |
| @@ -23,5 +23,5 @@ index ba87377..59c56df 100644 | |||
| 23 | RANLIB := $(CROSS)ranlib | 23 | RANLIB := $(CROSS)ranlib |
| 24 | 24 | ||
| 25 | -- | 25 | -- |
| 26 | 1.9.1 | 26 | 2.7.4 |
| 27 | 27 | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch index 962b3685f3..9ad4a5b99e 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0003-libubi.c-add-klibc-specific-fixes.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From 72a39bb3290a79e76b0dbf59eef83ea2d9b577a1 Mon Sep 17 00:00:00 2001 | 1 | From fecbb7056d621a30f7106e67f5fe209763571b70 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sun, 29 Jun 2014 00:40:15 +0200 | 3 | Date: Sun, 29 Jun 2014 00:40:15 +0200 |
| 4 | Subject: [PATCH 3/6] libubi.c: add klibc specific fixes for ioctl | 4 | Subject: [PATCH 3/9] libubi.c: add klibc specific fixes for ioctl |
| 5 | 5 | ||
| 6 | First issue is that ioctl() in klibc doesn't expect a constant as arg3. | 6 | First issue is that ioctl() in klibc doesn't expect a constant as arg3. |
| 7 | Second issue is that arg3 in klibc ioctl() implementation is not optional. | 7 | Second issue is that arg3 in klibc ioctl() implementation is not optional. |
| @@ -36,7 +36,7 @@ Fixes: | |||
| 36 | | __extern int ioctl(int, int, void *); | 36 | | __extern int ioctl(int, int, void *); |
| 37 | | ^ | 37 | | ^ |
| 38 | 38 | ||
| 39 | Upstream-Status: Inappropriate [klibc specific] | 39 | Upstream-Status: Accepted |
| 40 | 40 | ||
| 41 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 41 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 42 | --- | 42 | --- |
| @@ -44,7 +44,7 @@ Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | |||
| 44 | 1 file changed, 3 insertions(+), 3 deletions(-) | 44 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 45 | 45 | ||
| 46 | diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c | 46 | diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c |
| 47 | index 1e08b7d..491e525 100644 | 47 | index 97c0434..2b49833 100644 |
| 48 | --- a/ubi-utils/libubi.c | 48 | --- a/ubi-utils/libubi.c |
| 49 | +++ b/ubi-utils/libubi.c | 49 | +++ b/ubi-utils/libubi.c |
| 50 | @@ -687,7 +687,7 @@ void libubi_close(libubi_t desc) | 50 | @@ -687,7 +687,7 @@ void libubi_close(libubi_t desc) |
| @@ -72,5 +72,5 @@ index 1e08b7d..491e525 100644 | |||
| 72 | 72 | ||
| 73 | int ubi_update_start(libubi_t desc, int fd, long long bytes) | 73 | int ubi_update_start(libubi_t desc, int fd, long long bytes) |
| 74 | -- | 74 | -- |
| 75 | 1.9.1 | 75 | 2.7.4 |
| 76 | 76 | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch index fee1cbcf90..2f31fb4a26 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0004-common.h-klibc-fixes-1.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | From e56767b9caa02e7c41803499c77dc939d5a7f64a Mon Sep 17 00:00:00 2001 | 1 | From b668cb75cb7e72ff92055209130d4cd4b3cacbdb Mon Sep 17 00:00:00 2001 |
| 2 | From: Thorsten Glaser <tg@mirbsd.org> | 2 | From: Thorsten Glaser <tg@mirbsd.org> |
| 3 | Date: Fri, 20 Jun 2014 10:56:27 +0000 | 3 | Date: Fri, 20 Jun 2014 10:56:27 +0000 |
| 4 | Subject: [PATCH 4/6] Restore compatibility to dietlibc, klibc, musl libc after commit 4f1b108 | 4 | Subject: [PATCH 4/9] Restore compatibility to dietlibc, klibc, musl libc after |
| 5 | commit 4f1b108 | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 5 | 9 | ||
| 6 | Each C library has their own way to define off_t, and the <features.h> | 10 | Each C library has their own way to define off_t, and the <features.h> |
| 7 | header is nonstandard and specific to the GNU libc and those that clone | 11 | header is nonstandard and specific to the GNU libc and those that clone |
| @@ -21,7 +25,7 @@ Fixes: | |||
| 21 | | ^ | 25 | | ^ |
| 22 | | compilation terminated. | 26 | | compilation terminated. |
| 23 | 27 | ||
| 24 | Upstream-Status: Pending | 28 | Upstream-Status: Submitted |
| 25 | 29 | ||
| 26 | Signed-off-by: Thorsten Glaser <tg@mirbsd.org> | 30 | Signed-off-by: Thorsten Glaser <tg@mirbsd.org> |
| 27 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 31 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| @@ -30,7 +34,7 @@ Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | |||
| 30 | 1 file changed, 24 insertions(+) | 34 | 1 file changed, 24 insertions(+) |
| 31 | 35 | ||
| 32 | diff --git a/include/common.h b/include/common.h | 36 | diff --git a/include/common.h b/include/common.h |
| 33 | index 6895e5c..77f3f7d 100644 | 37 | index fb0ca83..5a20964 100644 |
| 34 | --- a/include/common.h | 38 | --- a/include/common.h |
| 35 | +++ b/include/common.h | 39 | +++ b/include/common.h |
| 36 | @@ -26,7 +26,9 @@ | 40 | @@ -26,7 +26,9 @@ |
| @@ -43,7 +47,7 @@ index 6895e5c..77f3f7d 100644 | |||
| 43 | #include <inttypes.h> | 47 | #include <inttypes.h> |
| 44 | #include "version.h" | 48 | #include "version.h" |
| 45 | 49 | ||
| 46 | @@ -52,6 +54,21 @@ extern "C" { | 50 | @@ -67,6 +69,21 @@ extern "C" { |
| 47 | #endif | 51 | #endif |
| 48 | 52 | ||
| 49 | /* define a print format specifier for off_t */ | 53 | /* define a print format specifier for off_t */ |
| @@ -65,7 +69,7 @@ index 6895e5c..77f3f7d 100644 | |||
| 65 | #ifdef __USE_FILE_OFFSET64 | 69 | #ifdef __USE_FILE_OFFSET64 |
| 66 | #define PRIxoff_t PRIx64 | 70 | #define PRIxoff_t PRIx64 |
| 67 | #define PRIdoff_t PRId64 | 71 | #define PRIdoff_t PRId64 |
| 68 | @@ -59,6 +76,13 @@ extern "C" { | 72 | @@ -74,6 +91,13 @@ extern "C" { |
| 69 | #define PRIxoff_t "l"PRIx32 | 73 | #define PRIxoff_t "l"PRIx32 |
| 70 | #define PRIdoff_t "l"PRId32 | 74 | #define PRIdoff_t "l"PRId32 |
| 71 | #endif | 75 | #endif |
| @@ -80,5 +84,5 @@ index 6895e5c..77f3f7d 100644 | |||
| 80 | /* Verbose messages */ | 84 | /* Verbose messages */ |
| 81 | #define bareverbose(verbose, fmt, ...) do { \ | 85 | #define bareverbose(verbose, fmt, ...) do { \ |
| 82 | -- | 86 | -- |
| 83 | 1.9.1 | 87 | 2.7.4 |
| 84 | 88 | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch index 6b09c14d6c..8309a72715 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0005-common.h-klibc-fixes-2.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From 8318852ef4f768bed31072aa7b57e11adc1f639c Mon Sep 17 00:00:00 2001 | 1 | From 5d4a66b502003ef385dab31a17012246407e7364 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sun, 29 Jun 2014 00:44:03 +0200 | 3 | Date: Sun, 29 Jun 2014 00:44:03 +0200 |
| 4 | Subject: [PATCH 5/6] common.h: more workarounds for klibc compatibility | 4 | Subject: [PATCH 5/9] common.h: more workarounds for klibc compatibility |
| 5 | 5 | ||
| 6 | Patch is addressing two issues: | 6 | Patch is addressing two issues: |
| 7 | * First, Klibc doesn't have rpmatch(). | 7 | * First, Klibc doesn't have rpmatch(). |
| @@ -15,18 +15,18 @@ Fixes: | |||
| 15 | | .../git/./include/common.h:157: undefined reference to `getline' | 15 | | .../git/./include/common.h:157: undefined reference to `getline' |
| 16 | | .../git/./include/common.h:164: undefined reference to `rpmatch' | 16 | | .../git/./include/common.h:164: undefined reference to `rpmatch' |
| 17 | 17 | ||
| 18 | Upstream-Status: Pending | 18 | Upstream-Status: Submitted |
| 19 | 19 | ||
| 20 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 20 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 21 | --- | 21 | --- |
| 22 | include/common.h | 10 ++++++---- | 22 | include/common.h | 8 +++++--- |
| 23 | 1 file changed, 6 insertions(+), 4 deletions(-) | 23 | 1 file changed, 5 insertions(+), 3 deletions(-) |
| 24 | 24 | ||
| 25 | Index: git/include/common.h | 25 | diff --git a/include/common.h b/include/common.h |
| 26 | =================================================================== | 26 | index 5a20964..2f51e1c 100644 |
| 27 | --- git.orig/include/common.h | 27 | --- a/include/common.h |
| 28 | +++ git/include/common.h | 28 | +++ b/include/common.h |
| 29 | @@ -161,15 +161,17 @@ static inline int __rpmatch(const char * | 29 | @@ -161,15 +161,17 @@ static inline int __rpmatch(const char *resp) |
| 30 | */ | 30 | */ |
| 31 | static inline bool prompt(const char *msg, bool def) | 31 | static inline bool prompt(const char *msg, bool def) |
| 32 | { | 32 | { |
| @@ -47,3 +47,6 @@ Index: git/include/common.h | |||
| 47 | printf("failed to read prompt; assuming '%s'\n", | 47 | printf("failed to read prompt; assuming '%s'\n", |
| 48 | def ? "yes" : "no"); | 48 | def ? "yes" : "no"); |
| 49 | break; | 49 | break; |
| 50 | -- | ||
| 51 | 2.7.4 | ||
| 52 | |||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch index 043a89d67e..d046f95050 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc/0006-libiniparser-remove-unused-function-needing-float.patch +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From 72a04a9b9ed33c889d2e2b86f306c5be9f6cde35 Mon Sep 17 00:00:00 2001 | 1 | From 2af30e9b2988111e45ed6ea6af55e49ec7cb1cb1 Mon Sep 17 00:00:00 2001 |
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | 2 | From: Andrea Adami <andrea.adami@gmail.com> |
| 3 | Date: Sun, 29 Jun 2014 00:44:57 +0200 | 3 | Date: Sun, 29 Jun 2014 00:44:57 +0200 |
| 4 | Subject: [PATCH 6/6] libiniparser: remove unused function needing float | 4 | Subject: [PATCH 6/9] libiniparser: remove unused function needing float |
| 5 | 5 | ||
| 6 | Fixes: | 6 | Fixes: |
| 7 | | LD ubi-utils/ubiformat | 7 | | LD ubi-utils/ubiformat |
| @@ -13,7 +13,7 @@ Fixes: | |||
| 13 | Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so | 13 | Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so |
| 14 | remove it: floating-point is not supported in klibc | 14 | remove it: floating-point is not supported in klibc |
| 15 | 15 | ||
| 16 | Upstream-Status: Pending | 16 | Upstream-Status: Accepted |
| 17 | 17 | ||
| 18 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | 18 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> |
| 19 | --- | 19 | --- |
| @@ -81,5 +81,5 @@ index 898f57f..ba70c08 100644 | |||
| 81 | @param d Dictionary to search | 81 | @param d Dictionary to search |
| 82 | @param key Key string to look for | 82 | @param key Key string to look for |
| 83 | -- | 83 | -- |
| 84 | 1.9.1 | 84 | 2.7.4 |
| 85 | 85 | ||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch new file mode 100644 index 0000000000..36b012f901 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | From 41e7c76b0853bf5241b38b8167dfd57c27fef1eb Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Sun, 28 Jan 2018 21:47:59 +0100 | ||
| 4 | Subject: [PATCH 7/9] mtd-utils: common.c: convert to integer arithmetic | ||
| 5 | |||
| 6 | We use floating point just to print out KiB, MiB, GiB. | ||
| 7 | Avoid that to be klibc friendly. | ||
| 8 | |||
| 9 | Fixes compilation for aarch64 against klibc: | ||
| 10 | |||
| 11 | error: '-mgeneral-regs-only' is incompatible with floating-point argument | ||
| 12 | | printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); | ||
| 13 | etc. | ||
| 14 | |||
| 15 | Note: | ||
| 16 | * In the KiB case, we could apparently multiply by 100 before dividing | ||
| 17 | without risking overflow. This code simply avoids multiplications. | ||
| 18 | |||
| 19 | Upstream-Status: Submitted | ||
| 20 | |||
| 21 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 22 | --- | ||
| 23 | ubi-utils/ubiutils-common.c | 18 ++++++++++++------ | ||
| 24 | 1 file changed, 12 insertions(+), 6 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/ubi-utils/ubiutils-common.c b/ubi-utils/ubiutils-common.c | ||
| 27 | index 6609a6b..0ded2a4 100644 | ||
| 28 | --- a/ubi-utils/ubiutils-common.c | ||
| 29 | +++ b/ubi-utils/ubiutils-common.c | ||
| 30 | @@ -107,6 +107,9 @@ long long ubiutils_get_bytes(const char *str) | ||
| 31 | void ubiutils_print_bytes(long long bytes, int bracket) | ||
| 32 | { | ||
| 33 | const char *p; | ||
| 34 | + int GiB = 1024 * 1024 * 1024; | ||
| 35 | + int MiB = 1024 * 1024; | ||
| 36 | + int KiB = 1024; | ||
| 37 | |||
| 38 | if (bracket) | ||
| 39 | p = " ("; | ||
| 40 | @@ -115,12 +118,15 @@ void ubiutils_print_bytes(long long bytes, int bracket) | ||
| 41 | |||
| 42 | printf("%lld bytes", bytes); | ||
| 43 | |||
| 44 | - if (bytes > 1024 * 1024 * 1024) | ||
| 45 | - printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); | ||
| 46 | - else if (bytes > 1024 * 1024) | ||
| 47 | - printf("%s%.1f MiB", p, (double)bytes / (1024 * 1024)); | ||
| 48 | - else if (bytes > 1024 && bytes != 0) | ||
| 49 | - printf("%s%.1f KiB", p, (double)bytes / 1024); | ||
| 50 | + if (bytes > GiB) | ||
| 51 | + printf("%s%lld.%lld GiB", p, | ||
| 52 | + bytes / GiB, bytes % GiB / (GiB / 10)); | ||
| 53 | + else if (bytes > MiB) | ||
| 54 | + printf("%s%lld.%lld MiB", p, | ||
| 55 | + bytes / MiB, bytes % MiB / (MiB / 10)); | ||
| 56 | + else if (bytes > KiB && bytes != 0) | ||
| 57 | + printf("%s%lld.%lld KiB", p, | ||
| 58 | + bytes / KiB, bytes % KiB / (KiB / 10)); | ||
| 59 | else | ||
| 60 | return; | ||
| 61 | |||
| 62 | -- | ||
| 63 | 2.7.4 | ||
| 64 | |||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch new file mode 100644 index 0000000000..5bd05742c8 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | From e6f1a85c0a3df24fe3ca9a520dc697105e75a80c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Sat, 27 Jan 2018 09:39:26 +0100 | ||
| 4 | Subject: [PATCH 8/9] ubi-utils: ubiformat.c: convert to integer arithmetic | ||
| 5 | |||
| 6 | Do not cast percent to double, it is just used as upper limit. | ||
| 7 | Avoid floating point to fix compilation for aarch64 against klibc: | ||
| 8 | |||
| 9 | error: '-mgeneral-regs-only' is incompatible with floating-point code | ||
| 10 | | int percent = ((double)si->ok_cnt)/si->good_cnt * 100; | ||
| 11 | | ^~~~~~~ | ||
| 12 | |||
| 13 | Notes: | ||
| 14 | * The checks in the code above this line ensure that si->good_cnt is not 0. | ||
| 15 | |||
| 16 | * The code assumes si->good_cnt * 100 will not overflow, then we can use | ||
| 17 | (si->ok_cnt * 100) safely because the former is bigger. | ||
| 18 | |||
| 19 | * The truncated result does not affect the logic: | ||
| 20 | i.e. a value of 49.9 is truncated to 49 and is still <50. | ||
| 21 | |||
| 22 | Upstream-Status: Submitted | ||
| 23 | |||
| 24 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 25 | --- | ||
| 26 | ubi-utils/ubiformat.c | 2 +- | ||
| 27 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 28 | |||
| 29 | diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c | ||
| 30 | index 21409ca..d93164a 100644 | ||
| 31 | --- a/ubi-utils/ubiformat.c | ||
| 32 | +++ b/ubi-utils/ubiformat.c | ||
| 33 | @@ -843,7 +843,7 @@ int main(int argc, char * const argv[]) | ||
| 34 | } | ||
| 35 | |||
| 36 | if (!args.override_ec && si->empty_cnt < si->good_cnt) { | ||
| 37 | - int percent = ((double)si->ok_cnt)/si->good_cnt * 100; | ||
| 38 | + int percent = (si->ok_cnt * 100) / si->good_cnt; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Make sure the majority of eraseblocks have valid | ||
| 42 | -- | ||
| 43 | 2.7.4 | ||
| 44 | |||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch new file mode 100644 index 0000000000..658246add6 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch | |||
| @@ -0,0 +1,48 @@ | |||
| 1 | From 2229f3b9fd4bad47794c28e558ad273173cea73d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrea Adami <andrea.adami@gmail.com> | ||
| 3 | Date: Sat, 27 Jan 2018 09:52:46 +0100 | ||
| 4 | Subject: [PATCH 9/9] Eliminate warnings about implicit non-const casting in | ||
| 5 | libmtd | ||
| 6 | |||
| 7 | The mtd_get_dev_info1 function reads (among other things) name and type | ||
| 8 | string into coresponding struct mtd_dev_info fields. | ||
| 9 | |||
| 10 | The struct mtd_dev_info has the string fields marked const, requiring | ||
| 11 | them to be cast to non-const version during initialization. | ||
| 12 | |||
| 13 | This cast was previously omitted from the dev_read_data calls, | ||
| 14 | triggering warnings during compilation. | ||
| 15 | |||
| 16 | Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> | ||
| 17 | Signed-off-by: Richard Weinberger <richard@nod.at> | ||
| 18 | |||
| 19 | Upstream-Status: Backport | ||
| 20 | |||
| 21 | Signed-off-by: Andrea Adami <andrea.adami@gmail.com> | ||
| 22 | --- | ||
| 23 | lib/libmtd.c | 4 ++-- | ||
| 24 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/lib/libmtd.c b/lib/libmtd.c | ||
| 27 | index 60b4782..5f0bcbc 100644 | ||
| 28 | --- a/lib/libmtd.c | ||
| 29 | +++ b/lib/libmtd.c | ||
| 30 | @@ -746,13 +746,13 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd) | ||
| 31 | if (dev_get_major(lib, mtd_num, &mtd->major, &mtd->minor)) | ||
| 32 | return -1; | ||
| 33 | |||
| 34 | - ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name, | ||
| 35 | + ret = dev_read_data(lib->mtd_name, mtd_num, (char *)&mtd->name, | ||
| 36 | MTD_NAME_MAX + 1); | ||
| 37 | if (ret < 0) | ||
| 38 | return -1; | ||
| 39 | ((char *)mtd->name)[ret - 1] = '\0'; | ||
| 40 | |||
| 41 | - ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str, | ||
| 42 | + ret = dev_read_data(lib->mtd_type, mtd_num, (char *)&mtd->type_str, | ||
| 43 | MTD_TYPE_MAX + 1); | ||
| 44 | if (ret < 0) | ||
| 45 | return -1; | ||
| 46 | -- | ||
| 47 | 2.7.4 | ||
| 48 | |||
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb index 518c02fc00..abb0d4b846 100644 --- a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc_1.5.2.bb | |||
| @@ -11,12 +11,15 @@ inherit klibc | |||
| 11 | 11 | ||
| 12 | SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1" | 12 | SRCREV = "aea36417067dade75192bafa03af70b6eb2677b1" |
| 13 | SRC_URI = "git://git.infradead.org/mtd-utils.git \ | 13 | SRC_URI = "git://git.infradead.org/mtd-utils.git \ |
| 14 | file://0001-Makefile-only-build-ubi-utils.patch \ | 14 | file://0001-Makefile-build-ubi-utils-only.patch \ |
| 15 | file://0002-common.mk-for-klibc-CC-is-klcc.patch \ | 15 | file://0002-common.mk-for-klibc-CC-is-klcc.patch \ |
| 16 | file://0003-libubi.c-add-klibc-specific-fixes.patch \ | 16 | file://0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch \ |
| 17 | file://0004-common.h-klibc-fixes-1.patch \ | 17 | file://0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch \ |
| 18 | file://0005-common.h-klibc-fixes-2.patch \ | 18 | file://0005-common.h-more-workarounds-for-klibc-compatibility.patch \ |
| 19 | file://0006-libiniparser-remove-unused-function-needing-float.patch \ | 19 | file://0006-libiniparser-remove-unused-function-needing-float.patch \ |
| 20 | file://0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch \ | ||
| 21 | file://0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch \ | ||
| 22 | file://0009-Eliminate-warnings-about-implicit-non-const-casting-.patch \ | ||
| 20 | " | 23 | " |
| 21 | 24 | ||
| 22 | S = "${WORKDIR}/git/" | 25 | S = "${WORKDIR}/git/" |
