summaryrefslogtreecommitdiffstats
path: root/init
Commit message (Collapse)AuthorAgeFilesLines
* init: fix write_file checkreqprot logic errorNick Kralevich2015-04-252-8/+10
| | | | | | | | | write_file() returned -errno on error, not -1. Callers who check for -1 would falsely believe that the write was successful when it wasn't. Fixup write_file so that it return -1 on error consistent with other functions. Change-Id: Ic51aaf8678d8d97b2606bd171f11b3b11f642e39
* init: remove mkdir /dev /proc /sysNick Kralevich2015-04-251-4/+0
| | | | | | | These directories are already present in the initial ramdisk, and these mkdir calls are no-ops. Change-Id: I528f9e96a3471de904845a2f9e09c1b6ff83a708
* Switch init to epoll.Elliott Hughes2015-04-248-87/+60
| | | | | | | | | | | Not just because it's what the cool kids are doing --- it also lets us simplify the inner loop and decouple it from whatever systems want to be woken to perform some activity if there's data to be read on some fd. Currently this is just used to clean up the existing signal handling, keychord, and property service code. Change-Id: I4d7541a2c4386957ad877df69e3be08b96a7dec5
* Clean up property service initialization.Elliott Hughes2015-04-242-43/+27
| | | | | | | | | | | All the code that was being delayed does is create a socket. We can do that straight away, avoid the overhead, and simplify our main loop. The keychord fd, on the other hand, seems a little tricky. It looks like /dev/keychord isn't immediately available, at least not on N9; we have to wait for ueventd to set us up the bomb. Change-Id: I020e75b8e4b233497707f0a3cbbb6038b714161f
* Clean up init signal handling a little.Elliott Hughes2015-04-242-50/+46
| | | | | | | We can set it up earlier, and error reporting like this helped me find the SELinux problem with the last change to this code. Change-Id: If0f38bc5ff0465c4030e2d39d34f31f49b2d8487
* Merge "Setup signal handler before any exec command"Elliott Hughes2015-04-251-1/+3
|\
| * Setup signal handler before any exec commandJohan Redestig2015-04-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | Fixes init deadlock when an exec command was called in an on-init section. The exec command handling relies on that the signal handler mechanism is working to know when to continue executing commands. Change-Id: Ib0ce75ffad7cf3bf926c93d0506b2fe3e5a92630
* | Revert "Revert "Remove now-unusable 'setcon' command.""Elliott Hughes2015-04-244-17/+0
| | | | | | | | | | | | | | | | | | | | This reverts commit b862bd00a4192d48c3ae82156d8c35b32283e9e4. This change was fine but an earlier change it depended on was broken. That change has been fixed and resubmitted. Bug: http://b/19702273 Change-Id: I17e565721026e48e2a73526f729f2481d4d6edb5
* | Revert "Revert "Make init re-exec itself for its SELinux domain transition.""Elliott Hughes2015-04-241-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4217374611ada50f33aee544f015f6f9dfbf7ced. It turns out that the kernel passes any unrecognized arguments on to init, and (at least) N6 and N9 have such arguments. My lazy check of argc was thus insufficient to recognize what stage of init we were in, so we'd skip to stage 2 and not set up SELinux. And apparently you can get a very long way with SELinux off... We'll fix that in a later change. Bug: 19702273 Change-Id: I43b3fb722fed35dd217cb529cbcac9a29aff4e4b
* | init: consider all platform devices for find_platform_deviceTom Cherry2015-04-231-10/+0
|/ | | | | | | | | | | | | | | | | | | | | | | Certain platforms list their platform devices with a path other than the current /devices or /devices/platform. Additionally, sometimes these paths are a platform device themselves. An example are devices with a path /devices/soc.0/... where /devices/soc.0 is also a platform devices. Instead of continuing to special case these path prefixes, we can consider the entire path, given that no mmc or usb devices create platform devices as subdevices, which they should not by their very nature. This keeps the symlinks for block devices named identically for current platform devices and places them in /dev/block/<full path to device> for devices in locations other than /devices or /devices/platform, eg /dev/block/platform/soc.0/7824900.sdhci This keeps the symlinks for character deviced named identically for all cases. Change-Id: Ifc8eedf1086db1826dbc8f7e96cdfcfa5da876b3
* Don't try to read /system/default.prop.Elliott Hughes2015-04-151-1/+0
| | | | | | It doesn't exist. We use /system/build.prop. Change-Id: Ie635f9b3cc65de807f128339199b853db5a8eb2f
* Fix memory leak in parse_actionTom Cherry2015-04-131-0/+7
| | | | Change-Id: I3ed1da5674ae0b4ac50c1925e4f63af7f1748483
* Revert "Revert "fs_mgr_verity: Add support for squashfs""Mohamad Ayyash2015-04-081-0/+1
| | | | | | This reverts commit 7b97c7a3fa0f1bdae5b45a70f625ff48f9dab0c1. Change-Id: Id47e70479fe9247b7936f2e54d4dbfbb4f63f635
* Merge "Revert "fs_mgr_verity: Add support for squashfs""Mohamad Ayyash2015-04-081-1/+0
|\
| * Revert "fs_mgr_verity: Add support for squashfs"Mohamad Ayyash2015-04-081-1/+0
| | | | | | | | | | | | This reverts commit 807f47004f03653997edbe3c83d46350cb056cd4. Change-Id: I2d7972c0828c842b44747dd08fbe44668f2a55db
* | Merge "fs_mgr_verity: Add support for squashfs"Mohamad Ayyash2015-04-081-0/+1
|\ \ | |/
| * fs_mgr_verity: Add support for squashfsMohamad Ayyash2015-04-061-0/+1
| | | | | | | | | | | | | | | | - Cleanup the code to get filesystem size in a block device - Add support to reading size of squashfs in a block device Change-Id: I3848a705ed4dc2fc9afad20331f0fdecfee545c5 Signed-off-by: Mohamad Ayyash <mkayyash@google.com>
* | Merge "Set verity mode as the verified property value"Sami Tolvanen2015-04-071-2/+3
|\ \ | |/ |/|
| * Set verity mode as the verified property valueSami Tolvanen2015-03-311-2/+3
| | | | | | | | | | | | | | Set the verity mode as the value for partition.%s.verified to make it easier for userspace to determine in which mode dm-verity was started. Change-Id: Icc635515f8a8ede941277aed196867351d8387cb
* | Remove execonce.Elliott Hughes2015-04-034-69/+0
| | | | | | | | | | | | Use 'exec' instead. Change-Id: I1320d1971f7cd8b23753c27aa87089006e112a11
* | Merge "Remove no-op "capabilities"."Elliott Hughes2015-04-012-4/+0
|\ \
| * | Remove no-op "capabilities".Elliott Hughes2015-04-012-4/+0
| |/ | | | | | | | | | | | | This never worked, and implementing it would just be an attempt to cling to the pre-SELinux past. Change-Id: Iecba2affa50ee49ccf62677a607bfae95cb0aaf7
* | Merge "Revert "Revert "Adding e4crypt support"""Paul Lawrence2015-04-014-3/+61
|\ \ | |/ |/|
| * Revert "Revert "Adding e4crypt support""Paul Lawrence2015-03-314-3/+61
| | | | | | | | | | | | | | | | Fix build break caused by original change This reverts commit 84b0bab58fcc7f225e9a17a15c531b0c2fc509c5. Change-Id: I99fbd7c3d1ed92db1f546033c8493bb71a327924
* | Build init with clang.Elliott Hughes2015-03-301-0/+5
|/ | | | Change-Id: I14d95b3fe0505dd7d7632e2eedc537f97553c715
* Clarify a few things about bootcharts.Elliott Hughes2015-03-282-14/+13
| | | | | | | | | Make it clearer in dmesg when we're deliberately not doing bootcharting, and explain in the documentation that the output for init is quite misleading (and, as far as I can tell, not within our power to fix). Change-Id: I0b22a56f83521d64c6d176dc423c81f7ea86b23c
* Further cleanup of the logic in device_init.Elliott Hughes2015-03-281-11/+11
| | | | Change-Id: I96e4b11894926b50792b9b7d7cfa0fe8392abef6
* Fix clang build by removing unused locals.Elliott Hughes2015-03-281-9/+3
| | | | | | | | | | Also don't manually set FD_CLOEXEC on a socket that's always opened with SOCK_CLOEXEC. (None of the other callers to the function do this.) Also move locals to where they're first used to help prevent more of this kind of breakage. Change-Id: I1ba7cd9400f53508dffb51a2bbf9d491ae647f26
* Log more timing information from init.Elliott Hughes2015-03-2814-215/+251
| | | | | | | | | | | | | | | | | Also make important events in init's life NOTICE rather than INFO, and ensure that NOTICE events actually make it to the kernel log. Also fix the logging so that if you have a printf format string error, the compiler now catches it. Also give messages from init, ueventd, and watchdogd distinct tags. (Previously they'd all call themselves "init", and dmesg doesn't include pids, so you couldn't untangle them.) Also include the tag in SELinux messages. Bug: 19544788 Change-Id: Ica6daea065bfdb80155c52c0b06f346a7df208fe
* init: missing break statementMark Salyzyn2015-03-241-0/+1
| | | | Change-Id: Iac4a19c404590c3faba6021c7e537b01805c2d45
* Add missing parenthesis in init log message.Elliott Hughes2015-03-231-1/+1
| | | | Change-Id: Iddcd8a002bfc692b1e70d59fa8c6530306c500fa
* Fix the number of arguments for verity commandsSami Tolvanen2015-03-221-2/+2
| | | | | | | Neither of the built-in verity state commands accept arguments, so set the number of required arguments to zero. Change-Id: Id57fe671b6b82eaf1e43b8ed7ff9d1e502ada5bd
* Always use strerror to report errno.Elliott Hughes2015-03-204-7/+7
| | | | Change-Id: Icd18e4bd7dc093c18967f45b99cd451359457b03
* Merge "Ensure all init commands are documented."Elliott Hughes2015-03-211-30/+77
|\
| * Ensure all init commands are documented.Elliott Hughes2015-03-201-30/+77
| | | | | | | | Change-Id: I21ef4d88b33337093396e14d792e1ff1fe0bfa17
* | Merge "init: refactor firmware loading locations into table"Daniel Rosenberg2015-03-201-44/+32
|\ \
| * | init: refactor firmware loading locations into tableDaniel Rosenberg2015-03-201-44/+32
| |/ | | | | | | | | Change-Id: I3ce8f9d237bf783335ae85540306aa539a8da568 Signed-off-by: Daniel Rosenberg <drosen@google.com>
* | Use unique_ptr to call closedir.Elliott Hughes2015-03-202-56/+56
|/ | | | Change-Id: I8f572a06ce59283e5bd444ae0491dea71b0ea304
* Clean up property setting code.Elliott Hughes2015-03-204-60/+38
| | | | | | In particular, ensure that all property_set failures are reported. Change-Id: Iab94a28bcba2346868c0f39bcfe26e55a2c55562
* Merge "Lose bootmode and console globals."Elliott Hughes2015-03-201-42/+17
|\
| * Lose bootmode and console globals.Elliott Hughes2015-03-201-42/+17
| | | | | | | | | | | | | | Also remove some code marked "TODO: these are obsolete. We should delete them". Change-Id: I6255cee4cb6680bfcbc5b46366990309cba95037
* | Merge "Add init command to set verified properties"Sami Tolvanen2015-03-203-0/+27
|\ \ | |/ |/|
| * Add init command to set verified propertiesSami Tolvanen2015-03-193-0/+27
| | | | | | | | | | | | | | | | | | | | Add a command that updates dm-verity state and sets partition.%.verified properties used by adb remount. This is needed in init since fs_mgr cannot set properties: I6a28cccb1ccce960841af20a4b20c32d424b5524 Change-Id: I0fdf5bc29c56690dcadff9d0eb216d3c68483538
* | Parse boot properties from device treeRom Lemarchand2015-03-191-5/+48
| | | | | | | | | | | | | | | | | | - Make sure compatible DT node is "android,firmware" - Set ro.boot.* properties from firmware/android/ DT node (cherry-pick of cbcbea27c70846a96f4bba2f7cb245f937de4d3f.) Change-Id: If3d0716831516cb3d3fde1f75d57e2691d42d054
* | Merge "Remove /proc/cpuinfo parsing"Elliott Hughes2015-03-194-71/+5
|\ \ | |/ |/|
| * Remove /proc/cpuinfo parsingRom Lemarchand2015-03-144-71/+5
| | | | | | | | | | | | | | | | | | | | - Clean up the paths for ro.revision and ro.hardware parsing - Use ro.hardwre in ueventd instead of parsing the kernel command line (cherry-pick of 38b340a52f8e864650db8bae1eb88d5c00485db0.) Bug: 19366018 Change-Id: I018a293f3d46e736a8b65132b5b00b0f7c20edae
* | Merge "Remove useless memset from init."Elliott Hughes2015-03-191-1/+0
|\ \
| * | Remove useless memset from init.Elliott Hughes2015-03-181-1/+0
| | | | | | | | | | | | Change-Id: Ia880810bb2c9a976dceeb0ffdba0cb98e69e3c6d
* | | Remove chroot from init.Elliott Hughes2015-03-184-12/+0
|/ / | | | | | | | | | | This is not obviously useful. Let's wait until we have an actual need. Change-Id: I2c75c96314b281e89df25b6ed202b3dd5dfdaf15
* | Switch init over to _PATH_DEFPATH.Elliott Hughes2015-03-171-0/+3
| | | | | | | | | | Bug: 19564110 Change-Id: I343b4a360b10319dca13ab01f2d411ff940e9052