Does hikey support insmod under init.rc?

also I use audit2allow to generate the policy automatically as below:

adb pull /sys/fs/selinux/policy 
cyin@kesh-hs-lws01:/work/hikey-xx-0507/external/selinux/prebuilts/bin$ cat avc.log | audit2allow -p policy


#============= modprobe ==============
allow modprobe vendor_toolbox_exec:file entrypoint;

I checked above line already added in my /device/linaro/sepolicy/modprobe.te. So this should have other issue.

Stop screwing around with selinux policy. Re-read my previous response and follow my instructions.

Thanks, I know you mean I need put the modprobe xxx.ko related on some vendor scripts, but in fact I could not find the vendor scripts on the Hikey platform, because Hikey platform even have no vendor folder under the project root /. But Qualcomm platform have vendor related init scripts.
So that’s why have not follow the instructions.
Sorry for confuse you.

@yinjun2014 Please see again previous reply (number 14) above. You might have missed it.

Again, for future references, please enclose code/logs/outputs in your post with 3 backticks. Otherwise it’s hard to read your logs. See https://help.github.com/en/articles/creating-and-highlighting-code-blocks#fenced-code-blocks for references.

Also as mentioned above, vendor init is device/linaro/hikey/init.common.rc in your source tree, or /vendor/etc/init/init.hikey960.rc. Try putting your modprobe there, but it should have already been loaded automatically by just using BOARD_VENDOR_KERNEL_MODULES, without having to change init rc files. One of our engineers did it.

In fact currently I already put the modprobe in the device/linaro/hikey/init.common.rc.

xx/device/linaro/hikey$ git diff  init.common.rc
diff --git a/init.common.rc b/init.common.rc
old mode 100644
new mode 100755
index 6d66ca7..465d150
--- a/init.common.rc
+++ b/init.common.rc
@@ -25,7 +25,8 @@ on init
     mkdir /dev/socket/pdx/system/vr/sensors 0775 system system

     start watchdogd
-
+    exec u:r:modprobe:s0 -- /vendor/bin/modprobe -a -d \
+        /vendor/lib/modules snd-soc-xxx- ...
 on fs

/device$ grep "BOARD_VENDOR_KERNEL_MODULES" -r .

also on the device folder, I searched the macro BOARD_VENDOR_KERNEL_MODULES, only google related folder used this macro, not found under hikey folder.
Below is all the output

./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/crosshatch/BoardConfig-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/taimen/BoardConfig.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \
./google/muskie/device-common.mk:BOARD_VENDOR_KERNEL_MODULES += \

do you mean your engineer use modprobe success on the hikey platform? which android version ? 8.0 or 10.0?

For the 3rd time, PLEASE enclose code/logs/outputs in your post with 3 backticks!!! It’s DIFFICULT to read your logs without the proper formatting, and you can’t expect others to fix your post for you every time! Please read https://help.github.com/en/articles/creating-and-highlighting-code-blocks#fenced-code-blocks for how to do it. It’ll take less than 5 minutes and not that difficult to do!

You were supposed to try below first in hikey960/BoardConfig.mk before trying modprobe in the init rc file. Have you done it? That’s all our engineer did and that should be all that’s needed. Shouldn’t have to mess with modprobe.

+vendor_hikey_dir := :device/linaro/hikey/vendor/lib/modules
+# USE BOARD_VENDOR_KERNEL_MODULES, NOT BOARD_RECOVERY_KERNEL_MODULES!
+BOARD_VENDOR_KERNEL_MODULES := \
+         $(vendor_hikey_dir)/snd-soc-xxx-1.ko \
+         $(vendor_hikey_dir)/snd-soc-xxx-2.ko \
+         $(vendor_hikey_dir)/iaxxx-xxx-3.ko \
+         $(vendor_hikey_dir)/iaxxx-xxx-1.ko

https://android-review.googlesource.com/c/device/linaro/hikey/+/989223 has additional details that might be related/useful to this discussion.