From: Carsten Schlote <[email protected]> Added lzo support for host-tools and dependancy. Added options to install remaining mtd-utils for target.
Small bugfix for lzo compression. Signed-off-by: Carsten Schlote <[email protected]> --- patches/mtd-utils-1.3.0/lzo-compr-fixes.patch | 59 +++++++ patches/mtd-utils-1.3.0/series | 3 + rules/host-mtd-utils.in | 21 +++- rules/host-mtd-utils.make | 5 + rules/mtd-utils.in | 200 +++++++++++++++++++++---- rules/mtd-utils.make | 123 +++++++++++----- 6 files changed, 340 insertions(+), 71 deletions(-) create mode 100644 patches/mtd-utils-1.3.0/lzo-compr-fixes.patch create mode 100644 patches/mtd-utils-1.3.0/series diff --git a/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch b/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch new file mode 100644 index 0000000..132d304 --- /dev/null +++ b/patches/mtd-utils-1.3.0/lzo-compr-fixes.patch @@ -0,0 +1,59 @@ +From: Carsten Schlote <[email protected]> +Date: Fri, 20 Mar 2009 12:43:32 +0100 +Subject: [PATCH 1/1] [lzo compressor] Fixed lzo compression tests and crash caused by unset variable. + +The following issues are addressed by this patch. + +- Check for compressed data to be smaller than the original size. This + a clear fail and break assumtions at other places (-t option) + +- Set the destlen to the expected maximum size, before calling lzo + decompression routine. It's used a max size value by this code (and + holds the real decompression size after the call.) + +- Calls lzo_init(). + +Signed-off-by: Carsten Schlote <[email protected]> +--- + compr_lzo.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +Index: compr_lzo.c +=================================================================== +--- compr_lzo.c.orig 2009-07-03 11:31:41.000000000 +0200 ++++ compr_lzo.c 2009-07-22 11:47:04.000000000 +0200 +@@ -56,6 +56,9 @@ + if (ret != LZO_E_OK) + return -1; + ++ if (compress_size > *sourcelen) ++ return -1; ++ + if (compress_size > *dstlen) + return -1; + +@@ -71,6 +74,7 @@ + int ret; + lzo_uint dl; + ++ dl = destlen; + ret = lzo1x_decompress_safe(data_in,srclen,cpage_out,&dl,NULL); + + if (ret != LZO_E_OK || dl != destlen) +@@ -92,11 +96,15 @@ + { + int ret; + ++ lzo_init(); ++ + lzo_mem = malloc(LZO1X_999_MEM_COMPRESS); + if (!lzo_mem) + return -1; + +- /* Worse case LZO compression size from their FAQ */ ++ /* Worse case LZO compression size from their FAQ - ++ see http://www.oberhumer.com/opensource/lzo/lzofaq.php */ ++ + lzo_compress_buf = malloc(page_size + (page_size / 16) + 64 + 3); + if (!lzo_compress_buf) { + free(lzo_mem); diff --git a/patches/mtd-utils-1.3.0/series b/patches/mtd-utils-1.3.0/series new file mode 100644 index 0000000..721ea5d --- /dev/null +++ b/patches/mtd-utils-1.3.0/series @@ -0,0 +1,3 @@ +0001-make-liblzo-optional.patch +lzo-compr-fixes.patch -p0 + diff --git a/rules/host-mtd-utils.in b/rules/host-mtd-utils.in index 7c3b629..eeffe6b 100644 --- a/rules/host-mtd-utils.in +++ b/rules/host-mtd-utils.in @@ -1,7 +1,22 @@ -## SECTION=hosttools_noprompt +## SECTION=hosttools -config HOST_MTD_UTILS +menuconfig HOST_MTD_UTILS tristate - select HOST_LIBLZO + prompt "MTD utils " select HOST_ZLIB select HOST_UTIL_LINUX_NG + select HOST_LIBLZO if HOST_MTD_UTILS_USE_LIBLZO + help + Install complete set of mtd-utils as host tools. + +if HOST_MTD_UTILS + +config HOST_MTD_UTILS_USE_LIBLZO + bool + prompt "Enable LZO support" + default y if MTD_UTILS_USE_LIBLZO + help + Enable LZO support. + +endif + diff --git a/rules/host-mtd-utils.make b/rules/host-mtd-utils.make index 8bd1018..ef13308 100644 --- a/rules/host-mtd-utils.make +++ b/rules/host-mtd-utils.make @@ -52,6 +52,11 @@ HOST_MTD_UTILS_MAKEVARS = \ BUILDDIR=$(HOST_MTD_UTILS_DIR) \ DESTDIR=/ +ifndef PTXCONF_HOST_MTD_UTILS_USE_LIBLZO + HOST_MTD_UTILS_COMPILE_ENV += WITHOUT_LZO=1 + HOST_MTD_UTILS_MAKEVARS += WITHOUT_LZO=1 +endif + HOST_MTD_UTILS_MAKE_PAR := NO # ---------------------------------------------------------------------------- diff --git a/rules/mtd-utils.in b/rules/mtd-utils.in index cbccf36..940a168 100644 --- a/rules/mtd-utils.in +++ b/rules/mtd-utils.in @@ -7,6 +7,7 @@ menuconfig MTD_UTILS select UTIL_LINUX_NG select UTIL_LINUX_NG_LIBBLKID select LIBLZO if MTD_UTILS_USE_LIBLZO + select HOST_MTD_UTILS help Memory Technology Device Utilities @@ -15,12 +16,74 @@ menuconfig MTD_UTILS if MTD_UTILS +comment "build options" + config MTD_UTILS_USE_LIBLZO bool prompt "liblzo support" help Enable LZO support + +comment "misc utils" + +config MTD_UTILS_PDDCUSTOMIZE + bool + prompt "pddcustomize" + help + customize bootenv and pdd values + +config MTD_UTILS_MKPFI + bool + prompt "mkpfi" + help + This perl program is assembles PFI files from a config file + +config MTD_UTILS_PFI2BIN + bool + prompt "pfi2bin" + help + a tool to convert PFI files into binary images + +config MTD_UTILS_PFIFLASH + bool + prompt "pfiflash" + help + a tool for updating a controller with PFI files + +config MTD_UTILS_DOC_LOADBIOS + bool + prompt "doc_loadbios" + help + FIXME + +config MTD_UTILS_DOCFDISK + bool + prompt "docfdisk" + help + FIXME + +config MTD_UTILS_MTD_DEBUG + bool + prompt "mtd_debug" + help + Does info, read, write and erase on mtd devices + +config MTD_UTILS_RECV_IMAGE + bool + prompt "recv_image" + help + Receive and flash image from a network host + +config MTD_UTILS_SERVE_IMAGE + bool + prompt "serve_image" + help + Serve flashimage to network + + +comment "flash utils" + config MTD_UTILS_FLASH_ERASE bool prompt "flash_erase" @@ -45,6 +108,18 @@ config MTD_UTILS_FLASH_LOCK help This utility locks one or more sectors of flash device. +config MTD_UTILS_FLASH_OTP_DUMP + bool + prompt "flash_otp_dump" + help + FIXME + +config MTD_UTILS_FLASH_OTP_INFO + bool + prompt "flash_otp_info" + help + FIXME + config MTD_UTILS_FLASH_UNLOCK bool prompt "flash_unlock" @@ -57,53 +132,81 @@ config MTD_UTILS_FLASHCP help Flash Copy - Written by Abraham van der Merwe -config MTD_UTILS_FTL_CHECK +config MTD_UTILS_JFFS2DUMP bool - prompt "ftl_check" + prompt "jffs2dump" help - Utility to check an FTL partition + This utility dumps the contents of a binary JFFS2 image -config MTD_UTILS_FTL_FORMAT +config MTD_UTILS_MKFS_JFFS2 bool - prompt "ftl_format" + prompt "mkfs.jffs2" help - Utility to create an FTL partition in a memory region + Build a JFFS2 image in a file, from a given directory tree. -config MTD_UTILS_JFFS2_DUMP +config MTD_UTILS_RFDDUMP bool - prompt "jffs2_dump" + prompt "rfddump" help - This utility dumps the contents of a binary JFFS2 image + Dumps the contents of a resident flash disk -#config MTD_UTILS_JFFS2READER -# bool -# prompt "jffs2reader" -# help -# A jffs2 image reader +config MTD_UTILS_RFDFORMAT + bool + prompt "rfdformat" + help + Formats NOR flash for resident flash disk -config MTD_UTILS_JITTERTEST +config MTD_UTILS_SUMTOOL bool - prompt "jittertest" + prompt "sumtool" help - This program is used to measure what the jitter of a - real time task would be under "standard" Linux. + Convert the input JFFS2 image to a summarized JFFS2 image + Summary makes mounting faster - if summary support enabled in your kernel + - More particularly, what is the effect of running - a real time task under Linux with background - JFFS file system activity. +comment "nand utils" -config MTD_UTILS_MTDDEBUG +config MTD_UTILS_BIN2NAND bool - prompt "mtd_debug" + prompt "bin2nand" help - Does info, read, write and erase on mtd devices + a tool for adding OOB information to a binary input file + +config MTD_UTILS_MKBOOTENV + bool + prompt "mkbootenv" + help + processes bootenv text files and convertes them into a binary format + +config MTD_UTILS_NAND2BIN + bool + prompt "nand2bin" + help + split data and OOB + +config MTD_UTILS_FTL_CHECK + bool + prompt "ftl_check" + help + Utility to check an FTL partition + +config MTD_UTILS_FTL_FORMAT + bool + prompt "ftl_format" + help + Utility to create an FTL partition in a memory region config MTD_UTILS_NANDDUMP bool prompt "nanddump" help - This utility dumps the contents of raw NAND chips or NAND - chips contained in DoC devices. + Dumping the content of NFTL partitions on a "Physical Disk" + +config MTD_UTILS_NANDTEST + bool + prompt "nandtest" + help + test NAND device and badblock check config MTD_UTILS_NANDWRITE bool @@ -123,13 +226,10 @@ config MTD_UTILS_NFTLDUMP bool prompt "nftldump" help - Dumping the content of NFTL partitions on a "Physical Disk" + This utility dumps the contents of raw NAND chips or NAND + chips contained in DoC devices. + -config MTD_UTILS_MKJFFS2 - bool - prompt "mkfs.jffs2" - help - Build a JFFS2 image in a file, from a given directory tree. config MTD_UTILS_SUMTOOL bool @@ -154,6 +254,12 @@ config MTD_UTILS_UBICRC32 help UBI CRC2 file checksum +config MTD_UTILS_UBICRC32_PL + bool + prompt "ubicrc32.pl" + help + Perl wrapper + config MTD_UTILS_UBIDETACH bool prompt "ubidetach" @@ -166,6 +272,18 @@ config MTD_UTILS_UBIFORMAT help format an mtd device +config MTD_UTILS_UBIGEN + bool + prompt "ubigen" + help + a tool for adding UBI information to a binary input file + +config MTD_UTILS_UBIMIRROR + bool + prompt "ubimirror" + help + mirrors ubi volumes + config MTD_UTILS_UBIMKVOL bool prompt "ubimkvol" @@ -182,7 +300,15 @@ config MTD_UTILS_UBINIZE bool prompt "ubinize" help - Creates UBI images. Probably more useful on host than on target + ubinize version 1.0 - a tool to generate UBI images. An UBI image may contain + one or more UBI volumes which have to be defined in the input configuration + ini-file. The ini file defines all the UBI volumes - their characteristics and + the and the contents, but it does not define the characteristics of the flash + the UBI image is generated for. Instead, the flash characteristics are defined + via the command-line options. Note, if not sure about some of the command-line + parameters, do not specify them and let the utility to use default values. + Creates UBI images. + Probably more useful on host than on target. config MTD_UTILS_UBIRMVOL bool @@ -196,6 +322,14 @@ config MTD_UTILS_UBIUPDATEVOL help Updates a volume with data from file +config MTD_UTILS_UNUBI + bool + prompt "unubi" + help + Extract volumes and/or analysis information from an UBI data file. + When no parameters are flagged or given, the default operation is + to rebuild all valid complete UBI volumes found within the image. + config MTD_UTILS_MTDINFO bool prompt "mtdinfo" diff --git a/rules/mtd-utils.make b/rules/mtd-utils.make index 113270d..f00f572 100644 --- a/rules/mtd-utils.make +++ b/rules/mtd-utils.make @@ -66,70 +66,106 @@ $(STATEDIR)/mtd-utils.targetinstall: @$(call install_fixup, mtd-utils,PRIORITY,optional) @$(call install_fixup, mtd-utils,VERSION,$(MTD_UTILS_VERSION)) @$(call install_fixup, mtd-utils,SECTION,base) - @$(call install_fixup, mtd-utils,AUTHOR,"Robert Schwebel <[email protected]>") + @$(call install_fixup, mtd-utils,AUTHOR,"Carsten Schlote <[email protected]>") @$(call install_fixup, mtd-utils,DEPENDS,) @$(call install_fixup, mtd-utils,DESCRIPTION,missing) +ifdef PTXCONF_MTD_UTILS_BIN2NAND + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/bin2nand) +endif +ifdef PTXCONF_MTD_UTILS_MKBOOTENV + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/mkbootenv) +endif +ifdef PTXCONF_MTD_UTILS_MKPFI + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/mkpfi) +endif +ifdef PTXCONF_MTD_UTILS_NAND2BIN + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nand2bin) +endif +ifdef PTXCONF_MTD_UTILS_PDDCUSTOMIZE + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/pddcustomize) +endif +ifdef PTXCONF_MTD_UTILS_PFI2BIN + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/pfi2bin) +endif +ifdef PTXCONF_MTD_UTILS_PFIFLASH + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/pfiflash) +endif + +ifdef PTXCONF_MTD_UTILS_DOC_LOADBIOS + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/doc_loadbios) +endif +ifdef PTXCONF_MTD_UTILS_DOCFDISK + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/docfdisk) +endif ifdef PTXCONF_MTD_UTILS_FLASH_ERASE - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flash_erase) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_erase) endif ifdef PTXCONF_MTD_UTILS_FLASH_ERASEALL - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flash_eraseall) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_eraseall) endif ifdef PTXCONF_MTD_UTILS_FLASH_INFO - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flash_info) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_info) endif ifdef PTXCONF_MTD_UTILS_FLASH_LOCK - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flash_lock) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_lock) +endif +ifdef PTXCONF_MTD_UTILS_FLASH_OTP_DUMP + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_otp_dump) +endif +ifdef PTXCONF_MTD_UTILS_FLASH_OTP_INFO + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_otp_info) endif ifdef PTXCONF_MTD_UTILS_FLASH_UNLOCK - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flash_unlock) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flash_unlock) endif ifdef PTXCONF_MTD_UTILS_FLASHCP - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/flashcp) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/flashcp) endif ifdef PTXCONF_MTD_UTILS_FTL_CHECK - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/ftl_check) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/ftl_check) endif ifdef PTXCONF_MTD_UTILS_FTL_FORMAT - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/ftl_format) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/ftl_format) endif -ifdef PTXCONF_MTD_UTILS_JFFS2_DUMP - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/jffs2dump) +ifdef PTXCONF_MTD_UTILS_JFFS2DUMP + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/jffs2dump) endif - -ifdef PTXCONF_MTD_UTILS_MTDDEBUG - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/mtd_debug) +ifdef PTXCONF_MTD_UTILS_MKFS.JFFS2 + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/mkfs.jffs2) +endif +ifdef PTXCONF_MTD_UTILS_MTD_DEBUG + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/mtd_debug) endif ifdef PTXCONF_MTD_UTILS_NANDDUMP - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/nanddump) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nanddump) +endif +ifdef PTXCONF_MTD_UTILS_NANDTEST + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nandtest) endif ifdef PTXCONF_MTD_UTILS_NANDWRITE - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/nandwrite) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nandwrite) endif ifdef PTXCONF_MTD_UTILS_NFTL_FORMAT - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/nftl_format) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nftl_format) endif ifdef PTXCONF_MTD_UTILS_NFTLDUMP - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/nftldump) + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/nftldump) endif -ifdef PTXCONF_MTD_UTILS_MKJFFS2 - @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ - /usr/sbin/mkfs.jffs2) +ifdef PTXCONF_MTD_UTILS_RECV_IMAGE + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/recv_image) +endif +ifdef PTXCONF_MTD_UTILS_RFDDUMP + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/rfddump) +endif +ifdef PTXCONF_MTD_UTILS_RFDFORMAT + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/rfdformat) +endif +ifdef PTXCONF_MTD_UTILS_SERVE_IMAGE + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/serve_image) +endif +ifdef PTXCONF_MTD_UTILS_SUMTOOL + @$(call install_copy, mtd-utils, 0, 0, 0755, -, /usr/sbin/sumtool) endif ifdef PTXCONF_MTD_UTILS_SUMTOOL @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ @@ -172,6 +208,23 @@ ifdef PTXCONF_MTD_UTILS_UBINIZE @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ /usr/sbin/ubinize) endif +ifdef PTXCONF_MTD_UTILS_UBICRC32_PL + @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ + /usr/sbin/ubicrc32.pl) +endif +ifdef PTXCONF_MTD_UTILS_UBIGEN + @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ + /usr/sbin/ubigen) +endif +ifdef PTXCONF_MTD_UTILS_UBIMIRROR + @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ + /usr/sbin/ubimirror) +endif +ifdef PTXCONF_MTD_UTILS_UNUBI + @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ + /usr/sbin/unubi) +endif + ifdef PTXCONF_MTD_UTILS_MTDINFO @$(call install_copy, mtd-utils, 0, 0, 0755, -, \ /usr/sbin/mtdinfo) -- 1.6.5.6.gb3118 -- ptxdist mailing list [email protected]
