Skip to contentSkip to conversation

android-tools: Enable build for ext4 fsutils

PATCH New Keith Mok 3 participants 10 messages Nov 30, 2017 – Dec 31, 2017

lore
Share & tools
lore

Keith Mok

author
#0 lore raw

PATCH 1/2 android-tools: Enable build for ext4 fsutils

This enable the build for make_ext4fs, simg2img, etc.
For creating Android sparse ext4 files and extract tools (simg2img).

---
 ...ke_ext4fs-makefiles-for-out-of-tree-build.patch | 53 ++++++++++++++++++++++
 package/android-tools/Config.in                    | 12 +++++
 package/android-tools/Config.in.host               |  6 +++
 package/android-tools/android-tools.mk             | 39 +++++++++++-----
 4 files changed, 99 insertions(+), 11 deletions(-)
 create mode 100644 package/android-tools/0008-Fix-make_ext4fs-makefiles-for-out-of-tree-build.patch
package/android-tools/0008-Fix-make_ext4fs-makefiles-for-out-of-tree-build.patch new file +53 -0
new file mode 100644
index 0000000..ec68c25
@@ -0,0 +1,53 @@
+[PATCH] Fix make_ext4fs makefiles for out-of-tree build
+
+Signed-off-by: Keith Mok <[email protected]>
+---
+ debian/makefiles/ext4_utils.mk | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/debian/makefiles/ext4_utils.mk b/debian/makefiles/ext4_utils.mk
+index cb64916..b56e27e 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
+@@ -23,6 +24,7 @@ SRCS+= output_file.c
+ 
+ OBJS_SHARED:= $(SRCS:.c=.o)
+ 
++VPATH+= $(SRCDIR)/extras/ext4_utils
+ SRCS+=make_ext4fs_main.c
+ SRCS+=ext4fixup_main.c
+ SRCS+=setup_fs.c
+@@ -31,10 +33,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)/core/include
++CPPFLAGS+= -I$(SRCDIR)/extras/ext4_utils/
++CPPFLAGS+= -I$(SRCDIR)/core/libsparse/include/
+ 
+ LIBS+= -lz -lselinux
+ 
+-- 
+2.13.6 (Apple Git-96)
+
package/android-tools/Config.in +12 -0
index 96e36e6..6697d45 100644
@@ -75,6 +75,18 @@ config BR2_PACKAGE_ANDROID_TOOLS_ADBD
 	  target, which can be used to interact with a host machine
 	  implementing the ADB protocol.
 
+config BR2_PACKAGE_ANDROID_TOOLS_EXT4_UTILS
+	bool "ext4-utils"
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux
+	depends on !BR2_STATIC_LIBS # libselinux
+	depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux
+	depends on !BR2_arc # libselinux
+	select BR2_PACKAGE_LIBSELINUX
+	select BR2_PACKAGE_ZLIB
+	help
+	  This option will build and install the ext4 utility for the
+	  host, which can be used to build sparse/extract ext4 image.
+
 endif
 
 comment "android-tools needs a toolchain w/ threads"
package/android-tools/Config.in.host +6 -0
index 993c4c9..a30b2d4 100644
@@ -23,4 +23,10 @@ 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"
+	help
+	  This option will build and install the ext4 utility for the
+	  host, which can be used to build sparse/extract ext4 image.
+
 endif
package/android-tools/android-tools.mk +28 -11
index f6c6913..01398de 100644
@@ -31,54 +31,71 @@ 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/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/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/ext2simg ext4_utils/ext4fixup ext4_utils/img2simg ext4_utils/make_ext4fs ext4_utils/simg2img ext4_utils/simg2simg
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
+endif
+
 ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_FASTBOOT),y)
-ANDROID_TOOLS_TARGETS += fastboot
+ANDROID_TOOLS_BUILD_TARGETS += fastboot
+ANDROID_TOOLS_INSTALL_TARGETS += fastboot/fastboot
 ANDROID_TOOLS_DEPENDENCIES += zlib libselinux
 endif
 
 ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADB),y)
-ANDROID_TOOLS_TARGETS += adb
+ANDROID_TOOLS_BUILD_TARGETS += adb
+ANDROID_TOOLS_INSTALL_TARGETS += adb/adb
 ANDROID_TOOLS_DEPENDENCIES += zlib openssl
 endif
 
 ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_ADBD),y)
-ANDROID_TOOLS_TARGETS += adbd
+ANDROID_TOOLS_BUILD_TARGETS += adbd
+ANDROID_TOOLS_INSTALL_TARGETS += adbd/adbd
 ANDROID_TOOLS_DEPENDENCIES += zlib openssl
 endif
 
+ifeq ($(BR2_PACKAGE_ANDROID_TOOLS_EXT4_UTILS),y)
+ANDROID_TOOLS_BUILD_TARGETS += ext4_utils
+ANDROID_TOOLS_INSTALL_TARGETS += ext4_utils/ext2simg ext4_utils/ext4fixup ext4_utils/img2simg ext4_utils/make_ext4fs ext4_utils/simg2img ext4_utils/simg2simg
+ANDROID_TOOLS_DEPENDENCIES += zlib libselinux
+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))
 endef
 
 define ANDROID_TOOLS_BUILD_CMDS
-	$(foreach t,$(ANDROID_TOOLS_TARGETS),\
+	$(foreach t,$(ANDROID_TOOLS_BUILD_TARGETS),\
 		mkdir -p $(@D)/build-$(t) && \
 		$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) SRCDIR=$(@D) \
 			-C $(@D)/build-$(t) -f $(@D)/debian/makefiles/$(t).mk$(sep))
 endef
 
 define HOST_ANDROID_TOOLS_INSTALL_CMDS
-	$(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
-		$(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(HOST_DIR)/bin/$(t)$(sep))
+	$(foreach t,$(HOST_ANDROID_TOOLS_INSTALL_TARGETS),\
+		$(INSTALL) -D -m 0755 $(@D)/build-$(t) $(HOST_DIR)/bin/$(basename $(notdir $(t)))$(sep))
 endef
 
 define ANDROID_TOOLS_INSTALL_TARGET_CMDS
-	$(foreach t,$(ANDROID_TOOLS_TARGETS),\
-		$(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(TARGET_DIR)/usr/bin/$(t)$(sep))
+	$(foreach t,$(ANDROID_TOOLS_INSTALL_TARGETS),\
+		$(INSTALL) -D -m 0755 $(@D)/build-$(t) $(TARGET_DIR)/usr/bin/$(basename $(notdir $(t)))$(sep))
 endef
 
 $(eval $(host-generic-package))
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 2/2 android-tools: upport char, block, fifo, socket devices

Pick changes from openwrt to enable support of special device for make_ext4fs

---
 ...ment-support-for-block-and-char-dev-nodes.patch | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch
package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch new file +109 -0
new file mode 100644
index 0000000..e86d9c6
@@ -0,0 +1,109 @@
+From 3258b175c3ea1f76823c6b69b5036ac7efb5599d Mon Sep 17 00:00:00 2001
+From: Jo-Philipp Wich <[email protected]>
+Date: Thu, 30 Nov 2017 10:10:24 -0800
+Subject: [PATCH] [PATCH] Implement support for block and char dev nodes, fifos
+ and sockets.
+
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Signed-off-by: Keith Mok <[email protected]>
+---
+ extras/ext4_utils/contents.c    | 45 +++++++++++++++++++++++++++++++++++++++++
+ extras/ext4_utils/contents.h    |  1 +
+ extras/ext4_utils/make_ext4fs.c |  6 +++++-
+ 3 files changed, 51 insertions(+), 1 deletion(-)
+
+diff --git a/extras/ext4_utils/contents.c b/extras/ext4_utils/contents.c
+index 6300680..b11ecba 100644
+--- a/extras/ext4_utils/contents.c
++++ b/extras/ext4_utils/contents.c
+@@ -225,6 +225,51 @@ u32 make_link(const char *filename, const char *link)
+ 	return inode_num;
+ }
+ 
++/* Creates a special file on disk.  Returns the inode number of the new file */
++u32 make_special(const char *path)
++{
++	struct ext4_inode *inode;
++	struct stat s;
++	u32 inode_num;
++	u32 devmajor;
++	u32 devminor;
++
++	if (stat(path, &s)) {
++		error("failed to stat file\n");
++		return EXT4_ALLOCATE_FAILED;
++	}
++
++	inode_num = allocate_inode(info);
++	if (inode_num == EXT4_ALLOCATE_FAILED) {
++		error("failed to allocate inode\n");
++		return EXT4_ALLOCATE_FAILED;
++	}
++
++	inode = get_inode(inode_num);
++	if (inode == NULL) {
++		error("failed to get inode %u", inode_num);
++		return EXT4_ALLOCATE_FAILED;
++	}
++
++	inode->i_mode = s.st_mode & S_IFMT;
++	inode->i_links_count = 1;
++	inode->i_flags |= aux_info.default_i_flags;
++
++	devmajor = major(s.st_rdev);
++	devminor = minor(s.st_rdev);
++
++	if ((devmajor < 256) && (devminor < 256)) {
++		inode->i_block[0] = devmajor * 256 + devminor;
++		inode->i_block[1] = 0;
++	} else {
++		inode->i_block[0] = 0;
++		inode->i_block[1] = (devminor & 0xff) | (devmajor << 8) |
++			((devminor & ~0xff) << 12);
++	}
++
++	return inode_num;
++}
++
+ int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime)
+ {
+ 	struct ext4_inode *inode = get_inode(inode_num);
+diff --git a/extras/ext4_utils/contents.h b/extras/ext4_utils/contents.h
+index 35867fd..b155429 100644
+--- a/extras/ext4_utils/contents.h
++++ b/extras/ext4_utils/contents.h
+@@ -36,6 +36,7 @@ u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
+ 	u32 dirs);
+ u32 make_file(const char *filename, u64 len);
+ u32 make_link(const char *filename, const char *link);
++u32 make_special(const char *path);
+ int inode_set_permissions(u32 inode_num, u16 mode, u16 uid, u16 gid, u32 mtime);
+ int inode_set_selinux(u32 inode_num, const char *secon);
+ #endif
+diff --git a/extras/ext4_utils/make_ext4fs.c b/extras/ext4_utils/make_ext4fs.c
+index b2d1426..70c4284 100644
+--- a/extras/ext4_utils/make_ext4fs.c
++++ b/extras/ext4_utils/make_ext4fs.c
+@@ -70,7 +70,6 @@
+ /* TODO: Not implemented:
+    Allocating blocks in the same block group as the file inode
+    Hash or binary tree directories
+-   Special files: sockets, devices, fifos
+  */
+ 
+ static int filter_dot(const struct dirent *d)
+@@ -259,6 +258,11 @@ static u32 build_directory_structure(const char *full_path, const char *dir_path
+ 			free(subdir_dir_path);
+ 		} else if (dentries[i].file_type == EXT4_FT_SYMLINK) {
+ 			entry_inode = make_link(dentries[i].full_path, dentries[i].link);
++		} else if (dentries[i].file_type == EXT4_FT_CHRDEV ||
++		           dentries[i].file_type == EXT4_FT_BLKDEV ||
++		           dentries[i].file_type == EXT4_FT_SOCK ||
++		           dentries[i].file_type == EXT4_FT_FIFO) {
++			entry_inode = make_special(dentries[i].full_path);
+ 		} else {
+ 			error("unknown file type on %s", dentries[i].path);
+ 			entry_inode = 0;
+-- 
+2.13.6 (Apple Git-96)
+
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 android-tools: upport char, block, fifo, socket devices

Hello,

Thanks for your contributions! See below for a few comments/questions.

Quoted 2 lines · Keith Mok

Pick changes from openwrt to enable support of special device for make_ext4fs

Missing Signed-off-by line.

Quoted 11 lines
---
 ...ment-support-for-block-and-char-dev-nodes.patch | 109 +++++++++++++++++++++
 1 file changed, 109 insertions(+)
 create mode 100644 package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch
package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch new file +0 -0
new file mode 100644
index 0000000..e86d9c6

package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch line 8

Quoted 8 lines
package/android-tools/0009-PATCH-Implement-support-for-block-and-char-dev-nodes.patch new file +8 -0
@@ -0,0 +1,109 @@
+From 3258b175c3ea1f76823c6b69b5036ac7efb5599d Mon Sep 17 00:00:00 2001
+From: Jo-Philipp Wich <[email protected]>
+Date: Thu, 30 Nov 2017 10:10:24 -0800
+Subject: [PATCH] [PATCH] Implement support for block and char dev nodes, fifos
+ and sockets.
+
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Signed-off-by: Keith Mok <[email protected]>

This really is a feature patch, and we don't like to take features patches in Buildroot (unlike OpenWRT). Indeed, those are often a pain to maintain over time.

Do you see any possibility of this being merged upstream? I do realize that the upstream for android-tools is somewhat unusual, and that getting contributions accepted might be more challenging than with other open source projects. But still I'd like to hear about what has been tried to push this upstream.

Best regards,

Thomas

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

PATCH 2/2 android-tools: upport char, block, fifo, socket devices

Wil try to submit to AOSP for [PATCH 2/2].
But for [PATCH 1/1] it is not a features batch. The debian package already have the make_ext4fs, we ust miss the makefile in buildroot.

2017-12-01 4:55 GMT-08:00 Thomas Petazzoni <
[email protected]>:

Quoted 46 lines

Hello,

Thanks for your contributions! See below for a few comments/questions.

Quoted 2 lines · Keith Mok

Pick changes from openwrt to enable support of special device for make_ext4fs

Missing Signed-off-by line.

Quoted 2 lines
---
 ...ment-support-for-block-and-char-dev-nodes.patch | 109

+++++++++++++++++++++

Quoted 2 lines
 1 file changed, 109 insertions(+)
 create mode 100644 package/android-tools/0009-

PATCH-Implement-support-for-block-and-char-dev-nodes.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/package/android-tools/0009-PATCH-Implement-support-for- block-and-char-dev-nodes.patch

package/android-tools/0009-PATCH-Implement-support-for-

Quoted 4 lines

new file mode 100644
index 0000000..e86d9c6

package/android-tools/0009-PATCH-Implement-support-for- new file +0 -0

block-and-char-dev-nodes.patch

package/android-tools/0009-PATCH-Implement-support-for- line 4

Quoted 5 lines
package/android-tools/0009-PATCH-Implement-support-for- new file +4 -0
@@ -0,0 +1,109 @@
+From 3258b175c3ea1f76823c6b69b5036ac7efb5599d Mon Sep 17 00:00:00 2001
+From: Jo-Philipp Wich <[email protected]>
+Date: Thu, 30 Nov 2017 10:10:24 -0800
+Subject: [PATCH] [PATCH] Implement support for block and char dev

nodes, fifos

package/android-tools/0009-PATCH-Implement-support-for- line 8

Quoted 4 lines
package/android-tools/0009-PATCH-Implement-support-for- new file +4 -0
+ and sockets.
+
+Signed-off-by: Jo-Philipp Wich <[email protected]>
+Signed-off-by: Keith Mok <[email protected]>

This really is a feature patch, and we don't like to take features patches in Buildroot (unlike OpenWRT). Indeed, those are often a pain to maintain over time.

Do you see any possibility of this being merged upstream? I do realize that the upstream for android-tools is somewhat unusual, and that getting contributions accepted might be more challenging than with other open source projects. But still I'd like to hear about what has been tried to push this upstream.

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171201/a5a8e97c/attachment.html>

#4 lore raw

PATCH 2/2 android-tools: upport char, block, fifo, socket devices

Hello,

Quoted 1 line · Keith Mok

Wil try to submit to AOSP for [PATCH 2/2].

Have you received any feedback ?

Best regards,

Thomas

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

PATCH 1/2 android-tools: Enable build for ext4 fsutils

In reply to Keith Mok

Hi Keith,

Thank you for your contribution. Please find my remark inline below.

Quoted 81 lines · Keith Mok

This enable the build for make_ext4fs, simg2img, etc.
For creating Android sparse ext4 files and extract tools (simg2img).

---
 ...ke_ext4fs-makefiles-for-out-of-tree-build.patch | 53 ++++++++++++++++++++++
 package/android-tools/Config.in                    | 12 +++++
 package/android-tools/Config.in.host               |  6 +++
 package/android-tools/android-tools.mk             | 39 +++++++++++-----
 4 files changed, 99 insertions(+), 11 deletions(-)
 create mode 100644 package/android-tools/0008-Fix-make_ext4fs-makefiles-for-out-of-tree-build.patch
package/android-tools/0008-Fix-make_ext4fs-makefiles-for-out-of-tree-build.patch new file +53 -0
new file mode 100644
index 0000000..ec68c25
@@ -0,0 +1,53 @@
+[PATCH] Fix make_ext4fs makefiles for out-of-tree build
+
+Signed-off-by: Keith Mok <[email protected]>
+---
+ debian/makefiles/ext4_utils.mk | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/debian/makefiles/ext4_utils.mk b/debian/makefiles/ext4_utils.mk
+index cb64916..b56e27e 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
+@@ -23,6 +24,7 @@ SRCS+= output_file.c
+ 
+ OBJS_SHARED:= $(SRCS:.c=.o)
+ 
++VPATH+= $(SRCDIR)/extras/ext4_utils
+ SRCS+=make_ext4fs_main.c
+ SRCS+=ext4fixup_main.c
+ SRCS+=setup_fs.c
+@@ -31,10 +33,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)/core/include
++CPPFLAGS+= -I$(SRCDIR)/extras/ext4_utils/
++CPPFLAGS+= -I$(SRCDIR)/core/libsparse/include/
+ 
+ LIBS+= -lz -lselinux
+ 
+-- 
+2.13.6 (Apple Git-96)
+
package/android-tools/Config.in +2 -0
index 96e36e6..6697d45 100644
@@ -75,6 +75,18 @@ config BR2_PACKAGE_ANDROID_TOOLS_ADBD
 	  target, which can be used to interact with a host machine
 	  implementing the ADB protocol.
 
+config BR2_PACKAGE_ANDROID_TOOLS_EXT4_UTILS
+	bool "ext4-utils"

package/android-tools/Config.in config BR2_PACKAGE_ANDROID_TOOLS_ADBD · line 89

Quoted 10 lines
package/android-tools/Config.in +10 -0
+	depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux
+	depends on !BR2_STATIC_LIBS # libselinux
+	depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux
+	depends on !BR2_arc # libselinux
+	select BR2_PACKAGE_LIBSELINUX
+	select BR2_PACKAGE_ZLIB
+	help
+	  This option will build and install the ext4 utility for the
+	  host, which can be used to build sparse/extract ext4 image.
+

There should be a comment here to explain all the dependencies. It is required when the dependencies are not met, so the user knows about it.

You can have a look at the fasboot comment as an example (should be more or less the same).

Other than that, the series looks good!

Thanks,
Gary

author
#6 lore raw

PATCH 1/2 android-tools: Enable build for ext4 fsutils

Basically depends on BR2_PACKAGE_LIBSELINUX.
But BR2_PACKAGE_LIBSELINUX depends on BR2_TOOLCHAIN_HAS_THREADS BR2_STATIC_LIBS BR2_TOOLCHAIN_USES_GLIBC BR2_arc Those dependency are just copied from FASTBOOT.

Thanks,
Keith

2017-12-01 4:49 GMT-08:00 Gary Bisson <[email protected]>:

Quoted 108 lines

Hi Keith,

Thank you for your contribution. Please find my remark inline below.

Quoted 6 lines · Keith Mok

This enable the build for make_ext4fs, simg2img, etc.
For creating Android sparse ext4 files and extract tools (simg2img).

---
 ...ke_ext4fs-makefiles-for-out-of-tree-build.patch | 53

++++++++++++++++++++++

Quoted 3 lines
 package/android-tools/Config.in                    | 12 +++++
 package/android-tools/Config.in.host               |  6 +++
 package/android-tools/android-tools.mk             | 39

+++++++++++-----

Quoted 2 lines
 4 files changed, 99 insertions(+), 11 deletions(-)
 create mode 100644 package/android-tools/0008-

Fix-make_ext4fs-makefiles-for-out-of-tree-build.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/package/android-tools/0008-Fix-make_ext4fs-makefiles-for- out-of-tree-build.patch

package/android-tools/0008-Fix-make_ext4fs-makefiles-for-

Quoted 4 lines

new file mode 100644
index 0000000..ec68c25

package/android-tools/0008-Fix-make_ext4fs-makefiles-for- new file +0 -0

out-of-tree-build.patch

package/android-tools/0008-Fix-make_ext4fs-makefiles-for- line 8

Quoted 9 lines
package/android-tools/0008-Fix-make_ext4fs-makefiles-for- new file +8 -0
@@ -0,0 +1,53 @@
+[PATCH] Fix make_ext4fs makefiles for out-of-tree build
+
+Signed-off-by: Keith Mok <[email protected]>
+---
+ debian/makefiles/ext4_utils.mk | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/debian/makefiles/ext4_utils.mk b/debian/makefiles/

ext4_utils.mk

package/android-tools/

Quoted 46 lines
package/android-tools/0008-Fix-make_ext4fs-makefiles-for- new file +45 -0
+index cb64916..b56e27e 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
+@@ -23,6 +24,7 @@ SRCS+= output_file.c
+
+ OBJS_SHARED:= $(SRCS:.c=.o)
+
++VPATH+= $(SRCDIR)/extras/ext4_utils
+ SRCS+=make_ext4fs_main.c
+ SRCS+=ext4fixup_main.c
+ SRCS+=setup_fs.c
+@@ -31,10 +33,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)/core/include
++CPPFLAGS+= -I$(SRCDIR)/extras/ext4_utils/
++CPPFLAGS+= -I$(SRCDIR)/core/libsparse/include/
+
+ LIBS+= -lz -lselinux
+
+--
+2.13.6 (Apple Git-96)
+
package/android-tools/ renamed from package/android-tools/Config.in +0 -0

Config.in

Quoted 9 lines

index 96e36e6..6697d45 100644

package/android-tools/Config.in +2 -0
@@ -75,6 +75,18 @@ config BR2_PACKAGE_ANDROID_TOOLS_ADBD
        target, which can be used to interact with a host machine
        implementing the ADB protocol.
 
+config BR2_PACKAGE_ANDROID_TOOLS_EXT4_UTILS
+     bool "ext4-utils"

package/android-tools/Config.in config BR2_PACKAGE_ANDROID_TOOLS_ADBD · line 89

Quoted 10 lines
package/android-tools/Config.in +10 -0
+     depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux
+     depends on !BR2_STATIC_LIBS # libselinux
+     depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux
+     depends on !BR2_arc # libselinux
+     select BR2_PACKAGE_LIBSELINUX
+     select BR2_PACKAGE_ZLIB
+     help
+       This option will build and install the ext4 utility for the
+       host, which can be used to build sparse/extract ext4 image.
+

There should be a comment here to explain all the dependencies. It is required when the dependencies are not met, so the user knows about it.

Quoted 8 lines

You can have a look at the fasboot comment as an example (should be more or less the same).

Other than that, the series looks good!

Thanks,
Gary

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171201/0872e305/attachment.html>

#7 lore raw

PATCH 1/2 android-tools: Enable build for ext4 fsutils

Hi Keith,

Quoted 4 lines · Keith Mok

Basically depends on BR2_PACKAGE_LIBSELINUX.
But BR2_PACKAGE_LIBSELINUX depends on BR2_TOOLCHAIN_HAS_THREADS BR2_STATIC_LIBS BR2_TOOLCHAIN_USES_GLIBC BR2_arc Those dependency are just copied from FASTBOOT.

Yes the 'depends' are ok, no problem there, but a 'comment' section is missing. See under the fastboot 'config' section [1].

Regards,
Gary

[1] https://git.buildroot.net/buildroot/tree/package/android-tools/Config.in#n49

author
#8 lore raw

PATCH 1/2 android-tools: Enable build for ext4 fsutils

Just sync with Google, that they are removed make_ext4fs in internal branch. and merge Android specific things into e2fsprogs. So we possibly no need this anymore.

Thanks,
Keith

2017-12-04 5:23 GMT-06:00 Gary Bisson <[email protected]>:

Quoted 8 lines

Hi Keith,

Quoted 4 lines · Keith Mok

Basically depends on BR2_PACKAGE_LIBSELINUX.
But BR2_PACKAGE_LIBSELINUX depends on BR2_TOOLCHAIN_HAS_THREADS BR2_STATIC_LIBS BR2_TOOLCHAIN_USES_GLIBC BR2_arc Those dependency are just copied from FASTBOOT.

Quoted 9 lines

Yes the 'depends' are ok, no problem there, but a 'comment' section is missing. See under the fastboot 'config' section [1].

Regards,
Gary

[1] https://git.buildroot.net/buildroot/tree/package/
android-tools/Config.in#n49

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20171205/9c97b44a/attachment.html>

#9 lore raw

PATCH 1/2 android-tools: Enable build for ext4 fsutils

Hello,

Quoted 3 lines · Keith Mok

Just sync with Google, that they are removed make_ext4fs in internal branch. and merge Android specific things into e2fsprogs. So we possibly no need this anymore.

OK, so I've marked your patch as "Rejected" in our patch tracking system. If a patch is still needed, please resend a new version.

Thanks!

Thomas

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