Commit graph

159 commits

Author SHA1 Message Date
Al Sutton
f456d47c50 Fix building on modern versions of Xcode and OS X.
Recent versions of XCode fail to compile the adb and fastboot binaries due to
two functions being deprecated in 10.9 (GetCurrentProcess and
ProcessInformationCopyDictionary), and the use of -Werrror.

This patch replaces the method implementations which use calls to methods
deprecated in the 10.9 SDK with versions which only call non-deprecated methods.

Change-Id: I855bf26aff45093ca9022924f3ecd1b80f2305a8
2014-11-19 19:50:48 +00:00
Stephen Hines
1e95e0b19c am 64f44b84: Merge "Remove obsolete reference to ddk; Fixes for -Werror" into lmp-dev
* commit '64f44b8444dabd69cf391d42e10d44e8e926a79d':
  Remove obsolete reference to ddk; Fixes for -Werror
2014-10-01 23:21:09 +00:00
Andrew Hsieh
b75d6f1429 Remove obsolete reference to ddk; Fixes for -Werror
Bug: 14416410

1. The new mingw-w64 toolchain x86_64-w64-mingw32-4.8 has ddk
   in x86_64-w64-mingw32/include/ddk
2. Add -Wno-error=cpp to suppress a warning that turns into error
   thanks to -Werror:

      Please include winsock2.h before windows.h
3. Cast GetLastError() return type DWORD to "int"
4. Include direct.h for _mkdir
5. Include stdint.h for uint8_t on Windows

Change-Id: I4bec0587f6573692f08c760da6c98ae551b8b5eb
2014-09-30 02:24:07 -07:00
Daniel Rosenberg
24e834ab60 am 81b857f3: Merge "fastboot: Remove tos from flashall" into lmp-dev
* commit '81b857f3a21f3ae96a5ec72e54982fe30278049f':
  fastboot: Remove tos from flashall
2014-09-16 21:34:45 +00:00
Daniel Rosenberg
015d73ff4e fastboot: Remove tos from flashall
bug: 17498561
Change-Id: I0190c1a5ac635375404799c040e4be523fa29622
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-09-15 13:44:07 -07:00
Jeremy Compostella
310db68903 am a42adff9: fastboot: add the support of the second stage image [DO NOT MERGE]
* commit 'a42adff905600219cbf5ef217d2b46670225aca3':
  fastboot: add the support of the second stage image [DO NOT MERGE]
2014-08-16 05:17:12 +00:00
Jeremy Compostella
a42adff905 fastboot: add the support of the second stage image [DO NOT MERGE]
The AOSP bootimage format allows the use of a second stage image
however the fastboot boot and flash:row commands do not allow the
"secondstage" optional argument.  This patch adds the support of this
argument for both commands.

Change-Id: I00403a95d7460a00233841ba0fe0e8a69d78c7b4
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
2014-08-15 21:21:09 -07:00
Ying Wang
0c3d98b02b am 87ad7cdc: am e1ba39aa: Merge "Fix 64-bit host build."
* commit '87ad7cdc590aa4033f0b7ae23d83e2fbc119d07a':
  Fix 64-bit host build.
2014-08-14 23:20:06 +00:00
Ying Wang
42a809ba06 Fix 64-bit host build.
Bug: 13751317
Change-Id: Ibf62935b7d12a55ffc57242a26a2581b52796847
2014-08-14 15:52:54 -07:00
Tim Murray
b2e13ae4fe am 3a5f3db2: am c894ced1: Merge "Fix fastboot for Darwin."
* commit '3a5f3db2aa5324518eb71c69cd1fb3e2125cbd43':
  Fix fastboot for Darwin.
2014-07-25 02:38:02 +00:00
Tim Murray
bd87944805 Fix fastboot for Darwin.
bug 16172793

Change-Id: Ib58446effc13a6e465d176da141b025d36841b8f
2014-07-24 19:27:37 -07:00
Patrick Tjin
4415e2a269 Scan all descriptors when checking for fastboot [DO NOT MERGE]
For Linux, the USB code was only looking at the first
descriptor when searching for the fastboot interface
which caused some devices to not be found.

Also clarify some code by using the actual USB structures
instead of void or char pointers.

(Cherry Picked from aac89db8a5)
Change-Id: I9e4871c4d477ac10ba75bb17a955f176809af289
Signed-off-by: Patrick Tjin <pattjin@google.com>
2014-07-17 10:07:19 -07:00
Patrick Tjin
3a07ce8c04 am 7793a109: am 5328f671: Merge "Scan all descriptors when checking for fastboot"
* commit '7793a10993a357db6a963760737193992055a690':
  Scan all descriptors when checking for fastboot
2014-07-17 12:59:43 +00:00
Patrick Tjin
aac89db8a5 Scan all descriptors when checking for fastboot
For Linux, the USB code was only looking at the first
descriptor when searching for the fastboot interface
which caused some devices to not be found.

Also clarify some code by using the actual USB structures
instead of void or char pointers.

Change-Id: I9e4871c4d477ac10ba75bb17a955f176809af289
Signed-off-by: Patrick Tjin <pattjin@google.com>
2014-07-11 14:15:30 -07:00
Markus Mayer
c335a3500c Fix typo in fs.h
fs.h defined _FH_H_ rather than _FS_H_

Change-Id: I710ef53e88d3601e486fde9957f6d022871d9602
Signed-off-by: Markus Mayer <code@mmayer.net>
2014-07-09 15:27:53 -07:00
Elliott Hughes
67db9d5f73 am b2ac4243: am f76c8fe6: am 328c3ef6: Merge "Fix typo in fs.h"
* commit 'b2ac4243000057baf1656c93197150ba7665137e':
  Fix typo in fs.h
2014-07-10 00:49:53 +00:00
JP Abgrall
fab6ebafa6 am 47050442: am 31132182: am 07703339: Merge "Wait for device to disappear after "fastboot reboot"."
* commit '4705044243225ffde88910154485a84c27a33709':
  Wait for device to disappear after "fastboot reboot".
2014-06-25 00:28:50 +00:00
Daniel Rosenberg
f530c93c4a Added support for vendor partition and image
Modified fastboot to flash vendor.img as well. Moved symlink
for /vendor to occur after mounting partitions. Changed mount
to also create the mount point.

Change-Id: I78e1ba24e6bb8b4af96a67ee0569af579439e682
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-06-24 21:51:31 +00:00
Mark Wachsler
ec25e7bc4b Wait for device to disappear after "fastboot reboot".
This is a follow-up to commit 157b00171a.
After "fastboot reboot", "fastboot devices" was still showing the device as
connected even though it was starting to reboot; now "fastboot reboot" will
wait until the device has disconnected.

The wait timeout is 3 seconds.

Change-Id: I8066741f0be91e53f3e3f5bc968bc1b9de31db05
2014-06-24 22:34:34 +00:00
JP Abgrall
188fdd1c0f Merge "fastboot: Allow searching for needed dynamic libs in '.' (F2FS)" 2014-06-19 20:37:59 +00:00
JP Abgrall
436abebf8c fastboot: Allow searching for needed dynamic libs in '.' (F2FS)
Currently the default rpath includes $ORIGIN/../lib
So we throw in '.' which should help distributions of fastboot.

readelf -d $(which fastboot)|grep RPATH
 0x0000000f (RPATH) Library rpath: [$ORIGIN/../lib:.]

Bug: 15731906
Change-Id: I2f4345d178e5b3c87f6f159faf105ae30f3b52eb
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-19 14:47:19 -07:00
Ying Wang
6b048ce839 Store libf2fs_fmt_host_dyn on the build server.
It will be dynamically loaded by fastboot.

Bug: 15731906
Change-Id: Iff6f2b745b4ffd2c5fe343160b3efb8dcd5702fa
2014-06-19 14:44:23 -07:00
JP Abgrall
64c0ff21e4 fastboot: correctly set dependency on f2fs dynamic lib
In the past it would incorrectly also link against the dlopen()'d lib.

Now it clearly does not care about it.

ldd $(which fastboot)
        linux-gate.so.1 =>  (0xf7735000)
        libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf76d9000)
        libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf75f4000)
        libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf75c7000)
        libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf75a9000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf73ff000)
        /lib/ld-linux.so.2 (0xf7736000)

Bug: 15717498
Change-Id: I5465e97a445b17f5493a1f590e181ef98a382451
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-18 11:13:05 -07:00
Torne (Richard Coles)
11d8ac2afb Only try and use f2fs on linux.
F2FS was already disabled on windows, but the library doesn't build for
mac either, so only try and use it on Linux hosts.

Change-Id: I8bacfa4c01c9ee13123aef6d05d17b3f9094c765
2014-06-18 13:48:38 +01:00
JP Abgrall
6bd72beff6 fastboot: fix windows sdk build (don't do f2fs dyn load on windows)
Only do f2fs dynamic loading on linux.
Adds a stub for windows builds.

Change-Id: I7bbaaa1b2ff5992709d904b7ace40ae263d32922
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-17 23:43:18 -07:00
JP Abgrall
1235158c29 F2FS support for fastboot format and fsmgr
- Enables fsck.f2fs for partitions with type F2FS.
- Adds support for f2fs as format fs-type.
- f2fs is optional and support is dlopen()d when needed.

Needs changes in
  system/extras/f2fs_utils
  external/f2fs-tools

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
2014-06-17 17:01:14 -07:00
Ying Wang
cf86e2f85d Fix host 64-bit build.
Bug: 13751317
Change-Id: Ib42d24408d053bacc24142ed18fc5f3181d2345b
2014-05-16 09:36:17 -07:00
Mark Salyzyn
5957c1ffe7 fastboot: turn on -Werror
- Deal with a missing initializer issue
- Deal with some -Wunused issues
- Deal with some signed/unsigned issues
- switch to usleep from sleep to facilitate win_sdk compile

Change-Id: I64e32a5b0782aeed9582f489e866173c4df1afbf
2014-05-14 08:33:56 -07:00
Alexander Levitskiy
8d7ddb35d5 Revert "System: Fastboot: warning fixit, misc bugs and cleanup."
This reverts commit 782111b3bc.

Change-Id: Ib66400dfaeef7f01e6461a57b9f09be08de2f1fe
2014-05-07 23:31:59 +00:00
Sasha Levitskiy
782111b3bc System: Fastboot: warning fixit, misc bugs and cleanup.
Change-Id: Ib8517a852977962de3f05c879ba7dce89bcef644
Signed-off-by: Sasha Levitskiy <sanek@google.com>
2014-05-07 11:43:12 -07:00
JP Abgrall
7e85974fc2 fastboot: support for overriding format fs-type and size
This changes allows overriding the fs-type and size that
are normally returned by the booloader.

This is in preparation for supporting other FSes.

Change-Id: I8d141a0d4d14df9fe84d3b131484e9696fcd8870
Signed-off-by: JP Abgrall <jpa@google.com>
2014-05-06 15:14:15 -07:00
Daniel Rosenberg
73a4ad288f fastboot: Added tos as an optional image
Change-Id: Ibff1f74ee4a949501ceae0b897f896067f022763
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-05-06 12:28:41 -07:00
Daniel Rosenberg
82280594ef fastboot: Fixed optional entries
Previously, if an image was listed as optional, but was not found,
flashall would fail. Now it will proceed if optional images are not
present.

Change-Id: Ic82595cf0cd6ddce4c676de590f03f1a95f32040
Signed-off-by: Daniel Rosenberg <drosen@google.com>
2014-05-06 12:28:39 -07:00
Dmitry Grinberg
e6f3e9bd26 fastboot: allow format on devices with small buffers
Formatting large partitions on devices with small transfer buffers did
not work before since format used a strange path through the code to
send data. It now uses the normal path. Also cleaned up a bit. FS
code now lives in a separate file and the custom path for format is
gone.

Change-Id: If4e01cabc2e250b7c02ca7ce8c268e51d49e1529
2014-05-06 12:28:37 -07:00
JP Abgrall
8e26b25222 Merge "Fastboot: fix fastboot timeout issue of Windows host side" 2014-05-06 02:24:19 +00:00
Mohamad Ayyash
29fd7b1f4f fastboot: Make tags_offset a command line option.
cherry picked from commit bdf513c5f2

Change-Id: I4ceca528f88cc8ede5742f8a67bec972e41eebe7
2014-05-01 20:31:29 +00:00
Jiebing Li
bbb7981e49 Fastboot: fix fastboot timeout issue of Windows host side
Normally fastboot follows the procedure that host sends a command
to device and device sends back response after the command
is executed.

But sometimes device spends too long time to execute the command
so that timeout error occurs before host receives the response.

This patch fixes the issue by aligning with the solution of ADB.
ADB commit id: 1c4b760a5d

Change-Id: I50e6bf428ea38219b64cca6ab82db22af28e0264
Author: Jiebing Li <jiebing.li@intel.com>
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
2014-04-25 14:15:08 +08:00
The Android Open Source Project
66ed50af68 Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
2013-11-22 13:44:43 -08:00
Elliott Hughes
14e28d39f7 Fix a bunch of small system/core bugs.
Missing frees in:
  adb/file_sync_client.c
  fastboot/fastboot.c
  libsparse/output_file.c

Missing closedirs in:
  adb/file_sync_service.c
  cpio/mkbootfs.c
  libcutils/dir_hash.c

Potential buffer overrun in:
  gpttool/gpttool.c

Incorrect NULL check in:
  libsparse/backed_block.c

Bug: https://code.google.com/p/android/issues/detail?id=61564
Change-Id: If97838a9e73a77aef7f416c31c237ce1fca4ce21
2013-10-29 14:12:46 -07:00
Mark Wachsler
157b00171a Wait for device to disappear after reboot-bootloader.
(Linux only for now) With fastboot reading serial numbers from sysfs, it had
become possible for a fastboot command issued immediately after rebooting
the bootloader to fail, because sysfs still thought the device was online.
To prevent this, after reboot-bootloader we wait for the device to disconnect.

Also made usb_read and usb_write fail immediately if the descriptor has been
closed; this prevents an incorrect error message ("Bad file descriptor")
when errors from fb_getvar are ignored (e.g., by fb_format_supported).

Also removed unused fd param from filter_usb_device, and simplified logic
in usb_write by using do/while instead of a special case for len == 0.

Change-Id: I799b857eab411fd8ad25f5777fc61c685152ea86
2013-10-17 20:06:32 +00:00
jp abgrall
e6e5daace5 am edeed28b: am 4a280e3d: Merge "Don\'t use control requests to read device serial numbers."
* commit 'edeed28bd397f863686ba3e5bb7479f881efc657':
  Don't use control requests to read device serial numbers.
2013-09-17 14:17:44 -07:00
Mark Wachsler
bd446c76f3 Don't use control requests to read device serial numbers.
Instead of sending control requests to all devices to read their serial
numbers, read the cached strings from sysfs. This fixes two problems:
1) The control requests sometimes timed out, causing devices to show up
as "????????????????", and 2) a control request could mess up devices
which were in the middle of being flashed.

Also enumerate by walking sysfs rather than devs so that we can avoid
opening host controller devices, which can be slow. On a system with 10
EHCI controllers, fastboot devices now takes 7 msec instead of 700 msec.

Change-Id: I2ad2d58b48268d7950bd279fd6a6753dc2f79514
2013-09-16 18:08:07 -04:00
Rom Lemarchand
622810ceff fastboot: add support for sparse images in flashall and update
Change-Id: I66a73b16a988a65fc91fb22a26d11986025089de
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-07-01 12:42:58 -07:00
Rom Lemarchand
c9cce4b981 fastboot: Remove legacy MINGW workarounds
The version of MINGW we compile with has more advanced POSIX support.
Removing legacy MINGW workarounds as those are not needed anymore.

Change-Id: Id5d67176b719db6c3667be6d63c41432e0ba9f30
Signed-off-by: Rom Lemarchand <romlem@google.com>
2013-06-28 17:00:41 -07:00
jp abgrall
88e8f61a9e Revert "fastboot: add preflash command to help with large downloads+flash"
This reverts commit 6f1cd0b2ad.

It causes some devices to fail (b/9581613). Revert for now.

Change-Id: I076158c704c2b4f0459322aa157c19ebd0c4615f
2013-06-26 03:51:29 +00:00
JP Abgrall
6f1cd0b2ad fastboot: add preflash command to help with large downloads+flash
Without the partition name, the bootloader would have to store all
of the data until the next flash command, which potentially wastes
time.
To help the bootloader deal with the data more efficiently, we now
issue a flashing hint ("preflash:%s", partname).
"preflash:" is used to indicate that the following download
should ignore any previous "preflash:%s".

Bug: 6045918
Change-Id: I4e9708f64f28a4781bde14eb3714d36b281ec5be
2013-06-25 11:52:05 -07:00
JP Abgrall
7b8970c577 fastboot: add support for some obscure args.
Some devices use mkbootimg with weird args for which fastboot
only a hardcoded value.

Now fastboot recognizes those args.

Made handling of global vars more consistent.

Bug: 8341331
Change-Id: Ic09f148ccd0249f49935fdc63e517cf8ab2229bc
2013-03-07 17:06:41 -08:00
Colin Cross
fa341f5b66 Merge commit '35d5b7e6' into master 2013-01-23 21:20:23 -08:00
Colin Cross
c86396eba2 am 5fc4fdc6: am 2447afdb: Merge "fastboot: use better exported api from libext4_utils"
# Via Android Git Automerger (1) and others
* commit '5fc4fdc6a06cfa151d29f751d9d9beb8cb781a6a':
  fastboot: use better exported api from libext4_utils
2013-01-23 20:52:29 -08:00
Colin Cross
81c632e4da fastboot: add errno.h to fix windows build
The removal of extra headers from ext4_utils.h removed an indirect
include of errno.h that breaks building with USE_MINGW=1.

Change-Id: Ic8448db97b5c056a139dc836e1d6f3aaafb917c9
2013-01-23 19:13:43 -08:00