This adds a new metadata header flag to the super partition. This flag
is set when "adb remount" is used, and is implicitly cleared when
flashing.
If there is a scratch partition present on /data, we require that the
flag be set in order to proceed using overlays. If not set, scratch is
not mapped in first-stage init, and scratch images are removed later
during startup.
Bug: 297923468
Test: adb remount -R, touch file in out/, sync, flashall
Change-Id: I9cc411a1632101b5fc043193b38db8ffb9c20e7f
The current code keeps a pointer to a local variable which doesn't
work too well. Change this to a unique_ptr and allocate the source
object that will be used instead.
Test: All unit tests pass.
Test: fastboot -w flashall on a mokey which crashed without this change.
Change-Id: Ief5437374181e514928c45dd540b42898901a137
We should change should_flash_in_userspace to work without
$ANDROID_PRODUCT_OUT being set and fall back on $OUT directory when
source isn't specified
This also fixes the flashing issue of flashing retrofit devices without
$ANDROID_PRODUCT_OUT set. If we
call fastboot update on a retrofit device, copy_avb_footer will resize
buf->sz of secondary partitions to the partition size, causing us to
send the unsparsed payload to the device -> "Invalid Size" issue.
This is because secondary partitions are considered physical partitions
on retrofit devices && should_flash_in_userspace wouldn't work if
$ANDROID_PRODUCT_OUT is set, so our first return clause in
copy_avb_footer doesn't catch this edge case causing us to resize the
buf-> sz incorrectly.
Did some testing, and also observed a case where flashing is able to
succeed despite $ANDROID_PRODUCT_OUT not being set before, so there
might still be some other edge case that we are still missing.
Test: fastboot update on sargo without $ANDROID_PRODUCT_OUT
Change-Id: I0e4781d96709b712f7d71657ec0d16d99b90214d
Adding test cases for correct formation of optimized flash super task.
We are adding an explicit pattern match for this task to be correctly
formed. Changing Optimized flash task to only remove the reboot to
userspace as a user might want to reboot back to bootloader after
flashing. We also need to change a couple functions to take a
IFastbootDriver to mock up the initialization path.
Test: fastboot_test
Bug: 297085098
Change-Id: Ic5c63bd4057ca6d64647134e5ce33fef12077fdb
Adding a hard pattern check for optimized task formation. To keep
behavior consistent, we will remove the old initialization path and add
resize tasks after attempting optimization.
Test: fastboot_test
Bug: 297085098
Change-Id: Ie0e656af9be7abdd130290fe547ffbf385ce75d6
aosp/2452605 might've accidentally omitted force flash functionality
from fastboot. Some users need to flash dynamic partitions from
bootloader, so we are readding this feature back into fastboot
Test: adb reboot bootloader, fastboot flash system --force
Change-Id: I37a51ebbe38b27ed428c38068d30c0febd7db09c
OptimizedFlashSuper makes more sense and is more consistent with
should-optimize-super
Test: m fastboot
Change-Id: I6ceb31144dce591e0a53faec68b932112d9cd360
Have get_sparse_limit() return FlashingPlan's sparse limit if set. Used
for testing to compare task lists
Test: fastboot_test
Change-Id: I7ac1eb4dc83a53b3d7aa59aa668a780b4b550664
Adding flag to turn off the super optimization. Makes for easier testing
as dynamic partitions flash tasks won't be replaced by one flash super
layout task
Test: fastboot flashall --disable-super-optimization
Bug: 194686221
Change-Id: I9142490ecfe587725872e4b734486d3db1728aa7
Using for easier debugging. Replacing old getter methods in flash task
with GetInfo(key)
Test: fastboot_test
Change-Id: If42df86c4b0278c3dc5525b1058f1947f0b34794
This check isn't needed as super_flash_helper.cpp calls a different
should_flash_in_userspace that isn't reliant on $ANDROID_PRODUCT_OUT
being set. Current code will fail when calling fastboot update
Test: fastboot update update.zip without calling lunch
Bug: 283330320
Change-Id: Icefe6092befb747b7f419ea997e0834602808d69
Old changes didn't actually take into account sources. fastboot update
{update.zip} should read fastboot-info from the update package. It was
instead flashing local images + reading local fastboot-info.txt
Test: m fastboot, fastboot update, fastboot flashall
Bug: 283330320
Change-Id: I9587a7735ddfbfb661153eb12ebc3caa7c32f141
Removing as we're no longer support reboot userspace in
fastboot-info.txt. Use reboot fastboot instead
Test: fastboot reboot fastboot
Change-Id: Ibd8bf597615dacde23ad446bde4f23837686710b
Adding const decorator to class constructor to ensure Flashing Plan
isn't modified during task construction
Bug: 194686221
Test: tested Flashall on raven
Change-Id: I99b71b2b756beaf871a31a1a035545d754d128e8
Updating old clean up slot logic change. Some devices don't know current
slot so we can't always just call get_current_slot()
Test: tested flashall on raven
Change-Id: Id655f1c1ee0b1ff09331f0d91d77412836d0af8d
Doesn't look like we actually need current_slot, since we can always
just call function get_current_slot
Test: tested flashall on raven
Change-Id: Icba64bc9fdd08f36d44965e32558a73d0beab0e1
Changed so if we call wipe on a partition that doesn't exist we'll get
some helpful error messages.
Test: tested wipe test
Bug: 194686221
Change-Id: I19dc0396a7a98d0b2be7859edbffeb8acdc9850a
sparse_file_len is not actually infallible; on Windows it's pretty easy
to make it fail by embedding large files in the stream. fastboot didn't
handle this anywhere, leading to bad sparse images when libsparse
runs out of address space.
Bug: 273933042
Bug: 268872725
Test: fastboot flashall on Windows
Change-Id: Ie68aed2f1970e820350d9f97aa89a6c0242229b8
Test: tested on raven device
Change-Id: I4935d720f567e70da95ea8da37f3404b80b313c8
Bug: 194686221
Changed reboot {target} to work off tasks. reboot-{target} commands are
also supported.
Test: tested reboot on raven device
Change-Id: I05aed269d121a5d651c1ab1180a1b4878ae213fd
Modified load_buf to be able to find images in $OUT directory
Test: tested flash {partition} and flash {partition} {img_name} on raven
device
Change-Id: I3879792d11ad15bc910670853d2a7fe200fcc66f