mtd-utils: Backport and create patches to support musl

(From OE-Core rev: 9a4ab3b1ad45a556b845530a12ec865be2278c78)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Khem Raj 2015-11-18 23:24:32 +00:00 committed by Richard Purdie
parent 41fd73fe65
commit 36a709aa0f
4 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,53 @@
From e16fa28bc57c29923ab60af2ac343da83e1992d8 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 6 Oct 2015 23:51:34 +0000
Subject: [PATCH] Fix build with musl
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
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 <byteswap.h>
#include <crc32.h>
#include <inttypes.h>
+#include <limits.h>
#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 <errno.h>
-#include <error.h>
#include <stdio.h>
#include <netdb.h>
#include <stdlib.h>
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 <time.h>
#include <errno.h>
-#include <error.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
--
2.6.1

View File

@ -0,0 +1,56 @@
From 26cc709291fc6c5d2e45b26c602407706d9142df Mon Sep 17 00:00:00 2001
From: Imre Kaloz <kaloz@openwrt.org>
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 <kaloz@openwrt.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
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 <sys/time.h>
#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

View File

@ -0,0 +1,24 @@
Replace rpmatch() usage with checking first character of line
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- 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;
}

View File

@ -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