From f5cb6e11a95f19f921e97848ea9aa0d23b81127c Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 17 Jun 2014 03:07:40 +0200 Subject: package/mtd-utils: allow to be used on the target Signed-off-by: Phil Sutter --- package/mtd-utils/Makefile | 75 ++++++++++++++++++++++++++++++-- package/mtd-utils/patches/patch-Makefile | 75 +++++++++----------------------- 2 files changed, 92 insertions(+), 58 deletions(-) diff --git a/package/mtd-utils/Makefile b/package/mtd-utils/Makefile index 8cb23eb6f..ce10bc777 100644 --- a/package/mtd-utils/Makefile +++ b/package/mtd-utils/Makefile @@ -6,19 +6,47 @@ include $(TOPDIR)/rules.mk PKG_NAME:= mtd-utils PKG_VERSION:= 1.5.0 PKG_RELEASE:= 1 -PKG_MD5SUM:= a4df1ad29684be79b0fa699bdae01faf +PKG_MD5SUM:= fd929de593acadd658d45feb07f993aa PKG_DESCR:= flash filesystem utilities PKG_SECTION:= sys/fs +PKG_DEPENDS:= liblzo +PKG_BUILDDEP:= liblzo HOST_BUILDDEP:= liblzo-host -PKG_SITES:= http://openadk.org/distfiles/ +PKG_URL:= http://www.linux-mtd.infradead.org +PKG_SITES:= http://git.infradead.org/mtd-utils.git/snapshot/ +DISTFILES:= ca39eb1d98e736109c64ff9c1aa2a6ecca222d8f.tar.gz +WRKDIST= ${WRKDIR}/mtd-utils-ca39eb1 -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz -PKG_CFLINE_MTD_UTILS:= depends on ADK_HOST_ONLY +PKG_SUBPKGS:= MTD_UTILS NANDWRITE NANDDUMP NANDTEST FLASH_ERASE FLASH_OTP_INFO FLASH_OTP_DUMP FLASH_LOCK +PKGSD_NANDWRITE:= mtd-utils nandwrite utility +PKGSD_NANDDUMP:= mtd-utils nanddump utility +PKGSD_NANDTEST:= mtd-utils nandtest utility +PKGSD_FLASH_ERASE:= mtd-utils flash_erase utility +PKGSD_FLASH_OTP_INFO:= mtd-utils flash_otp_info utility +PKGSD_FLASH_OTP_DUMP:= mtd-utils flash_otp_dump utility +PKGSD_FLASH_LOCK:= mtd-utils flash_lock/flash_unlock utilities + +PKG_CFLINE_MTD_UTILS:= depends on ADK_HOST_ONLY + +PKG_FLAVOURS_MTD_UTILS:= WITH_XATTR WITH_LZO WITH_UBIFS +PKGFD_WITH_XATTR:= enable support for extended attributes +PKGFD_WITH_LZO:= enable LZO support +PKGFD_WITH_UBIFS:= enable ubifs support +PKGFS_WITH_UBIFS:= liblzo +PKGFB_WITH_UBIFS:= liblzo include $(TOPDIR)/mk/host.mk include $(TOPDIR)/mk/package.mk $(eval $(call HOST_template,MTD_UTILS,mtd-utils,$(PKG_VERSION)-${PKG_RELEASE})) +$(eval $(call PKG_template,MTD_UTILS,$(PKG_NAME),$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +$(eval $(call PKG_template,NANDWRITE,nandwrite,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_NANDWRITE},${PKG_SECTION})) +$(eval $(call PKG_template,NANDDUMP,nanddump,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_NANDDUMP},${PKG_SECTION})) +$(eval $(call PKG_template,NANDTEST,nandtest,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_NANDTEST},${PKG_SECTION})) +$(eval $(call PKG_template,FLASH_ERASE,flash-erase,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FLASH_ERASE},${PKG_SECTION})) +$(eval $(call PKG_template,FLASH_OTP_INFO,flash-otp-info,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FLASH_OTP_INFO},${PKG_SECTION})) +$(eval $(call PKG_template,FLASH_OTP_DUMP,flash-otp-dump,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FLASH_OTP_DUMP},${PKG_SECTION})) +$(eval $(call PKG_template,FLASH_LOCK,flash-lock,$(PKG_VERSION)-${PKG_RELEASE},${PKG_DEPENDS},${PKGSD_FLASH_LOCK},${PKG_SECTION})) HOST_STYLE:= manual CPPFLAGS_FOR_BUILD+= -DWITHOUT_XATTR=1 -I./include @@ -32,5 +60,44 @@ mtd-utils-hostinstall: ${INSTALL_BIN} ${WRKBUILD}/mkfs.jffs2 \ ${STAGING_HOST_DIR}/usr/bin +CONFIG_STYLE:= manual +ifneq (${ADK_PACKAGE_MTD_UTILS_WITH_XATTR},y) +XAKE_FLAGS+= WITHOUT_XATTR=1 +endif +ifneq (${ADK_PACKAGE_MTD_UTILS_WITH_LZO},y) +XAKE_FLAGS+= WITHOUT_LZO=1 +endif +ifneq (${ADK_PACKAGE_MTD_UTILS_WITH_UBIFS},y) +XAKE_FLAGS+= WITHOUT_UBI=1 +endif +XAKE_FLAGS+= BUILDDIR="${WRKDIST}" + +post-install: + $(INSTALL_DIR) $(IDIR_MTD_UTILS)/usr/bin + $(INSTALL_BIN) $(WRKINST)/usr/sbin/{doc,flash_otp_,ftl_,nftl,rfd}* \ + ${WRKINST}/usr/sbin/{flashcp,jffs2dump,mkfs.jffs2,mtd_debug,recv_image,serve_image,sumtool} \ + $(IDIR_MTD_UTILS)/usr/bin + $(INSTALL_DIR) $(IDIR_NANDWRITE)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/nandwrite \ + ${IDIR_NANDWRITE}/usr/sbin + $(INSTALL_DIR) $(IDIR_NANDDUMP)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/nanddump \ + ${IDIR_NANDDUMP}/usr/sbin + $(INSTALL_DIR) $(IDIR_NANDTEST)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/nandtest \ + ${IDIR_NANDTEST}/usr/sbin + $(INSTALL_DIR) $(IDIR_FLASH_ERASE)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/flash_erase \ + ${IDIR_FLASH_ERASE}/usr/sbin + $(INSTALL_DIR) $(IDIR_FLASH_OTP_INFO)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/flash_otp_info \ + ${IDIR_FLASH_OTP_INFO}/usr/sbin + $(INSTALL_DIR) $(IDIR_FLASH_OTP_DUMP)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/flash_otp_dump \ + ${IDIR_FLASH_OTP_DUMP}/usr/sbin + $(INSTALL_DIR) $(IDIR_FLASH_LOCK)/usr/sbin + ${INSTALL_BIN} ${WRKINST}/usr/sbin/flash_{lock,unlock} \ + ${IDIR_FLASH_LOCK}/usr/sbin + include ${TOPDIR}/mk/host-bottom.mk include ${TOPDIR}/mk/pkg-bottom.mk diff --git a/package/mtd-utils/patches/patch-Makefile b/package/mtd-utils/patches/patch-Makefile index 53ed8640e..89a07af54 100644 --- a/package/mtd-utils/patches/patch-Makefile +++ b/package/mtd-utils/patches/patch-Makefile @@ -1,22 +1,18 @@ ---- mtd-utils-1.5.0.orig/Makefile 2012-05-07 09:19:39.000000000 +0200 -+++ mtd-utils-1.5.0/Makefile 2014-03-30 15:49:30.000000000 +0200 -@@ -16,27 +16,13 @@ endif - - TESTS = tests - --MTD_BINS = \ -- ftl_format flash_erase nanddump doc_loadbios \ -- ftl_check mkfs.jffs2 flash_lock flash_unlock \ -- flash_otp_info flash_otp_dump mtd_debug flashcp nandwrite nandtest \ -- jffs2dump \ -- nftldump nftl_format docfdisk \ -- rfddump rfdformat \ -- serve_image recv_image \ -- sumtool jffs2reader --UBI_BINS = \ -- ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ -- ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol -+MTD_BINS = mkfs.jffs2 + - allow disabling ubifs tools + - drop the tests +--- mtd-utils-ca39eb1.orig/Makefile 2012-05-07 09:19:39.000000000 +0200 ++++ mtd-utils-ca39eb1/Makefile 2014-06-02 23:39:37.857504666 +0200 +@@ -14,7 +14,7 @@ else + LZOLDLIBS = -llzo2 + endif + +-TESTS = tests ++#TESTS = tests + + MTD_BINS = \ + ftl_format flash_erase nanddump doc_loadbios \ +@@ -30,13 +30,16 @@ UBI_BINS = \ + ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol BINS = $(MTD_BINS) -BINS += mkfs.ubifs/mkfs.ubifs @@ -25,41 +21,12 @@ TARGETS = $(BINS) TARGETS += lib/libmtd.a --TARGETS += ubi-utils/libubi.a ++ ++ifneq ($(WITHOUT_UBI), 1) ++BINS += mkfs.ubifs/mkfs.ubifs ++BINS += $(addprefix ubi-utils/,$(UBI_BINS)) + TARGETS += ubi-utils/libubi.a ++endif OBJDEPS = $(BUILDDIR)/include/version.h -@@ -83,12 +69,12 @@ $(BUILDDIR)/include/version.h.tmp: - # - # Utils in top level - # --obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr_lzo.o compr.o rbtree.o --LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_mkfs.jffs2 = -lz $(LZOLDLIBS) -+obj-mkfs.jffs2 = compr_rtime.o compr_zlib.o compr.o rbtree.o -+LDFLAGS_mkfs.jffs2 = $(ZLIBLDFLAGS) -+LDLIBS_mkfs.jffs2 = -lz - --LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) $(LZOLDFLAGS) --LDLIBS_jffs2reader = -lz $(LZOLDLIBS) -+LDFLAGS_jffs2reader = $(ZLIBLDFLAGS) -+LDLIBS_jffs2reader = -lz - - $(foreach v,$(MTD_BINS),$(eval $(call mkdep,,$(v)))) - -@@ -103,7 +89,7 @@ $(call _mkdep,lib/,libmtd.a) - # - obj-mkfs.ubifs = crc16.o lpt.o compr.o devtable.o \ - hashtable/hashtable.o hashtable/hashtable_itr.o --LDLIBS_mkfs.ubifs = -lz -llzo2 -lm -luuid -+LDLIBS_mkfs.ubifs = -lz -lm -luuid - $(call mkdep,mkfs.ubifs/,mkfs.ubifs,,ubi-utils/libubi.a) - - # -@@ -117,6 +103,3 @@ obj-libubigen.a = libubigen.o - obj-mtdinfo = libubigen.a - obj-ubinize = libubigen.a libiniparser.a - obj-ubiformat = libubigen.a libscan.a -- --$(foreach v,libubi.a libubigen.a libiniparser.a libscan.a,$(eval $(call _mkdep,ubi-utils/,$(v)))) --$(foreach v,$(UBI_BINS),$(eval $(call mkdep,ubi-utils/,$(v),libubi.a ubiutils-common.o))) -- cgit v1.2.3