universal7580: Create root folders outside of vendor init script
authorBruno Martins <bgcngm@gmail.com>
Sun, 7 Oct 2018 23:25:18 +0000 (01:25 +0200)
committerDanny Wood <danwood76@gmail.com>
Tue, 10 Mar 2020 15:25:55 +0000 (15:25 +0000)
 * The core SELinux policies for vendor_init are being restricted as to
   comply with Treble. Simply adding a local rule to allow creating
   folders under rootfs would be enough, but at the same time defining
   the extra root folders and making use of AID/fs configuration file
   to set perms is more neat and clean.

 * Furthermore, with System As Root / is a read-only filesystem
   so we can't create our mountpoints from init script anymore

Change-Id: Idabd7ae72e4c4fd9daac5ba3be3e6236f79f251b

BoardConfigCommon.mk
config.fs [new file with mode: 0644]
ramdisk/etc/fstab.samsungexynos7580
ramdisk/etc/init.baseband.rc
ramdisk/etc/init.samsungexynos7580.rc
sepolicy/file_contexts

index 60c1d0579dd961b56ea45830f6894aa5ae594003..23f225ab51fe3185796cdf33c1a7f37a8e01b965 100644 (file)
@@ -59,6 +59,8 @@ BOARD_KERNEL_IMAGE_NAME := Image
 #BOARD_KERNEL_CMDLINE := The bootloader ignores the cmdline from the boot.img
 BOARD_KERNEL_SEPARATED_DT := true
 TARGET_CUSTOM_DTBTOOL := dtbhtoolExynos
+BOARD_ROOT_EXTRA_FOLDERS += efs cpefs
+TARGET_FS_CONFIG_GEN := $(LOCAL_PATH)/config.fs
 
 # Kernel
 TARGET_KERNEL_ARCH := arm64
diff --git a/config.fs b/config.fs
new file mode 100644 (file)
index 0000000..403da02
--- /dev/null
+++ b/config.fs
@@ -0,0 +1,5 @@
+[cpefs/]
+mode: 0771
+user: AID_SYSTEM
+group: AID_RADIO
+caps: 0
index 51ebcfc73f98f8b505708e71223f82d7c0c9fc1f..685ac829412bba705baa4c5c29994c2e01c1d061 100644 (file)
@@ -8,6 +8,7 @@
 /dev/block/platform/13540000.dwmmc0/by-name/BOOT        /boot       emmc    defaults                                                                        defaults
 /dev/block/platform/13540000.dwmmc0/by-name/OTA         /misc       emmc    defaults                                                                        defaults
 /dev/block/platform/13540000.dwmmc0/by-name/RECOVERY    /recovery   emmc    defaults                                                                        defaults
+/dev/block/platform/13540000.dwmmc0/by-name/CPEFS       /cpefs      ext4    noatime,nosuid,nodev,noauto_da_alloc,discard,journal_async_commit,errors=panic  wait,check
 /dev/block/platform/13540000.dwmmc0/by-name/EFS         /efs        ext4    nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic  wait,check
 /dev/block/platform/13540000.dwmmc0/by-name/CACHE       /cache      f2fs    rw,nosuid,nodev,noatime,nodiratime,inline_xattr                                 wait,check
 /dev/block/platform/13540000.dwmmc0/by-name/CACHE       /cache      ext4    nosuid,nodev,noatime,noauto_da_alloc,discard,journal_async_commit,errors=panic  wait,check
index 1aa1f0948a5999049b9290a2802a0b256fb302b6..6e008e5352ef96e2fea437ff452a7f2a6a54dbfb 100644 (file)
@@ -1,5 +1,4 @@
 on init
-    mkdir /efs 0771 radio system
     symlink /dev/block/platform/13540000.dwmmc0/by-name/RADIO /dev/mbin0
     restorecon /dev/mbin0
     write /sys/class/net/rmnet0/queues/rx-0/rps_cpus 6
@@ -34,14 +33,6 @@ on fs
     chmod 0660 /sys/devices/virtual/misc/umts_dm0/dm_state
     chown radio system /sys/devices/virtual/misc/umts_dm0/dm_state
 
-#For cpefs partition
-    mkdir /cpefs 0771 radio system
-    wait /dev/block/platform/13540000.dwmmc0/by-name/CPEFS
-    exec /system/bin/e2fsck -p /dev/block/platform/13540000.dwmmc0/by-name/CPEFS
-    mount ext4 /dev/block/platform/13540000.dwmmc0/by-name/CPEFS /cpefs noatime nosuid nodev barrier=1
-    chown radio system /cpefs
-    chmod 0771 /cpefs
-
 # Parse hardware revision (needs to happen before cbd starts)
 service modemloader /system/bin/modemloader
     class core
index 610621646a2f19aee0473c780d2c941391285957..4a50901353a63f727a697bb3f8daa76431c05e28 100644 (file)
@@ -9,8 +9,6 @@ on early-init
     mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755
 
 on init
-    mkdir /preload 0771 system system
-
     # RIL <-> audioserver comm
     chmod 0644 /proc/cmdline
 
@@ -274,19 +272,6 @@ on fs
     chmod 0660 /sys/class/mdnie/mdnie/lux
     chown system system /sys/class/mdnie/mdnie/lux
 
-#For Absolute Persistence Partition
-    mkdir /persdata 0755 system system
-    mkdir /persdata/absolute 0750 system system
-
-    wait /dev/block/platform/13540000.dwmmc0/by-name/PERSDATA
-    exec /system/bin/e2fsck -p /dev/block/platform/13540000.dwmmc0/by-name/PERSDATA
-    mount ext4 /dev/block/platform/13540000.dwmmc0/by-name/PERSDATA /persdata/absolute nosuid nodev barrier=1
-
-    chown system system /persdata
-    chmod 0755 /persdata
-    chown system system /persdata/absolute
-    chmod 0750 /persdata/absolute
-
 # Permissions for TouchScreen
     chown system radio /sys/class/sec/tsp/cmd
     chown system system /sys/class/sec/tsp/input/enabled
index 4009c0457a3830293e5609cb3576fc42ee8c0ebf..d18ec30c87f12ea5d7f11d99f02ce4223bed716a 100644 (file)
@@ -81,6 +81,7 @@
 /efs/prov_data(/.*)?         u:object_r:prov_efs_file:s0
 /efs/wifi(/.*)?              u:object_r:wifi_efs_file:s0
 /efs/wv\.keys                u:object_r:cpk_efs_file:s0
+/cpefs(/.*)?                 u:object_r:sec_efs_file:s0
 
 ####################################
 # data files