Skip to contentSkip to conversation

android-tools: new host package

PATCH Superseded Antoine Tenart 2 participants 3 messages May 1, 2015 – May 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 android-tools: new host package

From: Thomas Petazzoni <[email protected]>

This host package allows to build the fastboot and adb utilities, which can be used to interact with target devices implementing one of these protocols.

The work behind this commit was funded by ECA Group
<http://www.ecagroup.com>. ECA Group is the copyright owner of the contributed code.

---

Since v1:
- fixed typos
- added android-tools.hash

 package/Config.in.host                             |   1 +
 .../android-tools/0001-android-config-header.patch | 404 +++++++++++++++++++++
 package/android-tools/Config.in.host               |  24 ++
 package/android-tools/android-tools.hash           |   3 +
 package/android-tools/android-tools.mk             |  52 +++
 5 files changed, 484 insertions(+)
 create mode 100644 package/android-tools/0001-android-config-header.patch
 create mode 100644 package/android-tools/Config.in.host
 create mode 100644 package/android-tools/android-tools.hash
 create mode 100644 package/android-tools/android-tools.mk
package/Config.in.host +1 -0
index 94981adb6425..6df627f1752f 100644
@@ -1,5 +1,6 @@
 menu "Host utilities"
 
+	source "package/android-tools/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
 	source "package/cramfs/Config.in.host"
 	source "package/dfu-util/Config.in.host"
package/android-tools/0001-android-config-header.patch new file +404 -0

404 lines not on this page · raw message

package/android-tools/Config.in.host new file +24 -0
new file mode 100644
index 000000000000..7702d1d26266
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_HOST_ANDROID_TOOLS
+       bool "android-tools"
+       help
+         This package contains the fastboot and adb utilities, that
+         can be used to interact with target devices using of these
+         protocols.
+
+if BR2_PACKAGE_HOST_ANDROID_TOOLS
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT
+       bool "fastboot"
+       help
+         This option will build and install the fastboot utility for
+         the host, which can be used to reflash target devices
+         implementing the fastboot protocol.
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB
+       bool "adb"
+       help
+         This option will build and install the adb utility for the
+         host, which can be used to interact with target devices
+         implementing the ADB protocol.
+
+endif
package/android-tools/android-tools.hash new file +3 -0
new file mode 100644
index 000000000000..57bbc6f88070
@@ -0,0 +1,3 @@
+# From http://snapshot.debian.org/archive/debian/20141125T040054Z/pool/main/a/android-tools/
+sha512	aadf75d29e2aa223870c942fdd44bbeb9466542e17b81bb93069d4415dd6644b5266465d4e466b1d5ed2a84f86d89450a3aa077f4f81268ac1a3d1e4df74d9ad	android-tools_4.2.2+git20130529.orig.tar.xz
+sha512	c879d0fed0d53030319813cfadc29d939dec7600210d11c8e398e61c69447971f82e1e5228aeba730a2d95899c1c5d5d2a3b06e9a19a91866b33b5bc068079c6	android-tools_4.2.2+git20130529-5.1.debian.tar.xz
package/android-tools/android-tools.mk new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.4.0
#1 lore raw

PATCH v2 1/1 android-tools: new host package

Hi Antoine,

Quoted 11 lines · Antoine Tenart

From: Thomas Petazzoni <[email protected]>

This host package allows to build the fastboot and adb utilities, which can be used to interact with target devices implementing one of these protocols.

The work behind this commit was funded by ECA Group
<http://www.ecagroup.com>. ECA Group is the copyright owner of the contributed code.

Since the patch passes through you, you _have_ to add your Sob to confirm that
you are allowed to push this patch under Buildroot's license.

Quoted 34 lines

---

Since v1:
- fixed typos
- added android-tools.hash

 package/Config.in.host                             |   1 +
 .../android-tools/0001-android-config-header.patch | 404 +++++++++++++++++++++
 package/android-tools/Config.in.host               |  24 ++
 package/android-tools/android-tools.hash           |   3 +
 package/android-tools/android-tools.mk             |  52 +++
 5 files changed, 484 insertions(+)
 create mode 100644 package/android-tools/0001-android-config-header.patch
 create mode 100644 package/android-tools/Config.in.host
 create mode 100644 package/android-tools/android-tools.hash
 create mode 100644 package/android-tools/android-tools.mk
package/Config.in.host +1 -0
index 94981adb6425..6df627f1752f 100644
@@ -1,5 +1,6 @@
 menu "Host utilities"
 
+	source "package/android-tools/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
 	source "package/cramfs/Config.in.host"
 	source "package/dfu-util/Config.in.host"
package/android-tools/0001-android-config-header.patch new file +0 -0
new file mode 100644
index 000000000000..8717061a048c

package/android-tools/0001-android-config-header.patch line 7

Quoted 7 lines
package/android-tools/0001-android-config-header.patch new file +7 -0
@@ -0,0 +1,404 @@
+Add the AndroidConfig.h header and tweak the build system
+
+The Debian adaptation of android-tools normally relies on a separate
+package to provide linux-x86/AndroidConfig.h. Since we don't want to
+add this dependency in Buildroot just for one header file, let's
+simply integrate it as a patch, and tweak the build system
+accordingly.

Wouldn't it be better then to use EXTRA_DOWNLOADS to get it from some
repository, e.g.

http://platform--build.android-source-browsing.googlecode.com/git-history/2988a09f90d53bda1d1b5785b25cc153ba73fb77/core/combo/include/arch/linux-x86/AndroidConfig.h

[snip]

package/android-tools/0001-android-config-header.patch line 375

Quoted 8 lines
package/android-tools/0001-android-config-header.patch new file +8 -0
+--- a/debian/makefiles/adb.mk
++++ b/debian/makefiles/adb.mk
+@@ -40,7 +40,7 @@
+ CPPFLAGS+= -DADB_HOST=1
+ CPPFLAGS+= -I$(SRCDIR)/core/adb
+ CPPFLAGS+= -I$(SRCDIR)/core/include
+-CPPFLAGS+= -include /usr/include/android/arch/linux-x86/AndroidConfig.h
++CPPFLAGS+= -include $(SRCDIR)/AndroidConfig.h

This would have to stay of course.
This would have to stay of course.
[snip]

package/android-tools/Config.in.host line 5

Quoted 11 lines
package/android-tools/Config.in.host new file +5 -0
new file mode 100644
index 000000000000..7702d1d26266
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_HOST_ANDROID_TOOLS
+       bool "android-tools"
+       help
+         This package contains the fastboot and adb utilities, that
+         can be used to interact with target devices using of these

one

package/android-tools/Config.in.host line 11

Quoted 6 lines
package/android-tools/Config.in.host new file +6 -0
+         protocols.
+
+if BR2_PACKAGE_HOST_ANDROID_TOOLS
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT
+       bool "fastboot"

If neither is selected, then nothing will be built. So I'd add

default y if !BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT

so that at least by default _something_ will be built.

I would even say, get rid of the config options and build both of them, but I
guess you want to avoid a redundant build of host-openssl. Although I must say, if you anyway have to build host-libselinux and all its dependencies, openssl isn't going to make the difference.

Quoted 63 lines
package/android-tools/Config.in.host new file +13 -0
+       help
+         This option will build and install the fastboot utility for
+         the host, which can be used to reflash target devices
+         implementing the fastboot protocol.
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB
+       bool "adb"
+       help
+         This option will build and install the adb utility for the
+         host, which can be used to interact with target devices
+         implementing the ADB protocol.
+
+endif
package/android-tools/android-tools.hash new file +3 -0
new file mode 100644
index 000000000000..57bbc6f88070
@@ -0,0 +1,3 @@
+# From http://snapshot.debian.org/archive/debian/20141125T040054Z/pool/main/a/android-tools/
+sha512	aadf75d29e2aa223870c942fdd44bbeb9466542e17b81bb93069d4415dd6644b5266465d4e466b1d5ed2a84f86d89450a3aa077f4f81268ac1a3d1e4df74d9ad	android-tools_4.2.2+git20130529.orig.tar.xz
+sha512	c879d0fed0d53030319813cfadc29d939dec7600210d11c8e398e61c69447971f82e1e5228aeba730a2d95899c1c5d5d2a3b06e9a19a91866b33b5bc068079c6	android-tools_4.2.2+git20130529-5.1.debian.tar.xz
package/android-tools/android-tools.mk new file +35 -0
new file mode 100644
index 000000000000..436351853f5a
@@ -0,0 +1,52 @@
+################################################################################
+#
+# android-tools
+#
+################################################################################
+
+ANDROID_TOOLS_SITE = http://snapshot.debian.org/archive/debian/20141125T040054Z/pool/main/a/android-tools/
+ANDROID_TOOLS_VERSION = 4.2.2+git20130529
+ANDROID_TOOLS_SOURCE = android-tools_$(ANDROID_TOOLS_VERSION).orig.tar.xz
+HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS = android-tools_$(ANDROID_TOOLS_VERSION)-5.1.debian.tar.xz
+ANDROID_TOOLS_LICENSE = Apache-2.0
+ANDROID_TOOLS_LICENSE_FILES = debian/copyright
+
+# Extract the Debian tarball inside the sources
+define HOST_ANDROID_TOOLS_DEBIAN_EXTRACT
+	$(call suitable-extractor,$(notdir $(HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS))) \
+		$(DL_DIR)/$(notdir $(HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS)) | \
+		$(TAR) -C $(@D) $(TAR_OPTIONS) -
+endef
+
+HOST_ANDROID_TOOLS_POST_EXTRACT_HOOKS += HOST_ANDROID_TOOLS_DEBIAN_EXTRACT
+
+# Apply the Debian patches before applying the Buildroot patches
+define HOST_ANDROID_TOOLS_DEBIAN_PATCH
+	$(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*
+endef
+
+HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += HOST_ANDROID_TOOLS_DEBIAN_PATCH
+
+ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT),y)
+HOST_ANDROID_TOOLS_TARGETS += fastboot
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
+endif
+
+ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB),y)

package/android-tools/android-tools.mk line 45

Quoted 10 lines
package/android-tools/android-tools.mk new file +10 -0
+HOST_ANDROID_TOOLS_TARGETS += adb
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux host-openssl
+endif
+
+define HOST_ANDROID_TOOLS_BUILD_CMDS
+	$(foreach t,$(HOST_ANDROID_TOOLS_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

I think there should be a comment explaining why each tool has to be built in a
separate directory.

Regards,
Arnout

Quoted 8 lines
package/android-tools/android-tools.mk new file +7 -0
+
+define HOST_ANDROID_TOOLS_INSTALL_CMDS
+	$(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
+		$(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(HOST_DIR)/usr/bin/$(t)$(sep))
+endef
+
+$(eval $(host-generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH v2 1/1 android-tools: new host package

Arnout,

Quoted 7 lines · Arnout Vandecappelle
Quoted 6 lines · Antoine Tenart

From: Thomas Petazzoni <[email protected]>

This host package allows to build the fastboot and adb utilities, which can be used to interact with target devices implementing one of these protocols.

Quoted 8 lines
Quoted 5 lines

The work behind this commit was funded by ECA Group
<http://www.ecagroup.com>. ECA Group is the copyright owner of the contributed code.

Since the patch passes through you, you _have_ to add your Sob to confirm that
you are allowed to push this patch under Buildroot's license.

Sure,

Quoted 191 lines
Quoted 35 lines

---

Since v1:
- fixed typos
- added android-tools.hash

 package/Config.in.host                             |   1 +
 .../android-tools/0001-android-config-header.patch | 404 +++++++++++++++++++++
 package/android-tools/Config.in.host               |  24 ++
 package/android-tools/android-tools.hash           |   3 +
 package/android-tools/android-tools.mk             |  52 +++
 5 files changed, 484 insertions(+)
 create mode 100644 package/android-tools/0001-android-config-header.patch
 create mode 100644 package/android-tools/Config.in.host
 create mode 100644 package/android-tools/android-tools.hash
 create mode 100644 package/android-tools/android-tools.mk
package/Config.in.host +1 -0
index 94981adb6425..6df627f1752f 100644
@@ -1,5 +1,6 @@
 menu "Host utilities"
 
+	source "package/android-tools/Config.in.host"
 	source "package/checkpolicy/Config.in.host"
 	source "package/cramfs/Config.in.host"
 	source "package/dfu-util/Config.in.host"
package/android-tools/0001-android-config-header.patch new file +0 -0
new file mode 100644
index 000000000000..8717061a048c

package/android-tools/0001-android-config-header.patch line 7

Quoted 7 lines
package/android-tools/0001-android-config-header.patch new file +7 -0
@@ -0,0 +1,404 @@
+Add the AndroidConfig.h header and tweak the build system
+
+The Debian adaptation of android-tools normally relies on a separate
+package to provide linux-x86/AndroidConfig.h. Since we don't want to
+add this dependency in Buildroot just for one header file, let's
+simply integrate it as a patch, and tweak the build system
+accordingly.

Wouldn't it be better then to use EXTRA_DOWNLOADS to get it from some
repository, e.g.

http://platform--build.android-source-browsing.googlecode.com/git-history/2988a09f90d53bda1d1b5785b25cc153ba73fb77/core/combo/include/arch/linux-x86/AndroidConfig.h

[snip]

package/android-tools/0001-android-config-header.patch line 375

Quoted 8 lines
package/android-tools/0001-android-config-header.patch new file +8 -0
+--- a/debian/makefiles/adb.mk
++++ b/debian/makefiles/adb.mk
+@@ -40,7 +40,7 @@
+ CPPFLAGS+= -DADB_HOST=1
+ CPPFLAGS+= -I$(SRCDIR)/core/adb
+ CPPFLAGS+= -I$(SRCDIR)/core/include
+-CPPFLAGS+= -include /usr/include/android/arch/linux-x86/AndroidConfig.h
++CPPFLAGS+= -include $(SRCDIR)/AndroidConfig.h

This would have to stay of course.
This would have to stay of course.
[snip]

package/android-tools/Config.in.host line 5

Quoted 11 lines
package/android-tools/Config.in.host new file +5 -0
new file mode 100644
index 000000000000..7702d1d26266
@@ -0,0 +1,24 @@
+config BR2_PACKAGE_HOST_ANDROID_TOOLS
+       bool "android-tools"
+       help
+         This package contains the fastboot and adb utilities, that
+         can be used to interact with target devices using of these

one

package/android-tools/Config.in.host line 11

Quoted 6 lines
package/android-tools/Config.in.host new file +6 -0
+         protocols.
+
+if BR2_PACKAGE_HOST_ANDROID_TOOLS
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT
+       bool "fastboot"

If neither is selected, then nothing will be built. So I'd add

default y if !BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT

so that at least by default _something_ will be built.

I would even say, get rid of the config options and build both of them, but I
guess you want to avoid a redundant build of host-openssl. Although I must say, if you anyway have to build host-libselinux and all its dependencies, openssl isn't going to make the difference.

Quoted 63 lines
package/android-tools/Config.in.host new file +13 -0
+       help
+         This option will build and install the fastboot utility for
+         the host, which can be used to reflash target devices
+         implementing the fastboot protocol.
+
+config BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB
+       bool "adb"
+       help
+         This option will build and install the adb utility for the
+         host, which can be used to interact with target devices
+         implementing the ADB protocol.
+
+endif
package/android-tools/android-tools.hash new file +3 -0
new file mode 100644
index 000000000000..57bbc6f88070
@@ -0,0 +1,3 @@
+# From http://snapshot.debian.org/archive/debian/20141125T040054Z/pool/main/a/android-tools/
+sha512	aadf75d29e2aa223870c942fdd44bbeb9466542e17b81bb93069d4415dd6644b5266465d4e466b1d5ed2a84f86d89450a3aa077f4f81268ac1a3d1e4df74d9ad	android-tools_4.2.2+git20130529.orig.tar.xz
+sha512	c879d0fed0d53030319813cfadc29d939dec7600210d11c8e398e61c69447971f82e1e5228aeba730a2d95899c1c5d5d2a3b06e9a19a91866b33b5bc068079c6	android-tools_4.2.2+git20130529-5.1.debian.tar.xz
package/android-tools/android-tools.mk new file +35 -0
new file mode 100644
index 000000000000..436351853f5a
@@ -0,0 +1,52 @@
+################################################################################
+#
+# android-tools
+#
+################################################################################
+
+ANDROID_TOOLS_SITE = http://snapshot.debian.org/archive/debian/20141125T040054Z/pool/main/a/android-tools/
+ANDROID_TOOLS_VERSION = 4.2.2+git20130529
+ANDROID_TOOLS_SOURCE = android-tools_$(ANDROID_TOOLS_VERSION).orig.tar.xz
+HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS = android-tools_$(ANDROID_TOOLS_VERSION)-5.1.debian.tar.xz
+ANDROID_TOOLS_LICENSE = Apache-2.0
+ANDROID_TOOLS_LICENSE_FILES = debian/copyright
+
+# Extract the Debian tarball inside the sources
+define HOST_ANDROID_TOOLS_DEBIAN_EXTRACT
+	$(call suitable-extractor,$(notdir $(HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS))) \
+		$(DL_DIR)/$(notdir $(HOST_ANDROID_TOOLS_EXTRA_DOWNLOADS)) | \
+		$(TAR) -C $(@D) $(TAR_OPTIONS) -
+endef
+
+HOST_ANDROID_TOOLS_POST_EXTRACT_HOOKS += HOST_ANDROID_TOOLS_DEBIAN_EXTRACT
+
+# Apply the Debian patches before applying the Buildroot patches
+define HOST_ANDROID_TOOLS_DEBIAN_PATCH
+	$(APPLY_PATCHES) $(@D) $(@D)/debian/patches \*
+endef
+
+HOST_ANDROID_TOOLS_PRE_PATCH_HOOKS += HOST_ANDROID_TOOLS_DEBIAN_PATCH
+
+ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_FASTBOOT),y)
+HOST_ANDROID_TOOLS_TARGETS += fastboot
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux
+endif
+
+ifeq ($(BR2_PACKAGE_HOST_ANDROID_TOOLS_ADB),y)

package/android-tools/android-tools.mk line 45

Quoted 10 lines
package/android-tools/android-tools.mk new file +10 -0
+HOST_ANDROID_TOOLS_TARGETS += adb
+HOST_ANDROID_TOOLS_DEPENDENCIES += host-zlib host-libselinux host-openssl
+endif
+
+define HOST_ANDROID_TOOLS_BUILD_CMDS
+	$(foreach t,$(HOST_ANDROID_TOOLS_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

I think there should be a comment explaining why each tool has to be built in a
separate directory.

Regards,
Arnout

Quoted 8 lines
package/android-tools/android-tools.mk new file +7 -0
+
+define HOST_ANDROID_TOOLS_INSTALL_CMDS
+	$(foreach t,$(HOST_ANDROID_TOOLS_TARGETS),\
+		$(INSTALL) -D -m 0755 $(@D)/build-$(t)/$(t) $(HOST_DIR)/usr/bin/$(t)$(sep))
+endef
+
+$(eval $(host-generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
Signature · 3 lines
Antoine T?nart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com