summaryrefslogtreecommitdiffstats
path: root/init
Commit message (Collapse)AuthorAgeFilesLines
* init: Fix possible open file pointerMichael W2016-11-131-1/+3
| | | | | | | In error case the file is not closed properly. Add close() before return Change-Id: Ie1755987859a576045c786105404957d94f0b39d
* init: Allow devices to opt-out of fsck'ing on power offChristopher R. Palmer2016-05-162-0/+6
| | | | | | | | On the zenfone2 the fsck code patch kills alls processes. This causes watchdogd to get killed which then causes the system to emergency reboot instead of powering off. Change-Id: Ibcc74825df6571caa70e2dde7766a72b7749581b
* Use fsck.f2fs -a instead of -f for faster bootYusuke Sato2016-05-051-1/+70
| | | | | | | | | | | | | | | | | | and run fsck with -f on clean shutdown instead. With -f, fsck.f2fs always performs a full scan of the /data partition regardless of whether the partition is clean or not. The full scan takes more than 2 seconds on volantis-userdebug and delays the OS boot. With -a, the command does almost nothing when the partition is clean and finishes within 20-30ms on volantis-userdebug. When the partition has an error or its check point has CP_FSCK_FLAG (aka "need_fsck"), the command does exactly the same full scan as -f to fix it. Bug: 21853106 Change-Id: I126263caf34c0f5bb8f5e6794454d4e72526ce38
* Revert "Revert "init: Temporarily increase coldboot timeout to 5s""Gabriele M2016-04-111-1/+1
| | | | | | | | | 1 second might not be enough for some devices to complete the coldboot phase, so bring the timeout back to 5 seconds. This reverts commit c9e804ffd8d4108806eb8162fe7cf35f179b0596. Change-Id: If10cd4bb1ea66d1c98cdd16f5bfbdae7a04b52e8
* init: Fix derp in property name for rebooting to charger hookChristopher R. Palmer2016-03-131-1/+1
| | | | Change-Id: Ibfee73723d778f16f8e407380083bf3a2667a7a4
* init: Add a hook to turn a shutdown into a rebootChristopher R. Palmer2016-03-121-0/+3
| | | | | | | | | | | | | Intel bootloaders have not yet been made android friendly. When the bootloader is told to shutdown it will shutdown. Android expects the bootloader to actually shutdown if there is no charger connected and otherwise to enter charging mode. Add a hook to init that allows healthd to determine what a shutdown should do. When the property is specified, any request to shutdown will instead trigger a restart into the specified mode. Change-Id: Ie96fb58ecb9a4e8ffe7e73e590483b5323e40b74
* init: Add property_get_boolChristopher R. Palmer2016-03-122-0/+28
| | | | Change-Id: I2bef1862f6126f79c64faa7080a00096e4f955c5
* init: Android.mk: don't build libext4_utils_static twicekostoulhs2016-02-101-1/+0
| | | | Change-Id: I8ef939bcd060605a0d29fe73fbc01990b94a9b91
* Add vendor hook to handle_control_messageAaron Kling2016-01-013-0/+12
| | | | | | | | | | | | This is needed for Nvidia Shield devices to handle a 'restart consolemode' request from a blobbed stock app. The vendor function is expected to return non-0 if it did not handle the message and 0 if it did (or wants it ignored). Forward port of 119414. Change-Id: Ia8e4ba0bbf561f29f72862cd986f1660d7b501da
* Merge tag 'android-6.0.1_r3' of ↵Steve Kondik2015-12-071-1/+1
|\ | | | | | | | | | | | | | | https://android.googlesource.com/platform/system/core into HEAD Android 6.0.1 release 3 Change-Id: I8b65c0223e3444360432abd871a9d8f007831ba0
| * Remove __DATE__/__TIME__ from init and debuggerdDan Willemsen2015-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Keeping these means that every build has different init and debuggerd binaries, even if the source was the same. So OTAs that don't touch these sources would still need to update the binaries. Both of these messages are only informational, so can be safely removed. Bootchart already encodes build-specific information from the system properties. Bug: 24204119 Change-Id: I7ebd65a20a3e031e7528c9f741616e20b3cd7446 (cherry picked from commit 30622bbb209db187f6851e4cf0cdaa147c2fca9f)
* | init: Allow targets to ignore the ro.revision propertyChristopher N. Hesse2015-11-292-0/+6
| | | | | | | | Change-Id: I789879cde2797474b9303fd5bbf10d4760e6b822
* | ueventd: Fix bootdevice by-name/by-num link creationDavid Ng2015-11-241-13/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | Create bootdevice by-name/by-num links only if the block device is the bootdevice. This fixes the issue of bootdevice path being created incorrectly if the first reported device with by-name/by-num is not the bootdevice. It also fixes devices in which the bootdevice property doesn't exist, or the symlink is created by a later step in the init sequence (such as init.rc itself) Change-Id: Ifb68080e3149917f9ee88a4a421007f29e8d83d2
* | init: Add support for gzipped firmware filesChris Fries2015-11-232-15/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case no matching firmware is found, re-search the paths for [path][firmware].gz and use that instead if found. Reviewed-on: http://gerrit.mot.com/724787 SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Wen-Long Che <wenlong@motorola.com> SME-Granted: Gerrit Application <gerritmailarchive@motorola.com> Reviewed-by: Christopher Fries <cfries@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com> Adapted for Marshmallow by Benjamin Legrand (scritch007) Change-Id: I74e42ab3c77eb7722c58042489d7bd4856f3be63
* | init: Fire a trigger when a class is started/stoppedSteve Kondik2015-11-111-4/+16
| | | | | | | | | | | | | | * This allows us to react to these events without messing with the master config. Change-Id: Ifc72efc7b4cc0718838c711395f5fdc3b043827a
* | init: fix logic for determining charger modeDan Pasanen2015-11-071-1/+1
| | | | | | | | Change-Id: Ib4dd630b760303f26c794997aee3a5920cbeaaf5
* | init: create symlinks to mtd block device nodesBrian Beloshapka2015-11-071-0/+59
| | | | | | | | | | | | | | | | | | | | Given a device in the form of "/devices/virtual/mtd/mtd0/mtdblock0": * Creates symlinks for mtd block devices in /dev/block/mtd/mtd<partition number> * Creates symlinks based on partition name in /dev/block/mtd/by-name/<partition name> Change-Id: Id8d61be88935a0ef83297d1d5e453d8ba0d586de
* | init: define BOARD_CHARGING_CMDLINE parametersEthan Chen2015-11-071-1/+3
| | | | | | | | Change-Id: I18eaae51d293a03552905ee3a952b2de20e1a311
* | init: Bring back support for arbitrary chargermode cmdlinesRicardo Cerqueira2015-11-071-1/+10
| | | | | | | | | | | | | | | | This was accidentally removed while debugging the init breakage fixed in change I8ef5c932efcd5e7f8d6f6fce0915683d84c3ee11. Put it back Change-Id: Iaacc30abff0bcd9fa49f98b158b293fa363d9ea3
* | init: Allow devices to use user-space tools to set ro.serialnoChristopher R. Palmer2015-11-072-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CUrrently, init will always set a ro.serialno value which means that the kernel is the only option for configuring the serial number. The zenfone2 stores the serial number in a file-system that is mounted during the boot process and provides tools that pull the factory configuration from there. To support this, we need to allow init to opt-out of setting the serial number for us. Change-Id: I9c307d91bb8d3cb1c881213dd28e4f76e6eae14f
* | init: add detection of charging modePawit Pornkitprasan2015-11-052-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Prashant Somashekar's patch which is in turn based on techomancer's patch http://goo.gl/I19GG. When BOARD_CHARGING_MODE_BOOTING_LPM is set, init will read that value (usually from /sys) and enable charging mode when set to 1. This differs from the original patch in that Samsung-specific lpm.rc is not loaded, but instead, init.rc is loaded using the "charger" class, which is how AOSP devices handle charging. The change is because the either the SELinux or the init.rc changes is causing lpm.rc to not work, and porting lpm.rc to the Android system is easier than trying to fix it. Change-Id: Ice7a074da7e982f9a64aaa97de28bfcbccdc8b91
* | Merge tag 'android-6.0.0_r26' into cm-13.0Ricardo Cerqueira2015-11-055-46/+56
|\ \ | |/ | | | | | | | | Android 6.0.0 release 26 Change-Id: I93d1e3767cbacab2b18cff360065c91b9eaf1d96
| * DO NOT MERGE init: Fix parsing of multiple property triggersTom Cherry2015-09-011-24/+23
| | | | | | | | | | | | | | | | | | | | | | | | Triggers of the form on property:a=b && property:b=c are only triggered on the transition of a->b (given that b=c), but not on the transition of b->c (given that a=b). This commit allows both transitions to trigger the property as expected Bug 23631258 Change-Id: I9f70b4cbf36f8a99d10c37ad049ae8ceb378d610
| * Merge "Set up user directory crypto in init." into mnc-dr-devPaul Crowley2015-07-133-5/+21
| |\
| | * Set up user directory crypto in init.Paul Crowley2015-06-233-5/+21
| | | | | | | | | | | | | | | | | | | | | (cherry-picked from commit b94032b79c3cded501e2d5f7c328cf8c0c3911c4) Bug: 19704432 Change-Id: Ife4928ffbee39c8ae69e6ba66d9ce5ef5a0beb76
| * | Change init sequence to support file level encryptionPaul Lawrence2015-07-075-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File level encryption must get the key between mounting userdata and calling post_fs_data when the directories are created. This requires access to keymaster, which in turn is found from a system property. Split property loaded into system and data, and load in right order. Bug: 22233063
* | | ueventd: Add bootdevice links support for selinuxBiswajit Paul2015-10-301-2/+12
| | | | | | | | | | | | | | | | | | Adding bootdevice support to define context on common symlink. Change-Id: I25d7239614539d1ef2c9920e2c321824ee2c664b
* | | init: Make restorecon_recursive work for /data/Christopher R. Palmer2015-10-181-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following commit: commit f2b7ee765516c84a9995e3acdc8fbcd7dc1b33cc Author: Stephen Smalley <sds@tycho.nsa.gov> Date: Thu Feb 6 13:52:52 2014 -0500 Apply restorecon_recursive to all of /data. they removed all the adhoc restorecon_recursive of subdirectories of /data/ and replaced it with: # Set SELinux security contexts on upgrade or policy update. restorecon_recursive /data Unfortunately, that is a no-op because restorecon doesn't recurse through /data/ unless you add a FORCE flag. Since the expectation seems to be that the recursive restorecon in init will actually work, update the built-in to add the force flag and a flag to allow /data/data to also be recursed through. [RC: Removed the DATADATA flag. It throws a ton of errors, and it's supposed to be handled by seapp_contexts, not file_contexts. The actual root paths, however, now get their individual restorecon calls so that installd can deal with them] Change-Id: I435c505188e924b27ef2e6a2e0ee0a6951e43f0e
* | | init: Add vendor-specific initialization hooks.David Ng2015-10-165-0/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | Allow optional vendor-specific initializations within init. This can be used for runtime initialization setup that init rc scripts do not support. Change-Id: I7623a0d59b18f9ec8e3623958e2f7ccd72b877bf
* | | Rename libext2_uuid -> libext2_uuid_static libquanganh26272015-10-161-1/+1
| | | | | | | | | | | | Change-Id: I2dd416558321c424bca97efa973ee5a68b742a64
* | | fs_mgr: Skip filesystem check unless fs_type matchesDan Pasanen2015-10-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | * Prevent accidentally destroying a partition of the wrong type. * Don't skip iterations of the internal mount_all loop, otherwise encryptability may not be properly handled. Change-Id: I8f3ddc396a5fb85f4ae0a0a11dd61fb4d6462d6d
* | | init: Let a device's init.rc redefine service entriesRicardo Cerqueira2015-10-152-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of duplicate service definitions, init.rc's version always wins. This is a less-than-ideal situation and the main reason for some devices to override the default init.rc, which leads to out-of-sync situations whenever we happen to insert something into the main copy. So let services be overridden. To prevent accidental override of system services, use a specific keyword for this, "service_redefine" Change-Id: I94eb4ebadfda8982128ec17f639411c03b18f68f
* | | Revert "system: core: Add uevent support for dvb devices"Satish Kamuju2015-10-061-21/+0
| | | | | | | | | | | | | | | | | | This reverts commit ecfbe4c386d3a6f3bd36da81e277decc17678be0 Change-Id: I2c09c4a589c82dcbe0147c097fe22a0fb02b88c4
* | | system: core: Add uevent support for dvb devicesHamad Kadmany2015-10-061-0/+21
| | | | | | | | | | | | Change-Id: I9a31183014cc370a2d948dbd1d6a36a6e89b4c13
* | | init: powerctl: Reject "keys*" reboot reason unless in recoveryDavid Ng2015-10-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Reject all reboot reason starting with "keys" unless in recovery mode. This avoids mission mode, non-root (e.g. shell) users for triggering privileged reboot modes. Change-Id: I3727d0a92627a6cdf5f762ac61625c30bfa88946
* | | Revert "init: Temporarily increase coldboot timeout to 5s"David Ng2015-10-061-1/+1
| | | | | | | | | | | | | | | | | | | | | Increased coldboot timeout delay is no longer needed; revert. This reverts commit 4b6578901b4a9f4d3306d83ee1fefb80f95226a9. Change-Id: I3afaec458b5f7d05e5cefbd8e8fcd72d87270fe7
* | | init: Add support for fast factory boot mode(ffbm)Ameya Thakur2015-10-062-4/+13
| | | | | | | | | | | | | | | | | | | | | We now boot into ffbm mode based on the value of the ro.bootmode property. Change-Id: Id1cd3d13182479cc9272bb4b3fb74a99083a3cff
* | | init: Temporarily increase coldboot timeout to 5sDavid Ng2015-10-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Temporarily increase coldboot timeout to 5s to account for slower initialization during new hardware bring-up. This change will need to be reverted once the bring-up process is complete. Change-Id: I8816ed909b8758274078f15f1d8bc420098b57bf
* | | ueventd: Add bootdevice symlink for boot storage deviceDavid Ng2015-10-062-0/+12
|/ / | | | | | | | | | | | | | | | | | | | | Create /dev/block/bootdevice symlink for the boot storage device based on ro.boot.bootdevice property. The property value can be passed in via bootloader. This abstracts references to the boot device (including partition nodes in the boot device) from the actual device nodes (e.g. eMMC, UFS). Change-Id: I9c921fc9e31855759435fac27bd384645eee0236
* | Revert "Change init sequence to support file level encryption"Paul Lawrence2015-07-075-7/+13
| | | | | | | | | | | | This reverts commit d815178b7512cb44d8b5f234e3f823b5a3e44dea. Change-Id: I7e3f55d3092fcd04ea9f62f1971c9d42570f096c
* | Change init sequence to support file level encryptionPaul Lawrence2015-07-065-13/+7
|/ | | | | | | | | | | File level encryption must get the key between mounting userdata and calling post_fs_data when the directories are created. This requires access to keymaster, which in turn is found from a system property. Split property loaded into system and data, and load in right order. Bug: 22233063 Change-Id: I8a6c40d44e17de386417a443c9dfc3b4e7fe59a5
* init support for cgroups.Elliott Hughes2015-06-175-40/+71
| | | | | | | | | | This adds the "writepid" option that instructs init to write the child's pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs and/or /dev/cpuset/foreground/cgroup.procs). Bug: http://b/21163745 Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a (cherry picked from commit d62f0608d9d67bf647cf15debbd163e84584fe44)
* New "selinux.restorecon" control property.Jeff Sharkey2015-06-091-3/+10
| | | | | | | | | | | This new property is used as a control verb for running a recursive restorecon at the path contained in the property value. Shifts both SELinux actions to occur before the actual property set occurs, so setters can watch for completion. Bug: 21121357 Change-Id: I3db3eb876ae66e144b3bfd648349b66a028511fd
* init: change exec parsing to make SECLABEL optionalMark Salyzyn2015-06-023-3/+5
| | | | | | | | (cherry pick from commit 17fff893c04971b519d25d52b07f51111353cba5) Allow SECLABEL to be - to denote default Change-Id: I58cdc6c805dc6e50dc42b7e13e72d0eaf4864f11
* DO NOT MERGE Securely encrypt the master keyPaul Lawrence2015-05-291-32/+26
| | | | | | | | | | | | | | | | | | | | | | (chery-picked from commit 806d10be2336f32cdca16c2540cbf3d548f2fec7) Move all key management into vold Reuse vold's existing key management through the crypto footer to manage the device wide keys. Use ro.crypto.type flag to determine crypto type, which prevents any issues when running in block encrypted mode, as well as speeding up boot in block or no encryption. This is one of four changes to enable this functionality: https://android-review.googlesource.com/#/c/148586/ https://android-review.googlesource.com/#/c/148604/ https://android-review.googlesource.com/#/c/148606/ https://android-review.googlesource.com/#/c/148607/ Bug: 18151196 Change-Id: I6a8a18f43ae837e330e2785bd26c2c306ae1816b
* Don't use TEMP_FAILURE_RETRY on close in system/core.Elliott Hughes2015-05-271-2/+2
| | | | | | Bug: http://b/20501816 Change-Id: I1839b48ee4f891b8431ecb809e37a4566a5b3e50 (cherry picked from commit 47b0134ec2b5e8c8b5b5671cd4a3e41261275532)
* init: wait_for_file use smaller time resolutionThierry Strudel2015-05-221-2/+2
| | | | | | | | | | As 1s timeout can be requested, using second resolution time to check for timeout prevent from being accurate on the actual time we wait. Use available gettime_ns instead. Bug: 21374269 Change-Id: I8be1b69e02beacc7196427f97855e036addf54d1 Signed-off-by: Thierry Strudel <tstrudel@google.com>
* Reduce the coldboot timeout to 1s.Elliott Hughes2015-05-151-1/+4
| | | | | | | | | | | | | | 5s was already a ridiculously long time to delay booting, and some OEMs are trying to make it even more insane: https://www.codeaurora.org/cgit/quic/la/platform/system/core/commit/?h=lp&id=fd23edd48272976d2fb333f377242173f92aa343 Let's at least ensure that Nexus and Android One devices don't take forever to boot... Bug: http://b/19899875 Change-Id: I9680c166a759360f34118e51cd0645e12b6bd5c8 (cherry picked from commit c7331d02d1c6b1e51b3a1210506f38fd61819495)
* Fix insmod module sizeTom Cherry2015-05-125-15/+11
| | | | | | | | | | | | | read_file() used to append a new line character to the end of the buffer it returns, because parse_config() isn't able to cope with input that's not '\n'-terminated. Fix read_file() to be less insane, and push the workarounds into the parse_config() callers. Longer term we should rewrite parse_config(). Bug: http://b/21079470 Change-Id: Ie9d9a7adcd33b66621726aef20c4b8cc51c08be7 (cherry picked from commit eaa3b4ec6f79fe06163b8dd6fe8ba2581d3b9c0b)
* Enable property expansion for insmodEmmanuel Berthier2015-05-121-1/+10
| | | | | | | | | | | Useful for dynamic kernel module location. This permits to use init rule like: insmod ${persist.modules.location}/<module_name> Change-Id: If7479bdcb4e69ea7666f52a0075c785be025c2e9 Signed-off-by: Emmanuel Berthier <emmanuel.berthier@intel.com> (cherry picked from commit ac41230cbc10bae95a049282238adb03605579c2)