Skip to contentSkip to conversation

mtd: bump to version 2.0.0

PATCH New Thomas Petazzoni 2 participants 5 messages Jun 8, 2017 – Jun 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mtd: bump to version 2.0.0

From: Adam Duskett <[email protected]>

MTD Tools was bumped to version 2.0 after over a decade of being at 1.5.2.

This revision includes:
- Moving from a handwritten makefile to autotools.
- Restructuring and cleaning up the source tree.
- Fixing the problems that the patches in the package/mtd directory fixed.

Changes:
- Move from generic-package to autotools-package in mtd.mk.
- Remove no longer necessary patches.
- Update binary locations in mtd.mk
- Update library/header locations in mtd.mk
- Remove MTD_ADD_MISSING_LINTL definition from mtd.mk, as it's no longer needed.

Tested with toolchains compiled with musl, uclibc, and glibc.

[Thomas: additional improvements
- introduce hidden options BR2_PACKAGE_MTD_JFFS_UTILS, BR2_PACKAGE_MTD_UBIFS_UTILS and BR2_PACKAGE_MTD_TESTS that match the ./configure options of mtd. Those hidden options select the appropriate dependencies checked by the configure script, and are selected by the existing per-tool Config.in options.
- .mk file is changed to handle properly the new hidden options BR2_PACKAGE_MTD_JFFS_UTILS, BR2_PACKAGE_MTD_UBIFS_UTILS and BR2_PACKAGE_MTD_TESTS.
- .mk file is changed to properly handle BR2_PACKAGE_ACL, by passing --with-xattr/--without-xattr.
- remove HOST_MTD_BUILD_CMDS and HOST_MTD_INSTALL_CMDS, those are no longer needed since we have an autotools-package now.
- MTD_STAGING_y and MTD_INSTALL_STAGING_CMDS are removed, we use the default staging installation commands, that install everything that is needed.
- the MTD_TARGETS_UBI_y variable is merged into MTD_TARGETS_y, as we no longer need to distinguish both.
- integck installation logic is moved into MTD_TARGETS_y.]

---
Changes since v1:
- See all the changes I have done, detailed above.

---
 ...binize-Always-return-error-code-at-least-.patch |  64 -------------
 ...y-use-execinfo.h-when-INTEGCK_DEBUG-is-en.patch |  62 -------------
 ...tegrity-don-t-include-header-bits-stdio_l.patch |  45 ---------
 package/mtd/Config.in                              |  30 ++++--
 package/mtd/mtd.hash                               |   4 +-
 package/mtd/mtd.mk                                 | 103 +++++++--------------
 6 files changed, 61 insertions(+), 247 deletions(-)
 delete mode 100644 package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch
 delete mode 100644 package/mtd/0002-integck-only-use-execinfo.h-when-INTEGCK_DEBUG-is-en.patch
 delete mode 100644 package/mtd/0003-fs-tests-integrity-don-t-include-header-bits-stdio_l.patch
package/mtd/0001-mtd-utils-ubinize-Always-return-error-code-at-least-.patch deleted +0 -64
deleted file mode 100644
index 077ca0c..0000000
@@ -1,64 +0,0 @@
-From 5f50207231414bfdbac8f0f974a2824f24177d6e Mon Sep 17 00:00:00 2001
-From: Enrico Jorns <[email protected]>
-Date: Fri, 11 Sep 2015 15:28:13 +0200
-Subject: [PATCH] mtd-utils: ubinize: Always return error code (at least -1) in
- case of an error
-
-ubinize should not fail silenty, this can be very annoying when using
-it from other tools that rely on the exit code for determining the
-success of their operation.
-
-Signed-off-by: Enrico Jorns <[email protected]>
-Signed-off-by: Brian Norris <[email protected]>
-Signed-off-by: Luca Ceresoli <[email protected]>
----
- ubi-utils/ubinize.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c
-index 34f465a..60bbd9a 100644
---- a/ubi-utils/ubinize.c
-+++ b/ubi-utils/ubinize.c
-@@ -519,6 +519,7 @@ int main(int argc, char * const argv[])
- 	 */
- 	seek = ui.peb_size * 2;
- 	if (lseek(args.out_fd, seek, SEEK_SET) != seek) {
-+		err = -1;
- 		sys_errmsg("cannot seek file \"%s\"", args.f_out);
- 		goto out_free;
- 	}
-@@ -530,6 +531,7 @@ int main(int argc, char * const argv[])
- 		int fd, j;
- 
- 		if (!sname) {
-+			err = -1;
- 			errmsg("ini-file parsing error (iniparser_getsecname)");
- 			goto out_free;
- 		}
-@@ -550,6 +552,7 @@ int main(int argc, char * const argv[])
- 		 */
- 		for (j = 0; j < i; j++) {
- 			if (vi[i].id == vi[j].id) {
-+				err = -1;
- 				errmsg("volume IDs must be unique, but ID %d "
- 				       "in section \"%s\" is not",
- 				       vi[i].id, sname);
-@@ -557,6 +560,7 @@ int main(int argc, char * const argv[])
- 			}
- 
- 			if (!strcmp(vi[i].name, vi[j].name)) {
-+				err = -1;
- 				errmsg("volume name must be unique, but name "
- 				       "\"%s\" in section \"%s\" is not",
- 				       vi[i].name, sname);
-@@ -580,6 +584,7 @@ int main(int argc, char * const argv[])
- 		if (img) {
- 			fd = open(img, O_RDONLY);
- 			if (fd == -1) {
-+				err = fd;
- 				sys_errmsg("cannot open \"%s\"", img);
- 				goto out_free;
- 			}
--- 
-1.9.1
-
package/mtd/0002-integck-only-use-execinfo.h-when-INTEGCK_DEBUG-is-en.patch deleted +0 -62

62 lines not on this page · raw message

package/mtd/0003-fs-tests-integrity-don-t-include-header-bits-stdio_l.patch deleted +0 -45

45 lines not on this page · raw message

package/mtd/Config.in +24 -6
index 2e6cdbb..a1df4cf 100644
@@ -6,6 +6,25 @@ config BR2_PACKAGE_MTD
 	  http://www.linux-mtd.infradead.org/
 
 if BR2_PACKAGE_MTD
+
+# The three hidden options below match mtd configure script options
+# --enable-jffs, --enable-ubifs and --enable-tests.
+
+config BR2_PACKAGE_MTD_JFFS_UTILS
+	bool
+	select BR2_PACKAGE_LZO
+	select BR2_PACKAGE_ZLIB
+
+config BR2_PACKAGE_MTD_UBIFS_UTILS
+	bool
+	select BR2_PACKAGE_LZO
+	select BR2_PACKAGE_UTIL_LINUX
+	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	select BR2_PACKAGE_ZLIB
+
+config BR2_PACKAGE_MTD_TESTS
+	bool
+
 comment "MTD tools selection"
 
 config BR2_PACKAGE_MTD_DOCFDISK
@@ -50,18 +69,15 @@ config BR2_PACKAGE_MTD_FTL_FORMAT
 
 config BR2_PACKAGE_MTD_JFFS2DUMP
 	bool "jffs2dump"
+	select BR2_PACKAGE_MTD_JFFS_UTILS
 
 config BR2_PACKAGE_MTD_MKFSJFFS2
 	bool "mkfs.jffs2"
-	select BR2_PACKAGE_ZLIB
-	select BR2_PACKAGE_LZO
+	select BR2_PACKAGE_MTD_JFFS_UTILS
 
 config BR2_PACKAGE_MTD_MKFSUBIFS
 	bool "mkfs.ubifs"
-	select BR2_PACKAGE_ZLIB
-	select BR2_PACKAGE_LZO
-	select BR2_PACKAGE_UTIL_LINUX
-	select BR2_PACKAGE_UTIL_LINUX_LIBUUID
+	select BR2_PACKAGE_MTD_UBIFS_UTILS
 
 config BR2_PACKAGE_MTD_MTD_DEBUG
 	bool "mtd_debug"
@@ -102,6 +118,7 @@ config BR2_PACKAGE_MTD_SERVE_IMAGE
 
 config BR2_PACKAGE_MTD_SUMTOOL
 	bool "sumtool"
+	select BR2_PACKAGE_MTD_JFFS_UTILS
 
 config BR2_PACKAGE_MTD_MTDINFO
 	bool "mtdinfo"
@@ -158,6 +175,7 @@ config BR2_PACKAGE_MTD_UBIBLOCK
 config BR2_PACKAGE_MTD_INTEGCK
 	bool "integck"
 	depends on BR2_USE_MMU # fork()
+	select BR2_PACKAGE_MTD_TESTS
 	help
 	  Install the integck test program.
 
package/mtd/mtd.hash +2 -2
index a99e04e..6a234d2 100644
@@ -1,3 +1,3 @@
 # Locally calculated after checking pgp signature
-# ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-1.5.2.tar.bz2.asc
-sha256	5db57389280a3abaec5dd23af2590988b70f213fa3929c12a2642c8f9a86f400	mtd-utils-1.5.2.tar.bz2
+# ftp://ftp.infradead.org/pub/mtd-utils/mtd-utils-2.0.0.tar.bz2.asc
+sha256	20a377aa86af4c102e930b0d0bb9859e3a10aeb16445f6a1273989b206a717c8	mtd-utils-2.0.0.tar.bz2
package/mtd/mtd.mk +35 -68

142 lines not on this page · raw message

Signature · 1 line
2.7.4
author Applied
#1 lore raw

PATCH v2 1/2 mtd: bump to version 2.0.0

Hello,

Quoted 18 lines · Thomas Petazzoni

From: Adam Duskett <[email protected]>

MTD Tools was bumped to version 2.0 after over a decade of being at 1.5.2.

This revision includes:
- Moving from a handwritten makefile to autotools.
- Restructuring and cleaning up the source tree.
- Fixing the problems that the patches in the package/mtd directory fixed.

Changes:
- Move from generic-package to autotools-package in mtd.mk.
- Remove no longer necessary patches.
- Update binary locations in mtd.mk
- Update library/header locations in mtd.mk
- Remove MTD_ADD_MISSING_LINTL definition from mtd.mk, as it's no longer needed.

Quoted 3 lines

Tested with toolchains compiled with musl, uclibc, and glibc.

[snip]

I've applied both patches to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH v2 1/2 mtd: bump to version 2.0.0

In reply to Thomas Petazzoni

Hi Thomas, Adam,

Quoted 4 lines · Thomas Petazzoni

From: Adam Duskett <[email protected]>

MTD Tools was bumped to version 2.0 after over a decade of being at 1.5.2.

A little correction, mtd-utils 1.5.2 is not that old:

commit aea36417067dade75192bafa03af70b6eb2677b1

Author: Brian Norris <[email protected]>
Date:   Fri Jul 24 18:18:53 2015 -0700
    Release mtd-utils-1.5.2

baruch

Quoted 36 lines

This revision includes:
- Moving from a handwritten makefile to autotools.
- Restructuring and cleaning up the source tree.
- Fixing the problems that the patches in the package/mtd directory fixed.

Changes:
- Move from generic-package to autotools-package in mtd.mk.
- Remove no longer necessary patches.
- Update binary locations in mtd.mk
- Update library/header locations in mtd.mk
- Remove MTD_ADD_MISSING_LINTL definition from mtd.mk, as it's no longer needed.

Tested with toolchains compiled with musl, uclibc, and glibc.

[Thomas: additional improvements
- introduce hidden options BR2_PACKAGE_MTD_JFFS_UTILS, BR2_PACKAGE_MTD_UBIFS_UTILS and BR2_PACKAGE_MTD_TESTS that match the ./configure options of mtd. Those hidden options select the appropriate dependencies checked by the configure script, and are selected by the existing per-tool Config.in options.
- .mk file is changed to handle properly the new hidden options BR2_PACKAGE_MTD_JFFS_UTILS, BR2_PACKAGE_MTD_UBIFS_UTILS and BR2_PACKAGE_MTD_TESTS.
- .mk file is changed to properly handle BR2_PACKAGE_ACL, by passing --with-xattr/--without-xattr.
- remove HOST_MTD_BUILD_CMDS and HOST_MTD_INSTALL_CMDS, those are no longer needed since we have an autotools-package now.
- MTD_STAGING_y and MTD_INSTALL_STAGING_CMDS are removed, we use the default staging installation commands, that install everything that is needed.
- the MTD_TARGETS_UBI_y variable is merged into MTD_TARGETS_y, as we no longer need to distinguish both.
- integck installation logic is moved into MTD_TARGETS_y.]

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#3 lore raw

PATCH v2 1/2 mtd: bump to version 2.0.0

Hello,

Quoted 10 lines · Baruch Siach
Quoted 2 lines

MTD Tools was bumped to version 2.0 after over a decade of being at 1.5.2.

A little correction, mtd-utils 1.5.2 is not that old:

commit aea36417067dade75192bafa03af70b6eb2677b1

Author: Brian Norris <[email protected]>
Date:   Fri Jul 24 18:18:53 2015 -0700
    Release mtd-utils-1.5.2

Indeed, thanks for spotting. I've dropped this sentence from the commit log before applying.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#4 lore raw

PATCH v2 2/2 mtd: switch to a foreach loop for installation

In reply to Thomas Petazzoni

Such a construct allows to bail out if the installation of one of the program fails, which the current shell-based for loop doesn't do.

---
Changes since v1:
- New patch in this version.

---
 package/mtd/mtd.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
package/mtd/mtd.mk +3 -3
index 52ad96c..3df641e 100644
@@ -92,9 +92,9 @@ MTD_TARGETS_$(BR2_PACKAGE_MTD_MKFSUBIFS)	+= mkfs.ubifs
 MTD_TARGETS_$(BR2_PACKAGE_MTD_INTEGCK)		+= integck
 
 define MTD_INSTALL_TARGET_CMDS
-	for f in $(MTD_TARGETS_y) ; do \
-		$(INSTALL) -D -m 0755 $(@D)/$$f $(TARGET_DIR)/usr/sbin/$${f##*/} ; \
-	done
+	$(foreach f,$(MTD_TARGETS_y), \
+		$(INSTALL) -D -m 0755 $(@D)/$(f) $(TARGET_DIR)/usr/sbin/$(notdir $(f))
+	)
 endef
 
 $(eval $(autotools-package))
Signature · 1 line
2.7.4