Commit graph

2477 commits

Author SHA1 Message Date
Anton Hansson
904bbd8405 Remove init_second_stage.recovery dep.
This makes the init module only produce artifacts in
/system. A simultaneous change in the core product
makefiles explicitly adds init_second_stage.recovery.

Bug: 112318375
Test: lunch mainline_arm64 && m nothing
Change-Id: I33f0f0c869dfb1ffe781fc682eeb20589a4ffe90
2018-08-15 08:50:43 +01:00
Treehugger Robot
3231be66ce Merge "Add sideload, fastboot as reboot targets in init" 2018-08-14 21:25:50 +00:00
Mark Salyzyn
d88b52e7f4 Merge changes from topic "squashfs+overlayfs"
* changes:
  init: add fs_mgr_overlayfs_mount_all to FirstStageMount
  adb: add overlayfs handling for readonly system filesystems
  fs_mgr: get fs_mgr_mount_all to call fs_mgr_overlayfs_mount_all
  fs_mgr: add overlayfs handling for squashfs system filesystems
2018-08-09 20:44:20 +00:00
Tom Cherry
e85b2addca init: clarify comment for the restorecon of second stage init
Test: we actually do need this restorecon for recovery.
Change-Id: I46a8d6ea5c08b18d79fa6dd8df0f4a98695363e2
2018-08-09 10:40:51 -07:00
Mark Salyzyn
934db8a4a5 init: add fs_mgr_overlayfs_mount_all to FirstStageMount
Test: compile & smoke
Bug: 109821005
Bug: 110985612
Change-Id: I51a4b7fc123e736035f74e126f71288721dc9fab
2018-08-08 15:42:46 -07:00
Xin Li
5d707816ac Merge "Merge Android Pie into master" 2018-08-07 16:51:24 +00:00
Tom Cherry
31438489c0 split first stage init into a separate executable
In the future, systems with dm-linear will require a ramdisk to set up
the mount for system.  In this world, first stage init will be a part
of this ramdisk and handle setting up dm-linear, mounting the
necessary partitions, then pivoting to the system image, which will
become the root partition.

This also enables previous devices without system-as-root, to be
unified with system-as-root devices for all aspects of boot after the
pivot_root.

Bug: 79758715
Test: boot hikey
Test: boot sailfish, boot sailfish into recovery
Change-Id: Iefa88a3ec5994e7989aa9f26f2de0351ffa5468b
2018-08-06 10:36:43 -07:00
Tom Cherry
5744e4d7d2 Merge "Split init's source files init first stage and second stage"
am: e0f6dc46d8

Change-Id: Iec525d3fb0e09550895d67709ed958f8337d9e34
2018-08-03 16:00:05 -07:00
Tom Cherry
44aceed016 Split init's source files init first stage and second stage
This is a baseline for splitting init first and second stage into
their own executables.

Bug: 79758715
Test: sailfish boots
Change-Id: I549ad4502893b3a5e4c2a9886f66850f6d31b619
2018-08-03 13:40:17 -07:00
Tom Cherry
3676564019 Merge "Move watchdogd out of init"
am: 132615b803

Change-Id: Icfc2511dfa3b905e25d6b8187557871960c0f9b1
2018-08-03 12:37:22 -07:00
Tom Cherry
132615b803 Merge "Move watchdogd out of init" 2018-08-03 19:28:14 +00:00
Hridya Valsaraju
71fb82a271 Add sideload, fastboot as reboot targets in init
Rebooting to these targets requires writing bootloader
messages and thus root. Moving them into init means that
adb, reboot don't need root to use these targets.

Test: try rebooting to these targets
Bug: 78793464
Change-Id: Ia002d1e3b1cb0c0616f60435fb9af4dce162cf84
2018-08-03 10:03:41 -07:00
Tom Cherry
106e66e475 Merge "ueventd: require opt-in for modalias handling"
am: d52b17ff0a

Change-Id: Id827bf76f889ebd996954448648365d20350ca01
2018-08-02 12:32:55 -07:00
Tom Cherry
40acb379cd Move watchdogd out of init
We're moving past a world where static executables are needed,
including watchdogd, so treat this like any other executable and place
it in /system/bin.

Bug: 73660730
Test: watchdogd still runs
Change-Id: I1f7508fd55dce6e9ee72a6ab7a085011a76c0053
2018-08-02 12:25:58 -07:00
Tom Cherry
d52b17ff0a Merge "ueventd: require opt-in for modalias handling" 2018-08-02 19:22:13 +00:00
Tom Cherry
780d80b5a6 Merge "init: run fsck for early mount partitions"
am: 6e05552e35

Change-Id: I6b44584616557ef3c58039eff6ce7eaf3c2d7623
2018-08-01 14:11:19 -07:00
Tom Cherry
6e05552e35 Merge "init: run fsck for early mount partitions" 2018-08-01 21:02:35 +00:00
Tom Cherry
457e28f129 ueventd: require opt-in for modalias handling
Some devices have modules.alias and modules.dep for modprobe and other
purposes but do not want to opt into ueventd auto loading their
modules.  Therefore we add a flag that can be added to ueventd
configuration files to opt into this behavior.

Bug: 111916071
Bug: 112048758
Test: check that modules are loaded with this opt-in
Test: check that modules are not loaded without this opt-in
Change-Id: Ifb281b273059b4671eea1ca5bc726c9e79f3adfb
2018-08-01 13:29:05 -07:00
Tom Cherry
81ae07509d init: run fsck for early mount partitions
Bug: 111883560
Test: fsck runs successfully during early mount
Change-Id: I19bcd2610f87f5331f94c228fcbec8f9379fc5e8
2018-07-31 13:58:17 -07:00
David Anderson
4444219482 Merge "liblp: Allow building liblp as a shared library."
am: 2756339c77

Change-Id: I20ea48eff3843461cdc00c470643088d350195f6
2018-07-28 15:57:51 -07:00
Treehugger Robot
2756339c77 Merge "liblp: Allow building liblp as a shared library." 2018-07-28 22:52:23 +00:00
Luis Hector Chavez
01448be93e Merge "init: Cleanly shut down subcontext processes"
am: f6b823141e

Change-Id: Ic1cf8485da1baec8fd329e3e3ff59029140603e2
2018-07-27 19:36:08 -07:00
David Anderson
f792e4163d liblp: Allow building liblp as a shared library.
Bug: 79173901
Test: system image, partition_tools both build
Change-Id: I70f45d4cebfbddc39d03aa3fb3a56b6c48a20d7e
2018-07-27 19:34:56 -07:00
Treehugger Robot
f6b823141e Merge "init: Cleanly shut down subcontext processes" 2018-07-28 02:30:22 +00:00
Jerry Zhang
3051d54902 Merge "Move recovery to /system/bin"
am: 0937a84521

Change-Id: Ic3f3eb82178e6c5af22945e3aaaac3f86beb4ec8
2018-07-27 13:34:11 -07:00
Treehugger Robot
0937a84521 Merge "Move recovery to /system/bin" 2018-07-27 20:25:53 +00:00
Luis Hector Chavez
92c49bcb30 init: Cleanly shut down subcontext processes
This change adds an explicit cleanup for the subcontext processes and
avoids them from respawning, which causes a bunch of LOG(FATAL)s when
the system is going down.

Bug: 80425914
Test: kill -TERM $INIT_PID, no crashes for subcontext inits

Change-Id: I135191d959c1dd921b102af316b24d2bc161d6c9
2018-07-27 11:19:44 -07:00
Treehugger Robot
18be1e2f7e Merge "Add support for /product-services partition." 2018-07-27 17:15:05 +00:00
Tom Cherry
dd62c204da Merge "ueventd: Add dynamic kernel module loading"
am: 8b25b87074

Change-Id: I5163ae98e70cba3e89ea2ae538579f504e03256d
2018-07-26 15:08:21 -07:00
Dario Freni
3613710099 Add support for /product-services partition.
This CL is largely and adaptation of
Ie996def20e25dc1afe0c74af2096af844934b2dc

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.

Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80
Merged-In: I1046dfe19bf874da929c9131b76a1f85422fbb80
2018-07-26 16:27:28 +00:00
Dario Freni
d99a836380 Merge "Add support for /product-services partition." into stage-aosp-master 2018-07-26 16:16:38 +00:00
Andrew F. Davis
9963847419 ueventd: Add dynamic kernel module loading
For some platforms it is not known at build time what devices
will be attached at runtime. Building into the kernel or pre-loading
at init all the modules that could be needed would unnecessary bloat
the kernel. The solution is dynamic kernel module loading.

The kernel will generate uevents when devices are added, userspace
should monitor for these events and load the compatible modules.

The init process already monitors for uevents, add here the ability
to respond to modalias events and preform the correct action.

Adding this to init is preferred over an external program as we
can read and process the module alias and dependency files once,
instead of for each module needing to be loaded.

Test: Run on Beagle-X15, check all needed modules are loaded (lsmod)
Change-Id: I1b57d9aeb0a9770f309207183dc4bc2b7b905f14
Signed-off-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
2018-07-26 09:42:22 -05:00
Jerry Zhang
5de2be5cd5 Move recovery to /system/bin
Executables should be in /system/bin
rather than sbin. Change lookup paths
in a few places to reflect this.

Test: recovery is in system/bin
Bug: 78793464
Change-Id: Ibcdff7abf1f21e2566e02cad8bdb3c26ee500534
2018-07-24 21:42:23 -07:00
Tom Cherry
4d71e6fb45 Merge "init: fix typo in error message"
am: 2efcb522df

Change-Id: I36cc5ebced34cbd288123a71081997c909361890
2018-07-24 17:55:51 -07:00
Tom Cherry
8c901dda30 init: fix typo in error message
Test: none
Change-Id: Ie8417c7c6e3f6600544006c4a84b5bdfaff9725f
2018-07-24 15:54:33 -07:00
TreeHugger Robot
c67c7f9a3a Merge "Revert "Use more shared libraries in adb and init."" into stage-aosp-master 2018-07-23 19:18:34 +00:00
Hridya Valsaraju
22c2202e75 Revert "Use more shared libraries in adb and init."
This reverts commit fbd79687e6.

Reason for revert: b/111734137

Change-Id: I70e23ed20d16821a555b448d4ac76fe9e130afa5
2018-07-23 17:48:57 +00:00
Dario Freni
4fa866a467 Add support for /product-services partition.
This CL is largely and adaptation of
Ie996def20e25dc1afe0c74af2096af844934b2dc

Bug: 80741439
Test: Successfully built product-services.img with one module in it, and
flashed on device. Also successfully built image with
/system/product-services and no dedicated /product-services partition.
Change-Id: I1046dfe19bf874da929c9131b76a1f85422fbb80
2018-07-23 16:14:36 +01:00
Tom Cherry
9ad886c3cb Merge "init: rename init_first_stage"
am: 1d2b29a902

Change-Id: Ic92fae3ca17b0f05eabd8172548f8072d0eb6060
2018-07-20 21:19:13 -07:00
Tom Cherry
3203244471 Merge "init: clean up logging initialization"
am: 258109ce4a

Change-Id: I4918bc14048dc9fed10293b7a15cfb3b059f6181
2018-07-20 21:18:36 -07:00
Tom Cherry
1272c0ec21 Merge "init: removed unused includes"
am: 21d03d83fa

Change-Id: I31669436a744cca21127e8321c39d02967cc81ea
2018-07-20 21:17:59 -07:00
Treehugger Robot
1d2b29a902 Merge "init: rename init_first_stage" 2018-07-21 02:47:36 +00:00
Tom Cherry
258109ce4a Merge "init: clean up logging initialization" 2018-07-21 02:01:14 +00:00
Tom Cherry
f02506938e init: removed unused includes
Test: build
Change-Id: Ie3020491f67f6930acebe6397be6997b59477b96
2018-07-20 22:48:51 +00:00
Tom Cherry
38a11ccdd1 init: rename init_first_stage
In preparation for splitting first stage init from the rest of the
init executable, rename these files which are specifically involved in
first stage mount operations to a more appropriate name.

Test: builds
Change-Id: I8a2d4e8c7e1deea1bab45cc8e738727bc2ceb3e5
2018-07-20 15:31:36 -07:00
Tom Cherry
74069d1734 init: clean up logging initialization
Clean up a few mistakes in logging initialization

1) Only init needs to clear stdout/stderr/stdin, so remove this from
   ueventd, watchdogd, and subcontext init
2) Only init should reboot due to FATAL errors. This was true even
   before this change due to getpid() checks, but there's no reason to
   not just use the DefaultAborter for other processes.
3) It's probably a mistake for FATAL logs in init to try to gracefully
   shutdown the system, so simply call RebootSystem() here.
4) Lastly, remove log.cpp since it's not actually shared code anymore

Test: build
Change-Id: Ic8c323393dc7ee98ed6bb9691361b51d0d915267
2018-07-20 15:30:14 -07:00
Jerry Zhang
fbd79687e6 Use more shared libraries in adb and init.
fs_mgr is used by several different
processes in both system and recovery,
so it makes sense for it to be a shared
library to save space.

libadbd is used by adbd, recovery (as minadbd)
and fastbootd so it should be shared as well.

Bug: 78793464
Test: compiles
Change-Id: I4225f4d1a44e6e5811c68a55595d1f94f0773114
Merged-In: I4225f4d1a44e6e5811c68a55595d1f94f0773114
(cherry picked from commit aacfc68acf)
2018-07-20 17:54:44 +00:00
David Anderson
37716f6c81 Merge "fs_mgr: Remove early prototype code."
am: 881be58f41

Change-Id: I4215c6e183ddbda94cbb0de77f271a68fe21640b
2018-07-19 16:39:56 -07:00
Treehugger Robot
881be58f41 Merge "fs_mgr: Remove early prototype code." 2018-07-19 23:32:33 +00:00
David Anderson
241506b00b Merge "init: Don't look for logical partitions via uevents."
am: 8ab1fd076d

Change-Id: Ic4019cf8dfb24df708104cac4c8d81597e4c1ecc
2018-07-19 14:51:38 -07:00