Commit graph

52345 commits

Author SHA1 Message Date
David Anderson
9267c3f5c4 libsnapshot: Add helper for first-stage init mounting
With this patch, init can mount snapshots in the first stage by
performing the following operations:
 1. First, check if SnapshotManager::kBootIndicatorPath exists.
 2. If so, call SnapshotManager::NewForFirstStageMount.
 3. If NeedSnapshotsInFirstStageMount returns true,
 4. Call CreateLogicalAndSnapshotPartitions().

When called, this replaces any calls to CreateLogicalPartitions().

Rather than split this into multiple functions (to generate uevents as
needed), we instead use major:minor strings for device-mapper tables.
This means we don't have to wait for paths to resolve.

Bug: 139204329
Test: libsnapshot_test gtest
Change-Id: Ia7ec196a62e51748d6f01a66fe4e9eef25f2898f
2019-08-23 14:42:05 -07:00
Yifan Hong
3a136e58e3 rename liblp_test_static to vts_kernel_liblp_test.
Test: builds
Change-Id: I708ecef257b806c29a7f1e6108d91f52b2ed4241
2019-08-23 13:58:47 -07:00
Yifan Hong
fd659bdfed Add liblp_test to presubmit.
Create a new test binary, liblp_test, that can run on presubmit.

Bug: 138328907
Test: TH
Test: atest liblp_test

Change-Id: I968ff84078524e5733da9b009d9a7222aad299bd
2019-08-23 13:58:47 -07:00
Christopher Ferris
3bae40b279 Add ReadMapFileAsyncSafe function.
This is a function designed so that it doesn't do any allocations.
It's purpose is for testing allocation related code where doing an
allocation can disturb the test.

Added unit tests for the new code that disable memory allocations
before running.

Also, made the tests run in isolation mode since I added a bunch of
tests and this will keep the total runtime about the same as
before.

Bug: 137795072

Test: All unit tests pass.
Change-Id: I7645f1e9f88cdfbc57c8eebce80199b9cfae64c1
2019-08-23 10:07:44 -07:00
Xin Li
d62c31d3ac DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master
Bug: 139893257
Change-Id: Ib69c986e30b903cc48ca835fb307acf569930806
2019-08-23 06:45:26 +00:00
Xin Li
750fac4ed5 DO NOT MERGE - Merge build QP1A.190711.001 into stage-aosp-master history
Bug: 139893257
Change-Id: Iec16ca66c6149d2502f0a3f5777e5137d5c52a99
2019-08-23 06:42:12 +00:00
Inseob Kim
1dee49736c Implement sysprop_library API stability check
sysprop_library now checks the API stability itself, cutting dependency
on java_sdk_library. Under the directory {module_dir}/api,
{module_name}-current.txt and {module_name}-latest.txt hold API
signatures.

When sysprop_library is built, or a user run "m {module_name}-check-api"
command, API check is performed. First, current.txt must have exactly
same signature with built sysprop_library module. Second, current.txt
must be compatible with latest.txt.

Build system emits a handy error message to generate/update those API
files, in case of missing or mismatching. Also, a script file for
freezing API files is introduced.

Bug: 131637873
Test: 1) m && boot blueline
Test: 2) m {sysprop_library} performs API check
Test: 3) manual test for check-api, freezing api
Change-Id: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
Merged-In: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
Merged-In: I704f2ad45e62c15d9ffb13aa553f8fac9022bdc9
(cherry picked from commit f711999132)
2019-08-23 06:29:38 +00:00
Josh Gao
7240d67d91 Merge "tombstoned: start immediately after /data is mounted."
am: 3bd09415a3

Change-Id: I329f397fb866ebb63df5688f9c2e353f49b36aa9
2019-08-22 20:19:30 -07:00
Yifan Hong
53a729bd98 Merge "liblp_test_static: fix test"
am: f2c7dd666e

Change-Id: Ia6de660101e3366bec89e106df9481d6c7d752dd
2019-08-22 20:18:41 -07:00
Treehugger Robot
3bd09415a3 Merge "tombstoned: start immediately after /data is mounted." 2019-08-23 02:56:27 +00:00
Treehugger Robot
f2c7dd666e Merge "liblp_test_static: fix test" 2019-08-23 02:51:58 +00:00
Tom Cherry
9f22b00d87 Merge "Add init_tests to CTS"
am: 88eedafbe1

Change-Id: If2cdc075e1d81cda7e326f48017fbaac5e562552
2019-08-22 16:06:01 -07:00
Tobias Thierer
93c7c97047 Merge "Let init create /dev/boringssl/selftest/"
am: c3847f599c

Change-Id: I0eb2b4e57a7d5ba7e9bdcb7e3720d13d01c71a9e
2019-08-22 15:55:22 -07:00
Tom Cherry
88eedafbe1 Merge "Add init_tests to CTS" 2019-08-22 22:53:56 +00:00
Treehugger Robot
c3847f599c Merge "Let init create /dev/boringssl/selftest/" 2019-08-22 22:49:03 +00:00
Josh Gao
8ad965ae5e tombstoned: start immediately after /data is mounted.
Catch as many early-boot crashes as we can by starting tombstoned
immediately after /data is mounted.

Bug: http://b/139864948
Test: adb shell su 0 dmesg | grep "starting service"
Change-Id: I7f8821102191a445e87020f3efa59a2e0620d9db
2019-08-22 15:19:44 -07:00
Yifan Hong
607e4dfa1c liblp_test_static: fix test
- Fix test so that it skips compliance test on non-DAP devices
  and retrofit devices as well. Move these device-dependent tests
  into the DeviceTest test suite and skip them on non-DAP devices.
- Also add "ResetPropertyFetcher" in some tests in io_test.cpp.
- Also change some ASSERT to EXPECT.

Note that VtsKernelLiblpTest runs this test. VtsKernelDynamicPartitionsTest
enforces ro.boot.dynamic_partitions to be set.

Bug: 138328907
Test: run it

Change-Id: Ic5cd3921033142f38aae071585f6c0fa563ae362
2019-08-22 14:59:10 -07:00
David Anderson
4ae2efcac4 Merge "libsnapshot: Use a real fake super partition for tests."
am: 9612e2767e

Change-Id: Ied22edc6f24e6c3182267764134ebd10e6cb6a39
2019-08-22 14:00:39 -07:00
Tobias Thierer
3536fdb927 Let init create /dev/boringssl/selftest/
This directory is intended to be used by boringssl
(through the bssl_self_test{,64} binaries) to create /
check for the existence of marker files indicating that
the self test has successfully run.

It appears that because this is an .rc script for init
rather than a shell,
  mkdir -p /dev/boringssl/selftest 0755 root root
wouldn't work.

Bug: 139348610
Bug: 136262690
Test: Checked that after booting, /dev/boringssl/selftest
  exists:
  $ su root ls -l /dev/boringssl
  total 0
  drwxr-xr-x 2 root root 40 1972-02-11 03:27 selftest
Test: Checked that if I instead try:
  mkdir -p /dev/boringssl/selftest 0755 root root
  in init.rc then the directory isn't created (there is
  no error message in logcat because logd is only
  started in line 311).

Change-Id: I12fdd08c8ead152ac4e62cbd0a2099a9d6170ddb
2019-08-22 21:51:09 +01:00
David Anderson
9612e2767e Merge "libsnapshot: Use a real fake super partition for tests." 2019-08-22 20:39:59 +00:00
David Anderson
7e5bae88b8 libsnapshot: Use a real fake super partition for tests.
We are currently creating test partitions via ImageManager, which
unfortunately leads to a lot of hacks in my local tree to test
first-stage init. ImageManager devices look nothing like real partitions
in super, and it's a lot of work to massage it to act the same.

Instead, let's create an actual super partition. We can do this via
ImageManager, and give it its very own partition table. To make this
work, we need a special IPartitionOpener that will redirect requests for
"super" to our temporary device. A new .cpp file has been added to house
this. A few other tidbits have moved there as well.

This makes setup code a bit more complicated, but now our tests will
behave much closer to a real device.

Bug: 139204329
Test: libsnapshot_test gtest
Change-Id: I2f40109cd3c1d6343d6f52979789e25f9afd533a
2019-08-22 13:28:29 -07:00
David Anderson
272dae3005 Merge "liblp: Support sdcards in PartitionOpener."
am: c5b3c88f8a

Change-Id: I464d2e9f39e49fb529dc4be11ac632ae4a9d6b34
2019-08-22 12:54:01 -07:00
David Anderson
c5b3c88f8a Merge "liblp: Support sdcards in PartitionOpener." 2019-08-22 19:12:40 +00:00
Alessio Balsini
727c7f3bb2 libsnapshot: use DeleteDeviceIfExists() when required
Use the DeleteDeviceIfExists() helper function, instead of duplicating
its code..

Test: manual
Change-Id: I2cba65f1f69c3dc56fe277bfb0a3411ea2a9ec2b
Signed-off-by: Alessio Balsini <balsini@google.com>
2019-08-22 19:05:38 +01:00
Tom Cherry
e4be3d308d Merge changes Id9534a59,I3ee81536
am: afe45ab5f2

Change-Id: I36290408af2ac500101e30a139c26091c510834f
2019-08-22 10:49:46 -07:00
Tom Cherry
afe45ab5f2 Merge changes Id9534a59,I3ee81536
* changes:
  init: run property service in a thread
  Revert "init: Handle properties in the background of calling fs_mgr"
2019-08-22 17:24:18 +00:00
Tom Cherry
17b2be05a2 Add init_tests to CTS
Test: atest CtsInitTestCases
Test: Cts in presubmit still passes
Change-Id: Ic16dafbaacfbace904947bd3ce2b8586f981348f
2019-08-22 08:37:55 -07:00
Jooyung Han
52c5aafb21 ld.config.txt: remove link from rs to vndk
Linker namespace 'rs' has /system/lib/vndk-sp in its search paths.
So we don't need to link 'rs' namespace to 'vndk' namespace.

Bug: 139706981
Test: run RS-using apps from Play
Change-Id: I14c1d6c4e7624bbd6551731ea88de1b4c2e5edb6
2019-08-22 12:18:16 +00:00
Jiyong Park
3f1d0c0473 Merge "add nopreload option in public.libraries.txt"
am: 6b20b7cff8

Change-Id: Iad237dabf74e7485e4da71c9d3fc0797965230a2
2019-08-22 00:36:48 -07:00
Treehugger Robot
6b20b7cff8 Merge "add nopreload option in public.libraries.txt" 2019-08-22 07:14:31 +00:00
Inseob Kim
144dc9adfd Merge "Implement sysprop_library API stability check" into stage-aosp-master 2019-08-22 02:52:17 +00:00
David Anderson
d84ebe949d Merge "libdm: Add a helper function for GetState+DeleteDevice checks."
am: b21f3dd761

Change-Id: I07bdebb088ff20c89a53d3445d07baa2b0c545ce
2019-08-21 18:22:12 -07:00
David Anderson
b21f3dd761 Merge "libdm: Add a helper function for GetState+DeleteDevice checks." 2019-08-22 00:57:01 +00:00
David Anderson
c8edf84d45 init: Add first-stage init support for snapshot-based partitions.
Note that /metadata must now be mounted before CreateLogicalPartitions()
is called. This is because SnapshotManager overrides the default
partitioning scheme, and the only way to tell if a SnapshotManager is
needed is via the metadata partition.

Bug: 139204329
Test: manual test
Change-Id: I812df6c4c0d4d8753b1516f63dc70c5bc3e1c09c
2019-08-21 12:27:56 -07:00
David Anderson
251ec05f01 liblp: Support sdcards in PartitionOpener.
Before ImageManager was introduced, gsid avoided using PartitionOpener
when writing to external media. PartitionOpener couldn't interact with
non-boot devices, because it prepends /dev/block/by-name. We hacked
around this in both gsid and in first-stage init, which manually detects
the problem and prepends /dev/block instead.

After the ImageManager refactoring, sdcard support broke in gsid,
because it started relying on PartitionOpener. Let's fix this by allowing
/dev/block for mmcblk* names in PartitionOpener.

Bug: 139204329
Test: fiemap_image_test gtest
Change-Id: Ic1cbdbe0a18fc09522ee38cc62b35fd8193ce250
2019-08-21 12:27:56 -07:00
David Anderson
370226e662 libdm: Add a helper function for GetState+DeleteDevice checks.
Bug: N/A
Test: manual test
Change-Id: Ie97b63b53f548af1e82b73893fa491fac42b32ea
2019-08-21 12:27:56 -07:00
Steve Muckle
3611243e4d fastboot: add vendor_boot to list of images
The vendor_boot partition has been created, so add it to the list of
images which may be flashed.

Bug: 137297791
Change-Id: I27eaa16656a83dbcb8289680844bf58dd1fccf24
2019-08-21 11:17:55 -07:00
Paul Crowley
26aabfd1ed Move layout_version to /data/misc/installd
Bug: 139543295
Test: Boot, ensure file is properly created
Change-Id: I919b5599484b4c77f222e640a1f1b5d65198a0c7
2019-08-21 10:12:18 -07:00
Tom Cherry
26f5e7da3a init: run property service in a thread
It's been a long standing issue that init cannot respond to property
set messages when it is running a builtin command.  This is
particularly problematic when the commands involve IPC to vold or
other daemons, as it prevents them from being able to set properties.

This change has init run property service in a thread, which
eliminates the above issue.

This change may also serve as a starting block to running property
service in an entirely different process to better isolate init from
handling property requests.

Test: CF boots, walleye boots, properties are set appropriately
Change-Id: Id9534a5916abb2f7d2a49cda54e33c1b69c50c2f
2019-08-21 08:26:09 -07:00
David Anderson
55f74e58e5 Merge "fs_mgr: Allow using major:minor device strings in CreateLogicalPartition."
am: 63fe0e9a36

Change-Id: I844b7250167ad5cc79d9ed0157f0da9d269f68bd
2019-08-20 14:01:42 -07:00
David Anderson
63fe0e9a36 Merge "fs_mgr: Allow using major:minor device strings in CreateLogicalPartition." 2019-08-20 20:42:24 +00:00
Josh Gao
1f32a20c5c Merge changes Iacf0093a,I40be3504
am: c2f53906e8

Change-Id: I21f8c74909b218a2d35d149305d9858722911cd1
2019-08-20 13:40:55 -07:00
Josh Gao
c2f53906e8 Merge changes Iacf0093a,I40be3504
* changes:
  adb: fdevent: add fdevent_context_epoll.
  adb: extract soon-to-be-common code.
2019-08-20 20:00:34 +00:00
Jiyong Park
5db5d198ff add nopreload option in public.libraries.txt
A lib with 'nopreload' option in public.libraries.txt is not preloaded
during zygote. This is useful for seldom used public libraries; they
don't contribute to the zygote startup time and only affect the apps
that they are used.

Bug: 132911956
Test: libnativeloader_test
Change-Id: I6f97c90e6721aec7f2f96c8fc7b963b34f8edd3e
2019-08-21 00:35:34 +09:00
Inseob Kim
34114e3df3 Implement sysprop_library API stability check
sysprop_library now checks the API stability itself, cutting dependency
on java_sdk_library. Under the directory {module_dir}/api,
{module_name}-current.txt and {module_name}-latest.txt hold API
signatures.

When sysprop_library is built, or a user run "m {module_name}-check-api"
command, API check is performed. First, current.txt must have exactly
same signature with built sysprop_library module. Second, current.txt
must be compatible with latest.txt.

Build system emits a handy error message to generate/update those API
files, in case of missing or mismatching. Also, a script file for
freezing API files is introduced.

Bug: 131637873
Test: 1) m && boot blueline
Test: 2) m {sysprop_library} performs API check
Test: 3) manual test for check-api, freezing api
Change-Id: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
Merged-In: I6b95eebafaf88ad326be5d7c890e000cbdb79cb5
(cherry picked from commit f711999132)
2019-08-20 16:16:40 +09:00
Yi Kong
4a2b31f210 Merge "Fix ODR violation"
am: ebfd2a468b

Change-Id: Id3af3d8d9c6e5b42a1ef4712171a486d9c81c8aa
2019-08-19 17:12:28 -07:00
Yi Kong
ebfd2a468b Merge "Fix ODR violation" 2019-08-19 23:58:50 +00:00
Josh Gao
ada40cd6b8 Merge "adb: fix mac build"
am: ef356fa5bd

Change-Id: Ia7324a9137ce296f2090c82993b1c4726bb25553
2019-08-19 16:54:43 -07:00
Josh Gao
ef356fa5bd Merge "adb: fix mac build" 2019-08-19 23:18:01 +00:00
Adrian Roos
68c14d10b8 adb: fix mac build
Ensure that off64_t is defined when building adb for mac

Fixes: 139646013
Test: make # On mac
Change-Id: I32b68738d71c8a63a35c22434092933dcabac1ce
(cherry picked from commit 2167b9082d)
2019-08-19 10:51:00 -07:00