aboutsummaryrefslogtreecommitdiff
path: root/zh-cn/devices/tech/config/filesystem.html
diff options
context:
space:
mode:
Diffstat (limited to 'zh-cn/devices/tech/config/filesystem.html')
-rw-r--r--zh-cn/devices/tech/config/filesystem.html7
1 files changed, 5 insertions, 2 deletions
diff --git a/zh-cn/devices/tech/config/filesystem.html b/zh-cn/devices/tech/config/filesystem.html
index 6a721094..ed020565 100644
--- a/zh-cn/devices/tech/config/filesystem.html
+++ b/zh-cn/devices/tech/config/filesystem.html
@@ -56,13 +56,16 @@
<p>
要启用新的 AID 机制,请在 <code>BoardConfig.mk</code> 文件中设置 <code>TARGET_FS_CONFIG_GEN</code>。此变量含有配置文件列表,使您可以根据需要附加文件。</p>
-<aside class="caution"><strong>注意</strong>:请勿通过旧版 Android 中早期的 <code>TARGET_FS_CONFIG_GEN</code> 方法使用 <code>TARGET_ANDROID_FILESYSTEM_CONFIG_H</code>!否则,您会收到错误提示。</aside>
+<aside class="caution"><strong>注意</strong>:请勿将 <code>TARGET_FS_CONFIG_GEN</code> 与旧版 Android 中早期的 <code>TARGET_ANDROID_FILESYSTEM_CONFIG_H</code> 方法结合使用!否则,您会收到错误提示。</aside>
<p>按照惯例,配置文件使用名称 <code>config.fs</code>,但在实际使用中,您可以使用任何名称。<code>config.fs</code> 文件采用 <a href="https://docs.python.org/2/library/configparser.html" class="external">Python ConfigParser ini 格式</a>,并包含 caps 部分(用于配置文件系统权能)和 AID 部分(用于配置 OEM 专属 AID)。
</p>
<h3 id="configuring-the-caps-section">配置 caps 部分</h3>
-<p>利用 caps 部分,您可以在编译环境中对文件系统对象设置<a href="http://man7.org/linux/man-pages/man7/capabilities.7.html" class="external">文件系统权能</a>(文件系统本身也必须支持此功能)。</p>
+
+<aside class="note"><strong>注意</strong>:<a href="/devices/tech/config/ambient">Ambient 权能</a>是为 init 所启动的服务设置权能的首选机制(此方法可将服务配置的所有方面保存在单个 <code>.rc</code> 文件中)。我们建议您对这些服务使用 Ambient 权能,而不是在 <code>config.fs</code> 文件中使用 caps 部分配置文件系统权能。在为<strong>并非 init 所启动</strong>的服务设置权能时,请继续使用 <code>fs_config.c</code> 配置文件系统权能。</aside>
+
+<p>借助 caps 部分,您可以在编译环境中对文件系统对象设置<a href="http://man7.org/linux/man-pages/man7/capabilities.7.html" class="external">文件系统权能</a>(文件系统本身也必须支持此功能)。</p>
<p>由于在 Android 中以 Root 身份运行稳定的服务会导致无法通过<a href="/compatibility/cts/index.html">兼容性测试套件 (CTS)</a> 测试,因此在之前有关在运行进程或服务时保留权能的要求中,您在运行进程或服务时需要先设置权能,然后使用 <code>setuid</code>/<code>setgid</code> 设置适当的 AID。借助 caps 部分,您可以跳过这些要求,让内核为您代劳。当控制权交给 <code>main()</code> 时,您的进程已拥有其所需的权能,因此您的服务可以使用非 Root 用户和群组(这是启动特权服务的首选方式)。</p>