Skip to contentSkip to conversation

package/android-tools: add ext4_utils to host

PATCH New kaplan2539 at gmail.com 2 participants 2 messages Nov 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/android-tools: add ext4_utils to host

From: Alex Kaplan <[email protected]>

This patch adds an option to build and install the ext4_utils for the host, i.e. make_ext4fs, ext4fixup, ext2simg, img2simg, simg2img and simg2simg. As a default building of ext4_utils is disabled.

---
 ...akefiles-for-out-of-tree-ext4_utils-build.patch | 48 ++++++++++++++++++++++
 package/android-tools/Config.in.host               |  8 ++++
 package/android-tools/android-tools.mk             | 18 ++++++--
 3 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100644 package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch
package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch new file +48 -0
new file mode 100644
index 0000000..80ea1ec
@@ -0,0 +1,48 @@
+From d24abbec201975a5eb7f8589614cfb424b8c80b6 Mon Sep 17 00:00:00 2001
+From: Alex Kaplan <[email protected]>
+Date: Sat, 10 Nov 2018 19:50:51 -0800
+Subject: [PATCH] Fix makefiles for out-of-tree ext4_utils build
+
+Signed-off-by: Alex Kaplan <[email protected]>
+---
+ debian/makefiles/ext4_utils.mk | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/debian/makefiles/ext4_utils.mk b/debian/makefiles/ext4_utils.mk
+index cb64916..c5904bf 100644
+--- a/debian/makefiles/ext4_utils.mk
++++ b/debian/makefiles/ext4_utils.mk
+@@ -1,6 +1,7 @@
+ # Makefile for ext4_utils; based on https://heiher.info/2227.html
+ # Author: Dmitrijs Ledkovs <[email protected]>
+ 
++VPATH+=$(SRCDIR)/extras/ext4_utils
+ SRCS+=make_ext4fs.c
+ SRCS+=ext4fixup.c
+ SRCS+=ext4_utils.c
+@@ -13,7 +14,7 @@ SRCS+=sha1.c
+ SRCS+=wipe.c
+ SRCS+=crc16.c
+ 
+-VPATH+=../../core/libsparse
++VPATH+=$(SRCDIR)/core/libsparse
+ SRCS+= backed_block.c
+ SRCS+= sparse_crc32.c
+ SRCS+= sparse.c
+@@ -31,10 +32,9 @@ SRCS+=img2simg.c
+ SRCS+=simg2img.c
+ SRCS+=simg2simg.c
+ 
+-CPPFLAGS+= -I.
+-CPPFLAGS+= -I/usr/include
+-CPPFLAGS+= -I../../core/include
+-CPPFLAGS+= -I../../core/libsparse/include/
++CPPFLAGS+= -I$(SRCDIR)
++CPPFLAGS+= -I$(SRCDIR)/core/include
++CPPFLAGS+= -I$(SRCDIR)/core/libsparse/include/
+ 
+ LIBS+= -lz -lselinux
+ 
+-- 
+2.7.4
+
package/android-tools/Config.in.host +8 -0
index 993c4c9..6359e39 100644
@@ -23,4 +23,12 @@ config BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB
 	  host, which can be used to interact with target devices
 	  implementing the ADB protocol.
 
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS
+	bool "ext4 utils"
+	default n
+	help
+	  This option will build and install the ext4 utils for the
+	  host, i.e. make_ext4fs, ext4fixup, ext2simg, img2simg,
+	  simg2img and simg2simg.
+
 endif
package/android-tools/android-tools.mk +14 -4
index 879d788..b59ee13 100644
@@ -31,15 +31,23 @@ HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
 ANDROID_TOOLS_PRE_PATCH_HOOKS += ANDROID_TOOLS_DEBIAN_PATCH
 
 ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT),y)
-HOST_ANDROID_TOOLS_TARGETS += fastboot
+HOST_ANDROID_TOOLS_BUILD_TARGETS += fastboot
+HOST_ANDROID_TOOLS_INSTALL_TARGETS += fastboot
 HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
 endif
 
 ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB),y)
-HOST_ANDROID_TOOLS_TARGETS += adb
+HOST_ANDROID_TOOLS_BUILD_TARGETS += adb
+HOST_ANDROID_TOOLS_INSTALL_TARGETS += adb
 HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-openssl
 endif
 
+ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_EXT4_UTILS),y)
+HOST_ANDROID_TOOLS_BUILD_TARGETS += ext4_utils
+HOST_ANDROID_TOOLS_INSTALL_TARGETS_EXT4_UTILS += make_ext4fs ext4fixup ext2simg img2simg simg2img simg2simg
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-libselinux
+endif
+
 ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT),y)
 ANDROID_TOOLS_TARGETS += fastboot
 ANDROID_TOOLS_DEPENDENCIES += zlib libselinux
@@ -58,7 +66,7 @@ endif
 # Build each tool in its own directory not to share object files
 
 define HOST_ANDROID_TOOLS_BUILD_CMDS
-	$(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
+	$(foreach t,$(HOST_ANDROID_TOOLS_BUILD_TARGETS),\
 		mkdir -p $(@D)/build-$(t) && \
 		$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
 			-C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
@@ -72,8 +80,10 @@ define ANDROID_TOOLS_BUILD_CMDS
 endef
 
 define HOST_ANDROID_TOOLS_INSTALL_CMDS
-	$(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
+	$(foreach t,$(HOST_ANDROID_TOOLS_INSTALL_TARGETS),\
 		$(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(HOST_DIR)/bin/$(t)$(sep))
+	$(foreach t,$(HOST_ANDROID_TOOLS_INSTALL_TARGETS_EXT4_UTILS),\
+		$(INSTALL) -D -m 0755 $(@D)/build-ext4_utils/$(t) $(HOST_DIR)/bin/$(t)$(sep))
 endef
 
 define ANDROID_TOOLS_INSTALL_TARGET_CMDS
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 package/android-tools: add ext4_utils to host

Hi Alex,

Quoted 5 lines · On 11/11/2018 06:38, kaplan2539 at gmail.com wrote:

From: Alex Kaplan <[email protected]>

This patch adds an option to build and install the ext4_utils for the host, i.e. make_ext4fs, ext4fixup, ext2simg, img2simg, simg2img and simg2simg. As a default building of ext4_utils is disabled.

This patch does two things that I said shouldn't be done in my review of
sunxi-tools:

- separate Config.in options for the tools of a host package - but this is already the case for android-tools, so better follow that convention;

- build the different tools in a single run of make - but this time, there is a good reason not to: every tool is built in a separate build directory.

In other words, the comments I made on sunxi-tools don't apply here.

Therefore:

Quoted 15 lines
---
 ...akefiles-for-out-of-tree-ext4_utils-build.patch | 48 ++++++++++++++++++++++
 package/android-tools/Config.in.host               |  8 ++++
 package/android-tools/android-tools.mk             | 18 ++++++--
 3 files changed, 70 insertions(+), 4 deletions(-)
 create mode 100644 package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch
package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch new file +0 -0
new file mode 100644
index 0000000..80ea1ec

package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch line 6

Quoted 6 lines
package/android-tools/0009-Fix-makefiles-for-out-of-tree-ext4_utils-build.patch new file +6 -0
@@ -0,0 +1,48 @@
+From d24abbec201975a5eb7f8589614cfb424b8c80b6 Mon Sep 17 00:00:00 2001
+From: Alex Kaplan <[email protected]>
+Date: Sat, 10 Nov 2018 19:50:51 -0800
+Subject: [PATCH] Fix makefiles for out-of-tree ext4_utils build
+
+Signed-off-by: Alex Kaplan <[email protected]>

I was going to ask: did you send the patch upstream? However, android-tools
doesn't really have an upstream that accepts contributions I think.

Regards,
Arnout

[snip]