Commit graph

4305 commits

Author SHA1 Message Date
Terry Guan
b9f6c12b4d Merge "init: add a swapoff built-in command" into main 2024-09-10 16:59:46 +00:00
terryguan
4399754035 init: add a swapoff built-in command
Enables a method for swapping off certain block devices or files. This
will be used before hibernation occurs.

Bug: 339688542
Test: Manual, verified that calling swapoff from a init file swapsoff
location that is specified

Change-Id: I212a6f303a023c3e440b557caae82ad3904ac9c9
2024-09-06 08:49:04 -07:00
Ryan Prichard
4f13b13aac [fastboot+init] avoid std::allocator<const T>
std::vector<const T> uses std::allocator<const T>, which is an
undocumented libc++ extension to the C++ standard library. The extension
was removed in llvm.org/PR96319. Use an ordinary non-const T instead.

Bug: http://b/349681543
Test: m fuzzy_fastboot CtsInitTestCases
Test: m MODULES-IN-system-core
Flag: EXEMPT, refactor to fix build failure
Change-Id: Ia98a2f090e87541fd35a89bd75bf9638bc7dc711
2024-09-04 17:45:14 -07:00
Treehugger Robot
41db2810bc Merge "ueventd: fix other assorted style nits" into main 2024-08-30 21:31:21 +00:00
Eric Caruso
bb4a40955a ueventd: fix other assorted style nits
Indentation in this file is four spaces, remove an
unnecessary trailing semicolon, put a space between
a type declaration and its structured binding.

clang-format shuffled a line around as well.

Bug: None
Test: compile
Change-Id: Ib4cf17fecb1e54971020dc77b7903d2aac5dd9c1
2024-08-30 13:39:49 -04:00
Eric Caruso
23276f63af ueventd: fix confusing indentation
Bug: None
Test: compile
Change-Id: I8eb39792ed13ba61dd6a61e9771935ece33ae915
2024-08-30 11:31:35 -04:00
Treehugger Robot
8067bd819f Merge "Standardize page property." into main 2024-08-29 01:31:05 +00:00
Treehugger Robot
40f2bfd604 Merge "libsnapshot: Move snapshot metadata to super partition." into main 2024-08-28 17:39:29 +00:00
Jooyung Han
ad6ec1e35d Merge "libinit_host: clean up dependencies" into main 2024-08-28 07:14:45 +00: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
Jooyung Han
9b4ad17bfb libinit_host: clean up dependencies
libinit_host doesn't need HIDL stuff. host_init_verifier does HIDL
interface checks.

Bug: 326827772
Test: mmma system/core
Change-Id: I59c1444649a62202abb54a2e0cceee38522c1259
2024-08-27 13:10:33 +09:00
Steven Moreland
b47e18a659 Standardize page property.
ro.boot.hardware.cpu.pagesize is used on some devices to
report the page size. However, we also know what value this
should be from the CPU. Rather than create a separate property
for this, standardize around this property.

This also allows us to test the value of this property on all
devices.

Bug: 358696947
Test: Vts16KPageSizeTest
Change-Id: I7f6260c68e17e7df8a789e9066a7171f3a56f4b0
2024-08-23 00:41:44 +00:00
Jooyung Han
d51fb54d56 init: remove interface checks from init
HIDL interface checks are done by host_init_verifier at build-time.

Bug: 326827772
Test: mmma system/core/init
Change-Id: I18e9590aba614bebfdbc6aa8bca7036821a6c4f3
2024-08-21 17:44:09 +09:00
Jooyung Han
95c4242cf6 host_init_verifier: check interface names directly
Previously, ServiceParser did the check, but only when it's invoked by
host_init_verifier. Host_init_verifier can do it directly, which removes
unnecessary runtime dependencies from init.

Bug: 326827772
Test: host_init_verifier detects wrong HIDL interface names.
Change-Id: I4c8bb0e89a5def7341c48c52af730795a6ee13c0
2024-08-21 17:42:05 +09:00
Jooyung Han
d6790c4bc6 init_parser_fuzzer: remove interface checks
CheckInterfaceInheritanceHierarchy() is for host_init_verifier to check
the interface names at buildtime. We don't need to fuzz the host-side
verification code.

Bug: 326827772
Test: run init_parser_fuzzer
Change-Id: Ie01dc2953fd6e69ef3c2cb9caadf7b9964a3d244
2024-08-21 17:42:05 +09:00
Jooyung Han
148f602f23 init: clean up unused Service[List]::post_data
post_data was used by Userspace Reboot, which was removed.

Bug: 293377020
Test: atest CtsInitTestCases
Change-Id: I1a5bf328f62b8afbe58eef62c64689471e6b018c
2024-08-19 14:30:37 +09:00
Treehugger Robot
04636c8ff8 Merge "Remove InitProperties" into main 2024-08-15 07:56:10 +00:00
Steven Moreland
1409586daf Merge "init_kill_services_test: smoreland@ owners" into main 2024-08-12 23:12:55 +00:00
Jooyung Han
412d097d4a Remove InitProperties
As userspace reboot is deprecated, there's no clients.

Bug: 292469129
Test: m
Change-Id: Iafdd719b67fe74dc42498f7ecde2aa5b677ecd0c
2024-08-12 06:59:24 +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
576b1be2eb Merge changes I2b0fcb8d,I72510d61 into main
* changes:
  init_kill_services_test: += system_suspend
  init_kill_services_test: formatting for merges
2024-08-09 22:23:31 +00:00
Steven Moreland
aed90550d0 init_kill_services_test: smoreland@ owners
I've always maintained this test, would also take
overall init ownership, ;p

Bugs: me
Test: N/A
Change-Id: Id0ea93226b9afd22f8bc192a5a1b61e15d01f3e2
2024-08-09 20:52:43 +00:00
Steven Moreland
164f297007 init_kill_services_test: += system_suspend
Get coverage for this.

Bugs: me
Test: atest init_kill_services_test
Change-Id: I2b0fcb8d273f89de6d0ad115a8de0c0314dbfc3f
2024-08-09 20:50:51 +00:00
Steven Moreland
d945d20408 init_kill_services_test: formatting for merges
Adding formatting here, as we will start a push for people
using this, if they run into any linkToDeath issue, or if
they want to test this.

Bugs: me
Test: N/A
Change-Id: I72510d61926ce694671d897519463f37892a8d12
2024-08-09 20:50:34 +00:00
Elliott Hughes
30203af8fd There's only one <sys/system_properties.h> now.
Change-Id: I4d535484b9e25fda304fb748b7796e513c832265
2024-08-09 15:55:38 +00:00
Jooyung Han
f91503bd18 Clean up userspace-reboot (#2)
Bug: 292469129
Test: CtsInitTestCases
Test: system/core/bootstat/boot_reason_test.sh
Change-Id: I00deb50c5634ade6b69d5b6bf4d08c5101e0beb8
2024-08-09 16:17:20 +09: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
Tiffany Yang
ccb950f9ed Merge "init: Wait for /dev/hvc1 during ARCVM first-stage mount" into main 2024-08-05 18:37:56 +00:00
Jiyong Park
b6b55fc945 Merge "Update visibility according to the change AVF directories layout" into main 2024-07-23 07:21:23 +00:00
Treehugger Robot
d909570786 Merge "init: set a new trigger when a vold checkpoint is committed" into main 2024-07-22 09:12:29 +00:00
Jiyong Park
d959fc72c1 Update visibility according to the change AVF directories layout
Bug: 352458998
Test: m nothing
Change-Id: Ibdae7e76a66104cc644b7f82059a2dc5f08659d0
2024-07-22 11:24:03 +09:00
Mike McTernan
b525463558 init: set a new trigger when a vold checkpoint is committed
Add post-fs-data-checkpointed trigger when vold completes checkpointing
after an OTA update.

Bug: 350362101
Test: ABTD
Change-Id: I647a73a942174015b46c5f40bd8f8d3347977ecd
2024-07-19 16:40:23 +00:00
Tiffany Yang
b885e4ad53 init: Wait for /dev/hvc1 during ARCVM first-stage mount
This commit introduces a function to allow ARC-specific logic during
first-stage mount by checking for the existence of an indicator file
at the path "/is_arcvm".

ARC uses the virtio-console device `hvc1` to pass byte data to Android
before second-stage init. Ensure that /dev/hvc1 is initialized before
ARCVM continues booting, but allow other devices to bypass this device
initialization.

Bug: 325538592
Test: boot ARC, ensure /dev/hvc1 can be read during PropertyInit
Change-Id: Ic258b7b004b59da462f4990131a5c11fc94eca62
2024-07-18 23:58:21 +00:00
Tiffany Yang
0fb39f6e69 init: Support for initializing virtio-console devices
This change allows init to ensure that a specified virtio-console
device file (`/dev/hvc*`) is available before `ueventd` coldboot.
Times out if device path is not encountered within 10 seconds.

Bug: 325538592
Test: build bertha_x86_64 and bertha_arm64
Change-Id: Ia1512e69ea607bf4d235595caa53668e2dac500c
2024-07-10 18:59:44 -07:00
Jiyong Park
0bdd68bb06 Use no_full_install: true instead of installable: false
This is a follow-up on I37380c19232f2c497bdf492a83cdc16616f0ae8d.

Bug: 338160898
Bug: 345110999
Test: Microdroid boots even with BOARD_USES_RECOVERY_AS_BOOT
Change-Id: I41c1e40aeaffd5499fb6bd25e80b5be83470bc6b
2024-07-03 18:42:59 +09:00
Akilesh Kailash
9418c6712c Merge "libsnapshot: Check if the vendor is updated from Android S for GRF" into main 2024-06-29 00:11:19 +00:00
Akilesh Kailash
1bbf8f042f libsnapshot: Check if the vendor is updated from Android S for GRF
In a GRF config, if Vendor partition is updated from Android 12; post
OTA reboot, first stage init will communicate to daemon to check if the
daemon can support socket handoff. If that succeeds, then it is a signal
that the vendor has been updated from Android 12. Use a marker in
/metadata to signal that the vendor was updated. If the marker is present,
then post OTA reboot, userspace snapshot will be used.

Bug: 333854394
Test: OTA
Android U (system) + S (vendor) -> Android V (system) + V (Vendor)

Change-Id: Ie38c4379010789a84e5b44529b407f9f82135271
Signed-off-by: Akilesh Kailash <akailash@google.com>
2024-06-28 15:34:41 -07:00
Nelson Li
c2970dd06f Rewrite init_vendor using select syntax
The `select` syntax rewrite makes it more concise and easier to
understand.

Bug: 347605145
Test: m init_vendor
Change-Id: I866bbe9360fdbdf69cac3c6a24bbe37306227755
2024-06-19 02:14:23 +00:00
Nelson Li
064ac0bf15 Convert init_vendor to Android.bp
`init_first_stage` is a dependency of `init_vendor` only when
`BOARD_USES_RECOVERY_AS_BOOT` is false.
Since `BOARD_USES_RECOVERY_AS_BOOT` is already defined in
`build/make/core/android_soong_config_vars.mk` within a
soong_namespace, we can use the `soong_config_module_type` to easily
convert this to Android.bp.

Bug: 347600829
Test: m init_vendor
Change-Id: I1ddcd5fb62983b01e51452c9b7367750e03e7f48
2024-06-17 05:03:56 +00:00
Treehugger Robot
a1188013f3 Merge "make apex init .XXrc parsing honour .35rc even though we're not yet sdk=35" into main 2024-06-14 14:37:05 +00:00
Steven Moreland
e767a71114 Merge "init: enable 'user root' check at build time" into main 2024-06-05 19:23:20 +00:00
Steven Moreland
81a1b3ec23 init: enable 'user root' check at build time
For visibility.

We could make this only for new API levels, but it isn't
currently exposed at build time, and visibility is good
on upgrades.

Bug: 340953047
Test: build, on device passing and failing requirements
Change-Id: I3a0ea47560c65114bc1b8685954d1fb7687cb8df
2024-06-05 00:58:49 +00:00
Elliott Hughes
c088de1879 libc++fs is part of libc++ now.
Change-Id: I2be806de736377e77bb49e4b3b9f72e25f7d717a
2024-06-04 16:47:32 +00:00
Nate Myren
cdd4cb7db8 Merge "Revert^2 "Only write appcompat properties if flag is defined"" into main 2024-05-31 01:31:38 +00:00
Treehugger Robot
0b64326377 Merge "init: 'user root' check use vendor API" into main 2024-05-29 13:27:16 +00:00
Steven Moreland
5088e588f7 init: 'user root' check use vendor API
This changes user root to use the year date format
that vendor API uses.

Previously this still applied to V devices, which switched
to using API level 202404 after 35.

They recommend the year/date form, and there is no
constant for this.

Bug: 340953047
Test: service_test
Change-Id: I5ba8d1251c877a785e41f0cfcc35d7cb0776f8c7
2024-05-29 00:05:26 +00:00
Nate Myren
b9e0545c85 Revert^2 "Only write appcompat properties if flag is defined"
This reverts commit 6d8304aa46.

Reason for revert: resubmission

Change-Id: Ifb66efa2b1b7a734302316259690950306af99ec
2024-05-28 23:40:59 +00:00