diff options
Diffstat (limited to 'meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2')
4 files changed, 585 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0001-Add-simple-getline-implementation-to-libmissing.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0001-Add-simple-getline-implementation-to-libmissing.patch new file mode 100644 index 0000000000..d4c6d87551 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0001-Add-simple-getline-implementation-to-libmissing.patch @@ -0,0 +1,187 @@ +From 10c289454dad34632d767694aecb508dae5073bf Mon Sep 17 00:00:00 2001 +From: David Oberhollenzer <david.oberhollenzer@sigma-star.at> +Date: Thu, 1 Feb 2018 12:16:18 +0100 +Subject: [PATCH 1/4] Add simple getline() implementation to libmissing + +Some C libraries, like klibc don't implement getline(). This patch +adds a simple stub implementation to libmissing that does an fgets +into a stack allocated buffer and returns the result. + +Upstream-Status: Backport + +Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> +--- + configure.ac | 1 + + include/common.h | 1 + + include/libmissing.h | 7 +++++++ + jffsX-utils/Makemodule.am | 2 +- + lib/Makemodule.am | 3 ++- + lib/getline.c | 36 ++++++++++++++++++++++++++++++++++++ + misc-utils/Makemodule.am | 2 ++ + ubi-utils/Makemodule.am | 2 +- + ubifs-utils/Makemodule.am | 1 + + 9 files changed, 52 insertions(+), 3 deletions(-) + create mode 100644 lib/getline.c + +diff --git a/configure.ac b/configure.ac +index 83d754f..5af0115 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -191,6 +191,7 @@ if test "x$need_cmocka" = "xyes"; then + fi + + AC_CHECK_HEADERS([execinfo.h]) ++AC_CHECK_FUNCS([getline]) + + ##### produce summary on dependencies ##### + +diff --git a/include/common.h b/include/common.h +index 2ce5d22..f8f72ea 100644 +--- a/include/common.h ++++ b/include/common.h +@@ -32,6 +32,7 @@ + #include <sys/sysmacros.h> + + #include "config.h" ++#include "libmissing.h" + + #ifndef PROGRAM_NAME + # error "You must define PROGRAM_NAME before including this header" +diff --git a/include/libmissing.h b/include/libmissing.h +index 0196033..09dbce1 100644 +--- a/include/libmissing.h ++++ b/include/libmissing.h +@@ -7,11 +7,18 @@ + #include <execinfo.h> + #endif + ++#include <sys/types.h> ++#include <stdio.h> ++ + #ifndef HAVE_EXECINFO_H + int backtrace(void **buffer, int size); + char **backtrace_symbols(void *const *buffer, int size); + void backtrace_symbols_fd(void *const *buffer, int size, int fd); + #endif + ++#ifndef HAVE_GETLINE ++ssize_t getline(char **lineptr, size_t *n, FILE *stream); ++#endif ++ + #endif /* LIBMISSING_H */ + +diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am +index fb181de..9d7a5d9 100644 +--- a/jffsX-utils/Makemodule.am ++++ b/jffsX-utils/Makemodule.am +@@ -17,7 +17,7 @@ jffs2dump_SOURCES = jffsX-utils/jffs2dump.c + jffs2dump_LDADD = libmtd.a $(ZLIB_LIBS) $(LZO_LIBS) + + sumtool_SOURCES = jffsX-utils/sumtool.c +-sumtool_LDADD = libmtd.a ++sumtool_LDADD = libmtd.a libmissing.a + + JFFSX_BINS = \ + mkfs.jffs2 jffs2dump jffs2reader sumtool +diff --git a/lib/Makemodule.am b/lib/Makemodule.am +index 5bee5b6..645632a 100644 +--- a/lib/Makemodule.am ++++ b/lib/Makemodule.am +@@ -7,7 +7,8 @@ libmtd_a_SOURCES = \ + lib/libmtd_int.h + + libmissing_a_SOURCES = \ +- lib/execinfo.c ++ lib/execinfo.c \ ++ lib/getline.c + + libubi_a_SOURCES = \ + lib/libubi.c \ +diff --git a/lib/getline.c b/lib/getline.c +new file mode 100644 +index 0000000..c575bf7 +--- /dev/null ++++ b/lib/getline.c +@@ -0,0 +1,36 @@ ++#include <stdlib.h> ++#include <string.h> ++ ++#include "libmissing.h" ++ ++#ifndef HAVE_GETLINE ++ssize_t getline(char **lineptr, size_t *n, FILE *stream) ++{ ++ char buffer[256], *new; ++ size_t count; ++ ++ if (!(*lineptr)) ++ *n = 0; ++ ++ if (!fgets(buffer, sizeof(buffer), stream)) { ++ if (!feof(stream)) ++ return -1; ++ ++ buffer[0] = '\0'; ++ } ++ ++ count = strlen(buffer) + 1; ++ ++ if (*n < count) { ++ new = realloc(*lineptr, count); ++ if (!new) ++ return -1; ++ *lineptr = new; ++ *n = count; ++ } ++ ++ memcpy(*lineptr, buffer, count); ++ return count; ++} ++#endif ++ +diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am +index ce1c385..bfc5342 100644 +--- a/misc-utils/Makemodule.am ++++ b/misc-utils/Makemodule.am +@@ -1,4 +1,5 @@ + ftl_format_SOURCES = misc-utils/ftl_format.c ++ftl_format_LDADD = libmissing.a + + doc_loadbios_SOURCES = misc-utils/doc_loadbios.c + +@@ -25,6 +26,7 @@ flash_otp_info_SOURCES = misc-utils/flash_otp_info.c + flash_otp_dump_SOURCES = misc-utils/flash_otp_dump.c + + flash_otp_lock_SOURCES = misc-utils/flash_otp_lock.c ++flash_otp_lock_LDADD = libmissing.a + + flash_otp_write_SOURCES = misc-utils/flash_otp_write.c + +diff --git a/ubi-utils/Makemodule.am b/ubi-utils/Makemodule.am +index 215eac2..7b447c7 100644 +--- a/ubi-utils/Makemodule.am ++++ b/ubi-utils/Makemodule.am +@@ -23,7 +23,7 @@ ubinize_SOURCES = ubi-utils/ubinize.c + ubinize_LDADD = libubi.a libubigen.a libmtd.a libiniparser.a + + ubiformat_SOURCES = ubi-utils/ubiformat.c +-ubiformat_LDADD = libubi.a libubigen.a libmtd.a libscan.a ++ubiformat_LDADD = libubi.a libubigen.a libmtd.a libscan.a libmissing.a + + ubirename_SOURCES = ubi-utils/ubirename.c + ubirename_LDADD = libmtd.a libubi.a +diff --git a/ubifs-utils/Makemodule.am b/ubifs-utils/Makemodule.am +index 5862afb..787beb9 100644 +--- a/ubifs-utils/Makemodule.am ++++ b/ubifs-utils/Makemodule.am +@@ -17,6 +17,7 @@ mkfs_ubifs_SOURCES = \ + ubifs-utils/mkfs.ubifs/hashtable/hashtable_itr.c \ + ubifs-utils/mkfs.ubifs/devtable.c + mkfs_ubifs_LDADD = libmtd.a libubi.a $(ZLIB_LIBS) $(LZO_LIBS) $(UUID_LIBS) -lm ++mkfs_ubifs_LDADD += libmissing.a + mkfs_ubifs_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) $(UUID_CFLAGS) \ + -I$(top_srcdir)/ubi-utils/include -I$(top_srcdir)/ubifs-utils/mkfs.ubifs/ + +-- +2.7.4 + diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch new file mode 100644 index 0000000000..bb675a7be1 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0002-Instead-of-doing-preprocessor-magic-just-output-off_.patch @@ -0,0 +1,326 @@ +From 01c98d5d5d044d9a125abcdbb2f3d771966365b0 Mon Sep 17 00:00:00 2001 +From: mirabilos <m@mirbsd.org> +Date: Thu, 1 Feb 2018 15:34:07 +0100 +Subject: [PATCH 2/4] Instead of doing preprocessor magic, just output off_t as + long long + +Fix warnings abot PRIdoff_t in libmtd.c, in mtd_read (and mtd_write): + +In file included from ../git/lib/libmtd.c:40:0: +../git/lib/libmtd.c: In function 'mtd_read': +../git/include/common.h:110:18: warning: format '%ld' expects argument of + type 'long int', but argument 5 has type 'off_t {aka long long int}' + [-Wformat=] + +../git/include/common.h:120:2: note: in expansion of macro 'errmsg' + errmsg(fmt, ##__VA_ARGS__); \ + ^~~~~~ +../git/lib/libmtd.c:1082:10: note: in expansion of macro 'sys_errmsg' + return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, + ^~~~~~~~~~ + +/usr/lib/klibc/include/inttypes.h:28:17: note: format string is defined here + #define PRId32 "d" + +Upstream-Status: Submitted + +Signed-off-by: Thorsten Glaser <tg@mirbsd.org> +--- + include/common.h | 18 ------------------ + jffsX-utils/mkfs.jffs2.c | 20 ++++++++++---------- + lib/libmtd.c | 8 ++++---- + misc-utils/flash_erase.c | 6 +++--- + misc-utils/flash_otp_write.c | 2 +- + misc-utils/ftl_check.c | 2 +- + misc-utils/mtd_debug.c | 4 ++-- + misc-utils/serve_image.c | 4 ++-- + tests/fs-tests/integrity/integck.c | 4 ++-- + tests/mtd-tests/nandpagetest.c | 4 ++-- + tests/ubi-tests/integ.c | 6 +++--- + ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 6 +++--- + 12 files changed, 33 insertions(+), 51 deletions(-) + +diff --git a/include/common.h b/include/common.h +index f8f72ea..642c212 100644 +--- a/include/common.h ++++ b/include/common.h +@@ -70,24 +70,6 @@ extern "C" { + #define O_CLOEXEC 0 + #endif + +-/* define a print format specifier for off_t */ +-#if (SIZEOF_OFF_T >= 8) +-#define PRIxoff_t PRIx64 +-#define PRIdoff_t PRId64 +-#else +-#define PRIxoff_t "l"PRIx32 +-#define PRIdoff_t "l"PRId32 +-#endif +- +-/* define a print format specifier for loff_t */ +-#if (SIZEOF_LOFF_T >= 8) +-#define PRIxloff_t PRIx64 +-#define PRIdloff_t PRId64 +-#else +-#define PRIxloff_t "l"PRIx32 +-#define PRIdloff_t "l"PRId32 +-#endif +- + /* Verbose messages */ + #define bareverbose(verbose, fmt, ...) do { \ + if (verbose) \ +diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c +index 9aa6c39..0661786 100644 +--- a/jffsX-utils/mkfs.jffs2.c ++++ b/jffsX-utils/mkfs.jffs2.c +@@ -1237,8 +1237,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir) + } else switch (e->sb.st_mode & S_IFMT) { + case S_IFDIR: + if (verbose) { +- printf("\td %04o %9" PRIdoff_t " %5d:%-3d %s\n", +- e->sb.st_mode & ~S_IFMT, e->sb.st_size, ++ printf("\td %04o %9lld %5d:%-3d %s\n", ++ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, + (int) (e->sb.st_uid), (int) (e->sb.st_gid), + e->name); + } +@@ -1247,8 +1247,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir) + break; + case S_IFSOCK: + if (verbose) { +- printf("\ts %04o %9" PRIdoff_t " %5d:%-3d %s\n", +- e->sb.st_mode & ~S_IFMT, e->sb.st_size, ++ printf("\ts %04o %9lld %5d:%-3d %s\n", ++ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, + (int) e->sb.st_uid, (int) e->sb.st_gid, e->name); + } + write_pipe(e); +@@ -1256,8 +1256,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir) + break; + case S_IFIFO: + if (verbose) { +- printf("\tp %04o %9" PRIdoff_t " %5d:%-3d %s\n", +- e->sb.st_mode & ~S_IFMT, e->sb.st_size, ++ printf("\tp %04o %9lld %5d:%-3d %s\n", ++ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, + (int) e->sb.st_uid, (int) e->sb.st_gid, e->name); + } + write_pipe(e); +@@ -1285,8 +1285,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir) + break; + case S_IFLNK: + if (verbose) { +- printf("\tl %04o %9" PRIdoff_t " %5d:%-3d %s -> %s\n", +- e->sb.st_mode & ~S_IFMT, e->sb.st_size, ++ printf("\tl %04o %9lld %5d:%-3d %s -> %s\n", ++ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, + (int) e->sb.st_uid, (int) e->sb.st_gid, e->name, + e->link); + } +@@ -1297,8 +1297,8 @@ static void recursive_populate_directory(struct filesystem_entry *dir) + wrote = write_regular_file(e); + write_xattr_entry(e); + if (verbose) { +- printf("\tf %04o %9" PRIdoff_t " (%9u) %5d:%-3d %s\n", +- e->sb.st_mode & ~S_IFMT, e->sb.st_size, wrote, ++ printf("\tf %04o %9lld (%9u) %5d:%-3d %s\n", ++ e->sb.st_mode & ~S_IFMT, (long long)e->sb.st_size, wrote, + (int) e->sb.st_uid, (int) e->sb.st_gid, e->name); + } + break; +diff --git a/lib/libmtd.c b/lib/libmtd.c +index 86c89ae..f375381 100644 +--- a/lib/libmtd.c ++++ b/lib/libmtd.c +@@ -1079,8 +1079,8 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs, + /* Seek to the beginning of the eraseblock */ + seek = (off_t)eb * mtd->eb_size + offs; + if (lseek(fd, seek, SEEK_SET) != seek) +- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, +- mtd->mtd_num, seek); ++ return sys_errmsg("cannot seek mtd%d to offset %lld", ++ mtd->mtd_num, (long long)seek); + + while (rd < len) { + ret = read(fd, buf + rd, len - rd); +@@ -1188,8 +1188,8 @@ int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb, + if (data) { + /* Seek to the beginning of the eraseblock */ + if (lseek(fd, seek, SEEK_SET) != seek) +- return sys_errmsg("cannot seek mtd%d to offset %"PRIdoff_t, +- mtd->mtd_num, seek); ++ return sys_errmsg("cannot seek mtd%d to offset %lld", ++ mtd->mtd_num, (long long)seek); + ret = write(fd, data, len); + if (ret != len) + return sys_errmsg("cannot write %d bytes to mtd%d " +diff --git a/misc-utils/flash_erase.c b/misc-utils/flash_erase.c +index 0c9449f..ec4b2e1 100644 +--- a/misc-utils/flash_erase.c ++++ b/misc-utils/flash_erase.c +@@ -53,8 +53,8 @@ int target_endian = __BYTE_ORDER; + static void show_progress(struct mtd_dev_info *mtd, off_t start, int eb, + int eb_start, int eb_cnt) + { +- bareverbose(!quiet, "\rErasing %d Kibyte @ %"PRIxoff_t" -- %2i %% complete ", +- mtd->eb_size / 1024, start, ((eb - eb_start) * 100) / eb_cnt); ++ bareverbose(!quiet, "\rErasing %d Kibyte @ %llx -- %2i %% complete ", ++ mtd->eb_size / 1024, (unsigned long long)start, ((eb - eb_start) * 100) / eb_cnt); + fflush(stdout); + } + +@@ -210,7 +210,7 @@ int main(int argc, char *argv[]) + if (!noskipbad) { + int ret = mtd_is_bad(&mtd, fd, eb); + if (ret > 0) { +- verbose(!quiet, "Skipping bad block at %08"PRIxoff_t, offset); ++ verbose(!quiet, "Skipping bad block at %08llx", (unsigned long long)offset); + continue; + } else if (ret < 0) { + if (errno == EOPNOTSUPP) { +diff --git a/misc-utils/flash_otp_write.c b/misc-utils/flash_otp_write.c +index b02d0b0..04c96c6 100644 +--- a/misc-utils/flash_otp_write.c ++++ b/misc-utils/flash_otp_write.c +@@ -76,7 +76,7 @@ int main(int argc,char *argv[]) + return errno; + } + +- printf("Writing OTP user data on %s at offset 0x%"PRIxoff_t"\n", argv[2], offset); ++ printf("Writing OTP user data on %s at offset 0x%llx\n", argv[2], (unsigned long long)offset); + + if (mtd_type_is_nand_user(&mtdInfo)) + len = mtdInfo.writesize; +diff --git a/misc-utils/ftl_check.c b/misc-utils/ftl_check.c +index a853cf4..e854922 100644 +--- a/misc-utils/ftl_check.c ++++ b/misc-utils/ftl_check.c +@@ -131,7 +131,7 @@ static void check_partition(int fd) + perror("read failed"); + break; + } +- printf("\nErase unit %"PRIdoff_t":\n", i); ++ printf("\nErase unit %lld:\n", (long long)i); + if ((hdr2.FormattedSize != hdr.FormattedSize) || + (hdr2.NumEraseUnits != hdr.NumEraseUnits) || + (hdr2.SerialNumber != hdr.SerialNumber)) +diff --git a/misc-utils/mtd_debug.c b/misc-utils/mtd_debug.c +index ac37e23..d65ad36 100644 +--- a/misc-utils/mtd_debug.c ++++ b/misc-utils/mtd_debug.c +@@ -160,7 +160,7 @@ retry: + if (buf != NULL) + free(buf); + close(outfd); +- printf("Copied %zu bytes from address 0x%.8"PRIxoff_t" in flash to %s\n", len, offset, filename); ++ printf("Copied %zu bytes from address 0x%.8llx in flash to %s\n", len, (unsigned long long)offset, filename); + return 0; + + err2: +@@ -225,7 +225,7 @@ retry: + if (buf != NULL) + free(buf); + fclose(fp); +- printf("Copied %d bytes from %s to address 0x%.8"PRIxoff_t" in flash\n", len, filename, offset); ++ printf("Copied %d bytes from %s to address 0x%.8llx in flash\n", len, filename, (unsigned long long)offset); + return 0; + } + +diff --git a/misc-utils/serve_image.c b/misc-utils/serve_image.c +index f2475d6..6c8c8fb 100644 +--- a/misc-utils/serve_image.c ++++ b/misc-utils/serve_image.c +@@ -129,8 +129,8 @@ int main(int argc, char **argv) + } + + if (st.st_size % erasesize) { +- fprintf(stderr, "Image size %" PRIdoff_t " bytes is not a multiple of erasesize %d bytes\n", +- st.st_size, erasesize); ++ fprintf(stderr, "Image size %lld bytes is not a multiple of erasesize %d bytes\n", ++ (long long)st.st_size, erasesize); + exit(1); + } + image = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, rfd, 0); +diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c +index 84753d6..0a7f142 100644 +--- a/tests/fs-tests/integrity/integck.c ++++ b/tests/fs-tests/integrity/integck.c +@@ -897,8 +897,8 @@ static ssize_t file_write_data(struct file_info *file, int fd, off_t offset, + remains = size; + actual = 0; + written = IO_BUFFER_SIZE; +- v("write %zd bytes, offset %"PRIdoff_t", file %s", +- size, offset, get_file_name(file)); ++ v("write %zd bytes, offset %lld, file %s", ++ size, (long long)offset, get_file_name(file)); + while (remains) { + /* Fill up buffer with random data */ + if (written < IO_BUFFER_SIZE) { +diff --git a/tests/mtd-tests/nandpagetest.c b/tests/mtd-tests/nandpagetest.c +index c6812df..465e548 100644 +--- a/tests/mtd-tests/nandpagetest.c ++++ b/tests/mtd-tests/nandpagetest.c +@@ -232,8 +232,8 @@ static int verify_eraseblock(int ebnum) + return err; + + if (lseek(fd, addr, SEEK_SET) != addr) { +- fprintf(stderr, "cannot seek mtd%d to offset %"PRIdloff_t, +- mtd.mtd_num, addr); ++ fprintf(stderr, "cannot seek mtd%d to offset %lld", ++ mtd.mtd_num, (long long)addr); + return -1; + } + +diff --git a/tests/ubi-tests/integ.c b/tests/ubi-tests/integ.c +index 26c2ce5..1cd0649 100644 +--- a/tests/ubi-tests/integ.c ++++ b/tests/ubi-tests/integ.c +@@ -243,7 +243,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd) + while (size) + if (read_buffer[--size] != 0xff) { + fprintf(stderr, "block no. = %d\n" , erase_block->block_number); +- fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start); ++ fprintf(stderr, "offset = %lld\n" , (long long)gap_start); + fprintf(stderr, "size = %ld\n" , (long) bytes_read); + error_exit("verify 0xff failed"); + } +@@ -254,7 +254,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd) + errno = 0; + bytes_read = read(fd, read_buffer, w->size); + if (bytes_read != w->size) { +- fprintf(stderr, "offset = %"PRIdoff_t"\n" , w->offset); ++ fprintf(stderr, "offset = %lld\n" , (long long)w->offset); + fprintf(stderr, "size = %ld\n" , (long) w->size); + fprintf(stderr, "bytes_read = %ld\n" , (long) bytes_read); + error_exit("read failed"); +@@ -279,7 +279,7 @@ static void check_erase_block(struct erase_block_info *erase_block, int fd) + while (size) + if (read_buffer[--size] != 0xff) { + fprintf(stderr, "block no. = %d\n" , erase_block->block_number); +- fprintf(stderr, "offset = %"PRIdoff_t"\n" , gap_start); ++ fprintf(stderr, "offset = %lld\n" , (long long)gap_start); + fprintf(stderr, "size = %ld\n" , (long) bytes_read); + error_exit("verify 0xff failed!"); + } +diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +index c916f48..f0237ab 100644 +--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c ++++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +@@ -772,11 +772,11 @@ int write_leb(int lnum, int len, void *buf) + return sys_err_msg("ubi_leb_change_start failed"); + + if (lseek(out_fd, pos, SEEK_SET) != pos) +- return sys_err_msg("lseek failed seeking %"PRIdoff_t, pos); ++ return sys_err_msg("lseek failed seeking %lld", (long long)pos); + + if (write(out_fd, buf, c->leb_size) != c->leb_size) +- return sys_err_msg("write failed writing %d bytes at pos %"PRIdoff_t, +- c->leb_size, pos); ++ return sys_err_msg("write failed writing %d bytes at pos %lld", ++ c->leb_size, (long long)pos); + + return 0; + } +-- +2.7.4 + diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0003-Makefile.am-only-build-ubi-utils.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0003-Makefile.am-only-build-ubi-utils.patch new file mode 100644 index 0000000000..08c53d18a3 --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0003-Makefile.am-only-build-ubi-utils.patch @@ -0,0 +1,34 @@ +From 139d93bc405272a3261d57be26da842e737fe4d0 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Sun, 28 Jan 2018 23:10:34 +0100 +Subject: [PATCH 3/4] Makefile.am: only build ubi-utils + +We only target the ubi-utils, static, small. + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + Makefile.am | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 5a6e77c..98715dd 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -34,9 +34,9 @@ EXTRA_DIST += $(GLOBAL_HEADER) $(GLOBAL_EXTRA) + + include lib/Makemodule.am + include ubi-utils/Makemodule.am +-include misc-utils/Makemodule.am +-include nand-utils/Makemodule.am +-include nor-utils/Makemodule.am ++#include misc-utils/Makemodule.am ++#include nand-utils/Makemodule.am ++#include nor-utils/Makemodule.am + + if BUILD_UBIFS + include ubifs-utils/Makemodule.am +-- +2.7.4 + diff --git a/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch new file mode 100644 index 0000000000..5da05fa48f --- /dev/null +++ b/meta-initramfs/recipes-devtools/mtd/ubi-utils-klibc-2.0.2/0004-mtd-utils-common.h-no-features.h-for-klibc-builds.patch @@ -0,0 +1,38 @@ +From ae1cf6d0eb1833e46549328a4473222c259723d7 Mon Sep 17 00:00:00 2001 +From: Andrea Adami <andrea.adami@gmail.com> +Date: Thu, 1 Feb 2018 00:25:00 +0100 +Subject: [PATCH 4/4] mtd-utils: common.h: no features.h for klibc builds + +Add guard around features.h to fix missing include (here first error): + + ../git/include/common.h:29:10: + fatal error: features.h: No such file or directory + #include <features.h> + ^~~~~~~~~~~~ + compilation terminated + +Upstream-Status: Submitted + +Signed-off-by: Andrea Adami <andrea.adami@gmail.com> +--- + include/common.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/common.h b/include/common.h +index 642c212..f7c71fe 100644 +--- a/include/common.h ++++ b/include/common.h +@@ -26,7 +26,10 @@ + #include <string.h> + #include <fcntl.h> + #include <errno.h> ++#if defined(__KLIBC__) ++#else + #include <features.h> ++#endif + #include <inttypes.h> + #include <unistd.h> + #include <sys/sysmacros.h> +-- +2.7.4 + |