diff --git a/51-android.rules b/51-android.rules new file mode 100644 index 0000000..5e9ada8 --- /dev/null +++ b/51-android.rules @@ -0,0 +1,147 @@ +# Vendor id from: +# - http://developer.android.com/guide/developing/device.html +# - adb/usb_vendors.c + +# Quanta +SUBSYSTEM=="usb", ATTR{idVendor}=="0408", MODE="0666", GROUP="plugdev" + +# NEC +SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666", GROUP="plugdev" + +# Gigabyte +SUBSYSTEM=="usb", ATTR{idVendor}=="0414", MODE="0666", GROUP="plugdev" + +# Texas Instruments +SUBSYSTEM=="usb", ATTR{idVendor}=="0451", MODE="0666", GROUP="plugdev" + +# Philips +SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666", GROUP="plugdev" + +# Kyocera +SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666", GROUP="plugdev" + +# Foxconn +SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666", GROUP="plugdev" + +# Fujitsu +SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0666", GROUP="plugdev" + +# Panasonic +SUBSYSTEM=="usb", ATTR{idVendor}=="04DA", MODE="0666", GROUP="plugdev" + +# Sharp +SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666", GROUP="plugdev" + +# Samsung +SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev" + +# Acer +SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev" + +# Sony +SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0666", GROUP="plugdev" + +# Qualcomm +SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev" + +# Garmin-Asus +SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666", GROUP="plugdev" + +# Toshiba +SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666", GROUP="plugdev" + +# Nvidia +SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666", GROUP="plugdev" + +# ASUS +SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev" + +# HTC +SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev" + +# Archos +SUBSYSTEM=="usb", ATTR{idVendor}=="0E79", MODE="0666", GROUP="plugdev" + +# Funai +SUBSYSTEM=="usb", ATTR{idVendor}=="0F1C", MODE="0666", GROUP="plugdev" + +# Sony Ericsson +SUBSYSTEM=="usb", ATTR{idVendor}=="0FCE", MODE="0666", GROUP="plugdev" + +# LG +SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", GROUP="plugdev" + +# Hisense +SUBSYSTEM=="usb", ATTR{idVendor}=="109b", MODE="0666", GROUP="plugdev" + +# Pantech +SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666", GROUP="plugdev" + +# Compal +SUBSYSTEM=="usb", ATTR{idVendor}=="1219", MODE="0666", GROUP="plugdev" + +# Huawei +SUBSYSTEM=="usb", ATTR{idVendor}=="12D1", MODE="0666", GROUP="plugdev" + +# Positivo +SUBSYSTEM=="usb", ATTR{idVendor}=="1662", MODE="0666", GROUP="plugdev" + +# Lenovo +SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666", GROUP="plugdev" + +# Google +SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" + +# Lab126 +SUBSYSTEM=="usb", ATTR{idVendor}=="1949", MODE="0666", GROUP="plugdev" + +# ZTE +SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666", GROUP="plugdev" + +# T & A Mobile Phones +SUBSYSTEM=="usb", ATTR{idVendor}=="1BBB", MODE="0666", GROUP="plugdev" + +# Pegatron +SUBSYSTEM=="usb", ATTR{idVendor}=="1D4D", MODE="0666", GROUP="plugdev" + +# SK Telesys +SUBSYSTEM=="usb", ATTR{idVendor}=="1F53", MODE="0666", GROUP="plugdev" + +# LenovoMobile +SUBSYSTEM=="usb", ATTR{idVendor}=="2006", MODE="0666", GROUP="plugdev" + +# Nook +SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666", GROUP="plugdev" + +# KT Tech +SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666", GROUP="plugdev" + +# Yuandao +SUBSYSTEM=="usb", ATTR{idVendor}=="2207", MODE="0666", GROUP="plugdev" + +# On-The-Go-Video +SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666", GROUP="plugdev" + +# Motorola +SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev" + +# INQ Mobile +SUBSYSTEM=="usb", ATTR{idVendor}=="2314", MODE="0666", GROUP="plugdev" + +# Teleepoch +SUBSYSTEM=="usb", ATTR{idVendor}=="2340", MODE="0666", GROUP="plugdev" + +# IRiver +SUBSYSTEM=="usb", ATTR{idVendor}=="2420", MODE="0666", GROUP="plugdev" + +# K-Touch +SUBSYSTEM=="usb", ATTR{idVendor}=="24E3", MODE="0666", GROUP="plugdev" + +# Dell +SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666", GROUP="plugdev" + +# Intel +SUBSYSTEM=="usb", ATTR{idVendor}=="8087", MODE="0666", GROUP="plugdev" + +# Vizio +SUBSYSTEM=="usb", ATTR{idVendor}=="E040", MODE="0666", GROUP="plugdev" diff --git a/README.md b/README.md index 027a162..9d66b7a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,14 @@ # android-tools +Android platform tools ported to GNU/Linux for Android based devices management. + +The Android Debug Bridge (ADB) is used to: +* keep track of all Android devices and emulators instances connected to or running on a given host developer machine +* implement various control commands (e.g. "adb shell", "adb pull", etc.) for the benefit of clients (command-line users, or helper programs like DDMS). These commands are what is called a 'service' in ADB. + +Fastboot is used to manipulate the flash partitions of the Android phone. +It can also boot the phone using a kernel image or root filesystem image which reside on the host machine rather than in the phone flash. +In order to use it, it is important to understand the flash partition layout for the phone. +The fastboot program works in conjunction with firmware on the phone to read and write the flash partitions. +It needs the same USB device setup between the host and the target phone as adb. + diff --git a/adb-Makefile b/adb-Makefile new file mode 100644 index 0000000..f10ebbb --- /dev/null +++ b/adb-Makefile @@ -0,0 +1,58 @@ +BINDIR:=/usr/bin + +SRCS+= adb.c +SRCS+= adb_client.c +SRCS+= commandline.c +SRCS+= console.c +SRCS+= file_sync_client.c +SRCS+= fdevent.c +SRCS+= get_my_path_linux.c +SRCS+= services.c +SRCS+= sockets.c +SRCS+= transport.c +SRCS+= transport_local.c +SRCS+= transport_usb.c +SRCS+= usb_linux.c +SRCS+= usb_vendors.c +SRCS+= utils.c + +VPATH+= ../libcutils +SRCS+= abort_socket.c +SRCS+= socket_inaddr_any_server.c +SRCS+= socket_local_client.c +SRCS+= socket_local_server.c +SRCS+= socket_loopback_client.c +SRCS+= socket_loopback_server.c +SRCS+= socket_network_client.c + +VPATH+= ../libzipfile +SRCS+= centraldir.c +SRCS+= zipfile.c + +CPPFLAGS+= -DADB_HOST=1 +CPPFLAGS+= -DHAVE_FORKEXEC=1 +CPPFLAGS+= -DHAVE_SYMLINKS +CPPFLAGS+= -DHAVE_TERMIO_H +CPPFLAGS+= -D_GNU_SOURCE +CPPFLAGS+= -D_XOPEN_SOURCE +CPPFLAGS+= -I. +CPPFLAGS+= -I../include + +CFLAGS+= $(RPM_OPT_FLAGS) +LIBS= -lrt -lpthread -lz + +CC= $(TOOLCHAIN)gcc +LD= $(TOOLCHAIN)gcc + +OBJS= $(SRCS:.c=.o) + +all: adb + +adb: $(OBJS) + $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) + +install: adb + install -D -m0755 adb $(DESTDIR)$(BINDIR)/adb + +clean: + rm -rf $(OBJS) diff --git a/android-tools.spec b/android-tools.spec new file mode 100644 index 0000000..27767f1 --- /dev/null +++ b/android-tools.spec @@ -0,0 +1,110 @@ +Name: android-tools +Version: 4.0.3_r1 +Release: 3mamba +Summary: Android platform tools +Group: System/Tools +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://source.android.com +# git clone https://android.googlesource.com/platform/system/core +# cd core +# git archive --format=tar --prefix=android-tools-$(git tag -l | grep tools | sed "s,android-sdk-\([^-]*\)-tools\(.*\),\1\2,")/ \ +# $(git tag -l | grep tools) \ +# adb cpio fastboot include/cutils include/mincrypt include/private include/zipfile libcutils libmincrypt libzipfile mkbootimg | \ +# xz > $(rpm --eval %_sourcedir)/android-tools-$(git tag -l | grep tools | sed "s,android-sdk-\([^-]*\)-tools\(.*\),\1\2,").tar.xz +Source: android-tools-%{version}.tar.xz +# Source created with (very big download): +# mkdir android-src-system; cd android-src-system +# repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.3_r1 +# repo sync +# (only /system directory is archivced) +#Source: android-src-system-%{version}.tar.xz +Source1: 51-android.rules +Source2: core-Makefile +Source3: adb-Makefile +Source4: fastboot-Makefile +License: Apache License 2.0, BSD +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +BuildRequires: libz-devel +## AUTOBUILDREQ-END +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +Android platform tools ported to GNU/Linux for Android based devices management. + +The Android Debug Bridge (ADB) is used to: +* keep track of all Android devices and emulators instances connected to or running on a given host developer machine +* implement various control commands (e.g. "adb shell", "adb pull", etc.) for the benefit of clients (command-line users, or helper programs like DDMS). These commands are what is called a 'service' in ADB. + +Fastboot is used to manipulate the flash partitions of the Android phone. +It can also boot the phone using a kernel image or root filesystem image which reside on the host machine rather than in the phone flash. +In order to use it, it is important to understand the flash partition layout for the phone. +The fastboot program works in conjunction with firmware on the phone to read and write the flash partitions. +It needs the same USB device setup between the host and the target phone as adb. + +%package -n mkbootimg +Summary: A tool for creating kernel bootable images for the Android boot loader +Group: System/Kernel and Hardware + +%description -n mkbootimg +mkbootims is a command line tool useful for creating kernel bootable images for the Android boot loader. +This package also includes mkbootfs. + +%prep +%setup -q +cp -p %{S:2} Makefile +cp -p %{S:3} adb/Makefile +cp -p %{S:4} fastboot/Makefile + +%build +%make + +(cd libmincrypt +%{_host}-gcc -c *.c -I../include +%{_host}-ar rcs libmincrypt.a *.o) + +(cd mkbootimg +%{_host}-gcc mkbootimg.c -o mkbootimg -I../include ../libmincrypt/libmincrypt.a) + +(cd cpio +%{_host}-gcc mkbootfs.c -o mkbootfs -I../include) + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall + +install -D -m0644 %{S:1} \ + %{buildroot}%{_sysconfdir}/udev/rules.d/51-android.rules + +install -D -m0755 mkbootimg/mkbootimg \ + %{buildroot}%{_bindir}/mkbootimg +install -D -m0755 cpio/mkbootfs \ + %{buildroot}%{_bindir}/mkbootfs + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_bindir}/adb +%{_bindir}/fastboot +%{_sysconfdir}/udev/rules.d/51-android.rules +%doc adb/*.TXT adb/NOTICE adb/*.txt + +%files -n mkbootimg +%defattr(-,root,root) +%{_bindir}/mkbootimg +%{_bindir}/mkbootfs + +%changelog +* Fri Jun 01 2012 Stefano Cotta Ramusino 4.0.3_r1-3mamba +- fixed android udev rules + +* Wed May 30 2012 Stefano Cotta Ramusino 4.0.3_r1-2mamba +- added main package +- fixed license + +* Tue Feb 21 2012 Silvan Calarco 4.0.3_r1-1mamba +- package created by autospec diff --git a/core-Makefile b/core-Makefile new file mode 100644 index 0000000..17f7152 --- /dev/null +++ b/core-Makefile @@ -0,0 +1,11 @@ +all: + $(MAKE) -C adb all + $(MAKE) -C fastboot all + +install: + $(MAKE) -C adb install + $(MAKE) -C fastboot install + +clean: + $(MAKE) -C adb clean + $(MAKE) -C fastboot clean diff --git a/fastboot-Makefile b/fastboot-Makefile new file mode 100644 index 0000000..8682b54 --- /dev/null +++ b/fastboot-Makefile @@ -0,0 +1,42 @@ +BINDIR:=/usr/bin + +SRCS+= protocol.c +SRCS+= engine.c +SRCS+= bootimg.c +SRCS+= fastboot.c +SRCS+= usb_linux.c +SRCS+= util_linux.c + +VPATH+= ../libzipfile +SRCS+= centraldir.c +SRCS+= zipfile.c + +CPPFLAGS+= -DADB_HOST=1 +CPPFLAGS+= -DHAVE_FORKEXEC=1 +CPPFLAGS+= -DHAVE_SYMLINKS +CPPFLAGS+= -DHAVE_TERMIO_H +CPPFLAGS+= -D_GNU_SOURCE +CPPFLAGS+= -D_XOPEN_SOURCE +CPPFLAGS+= -I. +CPPFLAGS+= -I../include +CPPFLAGS+= -I../mkbootimg + + +CFLAGS+= $(RPM_OPT_FLAGS) +LIBS= -lrt -lpthread -lz + +CC= $(TOOLCHAIN)gcc +LD= $(TOOLCHAIN)gcc + +OBJS= $(SRCS:.c=.o) + +all: fastboot + +fastboot: $(OBJS) + $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) + +install: fastboot + install -D -m0755 fastboot $(DESTDIR)$(BINDIR)/fastboot + +clean: + rm -rf $(OBJS)