OSDN Git Service

Add fstab to fix annoying 'RLIMIT_NICE not set' errors
authorChih-Wei Huang <cwhuang@linux.org.tw>
Fri, 9 Jan 2015 17:03:47 +0000 (01:03 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Thu, 5 May 2016 18:17:11 +0000 (02:17 +0800)
Originally android relies mount_all to trigger some actions.
But android-x86 doesn't use fstab before. So we trigger these
actions on fs stage directly. This works before lollipop.

However, lollipop changed the built-in class main to be
triggerred via init*.rc. So I triggerred it on fs as well.
But this is incorrect. It makes the actions in class main
run before on boot stage. That causes rlimit not being
set for services started in class main.

Fix the issue by adding a fstab and do mount_all on fs stage
like normal android system. It should correct other possible
timing issues.

device.mk
fstab.x86 [new file with mode: 0644]
init.x86.rc

index 605afaf..1b80997 100644 (file)
--- a/device.mk
+++ b/device.mk
@@ -30,6 +30,7 @@ PRODUCT_COPY_FILES := \
     $(if $(wildcard $(PRODUCT_DIR)init.rc),$(PRODUCT_DIR)init.rc:root/init.rc) \
     $(if $(wildcard $(PRODUCT_DIR)init.sh),$(PRODUCT_DIR),$(LOCAL_PATH)/)init.sh:system/etc/init.sh \
     $(if $(wildcard $(PRODUCT_DIR)modules.blacklist),$(PRODUCT_DIR),$(LOCAL_PATH)/)modules.blacklist:system/etc/modules.blacklist \
+    $(if $(wildcard $(PRODUCT_DIR)fstab.$(TARGET_PRODUCT)),$(PRODUCT_DIR)fstab.$(TARGET_PRODUCT),$(LOCAL_PATH)/fstab.x86):root/fstab.$(TARGET_PRODUCT) \
     $(if $(wildcard $(PRODUCT_DIR)wpa_supplicant.conf),$(PRODUCT_DIR),$(LOCAL_PATH)/)wpa_supplicant.conf:system/etc/wifi/wpa_supplicant.conf \
     $(if $(wildcard $(PRODUCT_DIR)excluded-input-devices.xml),$(PRODUCT_DIR),$(LOCAL_PATH)/)excluded-input-devices.xml:system/etc/excluded-input-devices.xml \
     $(if $(wildcard $(PRODUCT_DIR)init.$(TARGET_PRODUCT).rc),$(PRODUCT_DIR)init.$(TARGET_PRODUCT).rc,$(LOCAL_PATH)/init.x86.rc):root/init.$(TARGET_PRODUCT).rc \
diff --git a/fstab.x86 b/fstab.x86
new file mode 100644 (file)
index 0000000..1e85b29
--- /dev/null
+++ b/fstab.x86
@@ -0,0 +1,6 @@
+none   /cache                  tmpfs   nosuid,nodev,noatime    defaults
+
+auto   /storage/usb0   vfat    none    wait,noemulatedsd,voldmanaged=usb0:auto
+auto   /storage/usb1   vfat    none    wait,noemulatedsd,voldmanaged=usb1:auto
+auto   /storage/usb2   vfat    none    wait,noemulatedsd,voldmanaged=usb2:auto
+auto   /storage/usb3   vfat    none    wait,noemulatedsd,voldmanaged=usb3:auto
index 47022b4..9001841 100644 (file)
@@ -45,6 +45,10 @@ on init
 
     exec /system/bin/logwrapper /system/bin/sh /system/etc/init.sh
 
+on fs
+    mount_all /fstab.${ro.hardware}
+    setprop ro.crypto.fuse_sdcard true
+
 on post-fs-data
     sysclktz 1
 
@@ -81,12 +85,6 @@ on boot
     # workaround for h.265 slowness
     setprop sys.media.vdec.drop 0
 
-on fs
-    setprop ro.crypto.fuse_sdcard true
-    # manually start class late_start since we don't use mount_all
-    class_start main
-    class_start late_start
-
 service wpa_supplicant /system/bin/wpa_supplicant -c/data/misc/wifi/wpa_supplicant.conf \
     -ddddd \
     -iwlan0 -Dnl80211 \