From 36a709aa0f232a1887cf60f2eaf0a44fdd707ecd Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 18 Nov 2015 23:24:32 +0000 Subject: mtd-utils: Backport and create patches to support musl (From OE-Core rev: 9a4ab3b1ad45a556b845530a12ec865be2278c78) Signed-off-by: Khem Raj Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- .../mtd/mtd-utils/0001-Fix-build-with-musl.patch | 53 ++++++++++++++++++++ ...ibfec-use-standard-C-type-instead-of-u_lo.patch | 56 ++++++++++++++++++++++ .../mtd/mtd-utils/010-fix-rpmatch.patch | 24 ++++++++++ meta/recipes-devtools/mtd/mtd-utils_git.bb | 4 ++ 4 files changed, 137 insertions(+) create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch create mode 100644 meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch create mode 100644 meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch (limited to 'meta/recipes-devtools/mtd') diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch new file mode 100644 index 0000000000..d3699c65d6 --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/0001-Fix-build-with-musl.patch @@ -0,0 +1,53 @@ +From e16fa28bc57c29923ab60af2ac343da83e1992d8 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Tue, 6 Oct 2015 23:51:34 +0000 +Subject: [PATCH] Fix build with musl + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + mkfs.jffs2.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- + recv_image.c | 1 - + serve_image.c | 1 - + 3 files changed, 42 insertions(+), 4 deletions(-) + +diff --git a/mkfs.jffs2.c b/mkfs.jffs2.c +index f09c0b2..ed2dc43 100644 +--- a/mkfs.jffs2.c ++++ b/mkfs.jffs2.c +@@ -72,6 +72,7 @@ + #include + #include + #include ++#include + + #include "rbtree.h" + #include "common.h" +diff --git a/recv_image.c b/recv_image.c +index 26a8361..0093831 100644 +--- a/recv_image.c ++++ b/recv_image.c +@@ -4,7 +4,6 @@ + #define _BSD_SOURCE /* struct ip_mreq */ + + #include +-#include + #include + #include + #include +diff --git a/serve_image.c b/serve_image.c +index 38549a1..4f0e946 100644 +--- a/serve_image.c ++++ b/serve_image.c +@@ -3,7 +3,6 @@ + + #include + #include +-#include + #include + #include + #include +-- +2.6.1 + diff --git a/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch new file mode 100644 index 0000000000..46ed956d0e --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch @@ -0,0 +1,56 @@ +From 26cc709291fc6c5d2e45b26c602407706d9142df Mon Sep 17 00:00:00 2001 +From: Imre Kaloz +Date: Mon, 4 May 2015 15:36:34 +0200 +Subject: [PATCH] mtd-utils: libfec: use standard C type instead of u_long + +Fixes compilation on hosts with the musl C library. +Also drops the unused u_short typedef. + +Signed-off-by: Imre Kaloz +Signed-off-by: Brian Norris +--- +Upstream-Status: Backport + + lib/libfec.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/lib/libfec.c b/lib/libfec.c +index ff5a127..bf68381 100644 +--- a/lib/libfec.c ++++ b/lib/libfec.c +@@ -61,8 +61,6 @@ struct timeval { + }; + #define gettimeofday(x, dummy) { (x)->ticks = clock() ; } + #define DIFF_T(a,b) (1+ 1000000*(a.ticks - b.ticks) / CLOCKS_PER_SEC ) +-typedef unsigned long u_long ; +-typedef unsigned short u_short ; + #else /* typically, unix systems */ + #include + #define DIFF_T(a,b) \ +@@ -75,12 +73,12 @@ typedef unsigned short u_short ; + t = x.tv_usec + 1000000* (x.tv_sec & 0xff ) ; \ + } + #define TOCK(t) \ +- { u_long t1 ; TICK(t1) ; \ ++ { unsigned long t1 ; TICK(t1) ; \ + if (t1 < t) t = 256000000 + t1 - t ; \ + else t = t1 - t ; \ + if (t == 0) t = 1 ;} + +-u_long ticks[10]; /* vars for timekeeping */ ++unsigned long ticks[10]; /* vars for timekeeping */ + #else + #define DEB(x) + #define DDB(x) +@@ -625,7 +623,7 @@ init_fec(void) + #define FEC_MAGIC 0xFECC0DEC + + struct fec_parms { +- u_long magic ; ++ unsigned long magic ; + int k, n ; /* parameters of the code */ + gf *enc_matrix ; + } ; +-- +2.6.0 + diff --git a/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch b/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch new file mode 100644 index 0000000000..7d783e7a5c --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/010-fix-rpmatch.patch @@ -0,0 +1,24 @@ +Replace rpmatch() usage with checking first character of line + +Upstream-Status: Pending +Signed-off-by: Khem Raj + +--- a/include/common.h ++++ b/include/common.h +@@ -122,10 +122,12 @@ + } + + if (strcmp("\n", line) != 0) { +- switch (rpmatch(line)) { +- case 0: ret = false; break; +- case 1: ret = true; break; +- case -1: ++ switch (line[0]) { ++ case 'N': ++ case 'n': ret = false; break; ++ case 'Y': ++ case 'y': ret = true; break; ++ default: + puts("unknown response; please try again"); + continue; + } diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb index 17dca77609..bc15ddd82c 100644 --- a/meta/recipes-devtools/mtd/mtd-utils_git.bb +++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb @@ -15,8 +15,12 @@ SRC_URI = "git://git.infradead.org/mtd-utils.git \ file://fix-armv7-neon-alignment.patch \ file://0001-hashtable-Remove-duplicate-hashtable_iterator_value-.patch \ file://mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch \ + file://0001-Fix-build-with-musl.patch \ + file://0001-mtd-utils-libfec-use-standard-C-type-instead-of-u_lo.patch \ " +SRC_URI_append_libc-musl = " file://010-fix-rpmatch.patch " + S = "${WORKDIR}/git/" # xattr support creates an additional compile-time dependency on acl because -- cgit v1.2.3-54-g00ecf