Commit graph

423 commits

Author SHA1 Message Date
Nick Kralevich
87980b5c9f Revert "init: Set ADDR_COMPAT_LAYOUT before spawning processes."
This reverts commit 01b1dee0ab.

Bug: 7188322
Change-Id: Ia159eab36e9e7373f470d20a3796b63868ea5689
2012-10-05 12:45:05 -07:00
Nick Kralevich
569182a2ab am 7f3de6a4: am d282dfc4: Merge "init: Set ADDR_COMPAT_LAYOUT before spawning processes." into jb-mr1-dev
* commit '7f3de6a450f025245bb27fdc13f5bbc1dc22624d':
  init: Set ADDR_COMPAT_LAYOUT before spawning processes.
2012-10-05 12:14:11 -07:00
Nick Kralevich
01b1dee0ab init: Set ADDR_COMPAT_LAYOUT before spawning processes.
Some Android programs have problems with memory which grows
from the top down.  Temporarily set ADDR_COMPAT_LAYOUT to
avoid breaking those programs.

Bug: 7188322
Change-Id: I61760500e670b4563838c63b82d4a0b6e354a86e
2012-10-05 12:02:46 -07:00
Nick Kralevich
474cb0e33a am 33045b3d: am f9c05970: Merge "init: harden property service."
* commit '33045b3d7bd965f67e2e0b175976cf9934fb924f':
  init: harden property service.
2012-10-04 11:47:06 -07:00
Nick Kralevich
7ecfe6a94b init: harden property service.
Don't create temporary files in a well-known location. Rather,
use mkstemp().

Don't read persistent property files from insecure files.

Change-Id: I81e2aca674a2a7ca54869f088737fb228d3af6d2
2012-10-04 10:47:05 -07:00
Nick Kralevich
32b9023d08 init: Don't read local properties if ro.debuggable=0
Bug: 7195965
Change-Id: I29fdad61aa61f2c46d49db227cf7b84d9cc6f25d
2012-09-19 13:03:18 -07:00
Jean-Baptiste Queru
c3a4a054a9 am 3af04b71: am 7c386a61: Merge "Extend and document the "wait" command"
* commit '3af04b71e51e89af02a1fe526e4fc32dce0100d3':
  Extend and document the "wait" command
2012-08-20 10:29:38 -07:00
Jean-Baptiste Queru
7c386a610d Merge "Extend and document the "wait" command" 2012-08-20 09:18:38 -07:00
Jean-Baptiste Queru
d7f78e88b5 am e3bdaeb6: am 2765e4fb: Merge "Use sigemptyset to initialise signal mask as it is more portable. Referencing sa_restorer fails on MIPS"
* commit 'e3bdaeb603ab7ac941b35b41856c6b8ebf47c6bb':
  Use sigemptyset to initialise signal mask as it is more portable. Referencing sa_restorer fails on MIPS
2012-08-15 09:37:56 -07:00
Iliyan Malchev
a8f1e11bcc Merge "bluetooth: bring up with bluedroid stack" into jb-mr1-dev 2012-08-15 09:20:33 -07:00
Jeonghoon lim
e953e9657c bluetooth: bring up with bluedroid stack
- change permission of "bluetooth." property to AID_BLUETOOTH

Change-Id: Ifcd97f136cfc3372412fe500e4f800d1bbbd065c
2012-08-15 01:34:31 -07:00
Benoit Goby
5c8574b512 init: Fix mkdir command when using ISUID or ISGID bit
On first boot, the directory is created with root:root ownership and
then chowned. chown clears the ISUID and ISGID bits, so we need to chmod
the directory again after chown.

Change-Id: I02dfe7a19a637678256b4e7cc09e6b5431e6f11e
2012-08-14 15:51:44 -07:00
Chris Dearman
6736eb1829 Use sigemptyset to initialise signal mask as it is more portable.
Referencing sa_restorer fails on MIPS

Change-Id: I81c9ed5ef027a9d5258942ffcecb96e3f787e93c
Signed-off-by: Chris Dearman <chris@mips.com>
2012-08-14 15:30:39 -07:00
Jeff Sharkey
90b80de5a7 Merge "Support shared-subtree and bind mount flags." into jb-mr1-dev 2012-08-14 14:17:45 -07:00
Jeff Sharkey
e50ac5f777 Support shared-subtree and bind mount flags.
Bug: 6925012
Change-Id: Id8d887d17c6b1b2f90cfd1a1de991ccaba730b7d
2012-08-14 12:38:14 -07:00
Jean-Baptiste Queru
96539e8153 am ee0d281a: am c95c15b1: Merge "Char device /dev/dri/card0 was not created during startup."
* commit 'ee0d281a3e5fe611bdda23db18fa0e5684ee43ed':
  Char device /dev/dri/card0 was not created during startup.
2012-08-14 08:41:16 -07:00
Jean-Baptiste Queru
c95c15b192 Merge "Char device /dev/dri/card0 was not created during startup." 2012-08-14 08:06:44 -07:00
Kenny Root
2fec4de5c7 am 11c783f1: am 9494f297: Merge "Implement SELinux/MAC checks for property service."
* commit '11c783f1ead9f276e8854cb1adaebeed8517e8a1':
  Implement SELinux/MAC checks for property service.
2012-08-13 10:22:57 -07:00
Kenny Root
605103fb55 resolved conflicts for merge of 4dcd52ab to jb-mr1-dev
Change-Id: Ibd0c03a7883a2e31adab18543c016776b7b36866
2012-08-13 10:21:35 -07:00
rpcraig
63207cd20f Implement SELinux/MAC checks for property service.
This is a set of changes to the init property service
implementation to apply a SELinux check over who can
change what properties. Also included control hooks
for the 'ctl' keys.

Change-Id: I5a18809bf5536f6459a36b6bf0d622b9f5061aa0
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>
2012-08-09 10:05:49 -04:00
Stephen Smalley
ae6f3d7c05 Add support for reloading policy from /data/system.
To support runtime policy management, add support for reloading
policy from /data/system.  This can be triggered by setting the
selinux.loadpolicy property to 1, whether from init.rc after
mounting /data or from the system_server (e.g. upon invocation of
a new device admin API for provisioning policy). ueventd and
installd are restarted upon policy reloads to pick up the new
policy configurations relevant to their operation.

Change-Id: I97479aecef8cec23b32f60e09cc778cc5520b691
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-08-09 09:59:10 -04:00
Stephen Hines
4900f43670 am f442cf27: am b3a5343e: Merge "Fixed a discarded const qualifier warning"
* commit 'f442cf27c5d1229eb32973cb499578ccd63ba727':
  Fixed a discarded const qualifier warning
2012-08-08 17:44:04 -07:00
Stephen Hines
b3a5343e3e Merge "Fixed a discarded const qualifier warning" 2012-08-08 15:27:25 -07:00
Jean-Baptiste Queru
ff5c802e6c am faad67fa: am ef3f7fa3: Merge "Set the SELinux security label on new directories."
* commit 'faad67fac68642ca039fe5c29099acebf546f5ee':
  Set the SELinux security label on new directories.
2012-08-08 14:06:27 -07:00
Jean-Baptiste Queru
ef3f7fa32b Merge "Set the SELinux security label on new directories." 2012-08-08 13:42:20 -07:00
Ravi Nagarajan
a8afd723a4 Allow AID_BLUETOOTH to update persist.service.bdroid
When devices are provisioned, bd address path is set in ro.bt.bdaddr_path.
On devices where this property is not present, a random bd address is
generated and saved to the property: persist.service.bdroid.bdaddr
This change allows bluetooth process to update this property
bug 6885309

Change-Id: I2e8a2471a0e890da82e6bbec6a2ef67ec8e1f8f4
2012-08-06 23:56:45 -07:00
Veeren Mandalia
4f97fd91e3 init: fix return value for android uid/gid check
Now get_android_id function returns -EINVAL if the uid/gid is not in the list
of android ids. This will allow ueventd to catch invalid ids and report the
error.

Change-Id: I943b04dd64d518891623e1ee2d561b8061af4863
Signed-off-by: Veeren Mandalia <v.mandalia@sta.samsung.com>
2012-08-03 13:16:05 -07:00
Edwin Vane
de7f1ad86f Fixed a discarded const qualifier warning
Change-Id: I9007924d0bf49705363aa130e6e588a9e0ccdc31
Author: Edwin Vane <edwin.vane@intel.com>
Reviewed-by: Tareq A Siraj <tareq.a.siraj@intel.com>
2012-08-02 09:20:51 -04:00
Ed Heyl
3cac204d35 Merge remote-tracking branch 'goog/jb-dev-mako' into jb-mr1-dev 2012-07-28 11:48:12 -07:00
Stephen Smalley
e096e36e50 Set the SELinux security label on new directories.
Automatically set the SELinux security label on directories created
by init.rc.  This avoids the need to separately call restorecon on
each such directory from the init.rc file.  Also restorecon /dev
and /dev/socket after initial policy load so that they are labeled
correctly before any other dev nodes or sockets are created.

Change-Id: If6af6c4887cdead949737cebdd673957e9273ead
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2012-07-26 09:01:22 -04:00
Colin Cross
308bc52d33 ueventd: fixup /sys permissions on change uevents
Change uevents may be triggered after new files are created on a device
in /sys, run the sys permissions fixup when they occur.

Change-Id: Iec2725c9f8a032e5124190444edaf189a766b0b2
2012-07-24 12:36:40 -07:00
Patrick McCormick
96d0a4dda8 Extend and document the "wait" command
The wait command was currently implemented but
undocumented and only used internally. This change
adds a second option toi (optionally) override the default
timeout of 5 seconds.

The wait command can be used to wait for a file to appear
during the boot process, for example a disk or other device,
and is a better alternative than an unconditional sleep.

Change-Id: Ia11d8419c0ea84deec0e1bf5adfca5bc76ff38b7
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-24 10:31:49 -07:00
Lukasz Anaczkowski
e6f8d45da8 Char device /dev/dri/card0 was not created during startup.
This device is required by libdrm for GPUs like IvyBridge.

Change-Id: I0ac47056a9cec2100f3e6eaa5591571fe6bbc145
Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2012-07-23 16:08:17 -07:00
jeonghoon.lim
8c0350f4ee bluetooth: add property permission for bluetooth
add property permission for bluetooth.

Change-Id: I099f325f533d06c63ad43843dd6477ea81fc9781
2012-07-16 17:35:22 -07:00
Arve Hjønnevåg
d97d9074ba Add watchdogd
"/sbin/watchdogd <interval> <margin>" will open /dev/watchdog, try
to set the timeout to <interval>+<margin> then write to it every
<interval> seconds to reset the watchdog.

Change-Id: I15571980cdb868ec19f20e80bf8274b32107d36d
2012-06-14 15:43:23 -07:00
Iliyan Malchev
029d44e6ae HACK: use /firmware/image as a 3rd choice
Change-Id: I74af2e2dc872f88b904ead13e300ae32547e70c8
Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-06-11 14:18:45 -07:00
Benoit Goby
93574c619c init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-05-04 16:29:41 -07:00
Geremy Condra
42a9349dc4 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-05-02 11:13:49 -07:00
Ken Sumrall
048cc27c8a am 0e9dd90a: Change init to use libfs_mgr to mount filesystems.
* commit '0e9dd90ac336278659477cad0b9e9f1004e2b338':
  Change init to use libfs_mgr to mount filesystems.
2012-05-01 14:01:13 -07:00
Ken Sumrall
0e9dd90ac3 Change init to use libfs_mgr to mount filesystems.
The new fs_mgr library moves much of the knowledge of what filesystems
to mount into a new fstab.<device> file, and just calls one function to
mount all the filesystems.

Change-Id: If3db37530a0676000cba3e679db27aca734227e5
2012-05-01 13:14:27 -07:00
Ken Sumrall
08ec39ecc6 Change init to use libfs_mgr to mount filesystems.
The new fs_mgr library moves much of the knowledge of what filesystems
to mount into a new fstab.<device> file, and just calls one function to
mount all the filesystems.

Change-Id: If3db37530a0676000cba3e679db27aca734227e5
2012-04-30 19:31:06 -07:00
Romain Guy
d0ffe3840b am ce182cb8: Merge "Let users with SYSTEM permission set debug. properties" into jb-dev
* commit 'ce182cb8c00d0f5dedadbd4964dbc8cb705b8550':
  Let users with SYSTEM permission set debug. properties
2012-04-27 15:27:48 -07:00
Romain Guy
45fa13f370 Let users with SYSTEM permission set debug. properties
Change-Id: Ieda3f7dd5dca5f6a8fc50b07822e6a875db030ad
2012-04-27 15:19:30 -07:00
Colin Cross
cf41769375 am 64753635: am a02ff986: Merge "init: Add noexec mount option"
* commit '647536359f8ea63330805cb77abbf2f101952daa':
  init: Add noexec mount option
2012-04-27 00:21:22 -07:00
Lars Svensson
b6ee25e3ad init: Add noexec mount option
Change-Id: Ic13d66797a86d38432e79af0c3387ce986d0a19f
2012-04-23 13:27:48 -07:00
Andrew Flynn
34f6d9e910 Don't set ro.carrier in init.c
It will instead be set using PRODUCT_PROPERTY_OVERRIDES
in makefiles

Change-Id: Idc8b480af4c15e15c2d97cdd82a20f259e027c52
2012-04-13 09:00:48 -07:00
Nick Kralevich
6ebf12fe1b init: Change umask of forked processes to 077
Modify init to set the umask to 077 when forking processes.
This helps protect against inadvertant information disclosure
in init's child processes.

ueventd: Keep umask at 000. uevent needs to be able to
create device nodes with exactly the permissions it
indicates.

Testing:
1) Do an "ls -lR /data /dev" on the device before and after
the umask change and diff the output. Verified by hand
that the permission change wouldn't cause any problems.

2) Verify that package installation works, and the permissions
are as expected, when installing a program from market and
"adb install".

Bug: 3272072
Change-Id: Ie4f7f06c0ee9da8d9b6fce25d71d8991a9bce406
2012-04-02 14:11:07 -07:00
Benoit Goby
5890301308 init: Fix chown and chmod for write-only files
Change-Id: I570b631ced11ab104aafe7ebfe71bae4e380d8af
2012-03-28 18:24:08 -07:00
Wei Zhong
f97b887848 Add handling for DEVNAME for usb devices
When creating device node, user-space handler should honor device
node provided by kernel if present.

Bug: 6105248

Change-Id: I9ab3810563f29f065c239e15149882db28f08893
Signed-off-by: Wei Zhong <wzhong@google.com>
2012-03-23 14:16:37 -07:00
Mike Kasick
b54f39fdd9 init: Retain traditional restart behavior for critical and oneshot services.
Adds an SVC_RESTART state that's used for an explicit "restart" of a
running service.  This retains the traditional restart behavior for
critical and oneshot services (previously altered by 7e36edd8), whereby
these services are "simply restarted" instead of counting as a crash (for a
critical serivce) or going into the disabled state (for a oneshot service).
2012-03-22 22:25:17 -04:00
Mike Kasick
7e36edd80f init: Safely restart services to avoid race conditions.
Previously, service restarts (either an explicit "restart", or a "stop,
start" pair) exhibited a race condition whereby the new (restarting)
service process was often spawned before the old (stopping) process had
terminated.  This may have resulted in the new service process failing to
acquire a limited resource (file lock, socket bind, etc.) that the old
process had not yet released.

Now, a stopping service remains in the SVC_RUNNING state until its exiting
process has been reaped by waitpid.  This prevents a "stop, start" sequence
from spawning a second service process before resources held by the first
are released.  This enables safe service restarts by stopping the service,
waiting for the old service process to terminate, and (only then) starting
the new service process.  In the event of "restarting" an already stopped
service, the previous behavior is maintained whereby the service is simply
started.

This scenario could be special-cased by the restart command, however, we
have observed instances where services are, unintentionally, stopped and
started "too quickly," and so simultaneous processes for the same service
should never be allowed.

Note that this commit alters the behaviors for explicit restarts of
critical and oneshot services.  Previously these serivces would simply be
restarted, whereas now, an explicit restart of a critical service counts as
a crash (which may result in a recovery reboot) and oneshot services go
into the disabled state.
2012-03-22 22:11:41 -04:00
Geremy Condra
9ed1fe7732 init: make chmod/mkdir/chown not follow symlinks
This change brings init's do_chmod, mkdir, and do_chown into line
with open's O_NOFOLLOW semantics, causing them to fail when the
last element of their target path is a symlink.

Change-Id: If00e1a25cfe17ef6f738af4bf0541abd0c1b084b
2012-03-21 15:13:08 -07:00
Colin Cross
50fb5a6933 init: manually set controlling tty for console services
Normally, calling open on a tty will set that tty as the process
group controlling tty if none already exists.  However, if the tty
is /dev/console, the kernel will never automatically set it as the
controlling tty.  Call the TIOCSCTTY manually on the fd, which will
always attempt to set it as the controlling tty.

Fixes ctrl-c on the console shell when androidboot.console is not
passed on the kernel command line and the default /dev/console is
used.

Change-Id: I449cc41b47e93ac38ad6987413bb54131e1ec0cd
2012-03-18 15:39:59 -07:00
Colin Cross
9c38e14299 am 1a2f32c4: am d39f9d93: am 9cec99ba: Merge "Fix typo in queue_property_triggers ident"
* commit '1a2f32c4828380ca8590cf664725650ef35f1e37':
  Fix typo in queue_property_triggers ident
2012-03-01 23:57:11 -08:00
Chris Dearman
469b7b2da8 Fix typo in queue_property_triggers ident
Signed-off-by: Chris Dearman <chris@mips.com>
Change-Id: I5f18ccb0912b9bb89c9f5104f9505c610c109af8
2012-03-01 15:29:20 -08:00
Jean-Baptiste Queru
6439693eff am 3b04bde9: am ee79b455: am 93553073: Merge "Extend init and ueventd for SE Android."
* commit '3b04bde991d57765a830e06c6f5bb094722583bd':
  Extend init and ueventd for SE Android.
2012-02-24 11:17:43 -08:00
Stephen Smalley
e46f9d510d Extend init and ueventd for SE Android.
Add SE Android support for init and ueventd.

init:
- Load policy at boot.
- Set the security context for service daemons and their sockets.
- New built-in commands: setcon, setenforce, restorecon, setsebool.
- New option for services: seclabel.

ueventd:
- Set the security context for device directories and nodes.

Change-Id: I98ed752cde503c94d99dfa5b5a47e3c33db16aac
2012-02-01 07:49:08 -05:00
Nick Kralevich
abc12070d0 Merge "Don't read /data/local.prop on user builds" 2012-01-18 15:41:47 -08:00
Nick Kralevich
0dbda7e1c5 Don't read /data/local.prop on user builds
Creating a root owned /data/local.prop is one of the most common
ways to root an Android device. /data/local.prop is only intended
to assist developers on debuggable devices, and is never
intended to be used on production devices.

Change-Id: Ifcfa21c2ee9914b0b54445218b4cf0fea0a98e9c
2012-01-18 13:38:34 -08:00
Nick Kralevich
38f368c1b3 Don't parse properties from unsafe files.
Don't set properties from files that are unsafe (world-writable
or group-writable)

Change-Id: I8da539c6446b10596be1d7c2014e4b9aea13e3fd
2012-01-18 13:22:38 -08:00
Dima Zavin
84bf9af758 init: use init's property expansion code for setprop/write
Change-Id: I3c284860cc8d5106ac2b086e62baeb6263873935
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:09 -08:00
Dima Zavin
78a1b1fe1a init: delay importing files until after parsing the current file
If we process the import directive inline, then the ordering of the
commands for the "on xxx" sections would be a little unexpected. The
init.rc files do not really have an implied  order as to which section
appears and gets processed first. The init code itself provides that
ordering explicitly. For the user, the expectation is that if both the
current file and the imported file define a section (e.g. "on init"),
then the commands in the current file will be executed first, and then
the ones from the imported file(s).

The current implementation did not do that. It processed the import
directive inline, and thus the imported (i.e. dependent) files would
appear first in the command lists for the sections. This created
unintended side effects and the solution would have been to try and
put the import lines somewhere in the middle of the init file. This
would be difficult to notice and hard to extract the dependencies.

To solve this, we add the imports to a list for each file being parsed
and process the list after finishing parsing the file. This provides
predictable order for imports and provides a logical flow from the
user perspective: the currently parsed file gets to run its commands
before the files being imported.

Change-Id: I06dc35ff286314060e16b18923683cd2787269de
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:06 -08:00
Dima Zavin
5511c84a50 init: export all androidboot cmd line values as ro.boot.xx props
Also, clean up how we initialize the ro.xx properties and process
the kernel command line.

Change-Id: Iedda6c90e31340a189171a44b2767480403354f7
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:36:02 -08:00
Dima Zavin
3e7b7739e3 init: import the hardware specific init file in init.rc
This removes the hardcoding of the file import in init and instead
allows the init.rc file to fully control what is loaded.

Change-Id: I933e5bbab57f1e8705a370d660f92c6508da94d2
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:58 -08:00
Dima Zavin
a6235eacf4 init: allow init file imports to use properties in names
Adds new property syntax in init files during init file filename
expansion during the import command:
${prop.name}

So, one can do:  import /init.${ro.hardware}.usb.rc

Should convert other usages of property names to use the new function.

Change-Id: I9205d7d7a2da620bc8e6b89ac0eb554fad53ded3
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:53 -08:00
Dima Zavin
d7634c9cda init: initialize property area early at boot
The property service is still started later, but the property area
and the initial boot properties are initialized before the init.rc
file is processed. This allows init.rc files to have access to boot
properties during parsing.

Change-Id: Iae9ed1093c821831a864b39ae6bc697e62b94757
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-11 04:35:49 -08:00
Dima Zavin
ebe2cb312d init: use init's property expansion code for setprop/write
Change-Id: I3c284860cc8d5106ac2b086e62baeb6263873935
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:28 -08:00
Dima Zavin
304f12270d init: delay importing files until after parsing the current file
If we process the import directive inline, then the ordering of the
commands for the "on xxx" sections would be a little unexpected. The
init.rc files do not really have an implied  order as to which section
appears and gets processed first. The init code itself provides that
ordering explicitly. For the user, the expectation is that if both the
current file and the imported file define a section (e.g. "on init"),
then the commands in the current file will be executed first, and then
the ones from the imported file(s).

The current implementation did not do that. It processed the import
directive inline, and thus the imported (i.e. dependent) files would
appear first in the command lists for the sections. This created
unintended side effects and the solution would have been to try and
put the import lines somewhere in the middle of the init file. This
would be difficult to notice and hard to extract the dependencies.

To solve this, we add the imports to a list for each file being parsed
and process the list after finishing parsing the file. This provides
predictable order for imports and provides a logical flow from the
user perspective: the currently parsed file gets to run its commands
before the files being imported.

Change-Id: I06dc35ff286314060e16b18923683cd2787269de
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
8886112d87 init: export all androidboot cmd line values as ro.boot.xx props
Also, clean up how we initialize the ro.xx properties and process
the kernel command line.

Change-Id: Iedda6c90e31340a189171a44b2767480403354f7
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
7634bf87cf init: import the hardware specific init file in init.rc
This removes the hardcoding of the file import in init and instead
allows the init.rc file to fully control what is loaded.

Change-Id: I933e5bbab57f1e8705a370d660f92c6508da94d2
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:02:00 -08:00
Dima Zavin
976b878a0a init: allow init file imports to use properties in names
Adds new property syntax in init files during init file filename
expansion during the import command:
${prop.name}

So, one can do:  import /init.${ro.hardware}.usb.rc

Should convert other usages of property names to use the new function.

Change-Id: I9205d7d7a2da620bc8e6b89ac0eb554fad53ded3
Signed-off-by: Dima Zavin <dima@android.com>
2012-01-05 15:01:57 -08:00
Dima Zavin
65a8360795 init: initialize property area early at boot
The property service is still started later, but the property area
and the initial boot properties are initialized before the init.rc
file is processed. This allows init.rc files to have access to boot
properties during parsing.

Change-Id: Iae9ed1093c821831a864b39ae6bc697e62b94757
Signed-off-by: Dima Zavin <dima@android.com>
2011-12-20 13:46:17 -08:00
Jeff Brown
33901e6024 Delete dead code.
Change-Id: Icfb9bcee2c524026ecbeb7e30e943d8ca299a33a
2011-11-18 15:21:56 -08:00
Ken Sumrall
a286480f56 Fix the class_reset command
The class_reset command used to reset services that had been set to
"disabled" in the init.rc file to a non-disabled state.  Now, if the
service was originally set to "disabled", have the reset command set
it back to disabled.  Otherwise, set it to the "reset" state as it
currently does.

Change-Id: I0c10582e46a8e443d4748d9d893ae762b19b653a
2011-10-26 16:58:27 -07:00
Vladimir Chtchetkine
2b99543cef Pick up on androidboot.hardware kernel cmd option
x86 emulator passes hardware name through the androidboot.hardware kernel cmd option, and
ueventd must pick up on it to locate proper ueventd.rc file for that hardware.

Change-Id: Id61c5b67fe6275a15c7aa62556e0b89eda7968f8
2011-09-28 11:44:30 -07:00
Dima Zavin
ebf46586f5 init: do not load default.prop from ramdisk in charger mode
Change-Id: Ic471b891829d7f857674b925c9948954972d9ecb
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-06 10:12:41 -07:00
Dima Zavin
ca47cef749 init: add charge mode handling
Introduces a 'charger' section that is processed when androidboot.mode
supplied on the kernel commandline is "charger".

In this mode, sections such as fs, post-fs, etc are skipped. Only the
'early-init' and 'init' sections of the init rc files are processed before
processing the 'charger' section.

Change-Id: If9eb6334de18f04cbcf2aab784578e2993615242
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:18 -07:00
Dima Zavin
da04c52ab1 init/cutils: move list utility code to cutils from init
Change-Id: I357ceee813700297d8343159f22a07659e768d41
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:18 -07:00
Dima Zavin
8f91282ebe init/cutils: move kernel logging interface to libcutils from init
Change-Id: Ia0f91b1fcd6cae69d76bf3dd841340958db938a8
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:17 -07:00
Dima Zavin
2d55e02d0f libcutils/init: move uevent socket opening code to libcutils
Change-Id: I90adf78c0eb6185505f2bf7b62e96e25ab918345
Signed-off-by: Dima Zavin <dima@android.com>
2011-09-02 12:11:17 -07:00
Dima Zavin
3bea0790e2 init: check for list empty when getting commands for action
Change-Id: Id42d6a6b6297919b2e6520e074e31b5e01ae17bc
Signed-off-by: Dima Zavin <dima@android.com>
2011-08-26 14:03:32 -07:00
Benoit Goby
5da93589f1 Allow radio to set sys.usb.config
This allows the ril to put the phone into diagnostic mode

Change-Id: Iafc8164991550e7ab0ffda8b8da1d58e34a4225b
2011-08-22 12:12:37 -07:00
Benoit Goby
22bfc4cca0 Allow radio to set net.cdma* properties
Change-Id: I656abde9d06175eb158e84de4d08ede42620b46a
2011-07-28 18:10:23 -07:00
Benoit Goby
7100f640de Allow radio to set net.lte* properties
Change-Id: I4b7a280ba4c773673b28db8cfbbffcb360ee717f
2011-07-25 18:02:06 -07:00
Conley Owens
c21dcef9fe am 45e8fc6b: am 8621b5ea: am 212282c3: am 80dbd2a7: Merge "Fix build error in init when building with bootchart"
* commit '45e8fc6bfd9221274f48861287ff7af06ee7a199':
  Fix build error in init when building with bootchart
2011-07-25 17:25:13 -07:00
Conley Owens
45e8fc6bfd am 8621b5ea: am 212282c3: am 80dbd2a7: Merge "Fix build error in init when building with bootchart"
* commit '8621b5ea475822499128e6f138a9dfc224bbb569':
  Fix build error in init when building with bootchart
2011-07-25 12:21:21 -07:00
Conley Owens
80dbd2a7f2 Merge "Fix build error in init when building with bootchart" 2011-07-21 17:41:32 -07:00
Chia-chi Yeh
9bb4d411e0 init: update permissions for VPN.
VPN no longer uses system properties to keep network parameters.
Besides, profiles are now stored and encrypted by keystore.

Change-Id: I7575f04f350b7d8d5ba7008eb874a72180d057e8
2011-07-08 20:03:03 -07:00
Chia-chi Yeh
27164dce5f init: make "mkdir" work even when the directory already exists.
This allows us to change permissions and ownerships of directories
in init scripts without adding additional commands.

Change-Id: I1815d6015953035251b98f28c0f3efd3c7f25f80
2011-07-08 16:06:56 -07:00
Mike Lockwood
d18678f882 init: Handle EINTR in handle_property_set_fd()
Change-Id: I5a6f1791eaf11e98b1d81697112d78c99822fba5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-07-01 15:04:38 -04:00
Mike Lockwood
1f0bd32f90 init: Add support for assigning system properties to system properties in init.rc
For example:
    setprop sys.usb.config $persist.sys.usb.config

Change-Id: I7b4e1ed1335906b32621bd96a341b0f94bbee7f5
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:54 -07:00
Mike Lockwood
f5cb5b2435 init: Fix the init.rc import command
Change-Id: I8a91c3f7d1ca31e137d9043bb7f56e4a44fb63df
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:47 -07:00
Mike Lockwood
7ba61b15ed init: Allow wildcards in property triggers by using * for property value
For example, the following trigger will fire when the sys.foo property
is set to any value:

on property:sys.foo=*
    write /data/foo hello

It is also possible to refer to the property within the trigger actions:

on property:sys.foo=*
    write /data/foo $sys.foo

Change-Id: If78d20a532f77e17aa5703d53be581ad6736cbcf
Signed-off-by: Mike Lockwood <lockwood@android.com>
2011-06-09 15:42:42 -07:00
Mike Lockwood
2c4d5dc415 init: Add support for writing system property value to a file in init.rc
The write command will write a property value if the value starts with a "$'

For example:
    write /sys/class/android_usb/iSerial $ro.serialno

Use double leading '$' if you need to write a string that starts with '$':

    write /data/foo $$hello

to write "$hello" to /data/foo

Change-Id: I55431ac7715a5347bb95c3a15aee97c575444dde
2011-06-09 15:42:31 -07:00
Ken Sumrall
211ce13432 Merge "Teach the mount command in init to not consider a wiped partition to be encrypted." 2011-05-27 16:13:43 -07:00
Ken Sumrall
7bc6e9ebe4 Teach the mount command in init to not consider a wiped partition to be encrypted.
Change-Id: I3e989f0b81ec35084baddc04e014406f4d90ce04
2011-05-26 20:01:39 -07:00
Nick Kralevich
57de8b8f27 rename uevent_checked_recv to uevent_kernel_multicast_recv
Change-Id: I1839627490080efcbb7269699709064856312f8b
2011-05-11 14:58:24 -07:00
Nick Kralevich
4682abaaa6 am b0d0e260: resolved conflicts for merge of 2baeb898 to honeycomb-plus-aosp
* commit 'b0d0e260bd6118959fa0e2d3c84037b3e0178551':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 13:49:59 -07:00
Nick Kralevich
b0d0e260bd resolved conflicts for merge of 2baeb898 to honeycomb-plus-aosp
Change-Id: Ib3169b3a36aa13ef413da624355b1737e9b76fd9
2011-04-27 13:09:24 -07:00
Vernon Tang
3f582e92f0 Fold uevent message origin checking from init into libcutils.
Change-Id: I7cbc0cb840d1b4962e6c360fdad9a9c0ce20e87b
2011-04-28 05:16:21 +10:00
Nick Kralevich
bb738d6727 am de35f274: am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message origin checking from init into libcutils.""
* commit 'de35f2741c4e32e331a92be99f7c04b92b94beb2':
  Revert "Fold uevent message origin checking from init into libcutils."
2011-04-27 10:37:48 -07:00
Nick Kralevich
de35f2741c am 03752be0: am 0c297f5e: Merge "Revert "Fold uevent message origin checking from init into libcutils.""
* commit '03752be0a437d12e19ac73ebe23385fe6f756e2c':
  Revert "Fold uevent message origin checking from init into libcutils."
2011-04-27 10:35:06 -07:00
Nick Kralevich
de9e65dd65 Revert "Fold uevent message origin checking from init into libcutils."
This reverts commit 8405ec0e75.

The original change does not compile.
2011-04-27 10:21:24 -07:00
Nick Kralevich
3268eda4dc am e3ab4245: am a7cf7ed9: am 282c2ab4: Merge "Fold uevent message origin checking from init into libcutils."
* commit 'e3ab42457077ec2a66bac553e59a7fee08d4fa9e':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 10:00:34 -07:00
Nick Kralevich
e3ab424570 am a7cf7ed9: am 282c2ab4: Merge "Fold uevent message origin checking from init into libcutils."
* commit 'a7cf7ed93486240ca48a407e67c7c3683a3b93aa':
  Fold uevent message origin checking from init into libcutils.
2011-04-27 09:59:14 -07:00
Vernon Tang
8405ec0e75 Fold uevent message origin checking from init into libcutils.
Change-Id: I1a38e611a7ad990f74306ce453740a1eeed2416d
2011-04-27 14:17:15 +10:00
Carl-Emil Lagerstedt
9ab8190e41 Fix build error in init when building with bootchart
There was a build error in init.c if you enabled bootchart, this
should probably be shipped upstream if not fixed already.

Change-Id: Iea3451c3e15d5cac00c5420d99bfce9a950aaaac
2011-04-11 14:17:54 +02:00
Brad Fitzpatrick
d6efa45489 am 80337ffc: am 47e4ee59: am 71ead183: Close the client socket early for ctl.* properties.
* commit '80337ffcf45205750b8b90cbbe28c4c8e7e2baff':
  Close the client socket early for ctl.* properties.
2011-04-01 12:27:04 -07:00
Brad Fitzpatrick
71ead18353 Close the client socket early for ctl.* properties.
Bug: 4199411
Change-Id: I3bf335e16e0df8405c538989a8f4f6db7795fa36
2011-04-01 12:00:35 -07:00
Colin Cross
ab0c4e0356 Merge "ueventd: track platform device uevents to parse block device names" 2011-03-31 17:01:26 -07:00
Colin Cross
320cbfa719 Merge "ueventd: refactor uevent handling" 2011-03-31 17:01:13 -07:00
Colin Cross
fadb85e3bd ueventd: track platform device uevents to parse block device names
The mmc block devices on panda boards use a platform device called
omap/omap_hsmmc.0.  The number of path entries in the uevent after
the platform device is unknown, and the number of path entries in
the platform device is unknown, so the only way to determine how
many entries make up the platform device is to compare against
a list of platform devices.

Add a list of platform devices that have been registered, and
iterate through it to determine the platform device portion of
a block device uevent.

Change-Id: I1480bc6429172ca6997d548787be3863ce062472
2011-03-31 16:44:04 -07:00
Colin Cross
eb5ba83065 ueventd: refactor uevent handling
Change-Id: I2002be3580ff87b0a55dc030a9099bf6d795011f
2011-03-31 16:37:20 -07:00
Brad Fitzpatrick
9f1e0e3ae3 Close the property socket *after* updating properties.
Also remove some dead code.

Bionic update is in change I3e80cecf

Bug: 4185486
Change-Id: I28e06197ff7a452c70b89b9fc5e2bcf0d9d54bbe
2011-03-30 15:27:03 -07:00
Brad Fitzpatrick
8ec49049da Close the property socket *after* updating properties.
Also remove some dead code.

Bionic update is in change I3e80cecf

Bug: 4185486
Change-Id: I8dd685eaea1a927c1659df5a1228cc259227ad1c
2011-03-30 14:18:25 -07:00
Brian Swetland
8d48c8e457 defer firmware load until after filesystems are mounted
In some situations a driver could try to request firmware before
/system is mounted.  Previously we'd fail the request.  Now we
will retry the read-from-filesystem every 100ms until we find the
firmware or we've finished the "fs" and "post-fs" stages of init.

Change-Id: Ie32402f7d41c818bf20f3297286ed5f99705b72c
2011-03-25 13:01:35 -07:00
Ken Sumrall
c5c51033c8 Load the persistent properties after decrypting the /data partition
Fix for bug 3415286.  The persistent properties are normally read early
in the boot process after /data is mounted.  However, for an encrypted
system, at that point /data is a tmpfs ramdisk.  This change adds a new
command to init (load_persist_props) to read the persistent properties,
and adds an action to init.rc to load the persistent properties.  This
action is triggered by setting a property in vold, but that's in a
different CL.

Change-Id: I74b3057974ee6029c29d956b76fef5566700d471
2011-03-10 18:12:19 -08:00
Ken Sumrall
e3aeeb4de3 Try to unmount writable filesystems when rebooting
Ext4 filesystems like to be unmounted before rebooting.  The Android system
doesn't have a traditional Linux init setup, and shutting down the system
was not much more than calling sync(2) and reboot(2).  This adds a new
function to libcutils called android_reboot().  By default, it calls sync()
and then remounts all writable filesystems as read-only and marks them clean.
There is a flag parameter in which the caller can ask for sync() not to be
called, or to not remount the filesystems as read-only.  Then it will call
reboot(2) as directed by the other parameters.  This change also updates
adb, init and toolbox to call the new android_reboot() function.
Fixes bugs 3350709 and 3495575.

Change-Id: I16d71ffce3134310d7a260f61ec6f4dd204124a7
2011-03-10 18:11:46 -08:00
Amol Bhatkar
cf01597121 property_service: Give radio permission to set net.qmi*
Change-Id: I771ef22859799b863ab79de9d3248ef610af4dd8
2011-03-02 16:00:58 -08:00
Ken Sumrall
dd4d786cbf Fix for bug 3379244, non-eMMC devices don't start all services.
Fix for non-eMMC based devices to properly start the "on nonencrypted"
action.

Change-Id: I5d2966db352b02f1a1724fb105e1cefc46037e42
2011-02-17 18:09:47 -08:00
Ken Sumrall
203bad597f Add the commands rm and rmdir to init.
rm only removes a single non-directory directory entry (no -r support)
rmdir removes a single empty directory

Change-Id: I49702b02ba98a177027b126268c2c2846f968195
2011-01-18 17:39:24 -08:00
Ken Sumrall
4e84d3bcf9 Set a read-only property to indicate if the device is running encrypted.
The UI needs to know if the device is running with an encrypted
filesystem or now.  So set a read-only property at boot to let it know.

Change-Id: I753de2d606c975bcbe9946d10fd47558cf357dac
2011-01-14 12:44:09 -08:00
Jean-Baptiste Queru
f5cb0a1385 am fc0b4ff1: Merge "init: Fix parser line numbering"
* commit 'fc0b4ff1c8675be3626510a5adfbcae507ecfa43':
  init: Fix parser line numbering
2011-01-07 15:34:03 -08:00
Bruce Beare
1be6968d9d init: Fix parser line numbering
Change-Id: I1ac481a2cef749b26c73bc9e6a212e6ace7a0ae2
2011-01-07 11:19:04 -08:00
Colin Cross
8bc6fb3433 am bf10797e: am f7ca6040: Fix infinite loop in init when debugging is turned off
* commit 'bf10797e538f9fa252d72710bd5ecf0ef1f6f3e0':
  Fix infinite loop in init when debugging is turned off
2011-01-04 18:50:51 -08:00
Colin Cross
bf10797e53 am f7ca6040: Fix infinite loop in init when debugging is turned off
* commit 'f7ca6040616f672a6f0039d55e39c610b7c1cf91':
  Fix infinite loop in init when debugging is turned off
2011-01-04 18:49:07 -08:00
Colin Cross
f7ca604061 Fix infinite loop in init when debugging is turned off
If a keychord is pressed when debugging is turned off, the main
event poll in init will return an event on the keychord fd,
but handle_keychord never reads the data.  Once this happens,
the poll will always return immediately, and init enters an
infinite loop.  Fix it by always reading from the keychord fd,
but only handling the returned keychord if debugging is
enabled.

Change-Id: Ie4efa98247d3cc978d275dc8a4516b32aa710278
2011-01-04 18:21:22 -08:00
Bruce Beare
378083a3f0 init: Fix parser line numbering
Change-Id: I3885dd7d631e7330d92780df822b3ee1a8d0350b
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
2011-01-02 17:00:08 -08:00
Ken Sumrall
752923c168 Changes to init to support encrypted filesystems.
These are the changes to init and init.rc necessary to
support booting with and encrypted /data filesystem.
A corresponding change to init.<device>.rc goes along
with this change.

Change-Id: I0c7e2cc39568358014a82e317735c0eae14dd683
2010-12-18 19:03:54 -08:00
Mike Lockwood
58aa5b0ee0 init: Allow non-root adbd to switch between TCP and USB modes
Change-Id: I9e93ceefadfaa2a4f8ec25cfa05fa4821fd98093
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-12-10 09:48:41 -08:00
Iliyan Malchev
d5c8ddfdf3 Revert "Add "slow_start" keyword to init"
This reverts commit 50b3afd9f3.
2010-12-08 16:19:12 -08:00
Paul Eastham
50b3afd9f3 Add "slow_start" keyword to init
This keyword will cause init to wait a few seconds before exec'ing
the target binary.  Maybe only useful for hacks and debugging.

Change-Id: I85caa0bcbc0be7e48bd21eb9e31e039c0740c8d5
2010-12-04 17:39:26 -08:00
Olivier Bailly
7e06476f6d Merge "Add missing headers for compilation on x86 targets" 2010-11-29 15:13:50 -08:00
Nick Kralevich
2268718ee2 check the return value of setuid and friends
Under some circumstances, setuid() and family can fail,
returning a non-zero value.  (see "man setuid" for details).
If this happens, we want to ensure that init doesn't spawn a
process which has root privileges when it's not suppose to.

Change-Id: Idd03f2c8f82a7eaf6e696b5bcfe308e51ea58b52
2010-11-17 16:55:42 -08:00
Olivier Bailly
b93e5812fa Add missing headers for compilation on x86 targets
Change-Id: I5f4dc797b353a0f01fa00d38375ec303bf863254
2010-11-17 11:47:23 -08:00
Benoit Goby
609d8828d3 init: Abort firmware transfer if firmware is missing
If firmware is not found, write -1 /sys/$DEVPATH/loading to cancel the
firmware load. Otherwise the driver has to wait for the 60s timeout.

Change-Id: Id2787cda9b2be45b9adea41f6f161cd54cda212e
Signed-off-by: Benoit Goby <benoit@android.com>
2010-11-09 18:49:40 -08:00
Brian Swetland
7ca8f1243b am 439b4dfb: am bc57d4ce: init: support owner/permission setting for sysfs attributes of devices 2010-10-26 15:42:22 -07:00
Brian Swetland
439b4dfb27 am bc57d4ce: init: support owner/permission setting for sysfs attributes of devices 2010-10-26 15:40:19 -07:00
Brian Swetland
bc57d4ce92 init: support owner/permission setting for sysfs attributes of devices
This should be much nicer than peppering init.rc with chown/chmod
directives.

Also, remove some dead code and obsolete comments.

Change-Id: I10895f10a9cf2f1226c8d12976cd3db3743da9ec
2010-10-26 15:37:06 -07:00
Wink Saville
cfa0d84393 Allow AID_RADIO to restart the ril-daemon.
This enhances robustness by allowing the Telephony Framework to restart
ril-daemon if it notices some catastrophic failure.

Added setprop ctl.restart.
Added ril-daemon to setprop control_perms and allow users/groups
with the AID_RADIO ID to control it.

Change-Id: I195abdd754a731ce0b77e8f71ab47fde8c3e7977
2010-10-03 13:54:03 -07:00
Mike Lockwood
64092e852d am 78ea2374: am 912ff85b: init: Add support for SOCK_SEQPACKET socket type
Merge commit '78ea2374c5c87d7bb58747b1a6173c598f386600'

* commit '78ea2374c5c87d7bb58747b1a6173c598f386600':
  init: Add support for SOCK_SEQPACKET socket type
2010-10-01 05:54:06 -07:00
Mike Lockwood
78ea2374c5 am 912ff85b: init: Add support for SOCK_SEQPACKET socket type
Merge commit '912ff85b035e0e6bc109812c1ea5661ea4df5967' into gingerbread-plus-aosp

* commit '912ff85b035e0e6bc109812c1ea5661ea4df5967':
  init: Add support for SOCK_SEQPACKET socket type
2010-10-01 05:50:01 -07:00
Mike Lockwood
912ff85b03 init: Add support for SOCK_SEQPACKET socket type
Change-Id: Ib264ecf9beb2685b070436d2bdec9655c7a31b47
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-10-01 08:20:36 -04:00
Brian Swetland
d06df51bcd resolved conflicts for merge of 3b5214a6 to master
Change-Id: Id73c53c6c2e9c21eb9b1d1e624aaeb25097ea7a4
2010-09-19 04:35:19 -07:00
Brian Swetland
3b5214a67f am 02863b95: add /vendor support
Merge commit '02863b957cfbfc302d3136ed78c0cba86accacd8' into gingerbread-plus-aosp

* commit '02863b957cfbfc302d3136ed78c0cba86accacd8':
  add /vendor support
2010-09-19 03:49:43 -07:00
Brian Swetland
02863b957c add /vendor support
- look in /vendor/firmware/... in addition to /system/etc/firmware/... for firmware loading
- add /vendor/bin to path before /system/bin
- add /vendor/lib to ldpath before /system/lib
- configure appropriate permissions for /system/vendor/bin
- symlink /vendor -> /system/vendor

Change-Id: I0c06ca1e38a44f0c7024cee6cea8907aa93a4532
2010-09-19 03:36:39 -07:00
Colin Cross
3eaa4e52d3 am 49b8124a: am 17dcc5c5: Use makedev helper for device major and minor numbers
Merge commit '49b8124a1759cb8b27e0c21a1a5a54b8a81bdb19'

* commit '49b8124a1759cb8b27e0c21a1a5a54b8a81bdb19':
  Use makedev helper for device major and minor numbers
2010-09-03 14:13:05 -07:00
Colin Cross
49b8124a17 am 17dcc5c5: Use makedev helper for device major and minor numbers
Merge commit '17dcc5c57dcffb919f3de65ff7a0134ffa3bd874' into gingerbread-plus-aosp

* commit '17dcc5c57dcffb919f3de65ff7a0134ffa3bd874':
  Use makedev helper for device major and minor numbers
2010-09-03 13:29:54 -07:00
Colin Cross
17dcc5c57d Use makedev helper for device major and minor numbers
Major and minor numbers can be greater than 255.  Major numbers
are 12 bits, and minor numbers are 20 bits.  Supporting major
and minor numbers > 255 allows the use of the extended block
device for extra mmc partitions.

Change-Id: I4c42bfe0781069e8e4cb13ebe26e860cdc03f866
2010-09-03 12:27:01 -07:00
Benoit Goby
d2278638d6 init: Add symlinks to USB character devices
Since we now support USB host mode, devices might get a different device
file depending if other devices are connected on the host port. This
patch creates symlinks to USB character devices that depend on the port
devices are connected to, but not on the order they have been probed.
(e.g. /dev/usb/tty2-1:1.0 -> /dev/ttyUSB0)

Change-Id: I285bcc2d59446fbff8a7abbe39c21781f3bb4bd3
2010-08-10 15:13:07 -07:00
Nick Kralevich
72f3a00cc7 am 3fc108ac: am fad7204e: resolved conflicts for merge of 5f5d5c8c to gingerbread
Merge commit '3fc108acf2b05153489730178c85b8db94f603af'

* commit '3fc108acf2b05153489730178c85b8db94f603af':
  validate the source of uevent messages
2010-07-20 10:48:18 -07:00
Nick Kralevich
3fc108acf2 am fad7204e: resolved conflicts for merge of 5f5d5c8c to gingerbread
Merge commit 'fad7204e9eac20a87afacd7547ed8202a39319f8' into gingerbread-plus-aosp

* commit 'fad7204e9eac20a87afacd7547ed8202a39319f8':
  validate the source of uevent messages
2010-07-20 10:45:06 -07:00
Nick Kralevich
fad7204e9e resolved conflicts for merge of 5f5d5c8c to gingerbread
Change-Id: Ieee2cd67d33f3e774fcfd96f8a5f67a0374aa873
2010-07-19 15:53:05 -07:00
Nick Kralevich
5f5d5c8cef validate the source of uevent messages
Bug: 2844206
Change-Id: If2eee54181abfc6c7fda0232f98fa6bb5d12c60c
2010-07-19 14:54:50 -07:00
The Android Open Source Project
f13c2ba5f8 am 742150c0: merge from open-source master
Merge commit '742150c031756da1393bf4223b2468b17cb79326'

* commit '742150c031756da1393bf4223b2468b17cb79326':
  Use complete hardware name without spaces.
2010-07-16 13:41:48 -07:00
The Android Open Source Project
742150c031 merge from open-source master
Change-Id: I29602fecafc2b6d93b849ada89696a67cfd23353
2010-07-16 13:39:30 -07:00
Brian Swetland
335cc39928 am 62a54f3b: am 25b15be9: init: use tmpfs/ftruncate for properties backing store instead of ashmem
Merge commit '62a54f3b1343043528b7e93c1a4311a5e9d5f358'

* commit '62a54f3b1343043528b7e93c1a4311a5e9d5f358':
  init: use tmpfs/ftruncate for properties backing store instead of ashmem
2010-07-13 17:18:42 -07:00
Brian Swetland
25b15be912 init: use tmpfs/ftruncate for properties backing store instead of ashmem
This removes the need for ashmem for early bringup and avoids an issue
with permissions enforcement.

Change-Id: I405b080660934d73048c79d614b6b2ebc43ab182
Signed-off-by: Brian Swetland <swetland@google.com>
2010-07-13 16:43:56 -07:00
Sean McNeil
68fec9a751 Use complete hardware name without spaces.
Many targets use generic first portions like 'OMAP'

Change-Id: I00ba4e64cffc48353c29e409c3c19238024fbd8c
2010-07-13 14:24:39 -07:00
Nick Kralevich
150f19e373 Mount /dev with nosuid
Change-Id: I66c7fcf9b65405dfc12d344ef3ed225d0ad2db84
2010-06-22 16:35:43 -07:00
Nick Kralevich
4ea0850642 Revert "Mount /dev with noexec and nosuid"
This reverts commit 4ec97f2b25.
2010-06-15 16:57:23 -07:00
Nick Kralevich
4ec97f2b25 Mount /dev with noexec and nosuid
Change-Id: Iea182c1e6a72c281abd17bf83ff765bb9cb59270
2010-06-08 14:40:53 -07:00
Colin Cross
6f5096b188 am 982a815c: Reap firmware child processes to prevent zombies 2010-06-03 14:45:19 -07:00
Colin Cross
982a815c10 Reap firmware child processes to prevent zombies
Change-Id: Ic6c50b929a025f05450cd309238e60a857690d9b
2010-06-03 12:21:01 -07:00
Mike Lockwood
c0d8fb5842 DO NOT MERGE resolved conflicts for merge of e95aad61 to kraken
this change is already in master

Change-Id: Ica43eae28b50d89d50217851aff7e62978abfa27
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-17 14:24:36 -04:00
The Android Open Source Project
e95aad61d8 merge from open-source master
Change-Id: I414c9479f4f913c777ef18b7ff27e410f49d35b9
2010-05-17 08:54:31 -07:00
Mike Lockwood
93ac1559b8 init: Add support for /dev/bus/usb/ file system and add new unix group AID_USB.
init now creates files in /dev/bus/usb/ for user access to USB devices.
Files are chmod 660 with group AID_USB.

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-16 16:04:51 -04:00
Mike Lockwood
b717dc85d8 init: Add support for /dev/bus/usb/ file system and add new unix group AID_USB.
init now creates files in /dev/bus/usb/ for user access to USB devices.
Files are chmod 660 with group AID_USB.

Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-05-06 13:40:51 -04:00
Colin Cross
33680b106d init: Use a relative symlink for ueventd to init
make doesn't seem to handle the absolute symlink from
$OUT/root/sbin/ueventd to /init well - it follows the link during
dependency resolution, decides $OUT/root/sbin/ueventd doesn't exist
because /init doesn't exist, and relinks it every time.

Change-Id: I9ca1c14fe5fa80634f51ffc51a7c73146d29d42e
2010-04-22 13:34:16 -07:00
Colin Cross
ebd4613bfc init: Fix init spinning once init.rc is complete
When the init process ran out of actions to execute, cur_action was
NULL and action_queue_empty() was true, but cur_command was still
set.  This patch clears cur_command when a new action is retreived,
and only depends on cur_action and action_queue_empty() to determine
the poll timeout.

Change-Id: Iaa95063c8c267a5b1ada9f20363b99c433e61ac4
2010-04-22 11:52:23 -07:00
Colin Cross
44b65d047c init: Add ueventd.rc parsing to ueventd
Change-Id: Iea53050d6c10e8cabf563e5d80e84eaf78873695
2010-04-21 20:59:42 -07:00
Colin Cross
f83d0b9af5 init: Move uevent handling to an external ueventd process
Change-Id: Iea6c56013062ade633a1754f7bcf8cf09b3dedc1
2010-04-21 20:59:38 -07:00
Colin Cross
6310a8261c init: Split parser into generic parser and init parser
Change-Id: I451ebc4ff12f2ac660eb533fa10ad561fa25c9dd
2010-04-21 19:43:40 -07:00
Colin Cross
3294bbbad9 init: Allow services to start before property triggers are up
Change-Id: I4f87657123bea88b7b5c537781868908d8d66b01
2010-04-21 19:43:35 -07:00
Colin Cross
cd0f173e27 init: Add wait command and mount wait flag
Change-Id: I6b4c10f8f246095a7fb7342388ec4f6ff97d5733
2010-04-21 19:43:35 -07:00
Colin Cross
ed8a7d8442 init: Move list and log handling to list.h and log.h
Change-Id: I298f575c590d0f28b7ad78747f3ebdbba56b7a27
2010-04-21 19:43:35 -07:00
Colin Cross
12541c6131 init: reap exited child processes on signal_init
If any child processes exit before signal_init, they won't get reaped
unless another child process exits after signal_init.  Calling
handle_signal from signal_init forces them to be reaped immediately.

Change-Id: I459cfbfe6cf00f29454c62a8c840baf21cb1fb03
2010-04-21 19:43:35 -07:00
Colin Cross
b0ab94b7d5 init: create symlinks to block device nodes
eMMC block device names may change based on the detection order of
the eMMC device and any other SD bus devices, such as a removable SD
card.

This patch adds support to init for:
  * Symlinks to block devices.  When a block device uevent is
    processed, if it starts with "/devices/platform", the platform
    driver name is parsed out, and symlinks to the block device are
    created in /dev/block/platform/<platform driver>/
  * Symlinks based on partition name and number.  If the uevent for
    a block device contains information on the partition name or
    number, symlinks are created under
    /dev/block/platform/<platform driver>/by-num/p<partition>
    and
    /dev/block/platform/<platform driver>/by-name/<partition name>

init.rc can then use a device path like the following to mount an
eMMC device:
/dev/block/platform/<platform>/by-name/system /system ro

Change-Id: Id11bb7cdf1e2ada7752a5bd671cbf87237b34ae2
2010-04-21 19:43:28 -07:00
Jay Freeman (saurik)
ed33625a4a Added a move flag for init's mount command that maps to MS_MOVE.
Change-Id: I7bc1a8ac5f73a34c101247f984cbf9ff29e02e7f
2010-04-20 15:21:35 -07:00
Colin Cross
ebc6ff105a init: Handle commands in event queue loop
Change-Id: I679059dae43143f3c8f16b68de5694539b699e50
2010-04-16 19:02:32 -07:00
Colin Cross
3899e9fc01 init: Move prototypes for util.c into util.h
Change-Id: I46a91849ce5297eb2597dd6134412f817564ec24
2010-04-13 22:52:10 -07:00
Colin Cross
9c5366ba55 init: Move signal handling to signal_handler.c
Change-Id: I3a24afa28a1cd279c749d6f384f687b8de56067e
2010-04-13 22:52:10 -07:00
Colin Cross
504bc5175a init: Move gettime() to util.c
Change-Id: I1df96964763f8baedbc1cea6875d3dfc5e48c065
2010-04-13 22:52:10 -07:00
Colin Cross
d11beb2b15 init: Move property_set_fd to property_service.c
Change-Id: Ic7a19073eae8f353d48cabee80fa9722b35a82b5
2010-04-13 22:52:10 -07:00
Colin Cross
ca7648ddfb init: Move parser prototypes to parser.h
Change-Id: I31db51eb8e8a33a0bd06b41206bc9f9147d16d41
2010-04-13 22:51:12 -07:00
Colin Cross
0dd7ca6e87 init: Move device_fd to devices.c
Change-Id: I11ed0f3e1b95d2cff4fdbd80b915c01572f76b0e
2010-04-13 22:47:08 -07:00
Colin Cross
a866695ebe init: Move keychords to keychords.c
Change-Id: I8fba9f5f73439a451fc961f8111612dff4fb5dfd
2010-04-13 22:46:44 -07:00
Colin Cross
f24ed8ca0a init: Move mtd functions from init.c to util.c
Change-Id: I04e8f0ae6cc88af974372872e5617d16e0b1a2c8
2010-04-13 20:07:22 -07:00
Colin Cross
31712beaf7 Move filesystem mounting into a new "fs" init level
Devices with non-MTD storage need to override the filesystem mounting
commands in init.rc.  Moving them to a new "fs" init level allows a
custom init.<device>.rc to handle the mounting.

Change-Id: If0e655139b9734650fb798b6eb0a90e2241fc29b
2010-04-13 20:06:03 -07:00
Nick Pelly
830abe0424 MOAR GROUPS
We were hitting the old limit with mediaserver.

Change-Id: Ia8217a9f2a1076fa247d7f5ed5159e3c91244d78
2010-03-23 20:39:05 -07:00
San Mehat
4e221f0077 init: Add support for specifying a services i/o priority
Signed-off-by: San Mehat <san@google.com>
2010-02-26 10:05:20 -08:00
Iliyan Malchev
32f51664c8 am 4f4ccaa1: am 1404c27b: Merge "system/core/init: set proper permissions for tpa2018d1 (CDMA)" into eclair
Merge commit '4f4ccaa1bd079ebc67a97709bbb7ab5ada7449d5'

* commit '4f4ccaa1bd079ebc67a97709bbb7ab5ada7449d5':
  system/core/init: set proper permissions for tpa2018d1 (CDMA)
2010-02-02 14:25:55 -08:00
Iliyan Malchev
4f4ccaa1bd am 1404c27b: Merge "system/core/init: set proper permissions for tpa2018d1 (CDMA)" into eclair
Merge commit '1404c27bff1499dae9b640870ce2251d78cdc5ef' into eclair-plus-aosp

* commit '1404c27bff1499dae9b640870ce2251d78cdc5ef':
  system/core/init: set proper permissions for tpa2018d1 (CDMA)
2010-02-02 14:20:30 -08:00
Iliyan Malchev
1340a095ac system/core/init: set proper permissions for tpa2018d1 (CDMA)
Signed-off-by: Iliyan Malchev <malchev@google.com>
2010-02-02 13:57:12 -08:00
Nick Pelly
6405c6953f Clean fix for the chown race condition on new input devices.
Drop init's egid to AID_INPUT while creating the device node, so that it is
created with the correct gid. This eliminates the
possibility of system_server opening the device node before its permissions
are set correctly.

Using setegid() allows us to swap back to AID_ROOT immediately after mknod().

Bug: 2375632
2010-01-22 11:50:49 -08:00
Mike Lockwood
7a36210cdb init: Support bugreports to SD card in user builds if adb is enabled.
The rationale being that we do not want this enabled by default, but
tying it to adb being enabled allows convenient bugreport collection
for savvy users and developers using production devices.

Change-Id: I71535b33f0774faf1975c98d106080f2ff12e349
Signed-off-by: Mike Lockwood <lockwood@android.com>
2010-01-19 14:41:40 -05:00
Oscar Montemayor
ef4e21520c Encrypted File SYstems project. Enabling EFS security properties.
This change enables persist.security.* flags in the device, allowing oly the system to modify them.
Change is necessary to allow for further progress in the project, as this is an ideal location for access both from the
framework as well as from the recovery mode / transition.
2009-11-12 12:02:24 -08:00
Dima Zavin
5c204f59f7 am 7789f4cc: am 065694b3: init: devices: Remove pmem_gpu regions as they are not needed since we have an mmu
Merge commit '7789f4cc4b712f15e0e5306a874ad6f47dc8c5c0' into eclair-mr2-plus-aosp

* commit '7789f4cc4b712f15e0e5306a874ad6f47dc8c5c0':
  init: devices: Remove pmem_gpu regions as they are not needed since we have an mmu
2009-10-15 02:43:55 -07:00
Dima Zavin
68b88de455 am 68221b91: am 8234aa37: init: Add qdsp6 video encoder, q6venc, device owned by system.audio
Merge commit '68221b91b13b174c9bc14c43f2d88bada0fa9546' into eclair-mr2-plus-aosp

* commit '68221b91b13b174c9bc14c43f2d88bada0fa9546':
  init: Add qdsp6 video encoder, q6venc, device owned by system.audio
2009-10-15 02:43:51 -07:00
Dima Zavin
c459372bc7 am 065694b3: init: devices: Remove pmem_gpu regions as they are not needed since we have an mmu
Merge commit '065694b32e481a50e57a793d61181494fbf6ef04' into eclair-plus-aosp

* commit '065694b32e481a50e57a793d61181494fbf6ef04':
  init: devices: Remove pmem_gpu regions as they are not needed since we have an mmu
2009-10-15 02:36:09 -07:00