Commit graph

33 commits

Author SHA1 Message Date
Thiébaud Weksteen
5d72d6ce20 Remove unused execution paths when formatting
fastboot uses the internal functions generate_ext4_image and
generate_f2fs_image when called via the `format` subcommand. An option
for populating the newly created fs with an initial directory exists,
but it is not exposed to the command line interface (initial_dir is
always ""). Remove the unused codepaths for this preloading.

Test: atest --host fastboot_test
Bug: 237960487
Change-Id: I7acfe6352cf26b5cbe0e5553b288c3798e96a893
2022-07-21 14:50:05 +10:00
David Anderson
6f70cc6f92 fastboot: Support casefolding in ext4 partitions.
Bug: 191929411
Test: manual test
Change-Id: I9bd0a906fa9a2605d56cc3f37247fcc2a3d5f858
2021-07-13 17:32:03 -07:00
Jaegeuk Kim
58d10c209a fastboot: f2fs: handle return code correctly
The f2fs shares the fsck return code for sload.f2fs, since it calls fsck after
loading files.

enum {
	FSCK_SUCCESS                 = 0,
	FSCK_ERROR_CORRECTED         = 1 << 0,
	FSCK_SYSTEM_SHOULD_REBOOT    = 1 << 1,
	FSCK_ERRORS_LEFT_UNCORRECTED = 1 << 2,
	FSCK_OPERATIONAL_ERROR       = 1 << 3,
	FSCK_USAGE_OR_SYNTAX_ERROR   = 1 << 4,
	FSCK_USER_CANCELLED          = 1 << 5,
	FSCK_SHARED_LIB_ERROR        = 1 << 7,
};

Bug: 176471360
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I06289670834f29a59e704e772791f12328a073f8
2020-12-29 19:56:36 +00:00
Jaegeuk Kim
638d05e84e fastboot: add casefold/projid/compress options
fastboot -w --fs-options=casefold
fastboot -w --fs-options=casefold,projid
fastboot format:f2fs --fs-options=casefold
fastboot format:f2fs --fs-options=casefold,projid
fastboot format:f2fs --fs-options=casefold,projid,compress

Bug: 172514669
Bug: 160198145
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: If3fad004fdd25dd754432ce98934b4ae6c8a8706
2020-11-09 10:04:30 -08:00
Jaegeuk Kim
46542f9ecc make_f2fs: use -g android by default
Bug: 119875846
Change-Id: I0c6d642d474df5cc678ced9ec4c04027ee51c6d1
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
2018-11-22 03:42:07 -08: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
Chris Fries
40cd9e03c9 Merge "Refactor libfastboot"
am: 767506fc5a

Change-Id: I1e20f30872969dd847fe67a23ebc5975dcb743e7
2018-07-20 14:06:46 -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
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
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
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
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
Connor O'Brien
ebcfa44937 Merge "fastboot: handle small flash block sizes correctly" 2017-11-03 21:15:34 +00: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
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
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
Connor O'Brien
ce16a8a940 Fastboot: use flash erase & logical block size for building userdata
If the bootloader provides erase-block-size and logical-block-size
getvar variables, then pass these to libext4_utils when building a new
userdata image. This info is used to tune stride and stripe-width.

Bug: 33243520
Test: Modify fb_getvar to return values for "erase-block-size" and
"logical-block-size" and check that fastboot -w sets userdata
parameters correctly.
Signed-off-by: Connor O'Brien <connoro@google.com>

Change-Id: Id48b7a3ebb9074983a4422a79a64dcb437c0f888
2017-02-08 18:30:40 -08: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
Paul Crowley
8f7f56e25b Add --wipe-and-use-fbe option to fastboot for FBE userdata marker.
With this option, userdata is wiped and recreated with the
"convert_fbe" file in the root, which triggers conversion to FBE.

Bug: 25898323
Change-Id: I9347b7057b6278e7e6437504896b22c82dd01d89
2015-12-03 18:02:25 +00:00
Elliott Hughes
8ab9a32323 Clarify and fix the intent of the partition-type checking code.
Change-Id: I202dab4ee91208b632bc2086d1e5c387a4c29edd
2015-11-02 14:05:57 -08:00
Elliott Hughes
fc79767fc2 Use 64-bit file sizes in fastboot.
Bug: 20110580
Change-Id: I5d3718103ff581ff3b5241c8b0e52b585b4f37e5
2015-08-25 19:11:52 -07:00
Elliott Hughes
b3748de33f Move fastboot to C++.
Minimal conversion.

Change-Id: I32cbf125be481a8757720d10fa303c38a7fd5e38
2015-06-23 20:56:01 -07:00
Renamed from fastboot/fs.c (Browse further)