From 716ca530e1c4515d8683c9d5be3d56b301758b66 Mon Sep 17 00:00:00 2001 From: James <> Date: Wed, 4 Nov 2015 11:49:21 +0000 Subject: trunk-47381 --- .../patches/0001-Fix-zlib-lzma-decompression.patch | 171 +++++++++++++++++++++ ...c-apply-necessary-quotes-to-result-of-mac.patch | 52 +++++++ ...mpiler-warning-on-printing-64-bit-integer.patch | 35 +++++ .../patches/0004-mips-remove-unused-variable.patch | 30 ++++ ...ix-warning-about-implicit-type-conversion.patch | 30 ++++ 5 files changed, 318 insertions(+) create mode 100644 package/boot/kexec-tools/patches/0001-Fix-zlib-lzma-decompression.patch create mode 100644 package/boot/kexec-tools/patches/0002-configure.ac-apply-necessary-quotes-to-result-of-mac.patch create mode 100644 package/boot/kexec-tools/patches/0003-mips-fix-compiler-warning-on-printing-64-bit-integer.patch create mode 100644 package/boot/kexec-tools/patches/0004-mips-remove-unused-variable.patch create mode 100644 package/boot/kexec-tools/patches/0005-mips-fix-warning-about-implicit-type-conversion.patch (limited to 'package/boot/kexec-tools/patches') diff --git a/package/boot/kexec-tools/patches/0001-Fix-zlib-lzma-decompression.patch b/package/boot/kexec-tools/patches/0001-Fix-zlib-lzma-decompression.patch new file mode 100644 index 0000000..06c11ec --- /dev/null +++ b/package/boot/kexec-tools/patches/0001-Fix-zlib-lzma-decompression.patch @@ -0,0 +1,171 @@ +From d606837b56d46eb7f815b5d85f07fcc3f1555d00 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Sun, 1 Feb 2015 00:10:07 +0800 +Subject: [PATCH 1/5] Fix zlib/lzma decompression. + +Let {zlib,lzma}_decompress_file() return NULL if anything wrong happened +to allow the other method to have a chance to run. + +Signed-off-by: Yousong Zhou +Signed-off-by: Simon Horman +--- + kexec/lzma.c | 33 ++++++++++++++++++++++----------- + kexec/zlib.c | 57 +++++++++++++++++++++++++++++++++++---------------------- + 2 files changed, 57 insertions(+), 33 deletions(-) + +diff --git a/kexec/lzma.c b/kexec/lzma.c +index 939aeb3..5bfccb7 100644 +--- a/kexec/lzma.c ++++ b/kexec/lzma.c +@@ -162,13 +162,16 @@ char *lzma_decompress_file(const char *filename, off_t *r_size) + off_t size, allocated; + ssize_t result; + +- if (!filename) { +- *r_size = 0; +- return 0; +- } ++ dbgprintf("Try LZMA decompression.\n"); ++ ++ *r_size = 0; ++ if (!filename) ++ return NULL; ++ + fp = lzopen(filename, "rb"); + if (fp == 0) { +- die("Cannot open `%s'\n", filename); ++ dbgprintf("Cannot open `%s'\n", filename); ++ return NULL; + } + size = 0; + allocated = 65536; +@@ -183,17 +186,25 @@ char *lzma_decompress_file(const char *filename, off_t *r_size) + if ((errno == EINTR) || (errno == EAGAIN)) + continue; + +- die ("read on %s of %ld bytes failed\n", +- filename, (allocated - size) + 0UL); ++ dbgprintf("%s: read on %s of %ld bytes failed\n", ++ __func__, filename, (allocated - size) + 0UL); ++ break; + } + size += result; +- } while(result > 0); +- result = lzclose(fp); +- if (result != LZMA_OK) { +- die ("Close of %s failed\n", filename); ++ } while (result > 0); ++ ++ if (lzclose(fp) != LZMA_OK) { ++ dbgprintf("%s: Close of %s failed\n", __func__, filename); ++ goto fail; + } ++ if (result < 0) ++ goto fail; ++ + *r_size = size; + return buf; ++fail: ++ free(buf); ++ return NULL; + } + #else + char *lzma_decompress_file(const char *UNUSED(filename), off_t *UNUSED(r_size)) +diff --git a/kexec/zlib.c b/kexec/zlib.c +index d44df12..7170ac3 100644 +--- a/kexec/zlib.c ++++ b/kexec/zlib.c +@@ -15,29 +15,39 @@ + #include + #include + ++static void _gzerror(gzFile fp, int *errnum, const char **errmsg) ++{ ++ *errmsg = gzerror(fp, errnum); ++ if (*errnum == Z_ERRNO) { ++ *errmsg = strerror(*errnum); ++ } ++} ++ + char *zlib_decompress_file(const char *filename, off_t *r_size) + { + gzFile fp; + int errnum; + const char *msg; + char *buf; +- off_t size, allocated; ++ off_t size = 0, allocated; + ssize_t result; + ++ dbgprintf("Try gzip decompression.\n"); ++ ++ *r_size = 0; + if (!filename) { +- *r_size = 0; +- return 0; ++ return NULL; + } + fp = gzopen(filename, "rb"); + if (fp == 0) { +- msg = gzerror(fp, &errnum); +- if (errnum == Z_ERRNO) { +- msg = strerror(errno); +- } +- fprintf(stderr, "Cannot open `%s': %s\n", filename, msg); ++ _gzerror(fp, &errnum, &msg); ++ dbgprintf("Cannot open `%s': %s\n", filename, msg); ++ return NULL; ++ } ++ if (gzdirect(fp)) { ++ /* It's not in gzip format */ + return NULL; + } +- size = 0; + allocated = 65536; + buf = xmalloc(allocated); + do { +@@ -49,25 +59,28 @@ char *zlib_decompress_file(const char *filename, off_t *r_size) + if (result < 0) { + if ((errno == EINTR) || (errno == EAGAIN)) + continue; +- +- msg = gzerror(fp, &errnum); +- if (errnum == Z_ERRNO) { +- msg = strerror(errno); +- } +- die ("read on %s of %ld bytes failed: %s\n", +- filename, (allocated - size) + 0UL, msg); ++ _gzerror(fp, &errnum, &msg); ++ dbgprintf("Read on %s of %ld bytes failed: %s\n", ++ filename, (allocated - size) + 0UL, msg); ++ size = 0; ++ goto fail; + } + size += result; + } while(result > 0); ++ ++fail: + result = gzclose(fp); + if (result != Z_OK) { +- msg = gzerror(fp, &errnum); +- if (errnum == Z_ERRNO) { +- msg = strerror(errno); +- } +- die ("Close of %s failed: %s\n", filename, msg); ++ _gzerror(fp, &errnum, &msg); ++ dbgprintf(" Close of %s failed: %s\n", filename, msg); ++ } ++ ++ if (size > 0) { ++ *r_size = size; ++ } else { ++ free(buf); ++ buf = NULL; + } +- *r_size = size; + return buf; + } + #else +-- +1.7.10.4 + diff --git a/package/boot/kexec-tools/patches/0002-configure.ac-apply-necessary-quotes-to-result-of-mac.patch b/package/boot/kexec-tools/patches/0002-configure.ac-apply-necessary-quotes-to-result-of-mac.patch new file mode 100644 index 0000000..aba8af7 --- /dev/null +++ b/package/boot/kexec-tools/patches/0002-configure.ac-apply-necessary-quotes-to-result-of-mac.patch @@ -0,0 +1,52 @@ +From eb20884c9bbc42bdf1ccace4444f3ce72657d7d8 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Tue, 9 Sep 2014 20:15:16 +0800 +Subject: [PATCH 2/5] configure.ac: apply necessary quotes to result of macro + expansion. + +This can fix the following error when searching for lzma support and +while at it also apply the practice to other uses of the same pattern. + + checking for lzma_code in -llzma... ./configure: line 4756: ac_fn_c_try_link: command not found + +Signed-off-by: Yousong Zhou +--- + configure.ac | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/configure.ac b/configure.ac +index db93331..c410e90 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -152,22 +152,22 @@ AC_CHECK_PROG([DIRNAME], dirname, dirname, "no", [$PATH]) + dnl See if I have a usable copy of zlib available + if test "$with_zlib" = yes ; then + AC_CHECK_HEADER(zlib.h, +- AC_CHECK_LIB(z, inflateInit_, , +- AC_MSG_NOTICE([zlib support disabled]))) ++ [AC_CHECK_LIB(z, inflateInit_, , ++ AC_MSG_NOTICE([zlib support disabled]))]) + fi + + dnl See if I have a usable copy of lzma available + if test "$with_lzma" = yes ; then + AC_CHECK_HEADER(lzma.h, +- AC_CHECK_LIB(lzma, lzma_code, , +- AC_MSG_NOTICE([lzma support disabled]))) ++ [AC_CHECK_LIB(lzma, lzma_code, , ++ AC_MSG_NOTICE([lzma support disabled]))]) + fi + + dnl find Xen control stack libraries + if test "$with_xen" = yes ; then + AC_CHECK_HEADER(xenctrl.h, +- AC_CHECK_LIB(xenctrl, xc_kexec_load, , +- AC_MSG_NOTICE([Xen support disabled]))) ++ [AC_CHECK_LIB(xenctrl, xc_kexec_load, , ++ AC_MSG_NOTICE([Xen support disabled]))]) + fi + + dnl ---Sanity checks +-- +1.7.10.4 + diff --git a/package/boot/kexec-tools/patches/0003-mips-fix-compiler-warning-on-printing-64-bit-integer.patch b/package/boot/kexec-tools/patches/0003-mips-fix-compiler-warning-on-printing-64-bit-integer.patch new file mode 100644 index 0000000..f4762e9 --- /dev/null +++ b/package/boot/kexec-tools/patches/0003-mips-fix-compiler-warning-on-printing-64-bit-integer.patch @@ -0,0 +1,35 @@ +From 89d455d785190203b1d3a8766c8babb8c1688fc3 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Mon, 9 Feb 2015 19:51:25 +0800 +Subject: [PATCH 3/5] mips: fix compiler warning on printing 64-bit integer. + + +Signed-off-by: Yousong Zhou +--- + kexec/arch/mips/crashdump-mips.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c +index e7840e0..98c9f7c 100644 +--- a/kexec/arch/mips/crashdump-mips.c ++++ b/kexec/arch/mips/crashdump-mips.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -52,7 +53,7 @@ static int get_kernel_paddr(struct crash_elf_info *elf_info) + + if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) { + elf_info->kern_paddr_start = start; +- dbgprintf("kernel load physical addr start = 0x%lx\n", start); ++ dbgprintf("kernel load physical addr start = 0x%" PRIu64 "\n", start); + return 0; + } + +-- +1.7.10.4 + diff --git a/package/boot/kexec-tools/patches/0004-mips-remove-unused-variable.patch b/package/boot/kexec-tools/patches/0004-mips-remove-unused-variable.patch new file mode 100644 index 0000000..8626c41 --- /dev/null +++ b/package/boot/kexec-tools/patches/0004-mips-remove-unused-variable.patch @@ -0,0 +1,30 @@ +From 904e9ae892b0592c916a013869e3be3d830e0155 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Mon, 9 Feb 2015 20:11:04 +0800 +Subject: [PATCH 4/5] mips: remove unused variable. + +Fixes the following compilation warning. + + kexec/arch/mips/crashdump-mips.c:151:6: warning: unused variable 'i' [-Wunused-variable] + +Signed-off-by: Yousong Zhou +--- + kexec/arch/mips/crashdump-mips.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c +index 98c9f7c..dc68cb4 100644 +--- a/kexec/arch/mips/crashdump-mips.c ++++ b/kexec/arch/mips/crashdump-mips.c +@@ -148,7 +148,7 @@ static int exclude_crash_reserve_region(int *nr_ranges) + static int get_crash_memory_ranges(struct memory_range **range, int *ranges) + { + const char iomem[] = "/proc/iomem"; +- int i, memory_ranges = 0; ++ int memory_ranges = 0; + char line[MAX_LINE]; + FILE *fp; + unsigned long long start, end; +-- +1.7.10.4 + diff --git a/package/boot/kexec-tools/patches/0005-mips-fix-warning-about-implicit-type-conversion.patch b/package/boot/kexec-tools/patches/0005-mips-fix-warning-about-implicit-type-conversion.patch new file mode 100644 index 0000000..008a62d --- /dev/null +++ b/package/boot/kexec-tools/patches/0005-mips-fix-warning-about-implicit-type-conversion.patch @@ -0,0 +1,30 @@ +From 00e75179b3b4b80e6e58d29a2bd948f97682fd00 Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Mon, 9 Feb 2015 20:28:14 +0800 +Subject: [PATCH 5/5] mips: fix warning about implicit type conversion. + +Fixes the following warning. + + kexec/arch/mips/kexec-elf-mips.c:161:16: warning: assignment makes integer from pointer without a cast [enabled by default] + +Signed-off-by: Yousong Zhou +--- + kexec/arch/mips/kexec-elf-mips.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c +index a27d986..8a6419a 100644 +--- a/kexec/arch/mips/kexec-elf-mips.c ++++ b/kexec/arch/mips/kexec-elf-mips.c +@@ -158,7 +158,7 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len, + if (info->kexec_flags & KEXEC_ON_CRASH) + /* In case of crashdump segment[0] is kernel. + * Put cmdline just after it. */ +- cmdline_addr = info->segment[0].mem + ++ cmdline_addr = (unsigned long)info->segment[0].mem + + info->segment[0].memsz; + else + cmdline_addr = 0; +-- +1.7.10.4 + -- cgit v1.2.3