Package: android-tools
Severity: normal
Version: 4.1.1+git20120801-1
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu raring ubuntu-patch

There are a few very useful tools shipped in the code. Specifically
those that are used to create/convert sparse disk images.

Here is a patch that packages them.

Maybe it's time to start compiling libs as shared libs.... But that
could be done in the next iteration.

diff -Nru android-tools-4.1.1+git20120801/debian/android-tools-fsutils.install android-tools-4.1.1+git20120801/debian/android-tools-fsutils.install
--- android-tools-4.1.1+git20120801/debian/android-tools-fsutils.install	1970-01-01 01:00:00.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/android-tools-fsutils.install	2012-11-06 11:40:41.000000000 +0000
@@ -0,0 +1,7 @@
+extras/ext4_utils/ext2simg usr/bin
+extras/ext4_utils/ext4fixup usr/bin
+extras/ext4_utils/make_ext4fs usr/bin
+extras/ext4_utils/test_ext4fixup usr/bin
+extras/ext4_utils/img2simg usr/bin
+extras/ext4_utils/simg2img usr/bin
+extras/ext4_utils/simg2simg usr/bin
\ No newline at end of file
diff -Nru android-tools-4.1.1+git20120801/debian/changelog android-tools-4.1.1+git20120801/debian/changelog
--- android-tools-4.1.1+git20120801/debian/changelog	2012-08-17 19:46:29.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/changelog	2012-11-05 18:01:19.000000000 +0000
@@ -1,3 +1,11 @@
+android-tools (4.1.1+git20120801-1.1) UNRELEASED; urgency=low
+
+  * Build extras/ext4_utils as well.
+  * Build for any architecture. (Closes: 690455)
+  * Add android-tools-ext4-utils package.
+
+ -- Dmitrijs Ledkovs <dmitrij.led...@ubuntu.com>  Mon, 05 Nov 2012 17:54:05 +0000
+
 android-tools (4.1.1+git20120801-1) unstable; urgency=low
 
   * Initial upload to Debian (closes: #685178), based on the work of Marcin
diff -Nru android-tools-4.1.1+git20120801/debian/control android-tools-4.1.1+git20120801/debian/control
--- android-tools-4.1.1+git20120801/debian/control	2012-08-17 18:54:42.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/control	2012-11-06 11:41:24.000000000 +0000
@@ -1,14 +1,14 @@
 Source: android-tools
 Section: devel
 Priority: extra
 Maintainer: Laszlo Boszormenyi (GCS) <g...@debian.hu>
 Uploaders: Marcin Juszkiewicz <marcin.juszkiew...@linaro.org>
-Build-Depends: debhelper (>= 9), zlib1g-dev
+Build-Depends: debhelper (>= 9), zlib1g-dev, python
 Standards-Version: 3.9.3
 Homepage: http://developer.android.com/guide/developing/tools/adb.html
 
 Package: android-tools-adb
-Architecture: amd64 i386
+Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Android Debug Bridge CLI tool
  Android Debug Bridge (adb) is a versatile tool lets you manage the state of an
@@ -27,8 +28,15 @@
  instance.
 
 Package: android-tools-fastboot
-Architecture: amd64 i386
+Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Fastboot protocol CLI tool
  Fastboot is protocol used to update the flash filesystem in Android devices
  from a host over USB. It allows flashing of unsigned partition images.
+
+Package: android-tools-fsutils
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}
+Description: Android ext4_utils with sparse support
+ Utilities needed to generate sparse ext4 images that can be used for
+ flashing android devices.
diff -Nru android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-adb.patch android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-adb.patch
--- android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-adb.patch	2012-08-01 11:31:05.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-adb.patch	2012-11-05 17:52:20.000000000 +0000
@@ -5,8 +5,10 @@
  core/adb/makefile |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 52 insertions(+)
 
+Index: b/core/adb/makefile
+===================================================================
 --- /dev/null
-+++ android-tools/core/adb/makefile
++++ b/core/adb/makefile
 @@ -0,0 +1,52 @@
 +# Makefile for adb
 +
@@ -59,4 +61,4 @@
 +	$(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
 +
 +clean:
-+	rm -rf $(OBJS)
++	rm -rf $(OBJS) adb
diff -Nru android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-mkfs.patch android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-mkfs.patch
--- android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-mkfs.patch	1970-01-01 01:00:00.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/patches/add-makefile-for-mkfs.patch	2012-11-06 11:40:03.000000000 +0000
@@ -0,0 +1,58 @@
+Subject: Add makefile to build ext4_utils without using Android build system
+Author: Dmitrijs Ledkovs <x...@ubuntu.com>
+Origin: https://heiher.info/2227.html
+
+Index: b/extras/ext4_utils/makefile
+===================================================================
+--- /dev/null
++++ b/extras/ext4_utils/makefile
+@@ -0,0 +1,49 @@
++SRCS+=make_ext4fs.c
++SRCS+=ext4fixup.c
++SRCS+=ext4_utils.c
++SRCS+=allocate.c
++SRCS+=contents.c
++SRCS+=extent.c
++SRCS+=indirect.c
++SRCS+=uuid.c
++SRCS+=sha1.c
++SRCS+=wipe.c
++
++VPATH+=../../core/libsparse
++SRCS+= backed_block.c
++SRCS+= sparse_crc32.c
++SRCS+= sparse.c
++SRCS+= sparse_read.c
++SRCS+= sparse_err.c
++SRCS+= output_file.c
++
++OBJS_SHARED:= $(SRCS:.c=.o)
++
++SRCS+=make_ext4fs_main.c
++SRCS+=ext4fixup_main.c
++SRCS+=setup_fs.c
++SRCS+=ext2simg.c
++SRCS+=img2simg.c
++SRCS+=simg2img.c
++SRCS+=simg2simg.c
++
++CPPFLAGS+= -I.
++CPPFLAGS+= -I/usr/include
++CPPFLAGS+= -I../../core/include
++CPPFLAGS+= -I../../core/libsparse/include/
++
++LIBS+= -lz
++
++OBJS= $(SRCS:.c=.o)
++
++all: make_ext4fs ext4fixup ext2simg img2simg simg2img simg2simg
++
++make_ext4fs ext4fixup: $(OBJS)
++	$(CC) -o $@ $(LDFLAGS) $(OBJS_SHARED) $@_main.o $(LIBS)
++
++ext2simg img2simg simg2img simg2simg: $(OBJS)
++	$(CC) -o $@ $(LDFLAGS) $(OBJS_SHARED) $@.o $(LIBS)
++
++clean:
++	rm -rf $(OBJS) ext2simg ext4fixup make_ext4fs img2simg simg2img simg2simg
++
diff -Nru android-tools-4.1.1+git20120801/debian/patches/series android-tools-4.1.1+git20120801/debian/patches/series
--- android-tools-4.1.1+git20120801/debian/patches/series	2012-07-16 15:19:48.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/patches/series	2012-11-05 17:02:17.000000000 +0000
@@ -1,2 +1,3 @@
 add-makefile-for-fastboot.patch
 add-makefile-for-adb.patch
+add-makefile-for-mkfs.patch
diff -Nru android-tools-4.1.1+git20120801/debian/rules android-tools-4.1.1+git20120801/debian/rules
--- android-tools-4.1.1+git20120801/debian/rules	2012-08-14 14:09:43.000000000 +0100
+++ android-tools-4.1.1+git20120801/debian/rules	2012-11-06 11:39:36.000000000 +0000
@@ -14,15 +14,20 @@
 endif
 
 %:
-	dh $@
+	dh $@ --with python2
 
 override_dh_clean:
 	dh_clean
-	rm -f core/adb/*.o core/adb/adb core/fastboot/*.o core/fastboot/fastboot
+	make -C core/adb CC=$(CC) clean
+	make -C core/fastboot CC=$(CC) clean
+	make -C extras/ext4_utils CC=$(CC) clean
 
 override_dh_auto_build:
-	cd core/adb && make CC=$(CC)
-	cd core/fastboot && make CC=$(CC)
+	make -C core/adb CC=$(CC)
+	make -C core/fastboot CC=$(CC)
+	make -C extras/ext4_utils CC=$(CC)
 
 override_dh_install:
 	dh_install --sourcedir=.
+	install core/libsparse/simg_dump.py debian/android-tools-fsutils/usr/bin/simg_dump
+	install extras/ext4_utils/mkuserimg.sh debian/android-tools-fsutils/usr/bin/mkuserimg
Regards,

Dmitrijs.

Reply via email to