From 1a4b7ee28bf7413af6513fb45ad0d0736048f866 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Sun, 16 Dec 2018 17:11:34 -0800 Subject: reset upstream subtrees to yocto 2.6 Reset the following subtrees on thud HEAD: poky: 87e3a9739d meta-openembedded: 6094ae18c8 meta-security: 31dc4e7532 meta-raspberrypi: a48743dc36 meta-xilinx: c42016e2e6 Also re-apply backports that didn't make it into thud: poky: 17726d0 systemd-systemctl-native: handle Install wildcards meta-openembedded: 4321a5d libtinyxml2: update to 7.0.1 042f0a3 libcereal: Add native and nativesdk classes e23284f libcereal: Allow empty package 030e8d4 rsyslog: curl-less build with fmhttp PACKAGECONFIG 179a1b9 gtest: update to 1.8.1 Squashed OpenBMC subtree compatibility updates: meta-aspeed: Brad Bishop (1): aspeed: add yocto 2.6 compatibility meta-ibm: Brad Bishop (1): ibm: prepare for yocto 2.6 meta-ingrasys: Brad Bishop (1): ingrasys: set layer compatibility to yocto 2.6 meta-openpower: Brad Bishop (1): openpower: set layer compatibility to yocto 2.6 meta-phosphor: Brad Bishop (3): phosphor: set layer compatibility to thud phosphor: libgpg-error: drop patches phosphor: react to fitimage artifact rename Ed Tanous (4): Dropbear: upgrade options for latest upgrade yocto2.6: update openssl options busybox: remove upstream watchdog patch systemd: Rebase CONFIG_CGROUP_BPF patch Change-Id: I7b1fe71cca880d0372a82d94b5fd785323e3a9e7 Signed-off-by: Brad Bishop --- .../0001-Makefile-build-ubi-utils-only.patch | 87 --------------------- .../0002-common.mk-for-klibc-CC-is-klcc.patch | 27 ------- ...bubi.c-add-klibc-specific-fixes-for-ioctl.patch | 76 ------------------- ...patibility-to-dietlibc-klibc-musl-libc-af.patch | 88 ---------------------- ...-more-workarounds-for-klibc-compatibility.patch | 52 ------------- ...rser-remove-unused-function-needing-float.patch | 85 --------------------- ...ls-common.c-convert-to-integer-arithmetic.patch | 64 ---------------- ...ubiformat.c-convert-to-integer-arithmetic.patch | 44 ----------- ...arnings-about-implicit-non-const-casting-.patch | 48 ------------ 9 files changed, 571 deletions(-) delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch delete mode 100644 meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch (limited to 'meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2') diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch deleted file mode 100644 index 6ac2cca9d..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0001-Makefile-build-ubi-utils-only.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 1c989e4c36d0bf76ab444f984bc73b98eeacd03f Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 29 Jun 2014 00:32:29 +0200 -Subject: [PATCH 1/9] Makefile: build ubi-utils only - -We build all the static ubi-utils but actually only ubiattach is needed in -a minimalistic initramfs for the mount of ubi volumes. - -More fixes are needed in order to build the full mtd-utils. -The first issue is: - -| mkfs.jffs2.c:64:20: fatal error: libgen.h: No such file or directory -| #include - -Removing the include then the second error is: - -| mkfs.jffs2.c:1570:22: error: '_SC_PAGESIZE' undeclared -| (first use in this function) -| page_size = sysconf(_SC_PAGESIZE); - -Upstream-Status: Inappropriate [embedded specific] - -Signed-off-by: Andrea Adami ---- - Makefile | 26 ++------------------------ - 1 file changed, 2 insertions(+), 24 deletions(-) - -diff --git a/Makefile b/Makefile -index 3ce8587..8b79f71 100644 ---- a/Makefile -+++ b/Makefile -@@ -16,28 +16,11 @@ endif - - TESTS = tests - --MTD_BINS = \ -- ftl_format flash_erase nanddump doc_loadbios \ -- ftl_check mkfs.jffs2 flash_lock flash_unlock \ -- flash_otp_info flash_otp_dump flash_otp_lock flash_otp_write \ -- mtd_debug flashcp nandwrite nandtest mtdpart \ -- jffs2dump \ -- nftldump nftl_format docfdisk \ -- rfddump rfdformat \ -- serve_image recv_image \ -- sumtool jffs2reader - UBI_BINS = \ - ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ - ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock - --BINS = $(MTD_BINS) --BINS += mkfs.ubifs/mkfs.ubifs --BINS += $(addprefix ubi-utils/,$(UBI_BINS)) --SCRIPTS = flash_eraseall -- --TARGETS = $(BINS) --TARGETS += lib/libmtd.a --TARGETS += ubi-utils/libubi.a -+BINS = $(addprefix ubi-utils/,$(UBI_BINS)) - - OBJDEPS = $(BUILDDIR)/include/version.h - -@@ -61,12 +44,9 @@ endif - rm -f $(BUILDDIR)/include/version.h - $(MAKE) -C $(TESTS) clean - --install:: $(addprefix $(BUILDDIR)/,${BINS}) ${SCRIPTS} -+install:: $(addprefix $(BUILDDIR)/,${BINS}) - mkdir -p ${DESTDIR}/${SBINDIR} - install -m 0755 $^ ${DESTDIR}/${SBINDIR}/ -- mkdir -p ${DESTDIR}/${MANDIR}/man1 -- install -m 0644 mkfs.jffs2.1 ${DESTDIR}/${MANDIR}/man1/ -- -gzip -9f ${DESTDIR}/${MANDIR}/man1/*.1 - - tests:: - $(MAKE) -C $(TESTS) -@@ -91,8 +71,6 @@ LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) - LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) - LDLIBS_jffs2reader = -lz $(LZOLDLIBS) - --$(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) -- - # - # Common libmtd - # --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch deleted file mode 100644 index c23d11f0b..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0002-common.mk-for-klibc-CC-is-klcc.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 89c76bbe82a2029a25b0654eb0a1d0b22d6e6877 Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 29 Jun 2014 00:37:28 +0200 -Subject: [PATCH 2/9] common.mk: for klibc $(CC) is klcc - -Do not hardcode: assign the value to the variable if it is not already defined. - -Upstream-Status: Submitted - -Signed-off-by: Andrea Adami ---- - common.mk | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/common.mk b/common.mk -index ba87377..126d11a 100644 ---- a/common.mk -+++ b/common.mk -@@ -1,4 +1,4 @@ --CC := $(CROSS)gcc -+CC ?= $(CROSS)gcc - AR := $(CROSS)ar - RANLIB := $(CROSS)ranlib - --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch deleted file mode 100644 index 9ad4a5b99..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0003-libubi.c-add-klibc-specific-fixes-for-ioctl.patch +++ /dev/null @@ -1,76 +0,0 @@ -From fecbb7056d621a30f7106e67f5fe209763571b70 Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 29 Jun 2014 00:40:15 +0200 -Subject: [PATCH 3/9] libubi.c: add klibc specific fixes for ioctl - -First issue is that ioctl() in klibc doesn't expect a constant as arg3. -Second issue is that arg3 in klibc ioctl() implementation is not optional. - -Fixes: - -| ubi-utils/libubi.c: In function 'do_attach': -| ubi-utils/libubi.c:698:8: warning: passing argument 3 of 'ioctl' discards -| 'const' qualifier from pointer target type -| ret = ioctl(fd, UBI_IOCATT, r); -| ^ -| In file included from ubi-utils/libubi.c:32:0: -| .../lib/klibc/include/sys/ioctl.h:15:14: note: expected 'void *' but argument -| is of type 'const struct ubi_attach_req *' -| __extern int ioctl(int, int, void *); -| ^ - -| ubi-utils/libubi.c: In function 'ubi_vol_block_create': -| ubi-utils/libubi.c:1118:9: error: too few arguments to function 'ioctl' -| return ioctl(fd, UBI_IOCVOLCRBLK); -| ^ -| In file included from ubi-utils/libubi.c:32:0: -| .../lib/klibc/include/sys/ioctl.h:15:14: note: declared here -| __extern int ioctl(int, int, void *); -| ^ -| ubi-utils/libubi.c: In function 'ubi_vol_block_remove': -| ubi-utils/libubi.c:1123:9: error: too few arguments to function 'ioctl' -| return ioctl(fd, UBI_IOCVOLRMBLK); -| ^ -| In file included from ubi-utils/libubi.c:32:0: -| .../usr/lib/klibc/include/sys/ioctl.h:15:14: note: declared here -| __extern int ioctl(int, int, void *); -| ^ - -Upstream-Status: Accepted - -Signed-off-by: Andrea Adami ---- - ubi-utils/libubi.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/ubi-utils/libubi.c b/ubi-utils/libubi.c -index 97c0434..2b49833 100644 ---- a/ubi-utils/libubi.c -+++ b/ubi-utils/libubi.c -@@ -687,7 +687,7 @@ void libubi_close(libubi_t desc) - * success and %-1 in case of failure. @r->ubi_num contains newly created UBI - * device number. - */ --static int do_attach(const char *node, const struct ubi_attach_req *r) -+static int do_attach(const char *node, struct ubi_attach_req *r) - { - int fd, ret; - -@@ -1115,12 +1115,12 @@ int ubi_rsvol(libubi_t desc, const char *node, int vol_id, long long bytes) - - int ubi_vol_block_create(int fd) - { -- return ioctl(fd, UBI_IOCVOLCRBLK); -+ return ioctl(fd, UBI_IOCVOLCRBLK, NULL); - } - - int ubi_vol_block_remove(int fd) - { -- return ioctl(fd, UBI_IOCVOLRMBLK); -+ return ioctl(fd, UBI_IOCVOLRMBLK, NULL); - } - - int ubi_update_start(libubi_t desc, int fd, long long bytes) --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch deleted file mode 100644 index 2f31fb4a2..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0004-Restore-compatibility-to-dietlibc-klibc-musl-libc-af.patch +++ /dev/null @@ -1,88 +0,0 @@ -From b668cb75cb7e72ff92055209130d4cd4b3cacbdb Mon Sep 17 00:00:00 2001 -From: Thorsten Glaser -Date: Fri, 20 Jun 2014 10:56:27 +0000 -Subject: [PATCH 4/9] Restore compatibility to dietlibc, klibc, musl libc after - commit 4f1b108 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Each C library has their own way to define off_t, and the -header is nonstandard and specific to the GNU libc and those that clone -it (uClibc). Fefe’s dietlibc uses different flags, and klibc always uses -a 64-bit off_t (like the BSDs); musl libc cannot be recognised using cpp -instructions, so we assume 64 bit there (and on unknown C libraries) and -leave it to the user to submit a follow-up fix if we guess wrong. I also -added a static assertion to verify the 64 bit guess is correct. - -It would be really better using a configure script for this instead. - -Fixes: -| CC lib/libmtd.o -| In file included from ubi-utils/ubiutils-common.c:35:0: -| ./include/common.h:29:22: fatal error: features.h: No such file or directory -| #include -| ^ -| compilation terminated. - -Upstream-Status: Submitted - -Signed-off-by: Thorsten Glaser -Signed-off-by: Andrea Adami ---- - include/common.h | 24 ++++++++++++++++++++++++ - 1 file changed, 24 insertions(+) - -diff --git a/include/common.h b/include/common.h -index fb0ca83..5a20964 100644 ---- a/include/common.h -+++ b/include/common.h -@@ -26,7 +26,9 @@ - #include - #include - #include -+#if defined(__GLIBC__) || defined(__UCLIBC__) - #include -+#endif - #include - #include "version.h" - -@@ -67,6 +69,21 @@ extern "C" { - #endif - - /* define a print format specifier for off_t */ -+#if defined(__KLIBC__) -+/* always 64 bit on klibc */ -+#define PRIxoff_t PRIx64 -+#define PRIdoff_t PRId64 -+#elif defined(__dietlibc__) -+/* depends on compiler flags on dietlibc */ -+#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) -+#define PRIxoff_t PRIx64 -+#define PRIdoff_t PRId64 -+#else -+#define PRIxoff_t "l"PRIx32 -+#define PRIdoff_t "l"PRId32 -+#endif -+#elif defined(__GLIBC__) || defined(__UCLIBC__) -+/* depends on compiler flags on glibc and uClibc */ - #ifdef __USE_FILE_OFFSET64 - #define PRIxoff_t PRIx64 - #define PRIdoff_t PRId64 -@@ -74,6 +91,13 @@ extern "C" { - #define PRIxoff_t "l"PRIx32 - #define PRIdoff_t "l"PRId32 - #endif -+#else -+/* unknown libc or musl */ -+#define PRIxoff_t PRIx64 -+#define PRIdoff_t PRId64 -+/* verify our guess of 64 bit is correct */ -+static char __PRIxoff_t_static_assert[sizeof(off_t) == 8 ? 1 : -1]; -+#endif - - /* Verbose messages */ - #define bareverbose(verbose, fmt, ...) do { \ --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch deleted file mode 100644 index 8309a7271..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0005-common.h-more-workarounds-for-klibc-compatibility.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 5d4a66b502003ef385dab31a17012246407e7364 Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 29 Jun 2014 00:44:03 +0200 -Subject: [PATCH 5/9] common.h: more workarounds for klibc compatibility - -Patch is addressing two issues: -* First, Klibc doesn't have rpmatch(). -* Second, Klibc lacks getline() - -Fixes: -| LD ubi-utils/ubiformat -| .../git/ubi-utils/ubiformat.o: In function `prompt': -| .../git/./include/common.h:157: undefined reference to `getline' -| .../git/./include/common.h:164: undefined reference to `rpmatch' -| .../git/./include/common.h:157: undefined reference to `getline' -| .../git/./include/common.h:164: undefined reference to `rpmatch' - -Upstream-Status: Submitted - -Signed-off-by: Andrea Adami ---- - include/common.h | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/include/common.h b/include/common.h -index 5a20964..2f51e1c 100644 ---- a/include/common.h -+++ b/include/common.h -@@ -161,15 +161,17 @@ static inline int __rpmatch(const char *resp) - */ - static inline bool prompt(const char *msg, bool def) - { -- char *line = NULL; -- size_t len; -+ char *line; - bool ret = def; - -+ const int sizeof_line = 2; -+ line = malloc(sizeof_line); -+ - do { - normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N'); - fflush(stdout); - -- while (getline(&line, &len, stdin) == -1) { -+ while (fgets(line, sizeof_line, stdin) == NULL) { - printf("failed to read prompt; assuming '%s'\n", - def ? "yes" : "no"); - break; --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch deleted file mode 100644 index d046f9505..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0006-libiniparser-remove-unused-function-needing-float.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 2af30e9b2988111e45ed6ea6af55e49ec7cb1cb1 Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 29 Jun 2014 00:44:57 +0200 -Subject: [PATCH 6/9] libiniparser: remove unused function needing float - -Fixes: -| LD ubi-utils/ubiformat -| .../git/ubi-utils/libiniparser.a(libiniparser.o): In function -| ` LD ubi-utils/ubirename -| iniparser_getdouble': -| .../git/ubi-utils/libiniparser.c:336: undefined reference to `atof' - -Grep doesn't reveal any occurrence of iniparser_getdouble(), using atof() so -remove it: floating-point is not supported in klibc - -Upstream-Status: Accepted - -Signed-off-by: Andrea Adami ---- - ubi-utils/include/libiniparser.h | 15 --------------- - ubi-utils/libiniparser.c | 22 ---------------------- - 2 files changed, 37 deletions(-) - -diff --git a/ubi-utils/include/libiniparser.h b/ubi-utils/include/libiniparser.h -index be3c667..abd77aa 100644 ---- a/ubi-utils/include/libiniparser.h -+++ b/ubi-utils/include/libiniparser.h -@@ -158,21 +158,6 @@ int iniparser_getint(dictionary * d, const char * key, int notfound); - - /*-------------------------------------------------------------------------*/ - /** -- @brief Get the string associated to a key, convert to a double -- @param d Dictionary to search -- @param key Key string to look for -- @param notfound Value to return in case of error -- @return double -- -- This function queries a dictionary for a key. A key as read from an -- ini file is given as "section:key". If the key cannot be found, -- the notfound value is returned. -- */ --/*--------------------------------------------------------------------------*/ --double iniparser_getdouble(dictionary * d, char * key, double notfound); -- --/*-------------------------------------------------------------------------*/ --/** - @brief Get the string associated to a key, convert to a boolean - @param d Dictionary to search - @param key Key string to look for -diff --git a/ubi-utils/libiniparser.c b/ubi-utils/libiniparser.c -index 898f57f..ba70c08 100644 ---- a/ubi-utils/libiniparser.c -+++ b/ubi-utils/libiniparser.c -@@ -316,28 +316,6 @@ int iniparser_getint(dictionary * d, const char * key, int notfound) - - /*-------------------------------------------------------------------------*/ - /** -- @brief Get the string associated to a key, convert to a double -- @param d Dictionary to search -- @param key Key string to look for -- @param notfound Value to return in case of error -- @return double -- -- This function queries a dictionary for a key. A key as read from an -- ini file is given as "section:key". If the key cannot be found, -- the notfound value is returned. -- */ --/*--------------------------------------------------------------------------*/ --double iniparser_getdouble(dictionary * d, char * key, double notfound) --{ -- char * str ; -- -- str = iniparser_getstring(d, key, INI_INVALID_KEY); -- if (str==INI_INVALID_KEY) return notfound ; -- return atof(str); --} -- --/*-------------------------------------------------------------------------*/ --/** - @brief Get the string associated to a key, convert to a boolean - @param d Dictionary to search - @param key Key string to look for --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch deleted file mode 100644 index 36b012f90..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0007-mtd-utils-common.c-convert-to-integer-arithmetic.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 41e7c76b0853bf5241b38b8167dfd57c27fef1eb Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sun, 28 Jan 2018 21:47:59 +0100 -Subject: [PATCH 7/9] mtd-utils: common.c: convert to integer arithmetic - -We use floating point just to print out KiB, MiB, GiB. -Avoid that to be klibc friendly. - -Fixes compilation for aarch64 against klibc: - -error: '-mgeneral-regs-only' is incompatible with floating-point argument -| printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); -etc. - -Note: -* In the KiB case, we could apparently multiply by 100 before dividing - without risking overflow. This code simply avoids multiplications. - -Upstream-Status: Submitted - -Signed-off-by: Andrea Adami ---- - ubi-utils/ubiutils-common.c | 18 ++++++++++++------ - 1 file changed, 12 insertions(+), 6 deletions(-) - -diff --git a/ubi-utils/ubiutils-common.c b/ubi-utils/ubiutils-common.c -index 6609a6b..0ded2a4 100644 ---- a/ubi-utils/ubiutils-common.c -+++ b/ubi-utils/ubiutils-common.c -@@ -107,6 +107,9 @@ long long ubiutils_get_bytes(const char *str) - void ubiutils_print_bytes(long long bytes, int bracket) - { - const char *p; -+ int GiB = 1024 * 1024 * 1024; -+ int MiB = 1024 * 1024; -+ int KiB = 1024; - - if (bracket) - p = " ("; -@@ -115,12 +118,15 @@ void ubiutils_print_bytes(long long bytes, int bracket) - - printf("%lld bytes", bytes); - -- if (bytes > 1024 * 1024 * 1024) -- printf("%s%.1f GiB", p, (double)bytes / (1024 * 1024 * 1024)); -- else if (bytes > 1024 * 1024) -- printf("%s%.1f MiB", p, (double)bytes / (1024 * 1024)); -- else if (bytes > 1024 && bytes != 0) -- printf("%s%.1f KiB", p, (double)bytes / 1024); -+ if (bytes > GiB) -+ printf("%s%lld.%lld GiB", p, -+ bytes / GiB, bytes % GiB / (GiB / 10)); -+ else if (bytes > MiB) -+ printf("%s%lld.%lld MiB", p, -+ bytes / MiB, bytes % MiB / (MiB / 10)); -+ else if (bytes > KiB && bytes != 0) -+ printf("%s%lld.%lld KiB", p, -+ bytes / KiB, bytes % KiB / (KiB / 10)); - else - return; - --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch deleted file mode 100644 index 5bd05742c..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0008-ubi-utils-ubiformat.c-convert-to-integer-arithmetic.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e6f1a85c0a3df24fe3ca9a520dc697105e75a80c Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sat, 27 Jan 2018 09:39:26 +0100 -Subject: [PATCH 8/9] ubi-utils: ubiformat.c: convert to integer arithmetic - -Do not cast percent to double, it is just used as upper limit. -Avoid floating point to fix compilation for aarch64 against klibc: - -error: '-mgeneral-regs-only' is incompatible with floating-point code -| int percent = ((double)si->ok_cnt)/si->good_cnt * 100; -| ^~~~~~~ - -Notes: -* The checks in the code above this line ensure that si->good_cnt is not 0. - -* The code assumes si->good_cnt * 100 will not overflow, then we can use - (si->ok_cnt * 100) safely because the former is bigger. - -* The truncated result does not affect the logic: - i.e. a value of 49.9 is truncated to 49 and is still <50. - -Upstream-Status: Submitted - -Signed-off-by: Andrea Adami ---- - ubi-utils/ubiformat.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c -index 21409ca..d93164a 100644 ---- a/ubi-utils/ubiformat.c -+++ b/ubi-utils/ubiformat.c -@@ -843,7 +843,7 @@ int main(int argc, char * const argv[]) - } - - if (!args.override_ec && si->empty_cnt < si->good_cnt) { -- int percent = ((double)si->ok_cnt)/si->good_cnt * 100; -+ int percent = (si->ok_cnt * 100) / si->good_cnt; - - /* - * Make sure the majority of eraseblocks have valid --- -2.7.4 - diff --git a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch b/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch deleted file mode 100644 index 658246add..000000000 --- a/meta-openembedded/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-1.5.2/0009-Eliminate-warnings-about-implicit-non-const-casting-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 2229f3b9fd4bad47794c28e558ad273173cea73d Mon Sep 17 00:00:00 2001 -From: Andrea Adami -Date: Sat, 27 Jan 2018 09:52:46 +0100 -Subject: [PATCH 9/9] Eliminate warnings about implicit non-const casting in - libmtd - -The mtd_get_dev_info1 function reads (among other things) name and type -string into coresponding struct mtd_dev_info fields. - -The struct mtd_dev_info has the string fields marked const, requiring -them to be cast to non-const version during initialization. - -This cast was previously omitted from the dev_read_data calls, -triggering warnings during compilation. - -Signed-off-by: David Oberhollenzer -Signed-off-by: Richard Weinberger - -Upstream-Status: Backport - -Signed-off-by: Andrea Adami ---- - lib/libmtd.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/lib/libmtd.c b/lib/libmtd.c -index 60b4782..5f0bcbc 100644 ---- a/lib/libmtd.c -+++ b/lib/libmtd.c -@@ -746,13 +746,13 @@ int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd) - if (dev_get_major(lib, mtd_num, &mtd->major, &mtd->minor)) - return -1; - -- ret = dev_read_data(lib->mtd_name, mtd_num, &mtd->name, -+ ret = dev_read_data(lib->mtd_name, mtd_num, (char *)&mtd->name, - MTD_NAME_MAX + 1); - if (ret < 0) - return -1; - ((char *)mtd->name)[ret - 1] = '\0'; - -- ret = dev_read_data(lib->mtd_type, mtd_num, &mtd->type_str, -+ ret = dev_read_data(lib->mtd_type, mtd_num, (char *)&mtd->type_str, - MTD_TYPE_MAX + 1); - if (ret < 0) - return -1; --- -2.7.4 - -- cgit v1.2.1