Added missing host-liblzo make fragment. Updated mtd-utils to
    1.2.0. Fixed compile errors with host build of mtd-utils, when
    using latest GCC on Ubuntu 8.10
    
    Also fixes a possible buffer overrun and stack corruption
    with memset.
    
    Signed-off-by: Carsten Schlote <[EMAIL PROTECTED]>
 
-- 
Mit freundlichen Grüßen / With best regards
Carsten Schlote

-------------------------------
konzeptpark GmbH
Carsten Schlote
Engineering
Fon: +49 6441 / 65009-23
Fax: +49 6441 / 65009-99
Web: http://konzeptpark.de
eMail: [EMAIL PROTECTED]
Georg-Ohm-Straße 2
D-35633 Lahnau
Germany

commit 3d9d3175b677df86a0b28c53b3d23cf1088e6911
Author: Carsten Schlote <[EMAIL PROTECTED](none)>
Date:   Wed Nov 19 19:44:57 2008 +0100

    Fixed host-mtd-utils 1.2.0 compile errors and liblzo support
    
    Added missing host-liblzo make fragment. Updated mtd-utils to
    1.2.0. Fixed compile errors with host build of mtd-utils, when
    using latest GCC on Ubuntu 8.10
    
    Also fixes a possible buffer overrun and stack corruption
    with memset.
    
    Signed-off-by: Carsten Schlote <[EMAIL PROTECTED]>

diff --git a/patches/mtd-utils-1.2.0/generic/series 
b/patches/mtd-utils-1.2.0/generic/series
index cc4d3be..526984b 100644
--- a/patches/mtd-utils-1.2.0/generic/series
+++ b/patches/mtd-utils-1.2.0/generic/series
@@ -1,2 +1,3 @@
 lzo-switch.diff
 ubi-utils-crosscompile-fix.diff
+ubi-utils-hostcompile-fix.diff
diff --git a/patches/mtd-utils-1.2.0/generic/ubi-utils-hostcompile-fix.diff 
b/patches/mtd-utils-1.2.0/generic/ubi-utils-hostcompile-fix.diff
new file mode 100644
index 0000000..156387a
--- /dev/null
+++ b/patches/mtd-utils-1.2.0/generic/ubi-utils-hostcompile-fix.diff
@@ -0,0 +1,239 @@
+From: Carsten Schlote <[EMAIL PROTECTED]>
+Subject: Add compile fixes for ubi-tools and latest GCC with -Werror set
+
+Fixes lots of unused results and some wired macros, which cause a compile break
+with latest GCC, e.g. as used on Ubuntu 8.10.
+
+Signed-off-by: Carsten Schlote <[EMAIL PROTECTED]>
+
+---
+ ubi-utils/new-utils/src/ubiformat.c |    6 +++--
+ ubi-utils/src/libpfiflash.c         |   38 
++++++++++++++++++------------------
+ ubi-utils/src/ubimirror.c           |    2 -
+ ubi-utils/src/unubi.c               |    2 -
+ 4 files changed, 25 insertions(+), 23 deletions(-)
+
+Index: mtd-utils-1.2.0/ubi-utils/new-utils/src/ubiformat.c
+===================================================================
+--- mtd-utils-1.2.0.orig/ubi-utils/new-utils/src/ubiformat.c   2008-11-19 
19:36:26.000000000 +0100
++++ mtd-utils-1.2.0/ubi-utils/new-utils/src/ubiformat.c        2008-11-19 
19:37:21.000000000 +0100
+@@ -212,10 +212,11 @@
+ static int want_exit(void)
+ {
+       char buf[4];
++      int rc;
+ 
+       while (1) {
+               normsg_cont("continue? (yes/no)  ");
+-              scanf("%3s", buf);
++              rc = scanf("%3s", buf);
+               if (!strncmp(buf, "yes", 3) || !strncmp(buf, "y", 1))
+                       return 0;
+               if (!strncmp(buf, "no", 2) || !strncmp(buf, "n", 1))
+@@ -226,9 +227,10 @@
+ static int answer_is_yes(void)
+ {
+       char buf[4];
++      int rc;
+ 
+       while (1) {
+-              scanf("%3s", buf);
++              rc = scanf("%3s", buf);
+               if (!strncmp(buf, "yes", 3) || !strncmp(buf, "y", 1))
+                       return 1;
+               if (!strncmp(buf, "no", 2) || !strncmp(buf, "n", 1))
+Index: mtd-utils-1.2.0/ubi-utils/src/libpfiflash.c
+===================================================================
+--- mtd-utils-1.2.0.orig/ubi-utils/src/libpfiflash.c   2008-11-19 
19:29:40.000000000 +0100
++++ mtd-utils-1.2.0/ubi-utils/src/libpfiflash.c        2008-11-19 
19:32:13.000000000 +0100
+@@ -136,7 +136,7 @@
+       }
+ 
+  err:
+-      EBUF(PFIFLASH_ERRSTR[-rc]);
++      EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+       return rc;
+ }
+ 
+@@ -173,7 +173,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -239,7 +239,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -323,7 +323,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -342,7 +342,7 @@
+       rc = bootenv_read(fp_in, bootenv_old, BOOTENV_MAXSIZE);
+       if (rc != 0) {
+               rc = -PFIFLASH_ERR_BOOTENV_READ;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -421,7 +421,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -442,7 +442,7 @@
+       rc = bootenv_read_crc(fp_in, bootenv_new, fp_in_size, &crc);
+       if (rc != 0) {
+               rc = -PFIFLASH_ERR_BOOTENV_READ;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       } else if (crc != pfi_crc) {
+               rc = -PFIFLASH_ERR_CRC_CHECK;
+@@ -464,7 +464,7 @@
+       rc = bootenv_size(bootenv_res, &update_size);
+       if (rc != 0) {
+               rc = -PFIFLASH_ERR_BOOTENV_SIZE;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -554,7 +554,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -586,13 +586,13 @@
+                       bytes_left : sizeof buf;
+               if (fread(buf, 1, to_rw, fp_in) != to_rw) {
+                       rc = -PFIFLASH_ERR_EOF;
+-                      EBUF(PFIFLASH_ERRSTR[-rc]);
++                      EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                       goto err;
+               }
+               crc = clc_crc32(crc32_table, crc, buf, to_rw);
+               if (fwrite(buf, 1, to_rw, fp_out) != to_rw) {
+                       rc = -PFIFLASH_ERR_FIO;
+-                      EBUF(PFIFLASH_ERRSTR[-rc]);
++                      EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                       goto err;
+               }
+               bytes_left -= to_rw;
+@@ -770,7 +770,7 @@
+ 
+ err:
+       if (rc < 0)
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+ 
+       for (i = 0; i < u->ids_size; i++)
+               fclose(fp_flash[i]);
+@@ -877,11 +877,11 @@
+                       int c = fgetc(pfi);
+                       if (c == EOF) {
+                               rc = -PFIFLASH_ERR_EOF;
+-                              EBUF(PFIFLASH_ERRSTR[-rc]);
++                              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                               goto err;
+                       } else if (ferror(pfi)) {
+                               rc = -PFIFLASH_ERR_FIO;
+-                              EBUF(PFIFLASH_ERRSTR[-rc]);
++                              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                               goto err;
+                       }
+                       pfi_data[j] = (char)c;
+@@ -906,7 +906,7 @@
+               for (j = 0; j < r->starts_size; j++) {
+                       rc = erase_mtd_region(mtd, r->starts[j], r->data_size);
+                       if (rc) {
+-                              EBUF(PFIFLASH_ERRSTR[-rc]);
++                              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                               goto err;
+                       }
+ 
+@@ -916,7 +916,7 @@
+                               if (c == EOF) {
+                                       fclose(mtd);
+                                       rc = -PFIFLASH_ERR_EOF;
+-                                      EBUF(PFIFLASH_ERRSTR[-rc]);
++                                      EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                                       goto err;
+                               }
+                               if ((char)c != pfi_data[k]) {
+@@ -1100,7 +1100,7 @@
+                       break;
+               default:
+                       rc = -PFIFLASH_ERR_UBI_UNKNOWN;
+-                      EBUF(PFIFLASH_ERRSTR[-rc]);
++                      EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+                       goto err;
+               }
+       }
+@@ -1137,7 +1137,7 @@
+       ulib = libubi_open();
+       if (ulib == NULL) {
+               rc = -PFIFLASH_ERR_UBI_OPEN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+@@ -1259,7 +1259,7 @@
+               pdd_f = pdd_funcs[pdd_handling];
+       else {
+               rc = -PFIFLASH_ERR_PDD_UNKNOWN;
+-              EBUF(PFIFLASH_ERRSTR[-rc]);
++              EBUF("%s",PFIFLASH_ERRSTR[-rc]);
+               goto err;
+       }
+ 
+Index: mtd-utils-1.2.0/ubi-utils/src/ubimirror.c
+===================================================================
+--- mtd-utils-1.2.0.orig/ubi-utils/src/ubimirror.c     2008-11-19 
19:32:38.000000000 +0100
++++ mtd-utils-1.2.0/ubi-utils/src/ubimirror.c  2008-11-19 19:34:05.000000000 
+0100
+@@ -203,7 +203,7 @@
+                      err_buf, sizeof(err_buf));
+       if( rc ){
+               err_buf[sizeof err_buf - 1] = '\0';
+-              fprintf(stderr, err_buf);
++              fprintf(stderr, "%s", err_buf);
+               if( rc < 0 )
+                       rc = -rc;
+       }
+Index: mtd-utils-1.2.0/ubi-utils/src/unubi.c
+===================================================================
+--- mtd-utils-1.2.0.orig/ubi-utils/src/unubi.c 2008-11-19 19:34:32.000000000 
+0100
++++ mtd-utils-1.2.0/ubi-utils/src/unubi.c      2008-11-19 19:35:29.000000000 
+0100
+@@ -895,7 +895,7 @@
+       free(cur);
+ 
+       if (a->analyze) {
+-              char fname[PATH_MAX];
++              char fname[PATH_MAX+1];
+               FILE *fp;
+ 
+               unubi_analyze(&head, first, a->odir_path);
diff --git a/rules/host-liblzo.make b/rules/host-liblzo.make
new file mode 100644
index 0000000..885eb38
--- /dev/null
+++ b/rules/host-liblzo.make
@@ -0,0 +1,97 @@
+# -*-makefile-*-
+# $Id$
+#
+# Copyright (C) 2007 by Marc Kleine-Budde <[EMAIL PROTECTED]>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+HOST_PACKAGES-$(PTXCONF_HOST_LIBLZO) += host-liblzo
+
+#
+# Paths and names
+#
+HOST_LIBLZO_DIR        = $(HOST_BUILDDIR)/$(LIBLZO)
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+host-liblzo_get: $(STATEDIR)/host-liblzo.get
+
+$(STATEDIR)/host-liblzo.get: $(STATEDIR)/liblzo.get
+       @$(call targetinfo, $@)
+       @$(call touch, $@)
+
+# ----------------------------------------------------------------------------
+# Extract
+# ----------------------------------------------------------------------------
+
+host-liblzo_extract: $(STATEDIR)/host-liblzo.extract
+
+$(STATEDIR)/host-liblzo.extract:
+       @$(call targetinfo, $@)
+       @$(call clean, $(HOST_LIBLZO_DIR))
+       @$(call extract, LIBLZO, $(HOST_BUILDDIR))
+       @$(call patchin, LIBLZO, $(HOST_LIBLZO_DIR))
+       @$(call touch, $@)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+host-liblzo_prepare: $(STATEDIR)/host-liblzo.prepare
+
+HOST_LIBLZO_PATH       := PATH=$(HOST_PATH)
+HOST_LIBLZO_ENV        := $(HOST_ENV)
+
+#
+# autoconf
+#
+HOST_LIBLZO_AUTOCONF   := $(HOST_AUTOCONF)
+
+$(STATEDIR)/host-liblzo.prepare:
+       @$(call targetinfo, $@)
+       @$(call clean, $(HOST_LIBLZO_DIR)/config.cache)
+       cd $(HOST_LIBLZO_DIR) && \
+               $(HOST_LIBLZO_PATH) $(HOST_LIBLZO_ENV) \
+               ./configure $(HOST_LIBLZO_AUTOCONF)
+       @$(call touch, $@)
+
+# ----------------------------------------------------------------------------
+# Compile
+# ----------------------------------------------------------------------------
+
+host-liblzo_compile: $(STATEDIR)/host-liblzo.compile
+
+$(STATEDIR)/host-liblzo.compile:
+       @$(call targetinfo, $@)
+       cd $(HOST_LIBLZO_DIR) && $(HOST_LIBLZO_PATH) $(MAKE) $(PARALLELMFLAGS)
+       @$(call touch, $@)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+host-liblzo_install: $(STATEDIR)/host-liblzo.install
+
+$(STATEDIR)/host-liblzo.install:
+       @$(call targetinfo, $@)
+       @$(call install, HOST_LIBLZO,,h)
+       @$(call touch, $@)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+host-liblzo_clean:
+       rm -rf $(STATEDIR)/host-liblzo.*
+       rm -rf $(HOST_LIBLZO_DIR)
+
+# vim: syntax=make
diff --git a/rules/mtd-utils.in b/rules/mtd-utils.in
index c5e9c73..a82327c 100644
--- a/rules/mtd-utils.in
+++ b/rules/mtd-utils.in
@@ -2,6 +2,7 @@
 menuconfig MTD_UTILS
        tristate
        prompt "mtd-utils                     "
+       select LIBLZO
        select ZLIB
        help
          mtdutils is a set of utilities for doing low-level operations on 
flash devices.
diff --git a/rules/mtd-utils.make b/rules/mtd-utils.make
index 84cc977..992f5f3 100644
--- a/rules/mtd-utils.make
+++ b/rules/mtd-utils.make
@@ -17,9 +17,9 @@ PACKAGES-$(PTXCONF_MTD_UTILS) += mtd-utils
 #
 # Paths and names
 #
-MTD_UTILS_VERSION      := 1.0.0
+MTD_UTILS_VERSION      := 1.2.0
 MTD_UTILS              := mtd-utils-$(MTD_UTILS_VERSION)
-MTD_UTILS_SUFFIX       := tar.gz
+MTD_UTILS_SUFFIX       := tar.bz2
 MTD_UTILS_URL          := 
ftp://ftp.infradead.org/pub/mtd-utils/$(MTD_UTILS).$(MTD_UTILS_SUFFIX)
 MTD_UTILS_SOURCE       := $(SRCDIR)/$(MTD_UTILS).$(MTD_UTILS_SUFFIX)
 MTD_UTILS_DIR          := $(BUILDDIR)/$(MTD_UTILS)
--
ptxdist mailing list
[email protected]

Reply via email to