Commit graph

131 commits

Author SHA1 Message Date
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
Colin Cross
2aaf5e84f0 fastboot: use better exported api from libext4_utils
Switch fastboot to use an exported api from libext4_utils that
will change less often, and remove some of the implementation
details from fastboot.

Change-Id: I85a10c8f58abe8093d0c781e1a0e100c348ef0d9
2013-01-23 15:43:41 -08:00
Scott Anderson
9bfecb0e34 Add old fastboot_protocol.txt
fastboot_protocol.txt used to live in bootable/bootloader/legacy
which was old, obsolete code.  However, fastboot_protocol.txt is
a useful file and belongs with the fastboot code.

Change-Id: Iea50c3219f9ff9dd0c394fc6028c456fa948ffd9
Signed-off-by: Scott Anderson <saa@android.com>
2012-12-06 09:34:34 -08:00
Kenny Root
efb5e3c709 resolved conflicts for merge of 20f5daa8 to master
Change-Id: Ie3e67696d265a56dfa4d089c777506f27783a9a6
2012-10-16 18:00:29 -07:00
Kenny Root
20f5daa865 resolved conflicts for merge of 44f4f8a4 to jb-mr1-dev-plus-aosp
Change-Id: I66988d8e87a8110ca9ab3da19870b80bbaf06eba
2012-10-16 17:51:14 -07:00
Kenny Root
b83c09812f Remove HAVE_SELINUX guards
Change-Id: Idef0a784a1d237257ff4135bb1df62ff8a67ded3
2012-10-16 12:34:06 -07:00
Ken Sumrall
656a24cae7 am e17c821e: am 608634a1: am 48f3b576: Merge "Update fastboot to wipe ext4 partitions before flashing" into jb-mr1-dev
* commit 'e17c821e36163695f6d5024a71f8e706bda65fd6':
  Update fastboot to wipe ext4 partitions before flashing
2012-10-03 14:02:38 -07:00
Ken Sumrall
5ee5d389d6 Update fastboot to wipe ext4 partitions before flashing
To prevent false error reports from e2fsck, update fastboot to erase
a partition identified as being ext4 partition before flashing an image
to it.

bug: 7259359

Change-Id: I85e9963aa8247b4b33fdd57f994cdb3ee72b670f
2012-10-02 19:10:51 -07:00
Kenny Root
d5d6d97def Host builds: add fastboot and adb
Add fastboot and adb host utilities to debug builds for debugging
and development purposes.

Change-Id: If77699a27497b8641998930f14d4ee418b856080
2012-09-26 10:01:40 -07:00
Colin Cross
80f9867431 fastboot: move help command before usb connect
Move the help command handling before the call to open_device
so that is doesn't block when no device is connected.

Bug: 7078873
Change-Id: I4e9a4317bd72b4ceb4b9fc838eafd2e57b17a473
2012-09-10 14:12:37 -07:00
Colin Cross
ae807aaa02 Merge "fastboot: move help command before usb connect" into jb-mr1-dev 2012-09-10 14:11:44 -07:00
Ying Wang
96535ba620 Dist fastboot and adb for the sdk build.
So they can be downloaded from the build page.
Bug: 7109694

Change-Id: Ibc60d0acbc5d2445c01010fd0bd4654a240b0a88
2012-09-05 10:26:43 -07:00
Colin Cross
c7b75dcc1a fastboot: move help command before usb connect
Move the help command handling before the call to open_device
so that is doesn't block when no device is connected.

Bug: 7078873
Change-Id: I4e9a4317bd72b4ceb4b9fc838eafd2e57b17a473
2012-08-29 18:21:06 -07:00
Jean-Baptiste Queru
bb0d0721e6 am 94938c9d: am ed2e672f: Merge "Print strerror for file read errors during flashing"
* commit '94938c9d60d6467ec40df4254beadc50bb787934':
  Print strerror for file read errors during flashing
2012-08-20 10:29:39 -07:00
Jean-Baptiste Queru
ed2e672f3b Merge "Print strerror for file read errors during flashing" 2012-08-20 09:19:09 -07:00
Joe Onorato
ab163a9a17 am c56f4285: am a11f4bcf: Merge changes I5006b467,I0118cebf,Ibc792367
* commit 'c56f428530a307c850dc99024d23f7e5ebbf92d3':
  Support for multiple modules with the same name is going away.
  Fix build by removing TAGS from host module
  libext4_utils on host is now called libext4_utils_host so there is no name conflict
2012-08-17 00:53:14 -07:00
Joe Onorato
5069b01e21 Support for multiple modules with the same name is going away.
Change-Id: I5006b467978071f9107babe532efa71d05061580
2012-08-15 19:52:52 -07:00
Joe Onorato
2ffe3c8ac4 libext4_utils on host is now called libext4_utils_host so there is no name conflict
Change-Id: Ibc7923676925ed6942b3f672ee764cfaa98ee96e
2012-08-15 19:52:52 -07:00
Matt Gumbel
64ba258b7a Print strerror for file read errors during flashing
Change-Id: I7390867abd00036f19eb4d1a1ce23aa0aca50674
Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-26 10:19:05 -07:00
Colin Cross
a7a64579c2 am 36f2e2ac: am 23ee469c: Merge "fastboot: change default sparse limit to disabled"
* commit '36f2e2ac96f8b2163a37773f5cb92cfff75dede2':
  fastboot: change default sparse limit to disabled
2012-07-24 18:54:18 -07:00
Colin Cross
a2b3ded589 am cecc3186: am f650c075: Merge "fastboot: check argc before using argv"
* commit 'cecc3186ca18ddf7a2d43a12353c45a81ab2baca':
  fastboot: check argc before using argv
2012-07-24 18:54:17 -07:00
Colin Cross
0bbfb3976e fastboot: change default sparse limit to disabled
Change the default sparse limit to disabled to prevent resparsing files
unless the bootloader or user specifies a sparse limit.  Some
bootloaders issue an erase before every flash command, which causes
earlier parts of the downloaded image to get erased.

Change-Id: Iac6f3b05580aba8b82ed0f2f800979a49c33c691
2012-07-24 18:07:18 -07:00
Colin Cross
8fb6e06ba4 fastboot: check argc before using argv
"fastboot -w" would segfault because *argv was invalid when no
non-option arguments were specified.  Check argc > 0 before
dereferencing argv.

Change-Id: I822a799e6a38e4e5c0a4eca48c6343b8a08a6185
2012-07-24 16:37:52 -07:00
Colin Cross
9a70e5c338 resolved conflicts for merge of 4d72d881 to master
Change-Id: Ic092d27d3fc2bcc4db8a375bbcb5b86c111bf062
2012-07-17 23:35:49 -07:00
Colin Cross
f838788e6a fastboot: add support for auto-resparsing large files
Add support to fastboot for automatically using libsparse to break large
files, whether they are in sparse or normal format, into multiple sparse
files that can each fit into the target's memory.  Allows flashing
images that are larger than the size of the available memory on the
target.

By default, any file over 512MB will be sparsed into 512MB chunks.  The
limit can be modified with the -m argument, or sparsing can be forced
with -S or avoided with -N.  If -m is not specified, the target can
override the default by implementing getvar:max-download-size

Change-Id: I6c59381c3d24475c4f2587ea877200b96971cbd7
2012-07-09 22:17:58 -07:00
Colin Cross
80f2d036a9 fastboot: add fb_getvar
Add an fb_getvar helper that can be used to get values from the
target.

Change-Id: I0da088fcbc8d40076c7bf5ef6e5bbd97fae61471
2012-07-09 22:16:57 -07:00
Colin Cross
8879f988ba fastboot: use getopt_long
Modify the fastboot argument parsing to use getopt_long.  This
simplifies argument parsing, and permutes all the commands to the end of
argv to allow parsing them later.

Also moves usb initailization between argument and command processing,
to allow commands to query parameters over usb.

Change-Id: I883572f52c4190c80ee3b4aa4511ea2061a6b734
2012-07-09 22:16:55 -07:00
JP Abgrall
a032dedefe fastboot: Let "fastboot devices" work in all cases
Ignore ANDROID_SERIAL when requesting to list devices, or else it is
impossible to list devices without unsetting the env var. Even
  ANDROID_SERIAL=  fastboot devices
or
  fastboot -s "" devices
won't work.

Change-Id: Ie92f35bda852c6ecea4ebaefb75b8f18c10b6d0c
2012-06-06 11:53:33 -07:00
Scott Anderson
dd32794a29 am 866b1bd5: fastboot: Make the format of "devices -l" match adb\'s
* commit '866b1bd5051db4f22b634df1f8a06bc1c9aa2e26':
  fastboot: Make the format of "devices -l" match adb's
2012-06-05 16:21:04 -07:00