Skip to contentSkip to conversation

package/mtd: install libubi.a and libmtd.a to staging

PATCH New Romain Naour 2 participants 3 messages Sep 6, 2014 – Sep 7, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/mtd: install libubi.a and libmtd.a to staging

Makefile's install rule deploy mtd's binaries but also static libraries (libubi.a libmtd.a).

Since mtd's binaries are manualy installed to target, static libraries are left in the build directory.

Others tools linked with -lubi or -lmtd fail to build.

Unconditionally build these libraries even if no mdt tool are enabled and manually install them to staging by setting MTD_INSTALL_STAGING_CMDS

---
 package/mtd/mtd.mk | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
package/mtd/mtd.mk +10 -5
index 80928b6..a9154a5 100644
@@ -10,6 +10,8 @@ MTD_SITE = ftp://ftp.infradead.org/pub/mtd-utils
 MTD_LICENSE = GPLv2
 MTD_LICENSE_FILES = COPYING
 
+MTD_INSTALL_STAGING = YES
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
@@ -36,6 +38,8 @@ endef
 MKFS_JFFS2 = $(HOST_DIR)/usr/sbin/mkfs.jffs2
 SUMTOOL = $(HOST_DIR)/usr/sbin/sumtool
 
+MTD_STAGING_y					+= lib/libmtd.a
+MTD_STAGING_y					+= ubi-utils/libubi.a
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOCFDISK)		+= docfdisk
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOC_LOADBIOS)	+= doc_loadbios
 MTD_TARGETS_$(BR2_PACKAGE_MTD_FLASHCP)		+= flashcp
@@ -79,16 +83,17 @@ MTD_TARGETS_UBI_$(BR2_PACKAGE_MTD_UBIBLOCK)	+= ubiblock
 MTD_TARGETS_y += $(addprefix ubi-utils/,$(MTD_TARGETS_UBI_y))
 MTD_TARGETS_$(BR2_PACKAGE_MTD_MKFSUBIFS) += mkfs.ubifs/mkfs.ubifs
 
-# only call make if atleast a single tool is enabled
-ifneq ($(MTD_TARGETS_y),)
-
 define MTD_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) $(MAKE1) CROSS=$(TARGET_CROSS) \
 		BUILDDIR=$(@D) WITHOUT_XATTR=1 WITHOUT_LARGEFILE=1 -C $(@D) \
-		$(addprefix $(@D)/,$(MTD_TARGETS_y))
+		$(addprefix $(@D)/,$(MTD_TARGETS_y)) \
+		$(addprefix $(@D)/,$(MTD_STAGING_y))
 endef
 
-endif
+define MTD_INSTALL_STAGING_CMDS
+     $(INSTALL) -D -m 0755 $(@D)/lib/libmtd.a $(STAGING_DIR)/usr/lib/libmtd.a
+     $(INSTALL) -D -m 0755 $(@D)/ubi-utils/libubi.a $(STAGING_DIR)/usr/lib/libubi.a
+endef
 
 define MTD_INSTALL_TARGET_CMDS
  for f in $(MTD_TARGETS_y) ; do \
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 package/mtd: install libubi.a and libmtd.a to staging

Dear Romain Naour,

Quoted 10 lines · Romain Naour

Makefile's install rule deploy mtd's binaries but also static libraries (libubi.a libmtd.a).

Since mtd's binaries are manualy installed to target, static libraries are left in the build directory.

Others tools linked with -lubi or -lmtd fail to build.

Unconditionally build these libraries even if no mdt tool are enabled and manually install them to staging by setting MTD_INSTALL_STAGING_CMDS

I find the explanation somewhat convoluted here, what about simply:

Currently, the mtd package only installs the mtd utilities into the target directory. However, the mtd-utils also provide two static libraries (libmtd.a and libubi.a) that can be used by other packages or tools.

Therefore, this commit extends the mtd package by adding the installation to the staging directory of those two libraries.

Quoted 20 lines
---
 package/mtd/mtd.mk | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
package/mtd/mtd.mk +2 -0
index 80928b6..a9154a5 100644
@@ -10,6 +10,8 @@ MTD_SITE = ftp://ftp.infradead.org/pub/mtd-utils
 MTD_LICENSE = GPLv2
 MTD_LICENSE_FILES = COPYING
 
+MTD_INSTALL_STAGING = YES
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif

package/mtd/mtd.mk endef · line 42

Quoted 5 lines
package/mtd/mtd.mk +2 -0
@@ -36,6 +38,8 @@ endef
 MKFS_JFFS2 = $(HOST_DIR)/usr/sbin/mkfs.jffs2
 SUMTOOL = $(HOST_DIR)/usr/sbin/sumtool
 
+MTD_STAGING_y					+= lib/libmtd.a
+MTD_STAGING_y					+= ubi-utils/libubi.a

Maybe the spaces are not necessary, and something like:

MTD_STAGING_y = lib/libmtd.a ubi-utils/libubi.a

would be sufficient.

Quoted 12 lines
package/mtd/mtd.mk +0 -3
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOCFDISK)		+= docfdisk
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOC_LOADBIOS)	+= doc_loadbios
 MTD_TARGETS_$(BR2_PACKAGE_MTD_FLASHCP)		+= flashcp
@@ -79,16 +83,17 @@ MTD_TARGETS_UBI_$(BR2_PACKAGE_MTD_UBIBLOCK)	+= ubiblock
 MTD_TARGETS_y += $(addprefix ubi-utils/,$(MTD_TARGETS_UBI_y))
 MTD_TARGETS_$(BR2_PACKAGE_MTD_MKFSUBIFS) += mkfs.ubifs/mkfs.ubifs
 
-# only call make if atleast a single tool is enabled
-ifneq ($(MTD_TARGETS_y),)
-
 define MTD_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) $(MAKE1) CROSS=$(TARGET_CROSS) \

package/mtd/mtd.mk MTD_TARGETS_UBI_$(BR2_PACKAGE_MTD_UBIBLOCK) += ubiblock · line 95

Quoted 10 lines
package/mtd/mtd.mk +5 -2
 		BUILDDIR=$(@D) WITHOUT_XATTR=1 WITHOUT_LARGEFILE=1 -C $(@D) \
-		$(addprefix $(@D)/,$(MTD_TARGETS_y))
+		$(addprefix $(@D)/,$(MTD_TARGETS_y)) \
+		$(addprefix $(@D)/,$(MTD_STAGING_y))
 endef
 
-endif
+define MTD_INSTALL_STAGING_CMDS
+     $(INSTALL) -D -m 0755 $(@D)/lib/libmtd.a $(STAGING_DIR)/usr/lib/libmtd.a
+     $(INSTALL) -D -m 0755 $(@D)/ubi-utils/libubi.a $(STAGING_DIR)/usr/lib/libubi.a

Please indent with one tab, not spaces.

Thanks!

Thomas

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

PATCH 1/1 package/mtd: install libubi.a and libmtd.a to staging

Hi Thomas,

Le 07/09/2014 09:51, Thomas Petazzoni a ?crit :

Quoted 16 lines

Dear Romain Naour,

Quoted 10 lines · Romain Naour

Makefile's install rule deploy mtd's binaries but also static libraries (libubi.a libmtd.a).

Since mtd's binaries are manualy installed to target, static libraries are left in the build directory.

Others tools linked with -lubi or -lmtd fail to build.

Unconditionally build these libraries even if no mdt tool are enabled and manually install them to staging by setting MTD_INSTALL_STAGING_CMDS

I find the explanation somewhat convoluted here, what about simply:

Quoted 8 lines

Currently, the mtd package only installs the mtd utilities into the target directory. However, the mtd-utils also provide two static libraries (libmtd.a and libubi.a) that can be used by other packages or tools.

Therefore, this commit extends the mtd package by adding the installation to the staging directory of those two libraries.

That's fine.

Quoted 23 lines
Quoted 23 lines
---
 package/mtd/mtd.mk | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
package/mtd/mtd.mk +2 -0
index 80928b6..a9154a5 100644
@@ -10,6 +10,8 @@ MTD_SITE = ftp://ftp.infradead.org/pub/mtd-utils
 MTD_LICENSE = GPLv2
 MTD_LICENSE_FILES = COPYING
 
+MTD_INSTALL_STAGING = YES
+
 ifeq ($(BR2_PACKAGE_MTD_MKFSJFFS2),y)
 MTD_DEPENDENCIES = zlib lzo
 endif
@@ -36,6 +38,8 @@ endef
 MKFS_JFFS2 = $(HOST_DIR)/usr/sbin/mkfs.jffs2
 SUMTOOL = $(HOST_DIR)/usr/sbin/sumtool
 
Quoted 8 lines

package/mtd/mtd.mk endef · line 42

Quoted 2 lines
package/mtd/mtd.mk +2 -0
+MTD_STAGING_y					+= lib/libmtd.a
+MTD_STAGING_y					+= ubi-utils/libubi.a

Maybe the spaces are not necessary, and something like:

MTD_STAGING_y = lib/libmtd.a ubi-utils/libubi.a

would be sufficient.

Fixed.

Quoted 19 lines
Quoted 19 lines
package/mtd/mtd.mk +2 -4
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOCFDISK)		+= docfdisk
 MTD_TARGETS_$(BR2_PACKAGE_MTD_DOC_LOADBIOS)	+= doc_loadbios
 MTD_TARGETS_$(BR2_PACKAGE_MTD_FLASHCP)		+= flashcp
@@ -79,16 +83,17 @@ MTD_TARGETS_UBI_$(BR2_PACKAGE_MTD_UBIBLOCK)	+= ubiblock
 MTD_TARGETS_y += $(addprefix ubi-utils/,$(MTD_TARGETS_UBI_y))
 MTD_TARGETS_$(BR2_PACKAGE_MTD_MKFSUBIFS) += mkfs.ubifs/mkfs.ubifs
 
-# only call make if atleast a single tool is enabled
-ifneq ($(MTD_TARGETS_y),)
-
 define MTD_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) $(MAKE1) CROSS=$(TARGET_CROSS) \
 		BUILDDIR=$(@D) WITHOUT_XATTR=1 WITHOUT_LARGEFILE=1 -C $(@D) \
-		$(addprefix $(@D)/,$(MTD_TARGETS_y))
+		$(addprefix $(@D)/,$(MTD_TARGETS_y)) \
+		$(addprefix $(@D)/,$(MTD_STAGING_y))
 endef
 
Quoted 6 lines

package/mtd/mtd.mk MTD_TARGETS_UBI_$(BR2_PACKAGE_MTD_UBIBLOCK) += ubiblock · line 95

Quoted 4 lines
package/mtd/mtd.mk +3 -1
-endif
+define MTD_INSTALL_STAGING_CMDS
+     $(INSTALL) -D -m 0755 $(@D)/lib/libmtd.a $(STAGING_DIR)/usr/lib/libmtd.a
+     $(INSTALL) -D -m 0755 $(@D)/ubi-utils/libubi.a $(STAGING_DIR)/usr/lib/libubi.a

Please indent with one tab, not spaces.

Fixed.

Thank you.

Best regards,
Romain