Commit graph

3990 commits

Author SHA1 Message Date
Dan Shi
5e359c04ac Merge "Revert "Skip F2FS formatting for dev option enabled devices"" into main 2024-08-31 03:10:10 +00:00
Dan Shi
642a98e2a7 Revert "Skip F2FS formatting for dev option enabled devices"
This reverts commit c2f2263bbf.

Reason for revert: possble cause of b/363089777

Change-Id: Ie7979e49bcbab6c99c0c7cba71e0b3858bfe0fbf
2024-08-30 23:14:15 +00:00
Akilesh Kailash
0049369534 Merge "libsnapshot: static link libselinux" into main 2024-08-30 21:39:49 +00:00
Akilesh Kailash
109eae5cd7 libsnapshot: compile tests for both 32 and 64 bit
Bug: 360254891
Test: vts_libsnapshot_test
Change-Id: I7c49bf5e40c58022e1930e054ebc0bd9319b4da2
2024-08-30 09:10:40 -07:00
Akilesh Kailash
093fd351fa libsnapshot: static link libselinux
libsnapshot_init is linked by microdroid. Adding libselinux as whole_static_libs in `libsnapshot_defaults` will bloat the super image of microdroid.

Instead, statically link libselinux for libsnapshot_init.

On Pixel 7 Pro:

Microdroid super image: 47173836
Baseline (Without this change): 47161548

Bug: 362839899
Test: Build, verify microdroid super image size.
Change-Id: I3c589097173b305c1d39af9edbfb8c5e29f21410
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-30 05:29:50 +00:00
Kelvin Zhang
6e1b4c5a1e Merge "Make some fstab functions available outside of fs_mgr" into main 2024-08-29 17:15:05 +00:00
Treehugger Robot
b346ff1e23 Merge "Skip F2FS formatting for dev option enabled devices" into main 2024-08-29 14:54:42 +00:00
Jacky Jian
be85b80f23 Merge "isBlockAligned to use uint64_t" into main 2024-08-29 06:37:41 +00:00
Daniel Zheng
15e9846473 isBlockAligned to use uint64_t
We want to avoid the usage of size_t for any integer value that could
exceed 2^32 (for 32 bit platforms). Let's update the usage here for
future compatibilty and avoid silent truncation failures.

Bug: 361048795
Test: th
Change-Id: I9ce2ca21706270a218f06f7d2b7dc9fade185a68
2024-08-28 19:27:09 +00:00
Kelvin Zhang
c2f2263bbf Skip F2FS formatting for dev option enabled devices
F2FS does not support page_size!=block_size configuration, and
dev option devices need to toggle between 4K/16K mode, hence F2FS
requires a data wipe every time page size changes. This is inconveinent,
skip F2FS formatting instead.

Test: th
Bug: 353436188
Change-Id: Ic33dbc39c16db3aee4c47349a9693aacec240de8
2024-08-28 10:28:48 -07:00
Kelvin Zhang
f61be9ea39 Make some fstab functions available outside of fs_mgr
Test: th
Bug: 353436188
Change-Id: I5d1d80935d345245dece579ea2d2cbdb61ebaf11
2024-08-28 10:28:48 -07:00
Akilesh Kailash
398203d1da libsnapshot: Move snapshot metadata to super partition.
snapshot metadata files are stored in /metadata. This means, we cannot
wipe after installing any update.

This patch does the following:

1: Create a scratch space in super partition. The scratch space for ota
   metadata is just about 1MB.

2: Create ext4 filesystem on top of scratch block device.

3: Mount the scratch on /mnt/scratch_super

4: When snapshot-manager instance is created, point the /mnt/scratch/ota
to metadata_dir_ so that all the snapshot files are stored in the new
path.

All the logic of OTA remains the same. This flow is enabled only on userdebug builds for now and the only consumer would be snapshotctl

$snapshotctl apply-update /data/nbd/ -w

During init, we would have to mount the scratch partition to detect
if there is any pending updates.

With this, we would now be able to wipe the device along with the update flow. This will help incremental flashing wherein we would end up saving ~35-40 seconds on Pixel devices.

With this flow, the end-to-end update for incremental builds takes
~20-30 seconds.

Bug: 330744468
Test: Pixel 6 incremental flashing with wipe, Full OTA, vts_libsnapshot
Change-Id: Iac6ce2cf37b70ea221cd18175c8962988d03d95b
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-27 23:48:03 -07:00
Terry Guan
adcba86848 Merge "Add resume from hibernation in first stage init" into main 2024-08-27 21:22:51 +00:00
terryguan
d96c6b8e88 Add resume from hibernation in first stage init
If bootconfig hibernation_resume_device is present in boot config, then
we write that value to /sys/power/resume

Bug: 339688542
Test: Check resume from hibernation/boots with/without config present
Change-Id: I1a9bf63af4dab07e494740722898c1aba33c00b5
2024-08-27 09:37:25 -07:00
Julien Desprez
3f11b6ac64 Move snapuserd_test to general-tests
The test should be able to build and run from generic-build.

Change-Id: I380565bbcae53c454fa1cbff655c8c6fe1000097
Test: presubmit
Bug: 358400696
2024-08-23 04:02:09 +00:00
Julien Desprez
4c6edd3c8f Reland aosp/3144167: Migrate vts_libsnapshot_test and friends to general-tests zip
for things that works in VTS, they should be buildable in general-tests
zip rather than device-tests. Which is cheaper in term of build resources.

The underlying issue should have been fixed in b/349278999

Change-Id: I611db1d60bd5b29f42f3404ed8b313024aca39ce
Test: presubmit
Bug: 358400696
2024-08-19 16:12:44 +00:00
Chaitanya Cheemala (xWF)
8cd0f23d1c Merge "Revert^3 "Set block device as RO/RW before mount"" into main 2024-08-13 12:01:15 +00:00
Chaitanya Cheemala (xWF)
1df3536b95 Revert^3 "Set block device as RO/RW before mount"
This reverts commit 61c07a09e8.

Reason for revert: Likely culprit for b/359414718  - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Ie40dcc6d3549183ba146c4ff37edc0d1e57d0cca
2024-08-13 08:28:03 +00:00
Treehugger Robot
1aaf2384f2 Merge "Revert^2 "Set block device as RO/RW before mount"" into main 2024-08-13 03:17:06 +00:00
David Anderson
780ea239f2 Merge "libsnapshot: Simplify wipe handling in recovery." into main 2024-08-12 16:10:18 +00:00
Jooyung Han
b29f0dcb5b Merge changes I00deb50c,I82650277 into main
* changes:
  Clean up userspace-reboot (#2)
  Clean up userspace-reboot
2024-08-12 00:40:07 +00:00
Elliott Hughes
20f66bed7a Merge "There's only one <sys/system_properties.h> now." into main 2024-08-10 17:15:08 +00:00
Treehugger Robot
fc28da24d0 Merge "Enable secondary_user_on_secondary_display for CtsFsMgrTestCases" into main 2024-08-09 22:57:31 +00:00
David Anderson
c85af55952 libsnapshot: Simplify wipe handling in recovery.
This refactors HandleImminentDataWipe to address some shortcomings
discovered through testing. Previously, it always called
CreateSnapshotsAndLogicalPartitions, which meant trying to use snapuserd
even if completely unnecessary.

Instead we now peek at the update state and eliminate the "easy" cases
ahead of time. These are "none", "initiated", and "unverified" when
either a rollback happens or there is no forward merge indicator. In
this case we simply return early and allow the wipe to continue
(disabling the current slot if necessary).

The hard case, when a merge is needed, is still handled within
ProcessUpdateStateOnDataWipe. However it's no longer recursive, and it
can assume a merge is about to initiated or already in progress.

In all cases except a merge failure, we change the update state to None
to clear any roadblocks update_engine or the bootloader might encounter.
A merge failure, however, still blocks a data wipe. The way to recover
from this is adb sideload.

Bug: 350613336
Test: vts_libsnapshot_test
      wipe in INITIATED state, no merge
      wipe in UNVERIFIED state, no merge
      wipe in UNVERIFIED + rollback state, no merge
      wipe in MERGING state, merge
Change-Id: I387aabcfa6304118be88ddbb85842111d5c2ef6a
2024-08-09 14:04:30 -07:00
Elliott Hughes
30203af8fd There's only one <sys/system_properties.h> now.
Change-Id: I4d535484b9e25fda304fb748b7796e513c832265
2024-08-09 15:55:38 +00:00
Treehugger Robot
a7f7f4065b Merge "Fix SnapshotTest crash" into main 2024-08-09 07:40:07 +00:00
Jooyung Han
e34549af33 Clean up userspace-reboot
The feature was deprecated last year.

Bug: 292469129
Test: atest CtsInitTestCases
Change-Id: I826502770ab3fa566be57a33829f1103efa893fb
2024-08-09 15:58:53 +09:00
mingwei xue
a791e91304 Fix SnapshotTest crash
For Android 12 vendor project, SnapshotTestEnvironment setup is skipped. So, test_device is not initialized, which will cause other tests to fail.

Change-Id: I6ce6a9e7ea2c210e25c2a5ffadaaa6348086ea7f
BUG:350678717
Test:run vts -m vts_libsnapshot_test
2024-08-09 05:46:07 +00:00
Treehugger Robot
9da55b8cf7 Merge "Revert "libsnapshot: compile tests for both 32 and 64 bit"" into main 2024-08-08 06:50:11 +00:00
Akilesh Kailash
873ae91b95 Revert "libsnapshot: compile tests for both 32 and 64 bit"
This reverts commit 2317bbad07.

Reason for revert: b/358254699

Change-Id: Icb9dc0d48f3e39a45a69f9aa36f9bfe46d27e37a
2024-08-08 05:29:52 +00:00
Akilesh Kailash
0fe7deb212 Merge "libsnapshot: compile tests for both 32 and 64 bit" into main 2024-08-08 00:12:31 +00:00
Sandeep Dhavale
2007e0cc83 Merge "snapuserd: remove implicit assumption about dm-user in BufferSink" into main 2024-08-07 22:44:44 +00:00
Akilesh Kailash
2317bbad07 libsnapshot: compile tests for both 32 and 64 bit
Bug: 352605053
Test: th
Change-Id: I0566e237d1151c705d61623be4b496d73b9ec3ea
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-07 10:57:41 -07:00
Akilesh Kailash
a880e5675b snapuserd_test: skip test if dm-user kernel driver is absent
Bug: 357487459
Test: snapuserd_test
Change-Id: I8458f223fc35fcfa042588e67a30c5bb273b0277
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-08-07 10:52:03 -07:00
Kelvin Zhang
61c07a09e8 Revert^2 "Set block device as RO/RW before mount"
Original CL reverted due to missing permission on vold.
The missing permission is added in aosp/3202313 , hence re-submit.

This reverts commit 1f00f794e6.


Reason for revert: b/349507086

Change-Id: Ia1086f3c8c65c476bdc119fe59ed4fd3a21f8591
2024-08-07 17:19:24 +00:00
Sandeep Dhavale
3df2dc1aae snapuserd: remove implicit assumption about dm-user in BufferSink
This removes implicit assumption that BufferSink can only be used with
dm-user. User of BufferSink can specify size of header during
BufferSink::Initialize to reserve the space for the header.

Also get rid of now unused structure dm_user_payload and
dm_user_message.

Test: TH
Test: ota
Test: vts_snapused_test
Bug: 357711761
Change-Id: I1e550393ce1f0277fe215015fa6948ad3c3b68ba
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
2024-08-07 09:47:39 -07:00
Eric Biggers
48931daf85 Merge "fs_mgr: Remove deprecated mount option" into main 2024-08-05 19:11:24 +00:00
Richard Chang
96265b3420 Merge "fs_mgr: check available space before creating zram backing device" into main 2024-08-02 02:53:44 +00:00
Ilya Byckevich
d60a2aa199 fs_mgr: Remove deprecated mount option
Mount option "nomblk_io_submit" was deleted from
upstream kernel v3.9 in 36ade451a5d736e61ac8302b64aacc5acb5e440f
and has not reappeared since then.
Now it only generates 'Ignoring removed nomblk_io_submit option'
in the logs

Test: manual
Change-Id: Ie609e7d3d38e808eeede1f1c55435ed027726025
2024-08-01 17:34:52 +00:00
Richard Chang
6c277195ab fs_mgr: check available space before creating zram backing device
This CL adds a check to ensure that there is enough free space on
the device before creating the zram backing device.
If there is not enough space, the zram backing device will not be
created.

Adding a system property 'ro.zram_backing_device_min_free_mb' to
define the minimum free space reserved for booting.
If the property is not set, skip the available space check.

Bug: 322821637
Bug: 326877642
Test: Fill up userdata, enlarge zram backing device size on next
boot.

Change-Id: I135b4beee2a8a21f8214f6579368a8d0d8792255
2024-08-01 04:21:11 +00:00
Daniel Rosenberg
9ca9303b05 Format if Encryption was Interrupted
If we're partially through setting up metadata encryption, failures
leave the partition in a known bad state, and we can avoid an eventual
boot into recovery by taking the format path.

Bug: 351704691
Test: Inserted debug code to reboot during initial encryption setup
      Verified device boots successfully on second attempt
Change-Id: I2d8591fa68ab0656e42b7b12f69001a5897e1a61
2024-07-30 18:13:42 -07:00
Chaitanya Cheemala (xWF)
4d73a9d9ad Merge "Revert "Set block device as RO/RW before mount"" into main 2024-07-30 09:47:57 +00:00
Chaitanya Cheemala (xWF)
1f00f794e6 Revert "Set block device as RO/RW before mount"
This reverts commit c6dfdbb761.

Reason for revert: Likely culprit for b/356319388  - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: Ibd85b26a02f0278676f330c6825d3cb15eefe3fc
2024-07-30 09:05:17 +00:00
Treehugger Robot
785961673b Merge "Set block device as RO/RW before mount" into main 2024-07-30 04:06:38 +00:00
Antonio Kantek
adaf620dde Enable secondary_user_on_secondary_display for CtsFsMgrTestCases
secondary_user_on_secondary_display is for background users that have
access to UI on assigned displays (a.k.a. visible background users) on devices
that have config_multiuserVisibleBackgroundUsers enabled. The main use
case is Automotive's multi-display Whole Cabin experience where
passengers (modeled as visible background users) can interact with the display
in front of them concurrently with the driver (modeled as the the
current user) interacting with driver's display.

Bug: 349714805
Flag: EXEMPT test fix
Test: atest CtsFsMgrTestCases
Test: atest --user-type secondary_user_on_secondary_display CtsFsMgrTestCases
Change-Id: I0e4498fd431f5c70135d8704f1d2fa5476620ef1
2024-07-25 23:10:25 +00:00
Daniel Zheng
39fe6e1d38 libsnapshot: add test for merge_size param
Add test to make sure that setting the protobuf successfully propogates
the gflag argument to snapuserd_handler.

Bug: 332255580
Test: th
Change-Id: Ic7a008bee7dd3ca29faa0a5409f0513f1551bf37
2024-07-24 15:21:51 -07:00
Daniel Zheng
1fbba3ed0d libsnapshot: cap merge op count
Set op processing window during snapshot merge from the build. The lower
the merge count, the lower the memory strain during the merge process

Bug: 332255580
Test: verify merge_size propogates to snapuserd daemon
Change-Id: Ic7770115bca963d923a7a276897c5deac30f9faf
2024-07-24 15:19:43 -07:00
Treehugger Robot
0c76dcb89a Merge "Add adb-remount-sh to presubmit & kernel-presubmit group." into main 2024-07-23 02:53:09 +00:00
Akilesh Kailash
6906249312 Skip tests if vendor partition is on Android S
Bug: 349278999
Test: vts_libsnapshot_test on GSI config
Change-Id: I6826b287565e8a78bea21b4830ad30f1c30a01bf
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-07-22 10:32:56 -07:00
Betty Zhou
3360d387d2 Add adb-remount-sh to presubmit & kernel-presubmit group.
Test: test-mapping test
Bug: 231996550
Change-Id: Ic03dcf8c316e64bc5d6b106b598c0af590d24802
2024-07-22 17:24:51 +00:00