Android Source Code Compilation: Permissive domain error in User mode

I tried to compile android 9.0 image with userdebug variant and it worked but constantly receiving this error when i try in user mode.
Can someone help please

Multiple same specifications for drm_device_management.
[ 0% 44/14830] build out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy
FAILED: out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy
/bin/bash -c “(ASAN_OPTIONS=detect_leaks=0 out/host/linux-x86/bin/checkpolicy -M -c 30 -o out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf ) && (out/host/linux-x86/bin/sepolicy-analyze out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp permissive > out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains ) && (if [ “user” = “user” -a -s out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains ]; then echo “==========” 1>&2; echo “ERROR: permissive domains not allowed in user builds” 1>&2; echo “List of invalid domains:” 1>&2; cat out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.permissivedomains 1>&2; exit 1; fi ) && (mv out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy )”
out/host/linux-x86/bin/checkpolicy: loading policy configuration from out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.recovery.conf
out/host/linux-x86/bin/checkpolicy: policy configuration loaded
out/host/linux-x86/bin/checkpolicy: writing binary representation (version 30) to out/target/product/rk3399/obj/ETC/sepolicy.recovery_intermediates/sepolicy.tmp

ERROR: permissive domains not allowed in user builds
List of invalid domains:
ninja: build stopped: subcommand failed.
09:26:42 ninja failed with: exit status 1

failed to build some targets (02:00 (mm:ss))


diff --git a/ b/
index 7f5eced..172506b 100755
--- a/
+++ b/
@@ -30,7 +30,7 @@ ifneq ($(project-path-for),)
     ifeq ($(LOCAL_PATH),bootable/recovery)
         PROJECT_PATH_AGREES := true
-            BOARD_SEPOLICY_DIRS += bootable/recovery/sepolicy
+            # BOARD_SEPOLICY_DIRS += bootable/recovery/sepolicy
         ifeq ($(LOCAL_PATH),bootable/recovery-twrp)
             ifeq ($(RECOVERY_VARIANT),twrp)

commented the line,
also just removed sepolicy from end
line became like
BOARD_SEPOLICY_DIRS += bootable/recovery
The OS compiled and flashed successfully on RockPi4 but after Rockchip KErnel logo it keeps on showing gray screen and keeps restarting, no android logo or anything
please help

Are you using GPT firmware?

yes, we are because we need to run it on rockpi and then root it using magisk and teamwin

Can you see the boot log? Maybe there was an error when packing GPT. You can try rkUpdate first.

sure let me see

@Lili please see these logs, also i cant access boot logs in user mode
start to make update.img…
Android Firmware Package Tool v1.65
------ PACKAGE ------
Add file: ./package-file
Add file: ./Image/MiniLoaderAll.bin
Add file: ./Image/parameter.txt
Add file: ./Image/trust.img
Add file: ./Image/uboot.img
Add file: ./Image/misc.img
Add file: ./Image/boot.img
Add file: ./Image/dtbo.img
Add file: ./Image/vbmeta.img
Add file: ./Image/recovery.img
Add file: ./Image/system.img
Add file: ./Image/vendor.img
Add file: ./Image/oem.img
Add CRC…
Make firmware OK!
------ OK ------
RKImageMaker ver 1.66
Generating new image, please wait…
Writing head info…
Writing boot file…
Writing firmware…
Generating MD5 data…
MD5 data generated successfully!
New image generated successfully!
Making update.img OK.

for adb its giving unauthorized errors

is there any way i can get out of the boot loop, by wiping cache partition or something. By default in user mode adb is disabled

We currently do not support compiling the user version, and there are some issues with SELinux.

1 Like