Commit graph

2526 commits

Author SHA1 Message Date
Jiyong Park
aa39f52a56 Merge changes from topic "sharedlib_in_recovery"
am: 91061985f5

Change-Id: Icaabb1cb46057771f71eb3fa0fad7be49d50dc64
2018-06-13 16:44:02 -07:00
Treehugger Robot
91061985f5 Merge changes from topic "sharedlib_in_recovery"
* changes:
  Build init with shared libraries
  Shared libs are supported in recovery mode
2018-06-13 23:14:29 +00:00
Wei Wang
849ea35725 Merge "init: Add warning in init first stage mount"
am: 4aa8421203

Change-Id: I5f8d12857a40ae68fecb86f5f3c069182e0261ef
2018-06-13 13:51:33 -07:00
Wei Wang
fdafb3d0ec init: Add warning in init first stage mount
init need find required devices and it some times takes a long time due
to rogue drivers. Add a warning if the timing is longer than 50ms.

Bug: 80494921
Test: Reboot
Change-Id: I8f937d7ca7127dc89ed76bb6e5f1781459d5c94a
2018-06-13 11:02:13 -07:00
Tom Cherry
daa054fa11 Merge "ueventd: fix extraneous 'Invalid section' error"
am: 86e65e9cac

Change-Id: Ia317ea6029f9251639c5b8875eaa5536880ae5f2
2018-06-12 15:18:34 -07:00
Tom Cherry
86e65e9cac Merge "ueventd: fix extraneous 'Invalid section' error" 2018-06-12 22:05:48 +00:00
Tom Cherry
6e31a2b9ae Merge "init: Actually check the return value for calls during first stage init"
am: 413bf61e48

Change-Id: I35a8be44f0d59458aaabac5c571f404e6c1fbec2
2018-06-12 14:53:38 -07:00
Tom Cherry
788fc8229c init: Actually check the return value for calls during first stage init
Init never checked the return values of the calls made during first
stage init (since of course they're not going to fail, right?).  But
of course commands can fail and they might not necessarily be obvious
when they do, so let's make it obvious.

Since the kernel log isn't up until later, this creates a list of the
failures that can then be sent to the kernel log once it's ready
(pending of course failures in setting it up...)

Test: boot bullhead, don't see errors
Change-Id: I8c12c61fa12e4368346e8b0e1c0bb0844b5d0377
2018-06-12 11:18:17 -07:00
Tom Cherry
d5d626c9f7 ueventd: fix extraneous 'Invalid section' error
When adding a new error case for host_init_parser, I didn't handle the
individual line callbacks used for ueventd correctly.  This change
fixes that.

Test: bullhead boots without extraneous ueventd warnings
Change-Id: I56cad854b0defd936a7fbcab73fe2f2963c0e2e4
2018-06-12 10:59:12 -07:00
Jiyong Park
787322c55f Build init with shared libraries
recovery partition now supports shared librarys. Therefore, init can now
be built as a dynamic executable both for normal and recovery modes.

To save save in the recovery mode, not all libs are dynamically linked.
Libs that are only used by init in the recovery mode are still
statically linked.

Note: init is still a static executable for legacy devices where
system-as-root is not on, because the dynamic linker and shared libs
which are in /system are not available when init starts.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: device boots to the UI in normal mode.
Test: do that for both walleye (system-as-root) and bullhead (legacy
ramdisk).
Change-Id: I30c84ae6a8e507e507ad0bb71acad281316d9e90
2018-06-10 08:32:33 +09:00
Yifan Hong
7dc09a089d Merge "androidboot.lrap => logical_partitions" am: 05625ab420
am: 8b328e403d

Change-Id: I37a8f05759e060cc7cab26411a822ad7be16a36b
2018-05-31 18:12:13 -07:00
Yifan Hong
05625ab420 Merge "androidboot.lrap => logical_partitions" 2018-05-31 22:05:06 +00:00
Yifan Hong
59bd65bdf6 androidboot.lrap => logical_partitions
Test: boots with prototype
Bug: 79885414
Change-Id: Ia84d052800b71ff9cfa1630def0ce72c57f76b81
2018-05-31 13:08:01 -07:00
Tom Cherry
4fc2cd7caa Merge "init: implement getpwnam for host init verifier" am: 1c15b02b54
am: 83c7fdcc1c

Change-Id: Ia2d557642c3167ca368e72faa137cb9c57592784
2018-05-31 11:37:53 -07:00
Tom Cherry
d1cc7a94d4 Merge "init: handle properties and imports for host init verifier" am: 279de56b3e
am: 758102af2b

Change-Id: I40073678d64544f74706dbb7026798f537aed8cc
2018-05-31 11:31:55 -07:00
Tom Cherry
31525f5cb6 init: implement getpwnam for host init verifier
Bug: 36970783
Test: test bullhead successfully at TOT
Test: create errors and check that they're caught
Test: create uid in passwd and check that it's successful
Change-Id: I237fb8df16a294757fe898bdbbd42e850bcb8301
2018-05-30 15:43:40 -07:00
Tom Cherry
194b5d1da9 init: handle properties and imports for host init verifier
Allow specifying properties on the command line when running host init
verifier.  This is needed particularly for importing files that have a
property expansion in their path.

Handle the import statement on host, basing paths off of the out
directory of Android builds.

Bug: 36970783
Test: verify that bullhead imports the correct files and checks them
Change-Id: I4fe263016b3764a372708b559bc0c739b1b7e5e3
2018-05-30 15:43:32 -07:00
Mark Salyzyn
94d6035077 Merge "init: add keychords_test" am: 680bc0b6b5
am: aac3972dd3

Change-Id: I46dc9bf77569f1c0c39e094b52f96e736306c5b4
2018-05-30 10:47:59 -07:00
Treehugger Robot
680bc0b6b5 Merge "init: add keychords_test" 2018-05-30 17:27:35 +00:00
Mark Salyzyn
654b1e2a02 Merge "init: switch out keychord id with std::vector match of chords" am: e6a878644c
am: b93b91c7ef

Change-Id: I79bd04e2e2c8b1a2a380ea7a79eaad01686b6129
2018-05-30 09:29:04 -07:00
Treehugger Robot
e6a878644c Merge "init: switch out keychord id with std::vector match of chords" 2018-05-30 16:12:36 +00:00
Mark Salyzyn
75b901d4a8 init: add keychords_test
Test: init_tests --gtest_filter=keychords.*
Bug: 64114943
Change-Id: I357d0c1bd56660ac28bc02b76d5632ef1b9328b7
2018-05-30 08:38:11 -07:00
Elliott Hughes
a391213d8a Merge "init; remove dead cruft." am: dfc4ad2a9c
am: 8d69c92b6d

Change-Id: Icb02fb3fa4580fe69cd72fc6f288bc6d92347df9
2018-05-29 21:44:51 -07:00
Elliott Hughes
ba3a589d1e Merge "libbase: add host properties support." am: d580c441ab
am: 10200e4c21

Change-Id: I6577c9f68378f16c9d2e543218c0eab4d54f4d52
2018-05-29 18:01:46 -07:00
Mark Salyzyn
e55e0c3d3d Merge "init: turn keychords into a standalone class" am: 420fe5fe90
am: f29bb19686

Change-Id: If128cedc913065565e9ea367c2a7c34b217ac2a7
2018-05-29 18:01:12 -07:00
Mark Salyzyn
a12e94809c Merge "init: refactor keychord for testing" am: 16dd3582b7
am: 334b4c843e

Change-Id: I8ccebe1a9cd1dd2c6386f4a641a3eb3ea3c13fc1
2018-05-29 18:00:28 -07:00
Elliott Hughes
b0aba0fff9 init; remove dead cruft.
Bug: N/A
Test: builds
Change-Id: Ia38ef6959e8615b4f103b924ae51c19f916daa48
2018-05-29 17:05:56 -07:00
Elliott Hughes
d580c441ab Merge "libbase: add host properties support." 2018-05-29 23:59:50 +00:00
Mark Salyzyn
1385725e09 init: switch out keychord id with std::vector match of chords
Drop all references to keychord_id and id and instead use keycodes_
as the id.  The keycodes are a std::vector<int> with an unique
sorted-order emplacement method added in the parser.  Solves the
academic issue with duplicate keychords and trigger all services
that match rather than first match only.

Test: init_tests
Bug: 64114943
Change-Id: I5582779d81458fda393004c551c0d3c03d9471e0
2018-05-29 15:18:38 -07:00
Mark Salyzyn
06aeb41c16 init: turn keychords into a standalone class
Test: init_tests
Bug: 64114943
Change-Id: Ie760e4a3a661260ed2aabb8a92fe65fc93521cb5
2018-05-29 13:46:12 -07:00
Mark Salyzyn
eca2507634 init: refactor keychord for testing
Move things around so that keychords.cpp is independent of service
and init and can be individually tested with few dependencies.
Permits also rolling out the keychords as a class in a future commit.
Improve parser checking.

Test: init_tests
Bug: 64114943
Change-Id: I82570bc6269ed478db784ec38a8bc916da2be2be
2018-05-29 13:20:19 -07:00
Elliott Hughes
dc80312628 libbase: add host properties support.
Move init and libprocessgroup away from their existing hacks.

Bug: N/A
Test: ran tests
Change-Id: Ifabdd38e0cc4ab2582f1ea59d32159d386f48eb6
2018-05-24 18:04:31 -07:00
Tom Cherry
05063a8715 Merge "init: finer grained permissions for ctl. properties" 2018-05-24 16:28:24 +00:00
Elliott Hughes
3055fb2f36 Merge "Add StdioLogger for command-line tools." am: 98c1b1ccf6
am: db67c344d1

Change-Id: Iab10e8c14926eb81d60606183f2e7faac7c72f32
2018-05-24 07:31:19 -07:00
Elliott Hughes
98c1b1ccf6 Merge "Add StdioLogger for command-line tools." 2018-05-23 23:38:55 +00:00
Elliott Hughes
1be0d1481b Add StdioLogger for command-line tools.
Bug: N/A
Test: ran tests
Change-Id: If366a4ea25aea1becdd3e443eba225e9bd52ebba
2018-05-23 10:06:20 -07:00
Tom Cherry
5ab2e1c8f7 init: finer grained permissions for ctl. properties
Currently, permissions for ctl. property apply to each action verb, so
if a domain has permissions for controlling service 'foo', then it can
start, stop, and restart foo.

This change implements finer grainer permissions such that permission
can be given to strictly start a given service, but not stop or
restart it.  This new permission scheme is mandatory for the new
control functions, sigstop_on, sigstop_off, interface_start,
interface_stop, interface_restart.

Bug: 78511553
Test: see appropriate successes and failures based on permissions
Merged-In: I6ce915ae39954a67eb6fe1795a93cf715c352ae4
Change-Id: I6ce915ae39954a67eb6fe1795a93cf715c352ae4
(cherry picked from commit 1debdcf1cf)
2018-05-22 13:44:34 -07:00
Tom Cherry
2aefe3026f Merge "init: finer grained permissions for ctl. properties" into pi-dev
am: 8b491495a3

Change-Id: Id70e02df338ac419099385de1e84781dd4362ebf
2018-05-22 13:26:28 -07:00
Tom Cherry
8b491495a3 Merge "init: finer grained permissions for ctl. properties" into pi-dev 2018-05-22 20:15:07 +00:00
DuXiao
08ccca6270 Merge "Property: Log errno for socket connect" am: 59976b9bed
am: bf5200ef61

Change-Id: I5abee669341d64da52c60eb63b1e14b58e3ca23e
2018-05-22 10:54:23 -07:00
Treehugger Robot
59976b9bed Merge "Property: Log errno for socket connect" 2018-05-22 17:37:23 +00:00
Tom Cherry
9ad11c0eee Merge "init: allow entering of network namespaces" into pi-dev 2018-05-22 17:13:41 +00:00
Tom Cherry
6532c78536 Merge "init: separate out epoll into a class" am: c5fbf494e7
am: aaab7d69b5

Change-Id: I2c3b9eef33128e8a3e91ae1d2dda988f15080a06
2018-05-22 08:13:36 -07:00
Tom Cherry
1debdcf1cf init: finer grained permissions for ctl. properties
Currently, permissions for ctl. property apply to each action verb, so
if a domain has permissions for controlling service 'foo', then it can
start, stop, and restart foo.

This change implements finer grainer permissions such that permission
can be given to strictly start a given service, but not stop or
restart it.  This new permission scheme is mandatory for the new
control functions, sigstop_on, sigstop_off, interface_start,
interface_stop, interface_restart.

Bug: 78511553
Test: see appropriate successes and failures based on permissions
Change-Id: I6ce915ae39954a67eb6fe1795a93cf715c352ae4
2018-05-22 08:02:35 -07:00
DuXiao
4053359c7f Property: Log errno for socket connect
It's currently not clear that the error no indicating the
failure to invoke the library function. This change introduces
logs at the failing of socket connect, that could be clearly
get the true reason.

Test: Set system property with failed, and socket recv errno
      log will show

Change-Id: I36bf66988811f953e679d1c5a468de0bf1ab0a05
Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2018-05-22 10:54:34 +08:00
Mark Salyzyn
6c6ec7240c init: separate out epoll into a class
Test: init_tests
Bug: 64114943
Change-Id: I5f03314773b02b9e30e8e21895b6bdcfd4909e88
2018-05-21 14:58:03 -07:00
Tom Cherry
2fa7451e9b init: allow entering of network namespaces
Add the ability to enter a network namespace when launching a service.
Typical usage of this would be something similar to the below:

on fs
  exec ip netns add namespace_name

service vendor_something /vendor/...
  capabilities <lower than root>
  user not_root
  enter_namespace net /mnt/.../namespace_name

Note changes to the `ip` tool are needed to create the namespace in
the correct directory.

Bug: 73334854
Test: auto team verified
Merged-In: Ifa91c873d36d69db399bb9c04ff2362518a0b07d
Change-Id: Ifa91c873d36d69db399bb9c04ff2362518a0b07d
(cherry picked from commit aead51b418)
2018-05-21 15:52:13 +00:00
Bowgo Tsai
b1b8dac123 Merge "Adds /dev/block/by-name/<partition> symlinks" am: 98214c81d1
am: d91d5ecd8b

Change-Id: Id5e75503a0fcc0df1e823d02fefb6e05db5de154
2018-05-18 19:02:55 -07:00
Treehugger Robot
98214c81d1 Merge "Adds /dev/block/by-name/<partition> symlinks" 2018-05-19 01:45:21 +00:00
Bowgo Tsai
5ee7dae840 Adds /dev/block/by-name/<partition> symlinks
During uevent processing, some "by-name" symlinks will be created.
    /dev/block/<type>/<device>/by-name/<partition>

<type> can be: platform, pci or vbd.
<device> might be: soc.0/f9824900.sdhci, soc.0/f9824900.sdhci, etc.
<partition> might be: system, vendor, system_a, system_b, etc.

e.g., on a non-A/B device:
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
    /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

On a A/B device:
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/system_b
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_a
    /dev/block/platform/soc/1da4000.ufshc/by-name/vendor_b

However, those symlinks are "device-specific".

This change adds the "generic" symlinks in ueventd, in addition to
the existing symlinks, when the possible "boot devices" are specified
in device tree. e.g.,

    &firmware_android {
	compatible = "android,firmware";
	boot_devices ="soc/1da4000.ufshc,soc.0/f9824900.sdhci";
    }

The following symlinks will then be created on the aforementioned non-A/B
and A/B devices, respectively.

    /dev/block/by-name/system
    /dev/block/by-name/vendor

    /dev/block/by-name/system_a
    /dev/block/by-name/system_b
    /dev/block/by-name/vendor_a
    /dev/block/by-name/vendor_b

Note that both <type> and <device> are skipped in the newly create symlinks.
It assumes there is no more than one devices with the same <partition>,
which is the assumption of current first stage mount flow.

Finally, when 'boot_devices' in DT is absent, it fallbacks to extract
'boot_devices' from fstab settings. e.g., using 'soc/1da4000.ufshc',
'soc.0/f9824900.sdhci' for a fstab with the following content:

   /dev/block/platform/soc/1da4000.ufshc/by-name/system
   /dev/block/platform/soc.0/f9824900.sdhci/by-name/vendor

Bug: 78613232
Test: adb shell ls /dev/block/by-name
Change-Id: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
Merged-In: Iec920b5a72409b6a2bdbeeb290f0a3acd2046b5d
(cherry picked from commit 8eec38f4e4)
2018-05-19 09:31:35 +08:00