Commit graph

98 commits

Author SHA1 Message Date
Jaegeuk Kim
a389610d9c support f2fs casefolding formatting tool
Bug: 159672232
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ia9dd5d63f03c2365b5d82a84ff93263424f116bb
2020-07-20 13:18:09 -07:00
Baligh Uddin
3d902d1637 Use SOONG_HOST_OUT_EXECUTABLES
Bug: 147699225
Test: m com.android.tzdata (apexer requires these executables)
Change-Id: I008d244e330d2113cb3f2dd4b6c770df3f2fac06
2020-01-23 14:09:01 +00:00
Dan Willemsen
3f439a7a88 Switch from dist-for-goals to dist in Android.bp
Removes a few more Android.mk files.

Test: check for adb, mkbootfs, and fastboot in the build artifacts
Change-Id: Ie4e50a363a734d0b9207f0d0098c54719f038e76
2018-11-19 23:06:12 -08:00
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
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
3195e6edc3 Allow C++17 in fastboot.
Bug: N/A
Test: fastboot builds
Change-Id: Ife120dbe4f45e8aa83225978ea9d5e88bbb58b9e
2018-08-13 13:18:02 -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
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
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
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
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
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
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
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
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
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
Jin Qian
988a51a9fe fastboot: remove reference of deprecated make_ext4 code
Bug: 64395169
Change-Id: Ida14996dc1488657e7bdeb34d6e767a8f6ed44ed
2017-11-02 15:13:46 -07: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
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
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
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
Chris Fries
4bf1be7ec8 fastboot: add AdbWinUsbApi as a required module
fastboot uses AdbWinUsbApi on Windows, let's keep it required.

Test: rm -rf out/host; mma fastboot and confirm AdbWinUsbApi is in out/
Bug: 36810152
Change-Id: Ica8b27cb1d0bca260f716dc61fdcea2ccc282623
2017-04-14 15:43:47 -05:00
Alex Deymo
b0c395955d Remove "_host" and "_static" suffix from libsparse definition.
This now combines all the "libsparse" libraries into the same soong
target. A minor side-effect of this change is that the libsparse
static library depends on the libz shared library instead of the libz
static library. This minor change has no effect since targets using
the static libsparse library need to explicitly include either the
static libz or the shared one.

Bug: 34220783
Change-Id: I8f41586cf4c3336791cfa57ab4f5ae59a76d7ffa
2017-01-11 19:15:11 -08:00
Alex Deymo
705353ae27 Remove "_static" and "_host" suffix from libext4_utils.
Bug: 34220783
Change-Id: I967dbaa9c48ad1feed2369c3a40f745b86a350f8
2017-01-11 14:05:42 -08:00
Treehugger Robot
955648a915 Merge "Rely on the platform -std default." 2016-10-14 02:28:38 +00:00
Elliott Hughes
36e0d390a2 Rely on the platform -std default.
Bug: http://b/32019064
Test: builds
Change-Id: I18a1d816d63b64601485045070851f32d44e85eb
2016-10-10 14:31:12 -07:00
Tao Bao
6d881d6db4 Update the header path for ext4_utils.
Test: `mmma system/core`

Change-Id: I6291d10d6c8d4972aeca55596baa83f555496193
2016-10-09 10:23:36 -07:00
Elliott Hughes
82ff315bb0 Add android::base::GetExecutablePath, switch adb and fastboot over.
We'd long had two copies of this stuff, so rather than rewrite both
Linux versions to use android::base::Readlink, let's kill the duplication
too...

Bug: http://b/30988271
Change-Id: I4de58a94a22a4b1faf969a6fc70ca1560a4d5121
2016-09-01 09:24:24 -07:00
Colin Cross
99f6b86733 Replace libziparchive-host with libziparchive
libziparchive-host is no longer necessary, and mixing libziparchive-host
and libziparchive can cause ODR violations.

Change-Id: I27b2cc9974000ee7bf1d1ac15fd7b069862d9b01
2016-08-26 11:12:38 -07:00
Ying Wang
71edfc8b9a Also archive adb.exe/fastboot.exe when building win_sdk.
On linux we archive both Linux and Windows binaries.

Bug: 27315911
Change-Id: I17d25cd1ea611a9c917f1e78b47f21a8959eea20
2016-02-29 19:27:06 -08:00
David Pursell
4601c978ca fastboot: add UDP protocol.
Implements a UDP protocol for fastboot, documented in
fastboot_protocol.txt.

This version of the protocol does not include multi-packet windowing,
which will likely be needed to achieve reasonable speeds over WiFi.
Since we don't have any WiFi use cases yet, we'd like to get this in
now and update the protocol later if it becomes necessary.

Usage:
  fastboot -s udp:<hostname>[:port] <command>

Bug: http://b/26154914
Change-Id: Ia5bbae6bcd6405671f594d7120b3994746d234d3
2016-02-10 10:21:30 -08:00
David Pursell
2ec418a4c9 fastboot: add TCP protocol.
This CL implements a TCP protocol for use with fastboot. Protocol
description is given in fastboot_protocol.txt, some examples of
expected behavior can also be found in tcp_test.cpp.

Usage is:
  fastboot -s tcp:<hostname>[:port] <command>

Bug: http://b/26558551
Change-Id: If53a514a534489c617db32c4fea8819949121282
2016-02-03 13:57:45 -08:00
David Pursell
b34e4a06ee libcutils/fastboot: improve multi-buffer write.
Fixes libcutils multi-buffer write interface to be more friendly and
hooks into it from the fastboot Socket class.

Bug: http://b/26558551
Change-Id: Ibb3a8428fc379755602de52722c1260f9e345bc0
2016-02-03 10:01:38 -08:00
David Pursell
c3a466960f fastboot: socket testing improvements.
(This code was originally part of a huge fastboot CL but has been split
out to try to make the CLs a little more manageable).

More prep for fastboot TCP and UDP implementations. This CL adds a
SocketMock class that makes it easy to mock out network behavior so we
can unit test the TCP and UDP protocols.

Also uses the new libcutils socket_get_local_port() to avoid hardcoding
a server port in unit tests.

Bug: http://b/26157893.
Change-Id: I1ba10f31e98d7349313fc15f240383d63378a8db
2016-02-02 11:29:10 -08:00
David Pursell
572bce2908 fastboot: use cutils socket functions.
Now that cutils has cross-platform socket functionality, we can
restructure fastboot to remove platform-dependent networking code.

This CL adds socket_set_receive_timeout() to libcutils and combines the
fastboot socket code into a single implementation. It also adds TCP
functionality to fastboot sockets, but nothing uses it yet except for
the unit tests. A future CL will add the TCP protocol which will use
this TCP socket implementation.

Bug: http://b/26558551

Change-Id: If613fb348f9332b31fa2c88d67fb1e839923768a
2016-01-21 09:53:11 -08:00
David Pursell
0eb8e1b706 libcutils: share Windows networking code.
This CL moves Windows networking code from fastboot to libcutils so
that it can be shared with other host programs such as adb.

Not all libcutils networking functions have been implemented for
Windows, just those necessary for fastboot. In the next CL I will do
the same for adb, adding any additional required functions.

Unit tests have also been added to test the functions using a loopback
connection.

Bug: http://b/26236380.
Change-Id: Ibc51a67030fe69a04c23512eefa9d19b055c7c12
2016-01-15 15:57:35 -08:00
David Pursell
815c7beae7 fastboot: implement UDP networking interface.
This CL creates a UdpSocket class that provides a simple unified
interface to send and receive UDP packets for all platforms. Nothing
uses this interface yet except for tests.

The eventual goal is to implement a UDP protocol for fastboot, but it
makes the code much simpler and more modular if we handle the low-level
networking here independently of our custom fastboot protocol.

Some of the Windows code is similar to adb. I'd like to create a
library to hold the common functionality, but it is going to be a
little delicate to separate out the features unique to adb (e.g. the
custom file descriptor system), and I don't want to risk breaking
something in adb before the holiday break, so I'm hoping to get this in
for now and merge them early next year.

Tests are included in this CL to exercise this functionality using a
loopback connection.

Bug: http://b/26154763.
Tests: `fastboot_test` loopback tests on Linux, Mac, and Windows 7.
Change-Id: I81d1b7ace8d864246b99f6c80b8e29f64b8aa375
2015-12-16 16:16:08 -08:00
Elliott Hughes
1b708d368f Share the new adb USB diagnostic code with fastboot.
Bug: http://b/26134129
Change-Id: Ieaf0651c7b3f8a028760982091ec63a21a5484ba
2015-12-14 10:50:21 -08:00
David Pursell
0b15663830 fastboot: create Transport object (take 2).
(Second upload of this CL; original upload had the wrong version of
usb_windows.cpp that caused a compilation error. Fixed error and
re-tested.)

This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.

Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.

Bug: http://b/22029765
Change-Id: I1175bbce08690fbd15f51e68166be9b3e9973ea0
2015-11-16 09:31:07 -08:00
David Pursell
c0504e1873 Revert "fastboot: create Transport object."
This broke some stuff, will look into it Monday.

This reverts commit 6f233a7799.

Change-Id: I155bc85d21fda3b0ba1e5e17839059797fb15509
2015-11-14 00:15:57 +00:00
David Pursell
6f233a7799 fastboot: create Transport object.
This CL creates a Transport object to provide a generic interface for
various transports. Specifically this is designed to be able to add UDP
support to fastboot in an upcoming CL without changing the main program
logic.

Also includes some minor code style fixes and replaces malloc/free
in the USB implementation files with smart pointers and std::string.

Bug: http://b/22029765
Change-Id: I68641af0da7d13db4647f5e20a18d04d67f0b327
2015-11-13 11:08:17 -08:00
Elliott Hughes
c1fd492ac5 Revert "Revert "adb/base: fix adb push of Unicode filenames on Win32""
This reverts commit cc8cd59456.

With the dependency on libcutils (for gettid for non-bionic) removed,
this no longer breaks the build.

Change-Id: I645bd6876e2502ddc1535b69af1e645c0df9d178
2015-11-11 18:23:00 -08:00
Elliott Hughes
cc8cd59456 Revert "adb/base: fix adb push of Unicode filenames on Win32"
This reverts commit ac9514a452.

The new gettid dependency caused other breakage.

Change-Id: I74a75e40c30a45beb275f9dd38eb5c7beac15fbd
2015-11-11 18:01:12 +00:00
Spencer Low
ac9514a452 adb/base: fix adb push of Unicode filenames on Win32
ae5a6c06cd made adb push use
android::base::ReadFileToString() for small files, but that API did not
support UTF-8 filenames on Windows, until this fix which does the
following:

- Add android::base::{WideToUTF8,UTF8ToWide}() which are only available
  on Windows. The signatures are based on Chromium's APIs of the same
  name.

- Add the namespace android::base::utf8 which has versions of APIs that
  take UTF-8 strings. To use this, make sure your code is in a namespace
  and then do "using namespace android::base::utf8;". On Windows, this will
  make calls to open() call android::base::utf8::open(), and on other
  platforms, it will just call the regular ::open().

- Make ReadFileToString() and WriteStringToFile() use utf8::open() and
  utf8::unlink().

- Adapt unittests from Chromium.

- fastboot needs to link with libcutils because it links with libbase
  which depends on libcutils for gettid() for logging.

Change-Id: I1aeac40ff358331d7a1ff457ce894bfb17863904
Signed-off-by: Spencer Low <CompareAndSwap@gmail.com>
2015-11-10 15:48:54 -08:00
Dan Willemsen
87a419c8b1 Remove USE_MINGW/CYGWIN; Whitelist windows modules
CYGWIN is not supported, USE_MINGW and HOST_OS==windows are being
replaced with LOCAL_..._windows variables.

Bug: 23566667
Change-Id: I3e4a1e4097dc994cf5abdce6939e83a91758fd75
2015-09-02 17:10:35 -07:00
Elliott Hughes
75d47421d0 Merge "Move fastboot's Windows code to C++." 2015-06-24 19:30:58 +00:00