Commit graph

666 commits

Author SHA1 Message Date
Dan Willemsen
ab971b5e7e Convert fastboot to Soong
Also fix adb's version number to match.

See build/soong/README.md for more information.

Test: cd system/core/fastboot; mma
Test: fastboot --version
Test: adb --version
Test: out/host/linux-x86/nativetest/fastboot_test/fastboot_test
Test: out/host/linux-x86/nativetest64/fastboot_test/fastboot_test
Change-Id: I65ea39af9183c602e84f3bc0e4a0d066a30fc464
2018-08-30 11:28:18 -07:00
David Anderson
cf444f3633 fastboot: Use a single codepath for flashall and update.
This patch extracts the common logic out of the flashall and update
command implementations. There is now a FlashAllTool helper class, and
an ImageSource class for commands to specify how to find built images.

With these paths merged, the update command now supports logical
partitions.

Bug: 78793464
Test: flashall works with or without a super partition
      update works with or without a super partition

Change-Id: I63a8690bbc4da6ea98a07eb2c07166ddd993a7b7
2018-08-29 15:58:34 -07:00
Tom Cherry
e51dadb8a7 fastboot: remove 'verify'
This isn't sent by the fastboot client.
This isn't in our bootloader requirement document.
Neither my hikey nor sailfish respond to this.

Test: fastboot still works
Change-Id: I11ff0aed818d98f3427ed427605d99b3c76ccb06
2018-08-29 15:29:20 -07:00
Tom Cherry
566751444d fastboot: remove 'powerdown'
This isn't sent by the fastboot client.
This isn't in our bootloader requirement document.
Neither my hikey nor sailfish respond to this.
The README.md literally uses this as an example for 'unknown command'

Test: fastboot still works.
Change-Id: Ia442a41de517dae078dd7e73c951aadb97646c73
2018-08-29 14:10:47 -07:00
David Anderson
0debda098f fastboot: Clean up the image array a bit.
This makes the following changes to the images array:
 * The "optional_if_no_partition" flag is removed, as it was a temporary
   workaround for super.img.
 * The "flashall" flag is removed.
 * The "needed_for_fastbootd" flag is now an ImageType enum.

Bug: N/A
Test: fastboot builds, flashall works
Change-Id: Id000ea20cf83639cec2c9ae94f28c799b34606f1
2018-08-28 15:17:48 -07:00
David Anderson
95d4093b49 fastboot: Flash boot partitions before rebooting to fastbootd.
Userspace fastboot is required when flashing logical partitions. If for
some reason userspace fastboot is broken, the user may be stuck with
bootloader fastboot. To address this scenario, we now flash "boot",
"vbmeta", "recovery", "dtbo", and "dts" before booting into userspace
fastboot, using whatever fastboot is currently active.

Bug: 78793464
Test: fastboot flashall with device in bootloader fastboot
Change-Id: I773707bbbe9235c560416c70976e32fd8e52a5a3
2018-08-28 12:54:01 -07:00
David Anderson
1d887434da fastboot: Automatically reboot to userspace fastboot.
In order to flash logical partitions, "flashall" must be run against
userspace fastboot. When the bootloader supports the "reboot-fastboot"
command, we now attempt to automatically reboot into userspace fastboot.

We do this by closing the transport, sleeping for one second, and then
polling for a new connection until one is available. FastBootDriver is
then assigned the new transport.

Bug: 78793464
Test: fastboot flashall on device with logical partitions, while booted
      into bootloader fastboot

Change-Id: I6949871b93ab5e352784cabe0963c6ecfc0af36d
2018-08-28 09:07:40 -07:00
Mark Salyzyn
8fb0fb86a7 fastboot: allow automatic detection of super location
Add "super" to the table of known images so that automatic file
resolution can occur.  Add a flag to indicate if the image should
be flashed with flashall and set it to false for the new "super"
image, all else true.

Test: 'fastboot flash super' works.
      'fastboot flashall' does not flash super
Bug: 78793464
Change-Id: I5b85536b1d4890264531af357aba84a061d6df44
2018-08-24 15:24:41 -07:00
Treehugger Robot
07c2c9a58d Merge "Added support to fuzzy_fastboot for more sparse tests" 2018-08-24 17:54:24 +00:00
Aaron Wisner
ab2645514d Added support to fuzzy_fastboot for more sparse tests
Test: Pixel 2
Change-Id: Ibd491336ace4f346c3900a61bca30ac3023e4f21
2018-08-24 16:22:54 +00:00
Aaron Wisner
a5ad20aecc Fix mac build breakage due to missing usb_osx.cpp in
Android.cpp file for libfastboot2

https://android-review.googlesource.com/c/platform/system/core/+/722153

Test: Build on osx
Change-Id: I6151e37581ac332e4d5cfb5e40feb3ea0e3093df
2018-08-24 10:53:04 -05:00
Treehugger Robot
5d3edb1422 Merge changes from topic "fastbootd-flashall"
* changes:
  fastbootd: Support flashall with logical partitions.
  fastboot: Use _WIN32 instead of WIN32.
2018-08-23 18:55:42 +00:00
David Anderson
32e376f848 fastbootd: Support flashall with logical partitions.
Currently, fastboot flashall will try to flash every partition in the
image list. For devices with logical partitions, this will cause those
partitions to be flashed twice (once via super.img, and again for each
individual image). Additionally, super.img is needed to synchronize the
logical partition list, but it is only generated with "make dist",
making it inconvenient for most workflows.

This patch removes automatic flashing of super.img. Instead, devices
with a super partition must now generate a "super_empty.img"
describing the super geometry and logical partition layout. Before
flashing any other partitions, this image is used to ensure the device
has created all necessary logical partitions.

Additionally, before flashing (but after updating super), all logical
partitions that will be flashed are resized to 0. This ensures that
logical partitions will receive more optimal space allocation.

Finally, during flashing of individual images, logical partitions are
resized to the image size, since they do not have hardcoded sizes in the
build.

Bug: 78793464
Test: fastboot flashall can flash vendor, product, product_services
      without a make dist/super.img.

Change-Id: I18c2291e0d0cb10de729c5646b75ac84dde8c871
2018-08-23 10:43:46 -07:00
David Anderson
c3ade7f48a fastboot: Use _WIN32 instead of WIN32.
Bug: N/A
Test: fastboot.exe builds
Change-Id: I316611f581c80ec813b953a7e6074293399ab7d7
2018-08-23 10:42:59 -07:00
Treehugger Robot
e41cb2e767 Merge "fastbootd: Add an update-super command to sync the super partition." 2018-08-23 00:54:26 +00:00
Treehugger Robot
9dc6f90cb8 Merge "adbd: use unique_fd for the usb file descriptors." 2018-08-23 00:45:03 +00:00
Treehugger Robot
e37c5ca4dd Merge "Create fuzzy-fastboot pen tester" 2018-08-23 00:42:54 +00:00
Josh Gao
860cc5ae39 adbd: use unique_fd for the usb file descriptors.
Test: adb shell
Change-Id: I8b5e31377bbda9b02e522e3a4b75ac908197912f
2018-08-22 15:33:08 -07:00
David Anderson
38b3c7a122 fastbootd: Add an update-super command to sync the super partition.
This change introduces an "update-super" command to the fastboot
protocol. Unlike the "flash" command, which copies raw or sparse data to
a partition, the "update-super" command requires the data to be a super
image generated by lpmake.

If the super partition is not yet formatted (or is corrupt), then it
will be formatted using the given image. Otherwise, "update-super" will
preserve the existing partition layout, and only ensure that logical
partition entries exist for all the new partitions in the given image.
All new partitions added this way will have a zero size, and it is the
host's responsibility to size them as needed afterwards with the
"resize-logical-partition" command.

In addition, the "update-super" command supports a "wipe" argument,
which will force the super partition to be reformatted with the given
image, overwriting any existing partition tables.

Bug: 78793464
Test: fastboot flashall with a super partition
Change-Id: If37d839a03e396e11b6c08a9c32984106613d1dc
2018-08-22 15:05:03 -07:00
Chris Fries
1572771495 Merge "Add support to fastboot_driver for sending sparse images with CRC check" 2018-08-22 18:39:16 +00:00
Aaron Wisner
00737b3939 Create fuzzy-fastboot pen tester
Test: Run on Sailfish, Walleye, and other devices
Bug: http://b/111126621
Change-Id: I309af79411d0a16d11874a048ce0db024770d7b2
2018-08-22 11:30:29 -05:00
Aaron Wisner
9812b58fc4 Add support to fastboot_driver for sending sparse images with CRC check
The default argument will prevent anything from breaking

Test: Build on glinux
Change-Id: Ib427ab210476db1ec1c69c0a3238d0653e98b79a
2018-08-22 11:02:47 -05:00
Dario Freni
ab5583b585 s/product-services/product_services/g
Attempting to reduce the number of different spellings we have for
"product services" partition in the codebase.

Bug: 112431447
Test: m
Change-Id: I1a87d7e040a8b1f91f973ac7d90d6360b5b54f71
Merged-In: I1a87d7e040a8b1f91f973ac7d90d6360b5b54f71
2018-08-20 17:46:42 +00:00
David Anderson
79ab0e3e98 fastbootd: Complete the implementation of getvar has-slot.
Bug: 78793464
Test: fastboot getvar has-slot:super returns "no"
Change-Id: I80f171df062c008718b810bbe12070834d4aa3fb
2018-08-14 16:24:07 -07:00
David Anderson
3195e6edc3 Allow C++17 in fastboot.
Bug: N/A
Test: fastboot builds
Change-Id: Ife120dbe4f45e8aa83225978ea9d5e88bbb58b9e
2018-08-13 13:18:02 -07:00
Chris Fries
3b984c7efe Merge "Increase fastboot timeout to 30 seconds" 2018-08-13 14:58:34 +00:00
Aaron Wisner
50acca7226 Increase fastboot timeout to 30 seconds
Some OEM commands can take quite a while.
The current 10 second timeout is too small.

Test: fastboot tool
Change-Id: Icf59615919c92dc85807abe3ec5793504cf7a162
2018-08-10 17:44:28 -05:00
David Anderson
d9ba061e77 fastbootd: Add is-userspace variable.
Bug: 78793464
Test: fastboot getvar is-userspace
          returns true for fastbootd
      fastboot getvar is-userspace
          returns false or error for bootloader fastboot.

Change-Id: I80e1ef6dcf3922e4f555cb2e409e3e098c16fbbc
2018-08-09 15:06:53 -07:00
David Anderson
0d4277d7b3 fastbootd: Add commands for logical partitions.
This patch adds the following new commands to fastbootd:

    getvar is_logical:<partition>
    create-logical-logical-partition <partition> <size>
    delete-logical-partition <partition>
    resize-logicallogical-partition <partition> <size>

All of these commands operate on logical partitions only, and require a
properly configured "super" partition to operate.

Bug: 78793464
Test: fastboot create-logical-partition example 4096
      fastboot create-logical-partition example 4096 returns error
      fastboot getvar is-logical:example returns "yes"
      fastboot getvar partition-size:example returns "1000"
      fastboot resize-logicalpartition example 8000
      fastboot getvar partition-size:example returns "2000"
      fastboot delete-logical-partition example
      fastboot getvar is-logical:example returns error
      fastboot getvar is-logical:system_a returns "no"

Change-Id: Iff323eabcf5c559fa04c7c92574650b01803eb1f
2018-08-09 15:06:52 -07:00
David Anderson
88ef0b1f25 fastbootd: Add support for flashing logical partitions.
When flashing logical partitions, we read the "super" partition metadata
corresponding to the current slot. We then temporarily create a
device-mapper device for that partition, and immediately destroy the
device after all operations are complete. We do not mount partitions
ahead of time, or keep them mounted, because a fastboot operation may
change the layout of the logical partition table (or change which slot
is current).

Bug: 78793464
Test: fastboot flash a logical partition under "super"
Change-Id: Id2a61d3592decabeebfd283c4fd6e6cbe576a18c
2018-08-09 11:15:23 -07:00
David Anderson
12211d163e fastbootd: Enable erase and flash commands for physical partitions.
Bug: 78793464
Test: adb reboot fastboot && fastboot flashall

Change-Id: Ibe802c36f6efe20111a2315616ef34d3a027950f
2018-08-09 09:58:37 -07:00
Tao Bao
075c351af2 Merge "fastboot: fastbootd uses libadbd.so." 2018-08-09 16:31:29 +00:00
David Anderson
856b7ecbb6 fastbootd: Allow returning errors from getvar handlers.
Currently a few getvar handlers will return invalid strings when an
error occurs. This change allows those handlers to instead send a proper
failure message.

Bug: 78793464
Test: N/A
Change-Id: I7ff7d036c1e6fb0a3d700ecf21b1103ab77278d2
2018-08-08 18:24:09 -07:00
Tao Bao
b71eedf912 fastboot: fastbootd uses libadbd.so.
The size of `fastbootd` goes down from 64088-byte to 38488-byte
(aosp_taimen-userdebug) after the change.

Bug: 78793464
Test: `m -j installclean && m -j fastbootd`. Check that
      $OUT/recovery/root/system/lib64/libadbd.so exists and
      $OUT/recovery/root/system/bin/fastbootd depends on that.
Change-Id: Ic36c98da1a0dda4e0d86e671f858c42578f53f90
2018-08-08 15:54:48 -07:00
Hridya Valsaraju
31d2c26409 fastbootd: Implement the getvar command.
This implements basic "fastboot getvar" support, including commands supported
by IBootControl.

Bug: 78793464
Test: fastboot getvar <fastboot variable>

Change-Id: Iee1a7b3f43dea46f80dcdf73c45034e2ffe4727d
2018-08-08 11:41:53 -07:00
Treehugger Robot
6b0ecdab15 Merge "fastboot: Fix product-services typo" 2018-08-07 18:24:10 +00:00
David Anderson
8cdea7ff0c fastboot: Fix product-services typo
The build system generates a partition name of "product_services" for
the product-services partition, so fastboot's image list must reflect
this.

Bug: 78793464
Test: fastboot flash product_services works with fastbootd
Change-Id: I348f970c9584fd3dd4369e8cded66b6e39eee2b2
2018-08-07 09:29:11 -07:00
Xin Li
fb973d34ac Merge Android Pie into master
Bug: 112104996
Change-Id: Ib0e5b2801a931b469b753806b1fbe2fabb0c1de5
2018-08-06 17:26:31 -07:00
Treehugger Robot
c4630ef445 Merge "Allow existance of partition to be checked before flashall or update" 2018-08-07 00:20:46 +00:00
Treehugger Robot
c30a75a007 Merge "Add fastbootd." 2018-08-07 00:08:18 +00:00
Hridya Valsaraju
f1f0a9c8a5 Allow existance of partition to be checked before flashall or update
Bug: 112108453
Test: fastboot flashall with super.img and product-services.img in $OUT,
fastboot update with super.img and product-services.img in image.zip.

Change-Id: I5718b5e60c546c55af74292895b3f7fe169e4f02
2018-08-06 11:05:37 -07:00
Aaron Wisner
794fb0107b Merge "Minor fixes to fastboot_driver"
am: 8cf510ff81

Change-Id: I358512c168fbe19c164bb201cf57accdb613f1a3
2018-08-02 17:49:30 -07:00
Treehugger Robot
8cf510ff81 Merge "Minor fixes to fastboot_driver" 2018-08-03 00:41:16 +00:00
Aaron Wisner
c771ae0fd4 Minor fixes to fastboot_driver
- Make RCString() static
- Add clearer error message for 0 length upload error
- Fix regex hex matching for partition-size
- Move ZLP packet checking to SparseWriteCallback()

Test: build fastboot on glinux
Change-Id: I51a040e07b9698a41f64b35a9e2baa8d575527a9
2018-08-02 17:47:38 -05:00
Hridya Valsaraju
dea91b4b53 Add fastbootd.
Fastbootd is started by recovery, and communicates
over usb with the fastboot protocol.

Add additional fastboot commands to move in and out of
fastbootd. "fastboot reboot recovery" and "fastboot reboot fastboot"

Bug: 78793464
Test: fastboot reboot recovery, fastboot reboot fastboot
Change-Id: Iffb77b2d3ceefb7335c38aa9fba7bd17821484f0
2018-08-02 09:43:23 -07:00
Hridya Valsaraju
cb10dca496 Merge "Flash super partition with fastboot flashall"
am: 10601fd512

Change-Id: Ibd1b1ba6ccd16ff82c7c050fb6bdf0121e851268
2018-08-01 13:57:11 -07:00
Treehugger Robot
10601fd512 Merge "Flash super partition with fastboot flashall" 2018-08-01 20:47:53 +00:00
Hridya Valsaraju
94943ee331 Flash super partition with fastboot flashall
Bug: 111763923
Test: fastboot flashall
Change-Id: I9b89825bac00d1237972a61715da05f933ac35ce
2018-08-01 18:30:36 +00:00
Dario Freni
586282a771 Merge "Add product-services.img for fastboot flashall."
am: 8b8d7d67f2

Change-Id: I698a75c06e6041ddf403aba2ae5e894308bce2c3
2018-07-31 19:15:00 -07:00
Treehugger Robot
8b8d7d67f2 Merge "Add product-services.img for fastboot flashall." 2018-08-01 02:00:40 +00:00
Dario Freni
c7ea1afe90 Add product-services.img for fastboot flashall.
This CL is largely and adaptation of
Ifd119650dd3316508870df0dfc770099e95ae1d1

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I204a831e052d018018ab124d70ad1ff1610ee007
2018-08-01 00:08:52 +01:00
David Anderson
64465fde9f Merge "fastboot: Fix hang when sparse images end in small chunks."
am: d0d7d0a6b9

Change-Id: Ia98cc2ed8f09ad99aa8d00ba7edb16553827556c
2018-07-30 16:50:32 -07:00
David Anderson
0c7bde8de6 fastboot: Fix hang when sparse images end in small chunks.
When host fastboot sends sparse blocks to the device, it tries to only
send blocks in multiples of 1024 bytes. If a block is not aligned to this
size, the excess bytes are prepended to the next write operation. This
is implemented by doing the write in two steps: first the previous
excess from the last write (plus new data up to alignment), then a
second write for the aligned remainder of the new data.

This logic has a bug if the final block plus the previous excess data
contains >= 1024 but < 2048 bytes. In this case the first write will
drain 1024 bytes from the data, and the second write will not have 1024
bytes to write. Instead of retaining this data for the next write, it
tries to write 0 chunks (and thus 0 bytes), which hangs the ioctl() call.

Bug: N/A
Test: "fastboot flash super super.img" where super.img is generated by
      lpmake, containing system and product_services partitions and
      images.

Change-Id: I9e8523c976ec84d5a57b36a28f4b1ca800edb7e7
2018-07-30 14:48:13 -07:00
Chris Fries
c6e9a94ed0 Merge "Add support for fastboot transport timeouts and USB Reset() on linux"
am: d6f97d67e0

Change-Id: I3da3a3a9679c375572de0a35e40a86f9476918fa
2018-07-26 13:05:34 -07:00
Aaron Wisner
acf78d462f Add support for fastboot transport timeouts and USB Reset() on linux
USB Reset() allows simulating unplugging and replugging device.

Test: build and run fastboot on mac 10.13.3
Test: glinux build and run fastboot
Change-Id: Id924d063e549a4cca9dda03afd8f8fe266f6d2ab
2018-07-26 11:19:44 -05:00
Tobias Thierer
c526c79b37 Merge "Revert "Add derived UsbTransport class with USB reset method""
am: f6ee8fe515

Change-Id: Ia50999004b5505566051e3927daa646a2024687b
2018-07-25 08:34:14 -07:00
Tobias Thierer
f6ee8fe515 Merge "Revert "Add derived UsbTransport class with USB reset method"" 2018-07-25 15:24:54 +00:00
Tobias Thierer
ec1542f22d Revert "Add derived UsbTransport class with USB reset method"
This reverts commit ceb7cbf5fd.

Reason for revert: Broke mac builds:
system/core/fastboot/usb_osx.cpp:513:35: error: use of undeclared identifier 'USB_TRANSACTION_TIMEOUT'
USB_TRANSACTION_TIMEOUT, USB_TRANSACTION_TIMEOUT);
^

Change-Id: Ibe2f9ff2d5c63f9d33f4bd6d9ba962604cf8caeb
2018-07-25 10:41:24 +00:00
Chris Fries
34bdf4e824 Merge "Add derived UsbTransport class with USB reset method"
am: 56795ac483

Change-Id: I0203e059f415ee63600a7f55c42107c21569d96e
2018-07-24 12:41:55 -07:00
Chris Fries
56795ac483 Merge "Add derived UsbTransport class with USB reset method" 2018-07-24 19:30:02 +00:00
Aaron Wisner
ceb7cbf5fd Add derived UsbTransport class with USB reset method
For testing there needs to be a way to simulate unplugging and
replugging a device. This change adds support for a USB reset
method that does this.

Also add timeouts, so USB reads/writes don't block forever
on an unresponsive device.

Test: glinux, fastboot tool still works
Test: Reset confirmed working via wireshark Linux URB captures

Change-Id: I7213a2395d4ef1c0238810e4929ab966e78c8b55
2018-07-24 11:24:15 -05:00
Elliott Hughes
99fea016f4 Merge "fastboot: add tomcherry to OWNERS."
am: b13c49b1b0

Change-Id: I72b43f9e162a3e10fc92b9d5c7be8534ba3dfbdd
2018-07-20 17:11:09 -07:00
Treehugger Robot
b13c49b1b0 Merge "fastboot: add tomcherry to OWNERS." 2018-07-20 22:16:42 +00:00
Chris Fries
40cd9e03c9 Merge "Refactor libfastboot"
am: 767506fc5a

Change-Id: I1e20f30872969dd847fe67a23ebc5975dcb743e7
2018-07-20 14:06:46 -07:00
Chris Fries
767506fc5a Merge "Refactor libfastboot" 2018-07-20 20:52:58 +00:00
Elliott Hughes
4239aa7b75 fastboot: add tomcherry to OWNERS.
Bug: N/A
Test: N/A
Change-Id: Ie2a367b7fbf1dd5319a3506d09951d571512f438
2018-07-20 13:20:09 -07:00
Josh Gao
6a928587f8 Merge "fastboot: fix USB_TRACE, make it better."
am: a570644b7d

Change-Id: I1d88e012d14af45e5a7332a1f3f675132c1f8ed4
2018-07-20 13:10:13 -07:00
Treehugger Robot
a570644b7d Merge "fastboot: fix USB_TRACE, make it better." 2018-07-20 20:01:05 +00:00
Jim Tang
a3024ba1fa Merge "Adb and fastboot completion supports zsh users."
am: 74be24d696

Change-Id: I9cc9fdfe875479eb1f6aa2fce7b896fd9d656630
2018-07-20 03:36:23 -07:00
Aaron Wisner
db511207ed Refactor libfastboot
This change creates a nice and clean API for issuing
fastboot commands without using the fastboot tool itself.

Test: fastboot tool itself (now using libfastboot2)
on sailfish, walleye, and other devices.
Test: flash bootloader bootloader.img
Test: flash radio radio.img
Test: -w update img.zip
Test: Manually getvar and reboot commands.

Bug: 111126621
Change-Id: I0022536b204ce0c5ad8329367fd522fa3c57877d
2018-07-19 15:16:47 -05:00
Jim Tang
0bd3432c5b Adb and fastboot completion supports zsh users.
Builtin command "type" in zsh doesn't support -t option and this
is resolved by checking the shell type prior to sourcing them.
Instead of using "type -t" explicitly, check_type() knows the the
type of the current shell and behaves accordingly.

Bug: 110629292
Test: (zsh) source build/envsetup.sh && lunch aosp_arm
      (bash) source build/envsetup.sh && lunch aosp_arm

Change-Id: Ie39e130e9cc87135cfd522abedba11ad5ac25261
2018-07-17 14:19:35 +08:00
Jerry Zhang
8666830fb1 Merge "fastboot: Refactor string constants to constants.h"
am: fcc16c53e1

Change-Id: I97770eed7cb35989fac6bc51dfb5ec1c33e3872a
2018-07-16 17:16:43 -07:00
Jerry Zhang
769a9c1d11 fastboot: Refactor string constants to constants.h
This allows them to be shared between host and device
implementations.

Test: fastboot works
Bug: 78793464
Change-Id: I79271687850ade2a904fd03d6a97dad1a9ab8e1c
2018-07-16 14:18:41 -07:00
Elliott Hughes
1f40b2c171 Merge "Simplify __attribute__((__printf__)) use."
am: 2aa50ff56d

Change-Id: Idbbad879ce10878aef55c4ead9ecaee40a4c1a71
2018-06-26 17:17:48 -07:00
Elliott Hughes
d8a4c60276 Simplify __attribute__((__printf__)) use.
We don't need this now everyone's using clang...

Bug: http://b/69933068
Test: ran tests
Change-Id: I88f0cf03981ade47e210387fd6f3a2706dfeb9b8
2018-06-26 13:07:21 -07:00
Pirama Arumuga Nainar
057fb5bede Merge changes from topic "mingw-clang"
am: b8f4fe4fd4

Change-Id: Ic3fff5a3f8801d9df3b6304cec9b055d6d582949
2018-06-26 12:57:37 -07:00
Pirama Arumuga Nainar
a2df1ef441 Do not customize __format__ for Windows/MinGW to gnu_printf
Bug: http://b/69933090
Bug: http://b/69933068

MinGW uses gnu_printf to force C99 printf analysis with GCC, but clang
does not support gnu_printf.  So just use the default that's used for
other platforms.  This also mirrors upstream commit
015e637b4b/.

Test: m native-host-cross with Clang.
Change-Id: I3deb266d70e25296c4ae1d58637afbabc3d949c1
2018-06-25 11:52:54 -07:00
Josh Gao
f22e953272 fastboot: fix USB_TRACE, make it better.
Fix some bit-rotten instances of printf("%d", size_t), add more
logging for device selection.

Test: fastboot.exe devices
Change-Id: I4683fab8f88805e1ac88e193a1e84821be8bfa4c
2018-06-01 13:05:49 -07:00
Elliott Hughes
7337fd1802 Merge "Clarify 'fastboot flash' help." am: f90137da60
am: 06d71a71fa

Change-Id: I2ebcb2e389abe78329f457b68b23ae4af6e2622f
2018-05-24 22:29:15 -07:00
Elliott Hughes
07fc6828a8 Clarify 'fastboot flash' help.
Bug: http://b/80206492
Test: `fastboot --help`
Change-Id: Idd4305628836eb0bcbcf3d217db0a9fc54a1d6d6
2018-05-24 18:30:58 -07:00
Elliott Hughes
db4c182063 Merge "fastboot: better temporary file errors." am: 9971005cd3
am: 301b6b39c8

Change-Id: I34e9ad732b605bda7239e6f9940ba996c0fbb62c
2018-05-22 11:12:46 -07:00
Elliott Hughes
da1dbd6e6a fastboot: better temporary file errors.
Bug: http://b/80082652
Test: N/A
Change-Id: Ib9f34342157ea3a15fd48504d03f4f3a2c710579
2018-05-21 23:02:26 -07:00
android-build-prod (mdb)
a1ece0bf7f Merge "Make fastboot host builds match adb." am: b004620f80
am: f270f31d72

Change-Id: I9f9d619bf4328db2bab978e457c019b2753ac421
2018-05-08 13:19:11 -07:00
Elliott Hughes
645b50e75d Make fastboot host builds match adb.
Bug: http://b/79131183
Test: builds
Change-Id: I572362e8d1c52ebbfb78f84fd2af5428711317d7
2018-05-08 11:30:07 -07:00
Tao Bao
d5a261670c Merge changes from topic "libsparse-callback" am: 49b7f296b9
am: b2cacbb983

Change-Id: If7807fcc8b33f9a404c25ea53917462b3a320a32
2018-04-30 16:18:51 -07:00
Tao Bao
49b7f296b9 Merge changes from topic "libsparse-callback"
* changes:
  fastboot: Track the libsparse API change.
  libsparse: Use 'size_t' for the 'len' parameter in callbacks.
2018-04-30 21:48:46 +00:00
Paul Crowley
edb12341ac Merge "Wipe metadata when we wipe userdata and cache." am: f88905d231
am: 9f5aa032f8

Change-Id: I001d86a509e46b313bfaf116479ccea3b175cdc1
2018-04-25 14:02:49 -07:00
Paul Crowley
4d17006b57 Wipe metadata when we wipe userdata and cache.
Bug: 78469699
Test: Run "fastboot -w" and see that metadata is wiped
Change-Id: I2d795281c48b59c87d4f8f010037d95186f55684
2018-04-25 10:51:05 -07:00
Tao Bao
7d27ffdd45 fastboot: Track the libsparse API change.
Bug: 78432315
Test: Successfully flash a previously failing (huge) sparse image.
Test: `fastboot update` existing marlin-img.zip.
Change-Id: I09c9a06109769882d26be56d4a0d2a2b7b62cb5f
2018-04-25 10:37:01 -07:00
Tao Bao
c3177b0094 Merge "fastboot: sparse_file_len() returns int64_t." am: 9249f4bc41
am: a1b308e288

Change-Id: I08114ba90aaea4c18e479dbff6f0507b4da239d0
2018-04-25 06:46:11 -07:00
Tao Bao
41cf35f8b2 fastboot: sparse_file_len() returns int64_t.
Check that the value fits in uint32_t that's supported by the current
protocol.

Also fix and sanity check the max_size before passing it to
sparse_file_resparse(), which accepts `unsigned int`. This shouldn't
happen in practice because of RESPARSE_LIMIT (1 GiB).

Test: `fastboot flash` with small and large images.
Change-Id: I0a8279fc14c54c40a70ddce65c3b25173c0d0a40
2018-04-24 18:10:42 -07:00
Elliott Hughes
30b408c6f0 Merge changes I1f55c6e1,Ib2adcf0a am: 395131df7b
am: 4a9a08183e

Change-Id: Ib571c60a499dd349358d7019d8004906b2acdaee
2018-04-20 13:31:45 -07:00
Elliott Hughes
542370dead Move fastboot over to ParseByteCount.
Bug: N/A
Test: `fastboot flashall` and `fastboot -S 100m flashall`
Change-Id: I1f55c6e10be74780bbf8dc30b2d4be3f362ac662
2018-04-19 19:49:44 -07:00
Hridya Valsaraju
cc331a0198 Merge "Remove header version check for command "fastboot boot boot.img"" am: b245377f0e
am: 72a1a812ad

Change-Id: Ia9604f30578452ee8058dab49aa6a9b147abe3dd
2018-04-17 12:12:29 -07:00
Hridya Valsaraju
d016ee4dbe Remove header version check for command "fastboot boot boot.img"
The header version argument is meant for creation of boot images
using boot and flash:raw commands. It is unnecessary to specify the same
while using the boot command with a complete boot image.

Bug: 77920157
Test: fastboot boot boot.img
Change-Id: Ia8fca4180e15906a3ae7c732496a744eb4b15e91
Merged-In: Ia8fca4180e15906a3ae7c732496a744eb4b15e91
2018-04-16 16:55:58 -07:00
Fernando Lugo
24b17cb296 Merge "fastboot: fix header_actual calculation" am: 53135a4772
am: 11f27f42f5

Change-Id: Ibf9a86e1ccc50772460a35343679784782b3c0be
2018-04-11 23:34:10 -07:00
Fernando Lugo
91dfaecca7 fastboot: fix header_actual calculation
Bug: 77920157
Test: fastboot boot $OUT/kernel
Change-Id: Ibe2f4b9a6476ac11937448e6547b5159af011633
Signed-off-by: Fernando Lugo <flugo@google.com>
2018-04-11 19:02:59 -07:00
Dan Willemsen
ca37bd3457 Merge "Fix mac build (ldflags -> ldlibs)" am: 1b2f2ee621
am: 808c7351c5

Change-Id: I1ae0648fdf3706260c476a5ac398d7cc05d43e33
2018-04-11 01:27:01 -07:00
Dan Willemsen
d81279f7ed Fix mac build (ldflags -> ldlibs)
Test: mmma system/core/fastboot   (on mac)
Change-Id: Ib917758c59fc33d6f8d9bd4f8716cf530c646f54
2018-04-10 22:55:55 -07:00
Jaegeuk Kim
64673e14cc Merge "fastboot, fs_mgr: set fsverity feature bit" into pi-dev
am: 44fd93d0d3

Change-Id: I2f5bf8e218c7e8204fbd42a6429c8e76357e42f4
2018-04-10 21:07:57 -07:00
Treehugger Robot
002959e492 Merge changes I983f361d,I899c8433,Ie6f4b029,Ic3cb9c82,I27107d05
* changes:
  Remove unused variable.
  Remove -i vendor id matching.
  Add quotes to -v INFO/OKAY/FAIL for clarity.
  Remove legacy slot-suffix support.
  Add fastboot_test.cpp and test --os-version/--os-patch-level parsing.
2018-04-11 03:22:26 +00:00
Elliott Hughes
7678ffd6d9 Fix Darwin build.
TEMP_FAILURE_RETRY in fs.cpp.

Bug: N/A
Test: N/A
Change-Id: If77da90eeb59e485d5caf4a2e73f7aa91801be2a
2018-04-10 18:01:08 -07:00
Elliott Hughes
bd86420b83 Remove unused variable.
Bug: N/A
Test: builds
Change-Id: I983f361d3d5a779600077a78b121c4ee399089db
2018-04-10 15:59:46 -07:00
Elliott Hughes
f3192bd052 Remove -i vendor id matching.
We removed this from adb years ago.

Bug: N/A
Test: N/A
Change-Id: I899c8433665e64a0c0302d2c30a8e689b8c83d65
2018-04-10 15:38:08 -07:00
Elliott Hughes
234910bc3b Add quotes to -v INFO/OKAY/FAIL for clarity.
This makes it easier to see which part came from the device.

Bug: N/A
Test: fastboot -v flashall
Change-Id: Ie6f4b02933cab21f343998b5fc84f8e487dd3984
2018-04-10 15:34:19 -07:00
Elliott Hughes
42b18a518b Remove legacy slot-suffix support.
Bug: N/A
Test: flashed Pixel
Change-Id: Ic3cb9c8225c75697099723347f7fd820bcadca6e
2018-04-10 15:32:21 -07:00
Elliott Hughes
6ebec932d6 Add fastboot_test.cpp and test --os-version/--os-patch-level parsing.
Also switch all remaining headers over to #pragma once, and actually
use FB_COMMAND_SZ.

Bug: http://b/77340848
Test: ran tests
Change-Id: I27107d054c206e66c39208099e36a55df604e08f
2018-04-10 14:24:02 -07:00
Elliott Hughes
11ff345979 Minimal changes to build fastboot as a library.
Bug: http://b/77809061
Test: builds
Change-Id: I0c388334d643a0a2abf0c03a29f336dc3af2f83f
2018-04-09 20:40:45 -07:00
Dan Willemsen
94e4dc26bb Fix fastboot dist to be compatible with adb
We've got an internal target 'static_sdk_tools' that attempts to ensure
that both adb and fastboot are distributed as artifacts. It's
essentially a loop calling dist-for-goals on
$(HOST_OUT_EXECUTABLES)/{adb,fastboot}.

The dist-for-goals macro has de-duplication checks, but both the src and
dest needs to be identical. Currently adb is using the installed
executable, fastboot is using the built executable, and static_sdk_tools
is trying to use the installed versions of both.

This causes an overriding commands for target warning, which I recently
turned into a warning.

Maybe everything should be converted over to using the built
executables, but that requires a bunch more checks everywhere, and most
places are already using the installed version.

Bug: 77775726
Test: check treehugger, fastboot is dist
Test: m BUILD_HOST_static=1 static_sdk_tools dist
Change-Id: If45fb9706fa75a812610224708b5f95f65b1f1bf
2018-04-09 14:26:23 -07:00
Elliott Hughes
577e8b44b6 Add fastboot --os-version and --os-patch-level.
Also move -c to --cmdline to match the python mkbootimg tool. Remove
the short options for these rarely-used options.

Remove #if 0 cruft from <bootimg/bootimg.h>.

Bug: http://b/77340848
Test: manual testing (need to fix http://b/77809061 for unit tests)
Change-Id: Ieaa795566611bd89ba3fee39a1d9f6ad0713a587
2018-04-09 18:37:39 +00:00
Jaegeuk Kim
b68b02ca5a fastboot, fs_mgr: set fsverity feature bit
Bug: 74604441
Bug: 67380979
Change-Id: Ia336be99eed42bbd0eab1b22e2cc3179a92d5233
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-04-06 10:18:21 -07:00
Elliott Hughes
59efd440eb Remove the "needs_erase" workaround.
This workaround shouldn't be necessary now we're using mke2fs.

Bug: http://b/25429933
Test: `fastboot -w flashall`
Change-Id: I577ad445a02a448102fb49674360a732aa3d153c
2018-04-05 14:24:00 -07:00
Treehugger Robot
243be559a1 Merge "Remove emergency from the fastboot reboot completions." 2018-04-05 02:36:19 +00:00
Treehugger Robot
3810f0076b Merge "Add newer partitions to the fastboot flash completions." 2018-04-05 02:24:34 +00:00
Treehugger Robot
52cd10fed6 Merge "Consistently use - rather than _ in fastboot option tab completion." 2018-04-04 23:11:47 +00:00
Elliott Hughes
eace8e2e53 Merge changes I50e27f46,I0b7cd983,I3639fdee
* changes:
  Remove lock_bootloader/unlock_bootloader.
  Remove `reboot emergency`.
  Clean up fastboot help:
2018-04-04 22:57:17 +00:00
Elliott Hughes
bd1e2dd67d Remove emergency from the fastboot reboot completions.
Bug: N/A
Test: N/A
Change-Id: Ia22f51061c845ea19a697e86ac109c02960251fa
2018-04-04 13:51:54 -07:00
Elliott Hughes
f0b9c7ccd2 Add newer partitions to the fastboot flash completions.
Bug: N/A
Test: `fastboot flash \t`
Change-Id: I1f33c90b8c26b18b9984102ac084b8865d72ff06
2018-04-04 13:51:24 -07:00
Elliott Hughes
b2b90154a8 Consistently use - rather than _ in fastboot option tab completion.
(fastboot actually supports both, but only barbarians use underscore.)

Bug: N/A
Test: `fastboot \t`
Change-Id: I52166d8b0e91285d16bcf65ad51de20f57a00ad1
2018-04-04 13:43:56 -07:00
Elliott Hughes
2e9b779d42 Remove lock_bootloader/unlock_bootloader.
These were implemented on Nexus 5X/6P, but the infrastructure for the
challenge-response system isn't available.

Bug: N/A
Test: N/A
Change-Id: I50e27f469ea7c668de1af314f83f5171376ccda4
2018-04-04 13:36:44 -07:00
Elliott Hughes
2cb9075b63 Remove reboot emergency.
This isn't in the bootloader requirements doc, and the internet implies
that you actually need to use `fastboot oem edl` or `fastboot oem
reboot-edl` anyway.

Bug: N/A
Test: N/A
Change-Id: I0b7cd9839fbd06fc104d029e92d5986dc3c6eda3
2018-04-04 13:31:30 -07:00
Elliott Hughes
fbfa0e8781 Move adb/fastboot bash completion into adb/fastboot.
Bug: http://b/74443706
Test: bash completion still works.
Change-Id: I9da3a0ae748a202407652f513c990e9d05f8b01a
2018-04-04 08:33:33 -07:00
Elliott Hughes
b76188ffc1 Clean up fastboot help:
After:

  usage: fastboot [OPTION...] COMMAND...

  flashing:
   update ZIP                 Flash all partitions from an update.zip package.
   flashall                   Flash all partitions from $ANDROID_PRODUCT_OUT.
                              On A/B devices, flashed slot is set as active.
                              Secondary images may be flashed to inactive slot.
   flash PARTITION [FILENAME]
                              Flash given partition only.

  basics:
   devices [-l]               List devices in bootloader (-l: with device paths).
   getvar NAME                Display given bootloader variable.
   reboot [bootloader]        Reboot device.

  locking/unlocking:
   flashing lock|unlock       Lock/unlock partitions for flashing
   flashing lock_critical|unlock_critical
                              Lock/unlock 'critical' bootloader partitions.
   flashing get_unlock_ability
                              Check whether unlocking is allowed (1) or not(0).

  advanced:
   erase PARTITION            Erase a flash partition.
   format[:FS_TYPE[:SIZE]] PARTITION
                              Format a flash partition.
   set_active SLOT            Set the active slot.
   oem [COMMAND...]           Execute OEM-specific command.

  boot image:
   boot KERNEL [RAMDISK [SECOND]]
                              Download and boot kernel from RAM.
   flash:raw PARTITION KERNEL [RAMDISK [SECOND]]
                              Create boot image and flash it.
   -c CMDLINE                 Override kernel command line.
   --base ADDRESS             Set kernel base address (default: 0x10000000).
   --kernel-offset            Set kernel offset (default: 0x00008000).
   --ramdisk-offset           Set ramdisk offset (default: 0x01000000).
   --tags-offset              Set tags offset (default: 0x00000100).
   --page-size BYTES          Set flash page size (default: 2048).
   --header-version VERSION   Set boot image header version.

  Android Things:
   stage IN_FILE              Sends given file to stage for the next command.
   get_staged OUT_FILE        Writes data staged by the last command to a file.

  options:
   -w                         Wipe userdata.
   -u                         Do not erase partition first when formatting.
   -s SERIAL                  Specify a USB device.
   -s tcp|udp:HOST[:PORT]     Specify a network device.
   -i VENDOR_ID               Filter devices by USB vendor id.
   -S SIZE[K|M|G]             Use sparse files above this limit (0 to disable).
   --slot SLOT                Use SLOT; 'all' for both slots, 'other' for
                              non-current slot (default: current active slot).
   --set-active[=SLOT]        Sets the active slot before rebooting.
   --skip-secondary           Don't flash secondary slots in flashall/update.
   --skip-reboot              Don't reboot device after flashing.
   --disable-verity           Sets disable-verity when flashing vbmeta.
   --disable-verification     Sets disable-verification when flashing vbmeta.
   --wipe-and-use-fbe         Enable file-based encryption, wiping userdata.
   --unbuffered               Don't buffer input or output.
   --verbose, -v              Verbose output.
   --version                  Display version.
   --help, -h                 Show this message.

Bug: N/A
Test: `fastboot --help`

Change-Id: I3639fdee68de544f12e75004ccbb03b8386e64ed
2018-04-03 13:30:18 -07:00
Treehugger Robot
a10d40e2b2 Merge "Add a header-version argument to fastboot" 2018-04-03 18:33:57 +00:00
Jayant Chowdhary
0a5bc29353 Merge "Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr." into pi-dev 2018-04-03 16:43:28 +00:00
Jayant Chowdhary
f4bda9a188 Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691

Test: m -j libmkbootimg creates libmkbootimg.so.lsdump.

Test: make -j64

Merged-In: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
(cherry picked from commit 4cc755dce5)
2018-04-02 17:32:23 -07:00
Hridya Valsaraju
7d824136ae Add a header-version argument to fastboot
The argument would set the boot header
version for flash:raw and boot
commands when they are used for boot
image creation.

Bug: 77154616
Test: Dumped the created boot image and checked
the header version using unpack_bootimg

Change-Id: I2c458996817615f4351db102b4234984108d47c0
Merged-In: I2c458996817615f4351db102b4234984108d47c0
(cherry picked from commit 88de5556ec)
2018-04-02 16:00:59 -07:00
Hridya Valsaraju
88de5556ec Add a header-version argument to fastboot
The argument would set the boot header
version for flash:raw and boot
commands when they are used for boot
image creation.

Bug: 77154616
Test: Dumped the created boot image and checked
the header version using unpack_bootimg

Change-Id: I2c458996817615f4351db102b4234984108d47c0
2018-04-02 22:50:53 +00:00
Elliott Hughes
855cdf82f5 Improve fastboot verbose output.
Move some verbose messages so they're only output with -v.

Remove some misleading verbose messages altogether (such as "wiping
userdata...").

Properly log all the commands sent and responses received. Example:

  $ fastboot -v flashall
  ...
  Sending sparse 'system' 2/2 (443712 KB)
  fastboot: verbose: sending command "download:1b1500d0"
  fastboot: verbose: received DATA 1b1500d0
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (165596160 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (267762688 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (20978688 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (7168 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (1024 bytes)
  fastboot: verbose: sending data (3072 bytes)
  fastboot: verbose: sending data (208 bytes)
  fastboot: verbose: received OKAY
  OKAY [ 13.871s]
  Writing sparse 'system' 2/2
  fastboot: verbose: sending command "flash:system"
  fastboot: verbose: received OKAY
  OKAY [  3.228s]
  Rebooting
  fastboot: verbose: sending command "reboot"
  fastboot: verbose: received OKAY

  Finished. Total time: 36.939s

Bug: http://b/30953083
Bug: http://b/74444116
Test: `fastboot -v flashall`
Change-Id: I2cca198daa062fd1fb732218343263803b111e38
2018-04-02 14:28:18 -07:00
Elliott Hughes
194e27bf5e Merge "Modernize fastboot output format." 2018-04-02 20:47:53 +00:00
Elliott Hughes
f238d8751b Modernize fastboot output format.
After:

  --------------------------------------------
  Bootloader Version...: 0.5
  Baseband Version.....: 0.5
  Serial Number........: serialv1.0
  --------------------------------------------
  Checking product                                   OKAY [  0.032s]
  Sending 'boot' (9962 KB)                           OKAY [  0.350s]
  Writing 'boot'                                     OKAY [  0.143s]
  Sending 'dts' (14 KB)                              OKAY [  0.068s]
  Writing 'dts'                                      OKAY [  0.048s]
  Sending sparse 'system' 1/2 (460796 KB)            OKAY [ 14.383s]
  Writing sparse 'system' 1/2                        OKAY [  4.138s]
  Sending sparse 'system' 2/2 (443712 KB)            OKAY [ 13.871s]
  Writing sparse 'system' 2/2                        OKAY [  3.246s]
  Rebooting
  Finished. Total time: 36.962s

For a failure:

  extracting android-info.txt (0 MB) to RAM...
  --------------------------------------------
  Bootloader Version...: 0.5
  Baseband Version.....: 0.5
  Serial Number........: serialv1.0
  --------------------------------------------
  Checking product                                   FAILED

  Device product is 'hikey960'.
  Update requires 'marlin' or 'sailfish'.

  fastboot: error: requirements not met!

This change also adds a -v/--verbose flag, but doesn't make much use of
it yet (http://b/30953083 will need it).

Bug: N/A
Test: manual
Change-Id: I7d19f5775859ffad5f3be5707b37dcb6e180917f
2018-04-02 11:01:48 -07:00
Jayant Chowdhary
478c7c1eaf Add dummy vndk library libmkbootimg to enable abi checks on boot_img_hdr.
Bug: 74763691

Test: m -j libmkbootimg creates libmkbootimg.so.lsdump.

Test: make -j64

Change-Id: I8d716c560467aaf090f4f7ee9cfbc53a9405f05d
(cherry picked from commit 4cc755dce5)
2018-03-31 07:13:33 -07:00
Elliott Hughes
9b7cd9ad04 Add "require partition-exists=" support.
The Pixel 2 system images release was a bit of a disaster because anyone
using an old version of fastboot would blindly flash too few partitions,
potentially bricking their device. This change lets us add a line to
the android-info.txt file for a device with a new partition.

Also error out sooner in such cases by checking the requirements
immediately, rather than optimistically unpacking everything first.

Switch Action over to C++ to fix memory issues.

Bug: http://b/77158188 (partition checking)
Bug: http://b/74444116 (error out sooner)
Test: manual testing with a modified android-info.txt

(cherry picked from commit 5620d224b6)

Change-Id: Ib97af6f9392f7672430ff71228484e6ee7af6fbf
2018-03-29 10:46:46 -07:00
Bowgo Tsai
de2472d63e Adding odm.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ie6c20a1004867e7c9cfa1894abab9252316a9154
Merged-In: Ie6c20a1004867e7c9cfa1894abab9252316a9154
(cherry picked from commit 017217ec57)
2018-03-29 08:18:37 +08:00
Elliott Hughes
539f3ddff5 Merge "Add "require partition-exists=" support." 2018-03-28 23:25:24 +00:00
Elliott Hughes
5620d224b6 Add "require partition-exists=" support.
The Pixel 2 system images release was a bit of a disaster because anyone
using an old version of fastboot would blindly flash too few partitions,
potentially bricking their device. This change lets us add a line to
the android-info.txt file for a device with a new partition.

Also error out sooner in such cases by checking the requirements
immediately, rather than optimistically unpacking everything first.

Switch Action over to C++ to fix memory issues.

Bug: http://b/77158188 (partition checking)
Bug: http://b/74444116 (error out sooner)
Test: manual testing with a modified android-info.txt
Change-Id: I58b426cad410107e368f35f5725216d07281dd97
2018-03-28 12:43:53 -07:00
Bowgo Tsai
017217ec57 Adding odm.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ie6c20a1004867e7c9cfa1894abab9252316a9154
2018-03-29 01:31:51 +08:00
Bowgo Tsai
7e50de4449 Adding product.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall

Change-Id: Ifd119650dd3316508870df0dfc770099e95ae1d1
Merged-In: Ifd119650dd3316508870df0dfc770099e95ae1d1
(cherry picked from commit 0afc6b07f1)
2018-03-27 09:40:35 +08:00
Bowgo Tsai
0afc6b07f1 Adding product.img for fastboot flashall
Bug: 64195575
Test: fastboot flashall
Change-Id: Ifd119650dd3316508870df0dfc770099e95ae1d1
2018-03-26 15:47:59 +08:00
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