Commit graph

427 commits

Author SHA1 Message Date
Steven Moreland
5d88aee9c1 fastboot: only require Linux modules on Linux
The following three modules aren't defined for Windows
builds:
 e2fsdroid mke2fs.conf sload_f2fs

Which leads to the following errors:
build/make/core/main.mk:586: warning: Missing required dependency host_cross_e2fsdroid from module host_cross_fastboot defined in system/core/fastboot/Android.mk
build/make/core/main.mk:586: warning: Missing required dependency host_cross_mke2fs.conf from module host_cross_fastboot defined in system/core/fastboot/Android.mk
build/make/core/main.mk:586: warning: Missing required dependency host_cross_sload_f2fs from module host_cross_fastboot defined in system/core/fastboot/Android.mk

Here, I've removed their requirement for the Windows build and
only included the requirement for the Linux build.

Bug: 7456955
Test: above errors no longer present
Change-Id: I14fdb880d868f893fa5899ea200820bd885a3bc1
2018-02-13 17:49:16 +00:00
Treehugger Robot
b6d7f2655d Merge "Fix fastboot memory corruption." 2018-01-19 22:39:14 +00:00
Elliott Hughes
aaa3b6bbf2 Fix fastboot memory corruption.
Bug: http://b/68664649
Test: echo 'ANDROID!' > fake.img ; fastboot -c `python -c "print 'A'*4000"` boot fake.img
Change-Id: I3299e0fba24a6c1f6178c994731a94cea68f7254
2018-01-18 16:50:14 -08:00
Treehugger Robot
d1f0687fe9 Merge "Add __attribute__((__format__)) to fastboot's die()." 2018-01-09 23:18:39 +00:00
Treehugger Robot
ef213b6d5b Merge "adb/fastboot: switch over to shared AdbWinApi." 2018-01-09 19:49:23 +00:00
Elliott Hughes
3d7fa22164 Add __attribute__((__format__)) to fastboot's die().
Also make the <android-base/stringprintf.h> macro less likely to collide.

Bug: N/A
Test: builds
Change-Id: I868a0a0002c9c53c1ec0670153df2af5f48fd969
2018-01-09 11:18:10 -08:00
Changrong Jin
e69917c59c fastboot: fix log print type mismatch
Test: mma -j8
Change-Id: I8b4373f4a044b802fc9f1dd4f998e880f7843b4a
2018-01-09 11:29:54 +08:00
Josh Gao
b0449da977 adb/fastboot: switch over to shared AdbWinApi.
Bug: http://b/71721338
Test: manually ran adb/fastboot on windows
Change-Id: I9fee6ea4c0e07cbeb69a48e456161832a5994e7b
2018-01-08 16:45:30 -08:00
Jaegeuk Kim
cf27dbacaf Merge "fastboot: support make_f2fs and sload_f2fs for win32" 2017-12-08 00:58:05 +00:00
Jaegeuk Kim
ec87074542 Merge changes from topic "sload_f2fs"
* changes:
  fastboot/fs_mgr/init: add sload_f2fs
  fs_mgr: format f2fs with length=xx fstab
2017-12-08 00:57:42 +00:00
Elliott Hughes
3289b9c928 Merge "Add OWNERS." 2017-12-07 23:21:26 +00:00
Elliott Hughes
693d63f9cf Add OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie785058c0f5eb9b4086c98ccba6e63e3ed411b65
2017-12-07 13:30:03 -08:00
Jaegeuk Kim
aa64620eaa fastboot: support make_f2fs and sload_f2fs for win32
This patch enalbes to use windows tools for f2fs.

Change-Id: Id9109d3d1d8db85f433a20c6a9b18a88daa540d0
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-12-06 22:40:08 -08:00
Jaegeuk Kim
899ad558cd fastboot/fs_mgr/init: add sload_f2fs
Change-Id: Iab1e4037cbb835aba97f941c8840b8971caf38e7
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-12-06 22:40:08 -08:00
Jin Qian
0c04f78286 fastboot: fix build break
execvpe is a GNU extension. Use execve instead.

Change-Id: I8bf4b6a4e9fd0cae0239f4c5aa9707f141460a7d
2017-12-05 21:39:40 -08:00
Jin Qian
03c73e106f fastboot: pass environment variables to exec_e2fs_cmd
Set MKE2FS_CONFIG to point to a config file that comes with mke2fs
binary.

Change-Id: I1d68726ff8baa0c00b930b32f66c54c298c46b81
2017-12-05 14:06:26 -08:00
Dan Willemsen
22088fd2d1 Mark more win32 parameters as unused
Missed one new instance with my last patch.

Bug: 69933068
Test: m native-host-cross
Change-Id: Ib6d0b994131a0011b3a2f1a4633b21756a9d6732
2017-11-30 23:35:42 +00:00
Dan Willemsen
f106bb6bb8 Merge "Fix / suppress new unused warnings for mingw+clang" 2017-11-30 22:31:54 +00:00
Dan Willemsen
528f144e77 Fix / suppress new unused warnings for mingw+clang
Bug: 69933068
Test: mmma system/core
Change-Id: I089166a979d3d8c5ada38a7745d507b555048499
2017-11-29 21:37:28 -08:00
Jaegeuk Kim
8d9b6ee621 fastboot: make_f2fs call by linux/darwin
Bug: 69298953
Change-Id: I6a7483e8617b649666247c4ca985384d086f15f8
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-11-15 14:22:37 -08:00
Jaegeuk Kim
d872118d88 fastboot: support f2fs format
+ quota support

This patch fixes broken f2fs_format by replacing the existing flow with calling
legacy mkfs.f2fs binary explicitly likewise ext4.

This removes obsolete ext4 stuffs as well.

Bug: 67009570
Change-Id: Ia81bcbc7adc3a8b57ada860f7f7871602ac1c6e9
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2017-11-11 18:29:02 -08:00
Elliott Hughes
23af112314 fastboot: show how long extraction takes.
Before:
  extracting android-info.txt (0 MB)...
  extracting boot.img (29 MB)...
  target reported max download size of 536870912 bytes
  archive does not contain 'boot.sig'
  archive does not contain 'boot_other.img'
  archive does not contain 'dtbo.img'
  archive does not contain 'dt.img'
  archive does not contain 'recovery.img'
  extracting system.img (1928 MB)...
  archive does not contain 'system.sig'
  extracting system_other.img (574 MB)...
  archive does not contain 'system.sig'
  archive does not contain 'vbmeta.img'

After:
  extracting android-info.txt (0 MB) to RAM...
  extracting boot.img (29 MB) to disk... took 0.232s
  target reported max download size of 536870912 bytes
  archive does not contain 'boot.sig'
  archive does not contain 'boot_other.img'
  archive does not contain 'dtbo.img'
  archive does not contain 'dt.img'
  archive does not contain 'recovery.img'
  extracting system.img (1928 MB) to disk... took 10.122s
  archive does not contain 'system.sig'
  extracting system_other.img (574 MB) to disk... took 3.424s
  archive does not contain 'system.sig'
  archive does not contain 'vbmeta.img'

Bug: http://b/69128980
Test: ran manually
Change-Id: Ib190d1cc56ad9da06a4f9a9e822f7dad4a9a53b7
2017-11-10 08:43:16 -08:00
Connor O'Brien
ebcfa44937 Merge "fastboot: handle small flash block sizes correctly" 2017-11-03 21:15:34 +00:00
Jin Qian
525205508f Merge "fastboot: remove reference of deprecated make_ext4 code" 2017-11-03 17:28:26 +00:00
Tao Bao
67212f9083 fastboot: Don't give parsing error for unsupported 'getvar erase-block-size'.
Couldn't parse erase-block-size '0x'.
Couldn't parse logical-block-size '0x'.
mke2fs 1.43.3 (04-Sep-2016)
...

Some bootloaders explicitly return error on failed query (e.g. walleye),
while others return empty message (e.g. bullhead). We should just return
zero for empty message, instead of giving a misleading parsing error.

Test: `fastboot format userdata` on bullhead, with no parsing error.
Test: `fastboot format userdata` on walleye still works.
Change-Id: I194d41d24679929eccc65bfe895d6ab2a26315b7
2017-11-02 15:53:12 -07:00
Jin Qian
988a51a9fe fastboot: remove reference of deprecated make_ext4 code
Bug: 64395169
Change-Id: Ida14996dc1488657e7bdeb34d6e767a8f6ed44ed
2017-11-02 15:13:46 -07:00
Connor O'Brien
6ef5c24b84 fastboot: handle small flash block sizes correctly
Erase block sizes smaller than the ext4 block size may be valid, but
can incorrectly result in a stripe width smaller than the stride
size. Instead of reporting these sizes as invalid, add a check to
enforce that raid_stripe_width >= raid_stride.

Bug: 68770797
Test: Hack fb_getvar to report small erase block size, run fastboot
-w and confirm it does not print a warning or set stripe_width smaller
than stride.
Signed-off-by: Connor O'Brien <connoro@google.com>

Change-Id: I689ce4bdd5b38bd0952bb6de54785cca39176010
2017-11-02 12:51:46 -07:00
Elliott Hughes
4089d34b93 fastboot should fail if it runs out of space while unzipping.
Previously fastboot would carry on regardless if decompression failed:

  fastboot: archive does not contain 'vbmeta.img'
  fastboot: extracting vendor.img (260 MB)...
  fastboot: W/ziparchive(56777): Zip: unable to allocate  272781472 bytes at offset 0 : No space left on device
  fastboot: failed to extract 'vendor.img': I/O error
  fastboot: archive does not contain 'vendor_other.img'
  fastboot: wiping userdata...

This is because all but "boot" and "system" are considered "optional",
and the implementation of "optional" was "ignore any failures". What it
_should_ have meant was "it's okay if these don't exist, but if they do,
failures matter".

Fix this logic, use die() more aggressively, and remove spurious "\n"s
from die() format strings.

Also fix spurious whitespace in the libziparchive format string. Before:

  Zip: unable to allocate  272781472 bytes at offset 0 : No space left on device

After:

  Zip: unable to allocate 272781472 bytes at offset 0: No space left on device

Bug: http://b/68383022
Test: `fastboot update` on marlin
Change-Id: I3cbf55f1a33ca125f293f873eafbcfb86c880ba8
2017-10-27 14:21:12 -07:00
Jin Qian
1e0df16e20 fastboot: bail out if failed to generate fs image
we don't want to continue fastboot process if failed to
generate fs image. Print an error message and exit early.

Bug: 64915319
Change-Id: I5506d2a7a5063c188685633d6c3890239f9d658e
2017-08-23 13:43:15 -07:00
Josh Gao
f806a3c303 fastboot: gracefully handle failure to open a USB device on OS X.
High Sierra restricts opening some USB devices (e.g. the touchbar)
to processes that have specific entitlements. Ignore devices that we
can't open.

Bug: http://b/64292422
Test: manual
Change-Id: I6074b53a365b8d936610bafea60244f8bba1a33f
2017-08-18 18:25:44 -07:00
David Zeuthen
b6ea435a20 fastboot: Add --disable-verity and --disable-verification options.
This can be used to disable verity and/or verification when flashing a
build to a device. It works with both 'fastboot flashall' and
'fastboot flash vbmeta /path/to/vbmeta.img'.

Bug: 62903976
Test: Manually tested.
Change-Id: Iad22d42a9dd5befd70ecd0224803721a10a28d90
2017-08-07 16:52:55 -04:00
Jin Qian
29fc859a6d fastboot: call mke2fs to format ext4 filesystem on windows
Bug: 35219933
Change-Id: I0cc8c165176e8dc9cbe4b6a52679937bc872e2d0
2017-08-01 00:19:56 +00:00
Jin Qian
99e3964e0d fastboot: enable uninit_bg for ext4
This speeds up mke2fs as well as e2fsck.

Bug: 23686092
Bug: 64032335
Change-Id: I9f2d4c15e431647bb845d50a2361b2a9a091fba6
2017-07-31 23:57:39 +00:00
Jin Qian
3fdf5eca70 fastboot: add mke2fs and e2fsdroid to build package
Bug: 23686092
Bug: 63849632
Change-Id: Iff0d92b7174597d43ee646847888aedc2080052a
(cherry picked from commit 6ce78321a2)
2017-07-21 12:00:16 -07:00
Jin Qian
4afba66781 fastboot: call mke2fs tools to generate ext4 image
Set MKE2FS_CONFIG to empty to use mke2fs default configs

Test: fastboot --wipe-and-use-fbe
Bug: 35219933
Change-Id: Ibc97bb125899e1f1fe820d53709fdb2ab291c171
(cherry picked from commit d14d7c14cb)
2017-07-21 12:00:16 -07:00
Jin Qian
4a335829da fastboot: use filename instead of fd to generate filesystem image
mke2fs tool takes a filename and has its own open function to handle
output file. Change fastboot in preparation to switch from make_ext4
to mke2fs.

Test: fastboot format:ext4 userdata
Bug: 35219933
Change-Id: I7a31cb215f443a4a7cb0bfc23ec28c121a6101e6
2017-05-31 21:23:12 +00:00
Elliott Hughes
1eec97af07 Fix "fastboot flashing".
...without breaking "fastboot oem". Turns out the bootloader actually needs
to know whether it's getting a "flashing" or "oem" command.

Bug: http://b/38321935
Test: "fastboot flashing unlock" "fastboot oem uart enable"
Change-Id: I2b3c0b42b01e3c884aa794fa273034a366985089
2017-05-15 16:53:53 -07:00
Dmitry Shmidt
de8c08c612 fastboot: Add DTS partition support for 'flashall' command
Hikey960 has DTS partiton for DT image

Test: Manual
Bug: 38310807

Change-Id: I9f8e9b27ed40ebdd225f3c4e4b30f53e7cdb5ee7
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-05-15 10:25:31 -07:00
Elliott Hughes
29d5d7d718 Fix "fastboot oem".
Broken by d6365a7052.

Bug: https://issuetracker.google.com/38216236
Test: "fastboot oem uart enable"
Change-Id: I672d5b96bb16fd77e7af61115b8a38606c691ea8
2017-05-11 15:05:13 -07:00
SzuWei Lin
b3526e1ee8 Fix build error when (ADB|FASTBOOT)_VERSION has space
Test: make, and build pass
Change-Id: I8fc608a5b8bccb43b8af72978ce16a945147f62d
2017-05-10 18:52:02 +08:00
Treehugger Robot
6f4d47438d Merge "Show the "platform tools" version in adb/fastboot --version." 2017-05-10 01:41:41 +00:00
Elliott Hughes
4d4f64ff94 Show the "platform tools" version in adb/fastboot --version.
Annoyingly folks parse the "adb --version" output so we have the
less-interesting protocol version first. But at least now we'll
have the "real" version somewhere...

Bug: N/A
Test: "adb --version"/"fastboot --version"
Change-Id: Ia85b561bd8d84c6fd6995923730d36f53b2f800b
2017-05-09 08:21:54 -07:00
Elliott Hughes
d6365a7052 Make fastboot command-line parsing a bit more like adb.
Only show all the help if asked to, and have a few more descriptive
syntax errors.

Also show the help on stdout rather than stderr.

Bug: N/A
Test: manually ran "fastboot flash"/"fastboot update"/"fastboot flashall"
Change-Id: I59abd60e58a56fe7e44da5116a702087c36e14ce
2017-05-09 08:16:23 -07:00
Elliott Hughes
2708a953d2 Give slightly less useless versions to adb and fastboot.
This will let us see (a) whether the user has a legit build or something they
built themselves and (b) what Android release it corresponds to.

This isn't as useful as showing what Platform Tools release we correspond to,
but I'm planning on doing that as a separate line.

Bug: N/A
Test: adb --version ; fastboot --version
Change-Id: Idca489295e3c6f8571146f95822c08808e36b382
2017-05-05 16:29:19 -07:00
Elliott Hughes
bdbcdf3a16 Merge "Clean up the partition name mapping in fastboot." 2017-05-05 00:04:45 +00:00
Elliott Hughes
45964a8e90 Clean up the partition name mapping in fastboot.
Also remove -p.

Bug: N/A
Test: builds
Change-Id: Iea55affc7262323c0d341003359d3175580efbfd
2017-05-03 22:45:37 -07:00
Elliott Hughes
92433d8af0 Remove bogus _LARGEFILE_SOURCE.
Bug: N/A
Test: builds
Change-Id: I145a521a58dc8f838ce188540b02bcda4e81b610
2017-05-03 22:21:16 -07:00
Yueyao Zhu
e67da71dc1 Add dtbo image support for device tree overlay
Test: Used the built fastboot tool to run flashall on a device
Bug: 32969430
Bug: 36813951
Change-Id: If2db3055bb7250a57d9a78b0534df491b68b6224
2017-05-03 14:36:43 -07:00
Treehugger Robot
9349b72a67 Merge changes I5b1a1ce0,I483a18f9
* changes:
  fastboot: Add 'get_staged' command
  fastboot: Add 'stage' command
2017-04-28 18:34:08 +00:00
Jocelyn Bohr
91fefadc2e fastboot: Add 'get_staged' command
(cherry-picked from internal nyc-iot-dev to AOSP)

New user-level command usage:

 * fastboot get_staged <outfile>
   Reads staged data from the last command handled by the device. If the
   last command did not result in staged data, this command will fail.

This enables data staged by OEM commands to be transferred from device
to host. get_staged wraps new device command "upload". Fastboot
clients are not required to support "upload", so get_staged won't
work on all devices.

Bug: 36002804
Test: Implemented "upload" in fastboot on imx6ul. Verified that uploading
      ~100K data from the device works.
Change-Id: I5b1a1ce023f362062505ee62746ea8ab6f36bfbf
(cherry-picked from commit 83a875de994bf48f0faa2a8a23ceb0b8f52b6b04)
2017-04-27 16:47:51 -07:00