Commit graph

43 commits

Author SHA1 Message Date
Elliott Hughes
b3748de33f Move fastboot to C++.
Minimal conversion.

Change-Id: I32cbf125be481a8757720d10fa303c38a7fd5e38
2015-06-23 20:56:01 -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
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
The Android Open Source Project
66ed50af68 Merge commit '536dea9d61a032e64bbe584a97463c6638ead009' into HEAD
Change-Id: I5c469a4b738629d99d721cad7ded02d6c35f56d5
2013-11-22 13:44:43 -08: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
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
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
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
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
JP Abgrall
3447b11d3e am 177a74ac: am c1f88106: Merge "fastboot: Change -w to format after the erase of userdata & cache" into jb-dev
* commit '177a74aced971b89c319fb61ee12da0ca40f0c12':
  fastboot: Change -w to format after the erase of userdata & cache
2012-05-14 08:35:13 -07:00
JP Abgrall
30ae5806e9 fastboot: Change -w to format after the erase of userdata & cache
If the bootloader doesn't support formatting of those partitions
(either because it doesn't support the getvar commands needed or
the partition type is not supported), the errors are printed but
doesn't halt processing of subsequent commands.

Change-Id: I816ac2e5e7593846fcb4fd39c793a8dbdd996f6f
Signed-off-by: Mike J. Chen <mjchen@google.com>
2012-05-07 20:25:24 -07:00
Scott Anderson
a61bcad58b resolved conflicts for merge of 13081c69 to master
Change-Id: I631e466fc53e9b0f4a39f24f959b4ae9b626bdda
2012-05-01 18:34:22 -07:00
Scott Anderson
13081c6915 fastboot: Add ability to specify device path
For manufacturing and testing, there is a need to talk to
whatever device is connected to a given port on the host.  This
change modifies fastboot's "-s" option to take either a serial
number or a device path.  The device paths of the connected
devices can be listed using "fastboot -l devices" whose output
will resemble:

    016B75D60A00600D	usb:2-5	fastboot
    AD3C12020173	usb:1-4.3	fastboot

The second column lists the device paths.  If the -l option is
not given, the output from "fastboot devices" will be the same as
it used to be (i.e. the paths will not be printed).

Finally, note that the format of the device paths are platform
dependent.  The example above is from Linux.  On OS-X, the paths
will be "usb:" followed by hex digits.  For Windows, the device
paths will be printed as "????????????" and the -s option will
not be able to select a device until someone implements the
underlying functionality in usb_windows.c.

Change-Id: I1f01b8f47acd32edb0ac18db107316a2c923bbde
Signed-off-by: Scott Anderson <saa@android.com>
2012-04-19 11:59:09 -07:00
Kenny Root
1ecb8681c3 fastboot: add support for SELinux and fs_config_func
There were some changes to make_ext4fs to add SELinux context. Also, we
changed the "android" argument to an fs_config_func that allows you to
customize the permissions put into a ext4 filesystem.

Change-Id: If23152c40659122a91771fcbd094f713b38e321e
2012-03-30 20:46:16 -07:00
Anatol Pomazau
5ae3f93f3b Remove trailing whitespaces
Change-Id: I6f83333a6ee0fbc562a12bb9555c43a44c98768e
2012-02-28 07:21:08 -08:00
Anatol Pomazau
c8ba5366da Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.

Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:

 - get size of partition
 - create an empty filesystem image
 - erase the partition
 - flush empty fs to the partition

This command applicable only for ext4 filesystem and checks the
partition type before formatting it.

Change-Id: I8529bc3485739487f0d91312f7c0ab1a6e5d8b44
2012-02-17 16:29:58 -08:00
Mike J. Chen
714052ba4d DO NOT MERGE
fastboot: Change -w to format after the erase of userdata & cache

If the bootloader doesn't support formatting of those partitions
(either because it doesn't support the getvar commands needed or
the partition type is not supported), the errors are printed but
doesn't halt processing of subsequent commands.

Change-Id: I816ac2e5e7593846fcb4fd39c793a8dbdd996f6f
Signed-off-by: Mike J. Chen <mjchen@google.com>
2012-02-16 09:32:42 -08:00
Mike Lockwood
ca2074b78d Revert "Implement 'fastboot format' command"
until Windows support is done

This reverts commit 452e11885a.
2012-02-13 09:57:19 -08:00
Anatol Pomazau
452e11885a Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.

Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:

 - get size of partition
 - create an empty filesystem image
 - erase the partition
 - flush empty fs to the partition

This command applicable only for ext4 filesystem and checks the
partition type before formatting it.

Change-Id: Ifa42deaa66c3cb96ff786a73c3fadad92658f395
2012-02-11 11:02:40 -08:00
Anatol Pomazau
6f53225ef9 Revert "Implement 'fastboot format' command"
This reverts commit 230d160a71
2012-02-03 18:20:02 -08:00
Anatol Pomazau
230d160a71 Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.

Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:

 - get size of partition
 - create an empty filesystem image
 - erase the partition
 - flush empty fs to the partition

This command applicable only for ext4 filesystem and checks the
partition type before formatting it.

Change-Id: I8529bc1dc64237f1f0d91312f7c0ab1a6e5d8b44
2012-02-03 16:07:18 -08:00
Anatol Pomazau
21311f87c6 Revert "Implement 'fastboot format' command"
This reverts commit 049dff53ef
2012-02-03 10:57:46 -08:00
Anatol Pomazau
65cf84f3ff Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.

Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:

 - get size of partition
 - create an empty filesystem image
 - erase the partition
 - flush empty fs to the partition

This command applicable only for ext4 filesystem and checks the
partition type before formatting it.

Change-Id: I8529bc1dc64698f1f0d91312f7c0ab1a6e5d8b44
2012-02-03 10:29:56 -08:00
Anatol Pomazau
049dff53ef Implement 'fastboot format' command
Some filesystems (e.g. ext4) require flushing an initial
fs image, right after erasing it the partition is unusable.

Doing erase,flush emptyfs is a little bit scaring so we have a
separate command that performs it as atomic step:

 - get size of partition
 - create an empty filesystem image
 - erase the partition
 - flush empty fs to the partition

This command applicable only for ext4 filesystem and checks the
partition type before formatting it.

Change-Id: I8529bc1dc64698f1f0d91312f7c0ab1a6e5d8b44
2012-01-25 13:55:39 -08:00
Wink Saville
b98762f782 Teach fastboot to allow required variables per product.
This is needed for products like xoom-cdma and xoom-cdma-lte.
The xoom-cdma-lte product requires an lte baseband binary but
it's not needed for xoom-cdma.

This is implemented by allowing an optional product parameter
to "required" statements. The parameter is separated from
"required" by a colon so the version-baseband-2 requirment in
board-info.txt for stingray becomes:

 require-for-product:xoom-cdma-lte version-baseband-2=ltedc_u_03.25.00|ltedc_u_03.19.00

In the above statement, only xoom-cdma-lte requires version-baseband-2
and the baseband can be lte_u_03.25.00 or lte_u_03.19.00. For other
products version-baseband-2 will be ignored.


Change-Id: I786bec5f5661c2243d87925b064fc6124d3cffa1
2011-04-04 17:54:59 -07:00
Jean-Baptiste Queru
69f2d3ce91 am 42b871f1: am c37ba1c9: Merge "Check fastboot oem command line length"
Merge commit '42b871f1bfc116d53d1bff9d7497415494b2e0e0'

* commit '42b871f1bfc116d53d1bff9d7497415494b2e0e0':
  Check fastboot oem command line length
2010-07-29 11:11:07 -07:00
Jean-Baptiste Queru
42b871f1bf am c37ba1c9: Merge "Check fastboot oem command line length"
Merge commit 'c37ba1c916d73fbf35c6faba1e252e2916d2d41d' into gingerbread-plus-aosp

* commit 'c37ba1c916d73fbf35c6faba1e252e2916d2d41d':
  Check fastboot oem command line length
2010-07-29 11:08:02 -07:00
Bruce Beare
50b3995d02 Check fastboot oem command line length
Change-Id: I301af09c4ec460c9049b75cc7f4d2c50cfe00ceb
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
2010-07-15 08:52:01 -07:00
Brian Swetland
587c286f98 am beb72464: am 63e5205c: fastboot: make it so I can actually see the bootloader chatter
Merge commit 'beb72464ff8c501597cd7e098090f7d131dc5ccb'

* commit 'beb72464ff8c501597cd7e098090f7d131dc5ccb':
  fastboot: make it so I can actually see the bootloader chatter
2010-07-13 17:18:39 -07:00
Brian Swetland
63e5205cd2 fastboot: make it so I can actually see the bootloader chatter
- prefix bootloader messages with (bootloader)
- remove the fancy right justified no newline business

Change-Id: Ica16ebe6a25971db423c5db06300a280d93faf3e
Signed-off-by: Brian Swetland <swetland@google.com>
2010-07-01 13:54:13 -07:00
Brian Carlstrom
eb31c0bdc0 fastboot should return non-zero exit code on error
When using fastboot in scripts, it currently is necessary to parse the
output for FAILED messages and possible other indications of
error. This happens relatively often, for example when there are radio
update issues. Fortunately, fb_execute_queue already has a notion that
an error has occured which is used to abort the queue execution.

This change makes the status value be returned from fb_execute_queue
to main which can then return it as an exit status. usage cases were
also changed to return 1.

Note the code already returned 1 for error in one other case when
there was a problem with boot, so there is a precedent for return 1 on
error in this program.

Change-Id: Ib0463b08c8f2569495e248dd84e331f7e3691039
2010-04-23 12:45:38 -07:00
Daniel Sandler
cb6e22b687 Add wall-clock timing for each fastboot Action.
(For diagnosing slow flashes.)

Change-Id: Ibbcbd080db551c8590ca8bfe50e9ddb45eea5661
2010-02-25 14:05:33 -05:00
The Android Open Source Project
dd7bc3319d auto import from //depot/cupcake/@135843 2009-03-03 19:32:55 -08:00
The Android Open Source Project
e54eebbf1a auto import from //depot/cupcake/@135843 2009-03-03 18:29:04 -08:00
The Android Open Source Project
4f6e8d7a00 Initial Contribution 2008-10-21 07:00:00 -07:00