AOSP 7.1.2 r33 stuck in boot loop on HiKey

I followed the instructions on the AOSP site and here: How to make boot.img file to build and install AOSP for the HiKey, however when I try to boot it the board gets stuck in a loop:

[    6.139135] ALSA device list:
[    6.142213]   #0: hikey-hdmi
[    6.152906] Freeing unused kernel memory: 4544K
[    6.158014] mmc_host mmc2: Bus speed (slot 0) = 24800000Hz (slot req 25000000Hz, actual 24800000HZ div = 0)
[    6.181972] mmc2: new SDIO card at address 0001
[    6.187852] init: init first stage started!
[    6.194462] wl18xx_driver wl18xx.3.auto: Direct firmware load for ti-connectivity/wl18xx-conf.bin failed with error -2
[    6.219274] wl18xx_driver wl18xx.3.auto: Falling back to user helper
[    6.239670] SELinux:  Permission validate_trans in class security not defined in policy.
[    6.248929] SELinux:  Class cap_userns not defined in policy.
[    6.254817] SELinux:  Class cap2_userns not defined in policy.
[    6.260880] SELinux: the above unknown classes and permissions will be denied
[    6.279410] dwc2 f72c0000.usb: Set speed to high-speed
[    6.284731] usb 1-1: new high-speed USB device number 2 using dwc2
[    6.450370] audit: type=1403 audit(9.843:2): policy loaded auid=4294967295 ses=4294967295
[    6.459762] audit: type=1404 audit(9.855:3): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
[    6.479368] dwc2 f72c0000.usb: Set speed to high-speed
[    6.487715] init: (Initializing SELinux enforcing took 0.29s.)
[    6.500526] init: init second stage started!
[    6.506173] hub 1-1:1.0: USB hub found
[    6.510390] hub 1-1:1.0: 3 ports detected
[    6.515222] init: Running restorecon...
[    6.797678] init: waitpid failed: No child processes
[    6.803141] dwc2 f72c0000.usb: Set speed to full-speed
[    6.803263] init: (Loading properties from /default.prop took 0.00s.)
[    6.806857] init: (Parsing /init.environ.rc took 0.00s.)
[    6.807753] init: (Parsing /init.usb.rc took 0.00s.)
[    6.808775] init: (Parsing init.hikey.usb.rc took 0.00s.)
[    6.808802] init: (Parsing /init.hikey.rc took 0.00s.)
[    6.810167] init: (Parsing /init.usb.configfs.rc took 0.00s.)
[    6.810366] init: (Parsing /init.zygote64_32.rc took 0.00s.)
[    6.821446] ueventd: ueventd started!
[    6.854133] usb 1-1.1: new low-speed USB device number 3 using dwc2
[    7.151464] usb 1-1: USB disconnect, device number 2
[    7.346716] ueventd: Coldboot took 0.52s.
[    7.402297] audit: type=1400 audit(10.795:4): avc:  denied  { create } for  pid=1 comm="init" name="cpu.rt_period_us" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.419876] audit: type=1400 audit(10.815:5): avc:  denied  { create } for  pid=1 comm="init" name="cpu.rt_runtime_us" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.448787] audit: type=1400 audit(10.843:6): avc:  denied  { create } for  pid=1 comm="init" name="cpus" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.465309] audit: type=1400 audit(10.863:7): avc:  denied  { create } for  pid=1 comm="init" name="mems" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.482208] audit: type=1400 audit(10.875:8): avc:  denied  { create } for  pid=1 comm="init" name="cpus" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.498695] audit: type=1400 audit(10.891:9): avc:  denied  { create } for  pid=1 comm="init" name="mems" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.515620] audit: type=1400 audit(10.911:10): avc:  denied  { create } for  pid=1 comm="init" name="cpus" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.532200] audit: type=1400 audit(10.927:11): avc:  denied  { create } for  pid=1 comm="init" name="mems" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.549158] audit: type=1400 audit(10.943:12): avc:  denied  { create } for  pid=1 comm="init" name="cpus" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.565724] audit: type=1400 audit(10.959:13): avc:  denied  { create } for  pid=1 comm="init" name="mems" scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=0
[    7.585073] Registered swp emulation handler
[    7.605498] EXT4-fs (mmcblk0p9): mounted filesystem with ordered data mode. Opts: (null)
[    7.623642] EXT4-fs (mmcblk0p8): mounted filesystem with ordered data mode. Opts: discard,noauto_da_alloc,data=ordered,user_xattr,discard,barrier=1
[    7.646142] EXT4-fs (mmcblk0p10): mounted filesystem with ordered data mode. Opts: discard,noauto_da_alloc,data=ordered,user_xattr,discard,barrier=1
[    7.714939] Bluetooth: hci0: change remote baud rate command in firmware
[    7.908484] wlcore: wl18xx HW: 183x or 180x, PG 2.2 (ROM 0x11)
[    7.943452] wlcore: loaded
[    7.954220] logd.auditd: start
[    7.957833] logd.klogd: 7902699999
[    8.327585] file system registered
[    8.331356] type=1400 audit(11.719:17): avc: denied { create } for pid=1 comm="init" name="idVendor" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    8.358095] binder: 1891:1891 transaction failed 29189/0, size 0-0 line 2866
[    8.402698] using random self ethernet address
[    8.402708] using random host ethernet address
[    8.426742] read descriptors
[    8.426759] read strings
[    8.467221] logd.daemon: reinit
[    8.487460] type=1400 audit(11.719:18): avc: denied { create } for pid=1 comm="init" name="bcdDevice" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    8.503973] type=1400 audit(11.719:19): avc: denied { create } for pid=1 comm="init" name="bcdUSB" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
hikey:/ $ [    8.520241] type=1400 audit(11.719:20): avc: denied { create } for pid=1 comm="init" name="serialnumber" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    8.537971] type=1400 audit(11.719:21): avc: denied { create } for pid=1 comm="init" name="manufacturer" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    8.545784] dwc2 f72c0000.usb: bound driver configfs-gadget
[    8.560472] type=1400 audit(11.719:22): avc: denied { create } for pid=1 comm="init" name="product" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    8.576807] type=1400 audit(11.795:23): avc: denied { create } for pid=1 comm="init" name="wceis" scontext=u:r:init:s0 tcontext=u:object_r:configfs:s0 tclass=file permissive=0
[    9.207359] Mali<2>: [    9.209502] Session 0x732F6E00 with pid 1894 was granted higher priority.
[    9.359547] healthd: wakealarm_init: timerfd_create failed
[    9.365544] healthd: No battery devices found
[    9.370298] healthd: battery l=100 v=0 t=42.4 h=2 st=2 chg=a
[    9.550046] surfaceflinger[1894]: unhandled level 1 translation fault (11) at 0x00000000, esr 0x92000045
[    9.559735] pgd = ffffffc0733cb000
[    9.563242] [00000000] *pgd=0000000000000000, *pud=0000000000000000
[    9.569693] 
[    9.571261] CPU: 4 PID: 1894 Comm: surfaceflinger Not tainted 4.9.51-02188-geab3faa #1
[    9.579330] Hardware name: HiKey Development Board (DT)
[    9.584660] task: ffffffc074281000 task.stack: ffffffc072820000
[    9.590690] PC is at 0x7fb6cc49f8
[    9.594084] LR is at 0x7fb6cc49f0
[    9.597502] pc : [<0000007fb6cc49f8>] lr : [<0000007fb6cc49f0>] pstate: 60000000
[    9.605039] sp : 0000007fffffeee0
[    9.608448] x29: 0000007fffffef80 x28: 0000000000000000 
[    9.613880] x27: 939edbec049bc520 x26: 0000000000000008 
[    9.619336] x25: 0000007fb7427a88 x24: 0000007fb7427810 
[    9.624802] x23: 0000000000000000 x22: 0000007fb7427a80 
[    9.630242] x21: 0000007fb74e4010 x20: 0000007fb7437280 
[    9.635711] x19: 0000007fb74848c0 x18: 00000000ffffffff 
[    9.641160] x17: 0000007fb7c8cc88 x16: 0000007fb7e0f9f8 
[    9.646602] x15: 00000f9c94fff99b x14: 00097a25bfecdc00 
[    9.652056] x13: 000000000000000c x12: 0000000000000016 
[    9.657487] x11: 0000000000000000 x10: 0000000000000001 
[    9.662913] x9 : 0000000000000000 x8 : 0000007fb748b610 
[    9.668378] x7 : 0000007fb748b610 x6 : 0000007fb7f4a000 
[    9.673796] x5 : 0000000000000002 x4 : 00081ea9db800000 
[    9.679261] x3 : 0000000000000000 x2 : 0000007fffffeeec 
[    9.684695] x1 : 0000000000000001 x0 : 0000007fb7427a88 
[    9.690110] 
[   11.618299] random: crng init done
[   12.391291] dwc2 f72c0000.usb: Set speed to full-speed
[   12.397323] usb 1-1: new full-speed USB device number 7 using dwc2
[   12.591198] dwc2 f72c0000.usb: Set speed to full-speed
[   12.616387] usb 1-1: not running at top speed; connect to a high speed hub
[   12.632287] hub 1-1:1.0: USB hub found
[   12.636613] hub 1-1:1.0: 3 ports detected
[   12.927233] dwc2 f72c0000.usb: Set speed to full-speed
[   12.932615] usb 1-1.1: new low-speed USB device number 8 using dwc2
[   13.019208] dwc2 f72c0000.usb: Set speed to full-speed
[   13.065508] input: Logitech Logitech USB Keyboard as /devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.1/1-1.1:1.0/0003:046D:C315.0001/input/input1
[   13.155433] hid-generic 0003:046D:C315.0001: input,hidraw0: USB HID v1.10 Keyboard [Logitech Logitech USB Keyboard] on usb-f72c0000.usb-1.1/input0
[   13.251163] dwc2 f72c0000.usb: Set speed to full-speed
[   13.257287] usb 1-1.2: new full-speed USB device number 9 using dwc2
[   13.343235] dwc2 f72c0000.usb: Set speed to full-speed
[   13.396938] input: ILITEK Multi-Touch-V3000 as /devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.2/1-1.2:1.0/0003:222A:0001.0002/input/input2
[   13.419778] hid-multitouch 0003:222A:0001.0002: input,hidraw1: USB HID v1.10 Device [ILITEK Multi-Touch-V3000] on usb-f72c0000.usb-1.2/input0
[   13.443878] input: ILITEK Multi-Touch-V3000 as /devices/platform/soc/f72c0000.usb/usb1/1-1/1-1.2/1-1.2:1.1/0003:222A:0001.0003/input/input3
[   13.525128] hid-generic 0003:222A:0001.0003: input,hidraw2: USB HID v1.10 Mouse [ILITEK Multi-Touch-V3000] on usb-f72c0000.usb-1.2/input1
[   13.955768] init: Starting service 'zygote'...
[   13.962151] init: Starting service 'audioserver'...
[   13.969681] init: Starting service 'cameraserver'...
[   13.977121] init: Starting service 'media'...
[   13.996966] type=1400 audit(17.391:36): avc: denied { getattr } for pid=2060 comm="audioserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:audioserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   14.017869] init: couldn't write 2061 to /dev/cpuset/camera-daemon/tasks: No such file or directory
[   14.023312] type=1400 audit(17.415:37): avc: denied { getattr } for pid=2061 comm="cameraserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:cameraserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   14.148949] init: Starting service 'netd'...
[   14.172969] init: Starting service 'surfaceflinger'...
[   14.435982] capability: warning: `main' uses 32-bit capabilities (legacy support in use)
[   14.785308] Mali<2>: [   14.788101] Session 0x70814800 with pid 2064 was granted higher priority.
[   15.094478] surfaceflinger[2064]: unhandled level 1 translation fault (11) at 0x00000000, esr 0x92000045
[   15.104231] pgd = ffffffc072abb000
[   15.107752] [00000000] *pgd=0000000000000000, *pud=0000000000000000
[   15.114280] 
[   15.115912] CPU: 0 PID: 2064 Comm: surfaceflinger Not tainted 4.9.51-02188-geab3faa #1
[   15.124082] Hardware name: HiKey Development Board (DT)
[   15.129492] task: ffffffc073117080 task.stack: ffffffc072820000
[   15.135556] PC is at 0x7fb6fcc9f8
[   15.138966] LR is at 0x7fb6fcc9f0
[   15.142383] pc : [<0000007fb6fcc9f8>] lr : [<0000007fb6fcc9f0>] pstate: 60000000
[   15.149950] sp : 0000007fffffeee0
[   15.153394] x29: 0000007fffffef80 x28: 0000000000000000 
[   15.158869] x27: 2930ea361c302066 x26: 0000000000000008 
[   15.164342] x25: 0000007fb7427a88 x24: 0000007fb7427810 
[   15.169813] x23: 0000000000000000 x22: 0000007fb7427a80 
[   15.175323] x21: 0000007fb74e4010 x20: 0000007fb7437280 
[   15.180813] x19: 0000007fb74838c0 x18: 00000000ffffffff 
[   15.186275] x17: 0000007fb7caac88 x16: 0000007fb79559f8 
[   15.191770] x15: 00000cbdb7fffac8 x14: 0003473bbfcac700 
[   15.197246] x13: 0000000000000012 x12: 0000000000000016 
[   15.202715] x11: 0000000000000000 x10: 0000000000000001 
[   15.208204] x9 : 0000000000000000 x8 : 0000007fb748b610 
[   15.213667] x7 : 0000007fb748b610 x6 : 0000007fb7f4a000 
[   15.219154] x5 : 0000000000000002 x4 : 00081ea9db800000 
[   15.224748] x3 : 0000000000000000 x2 : 0000007fffffeeec 
[   15.230325] x1 : 0000000000000001 x0 : 0000007fb7427a88 
[   15.235917] 
[   15.242794] init: Service 'surfaceflinger' (pid 2064) killed by signal 11
[   15.249835] init: Service 'surfaceflinger' (pid 2064) killing any children in process group
[   15.258513] init: Service 'zygote' is being killed...
[   18.331706] type=1400 audit(21.723:38): avc: denied { getattr } for pid=2130 comm="cameraserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:cameraserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   18.352918] type=1400 audit(21.743:39): avc: denied { getattr } for pid=2129 comm="audioserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:audioserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   19.302834] init: Starting service 'media'...
[   19.308785] init: Starting service 'netd'...
[   19.314814] init: Starting service 'surfaceflinger'...
[   19.546068] Mali<2>: [   19.548894] Session 0x70956200 with pid 2135 was granted higher priority.
[   19.822472] surfaceflinger[2135]: unhandled level 1 translation fault (11) at 0x00000000, esr 0x92000045
[   19.832137] pgd = ffffffc070aa3000
[   19.835615] [00000000] *pgd=0000000000000000, *pud=0000000000000000
[   19.842048] 
[   19.843603] CPU: 3 PID: 2135 Comm: surfaceflinger Not tainted 4.9.51-02188-geab3faa #1
[   19.851652] Hardware name: HiKey Development Board (DT)
[   19.856959] task: ffffffc074d48000 task.stack: ffffffc070924000
[   19.862970] PC is at 0x7fb6cc49f8
[   19.866339] LR is at 0x7fb6cc49f0
[   19.869711] pc : [<0000007fb6cc49f8>] lr : [<0000007fb6cc49f0>] pstate: 60000000
[   19.877205] sp : 0000007fffffeee0
[   19.880578] x29: 0000007fffffef80 x28: 0000000000000000 
[   19.885984] x27: ae5cdb98c47e5427 x26: 0000000000000008 
[   19.891405] x25: 0000007fb7427a88 x24: 0000007fb7427810 
[   19.896814] x23: 0000000000000000 x22: 0000007fb7427a80 
[   19.902224] x21: 0000007fb74e4010 x20: 0000007fb7437280 
[   19.907645] x19: 0000007fb74848c0 x18: 00000000ffffffff 
[   19.913052] x17: 0000007fb7b19c88 x16: 0000007fb7aae9f8 
[   19.918463] x15: 0000154797554c9e x14: 000e6ca07fadcc40 
[   19.923884] x13: 0000000000000016 x12: 0000000000000016 
[   19.929298] x11: 0000000000000000 x10: 0000000000000001 
[   19.934708] x9 : 0000000000000000 x8 : 0000007fb748b610 
[   19.940127] x7 : 0000007fb748b610 x6 : 0000007fb7f4a000 
[   19.945537] x5 : 0000000000000002 x4 : 00081ea9db800000 
[   19.950943] x3 : 0000000000000000 x2 : 0000007fffffeeec 
[   19.956360] x1 : 0000000000000001 x0 : 0000007fb7427a88 
[   19.961769] 
[   19.967834] binder: release 2135:2180 transaction 410 in, still active
[   19.972433] init: Service 'surfaceflinger' (pid 2135) killed by signal 11
[   19.972452] init: Service 'surfaceflinger' (pid 2135) killing any children in process group
[   19.972491] init: Service 'zygote' is being killed...
[   19.980122] init: Service 'zygote' (pid 2128) killed by signal 9
[   19.980141] init: Service 'zygote' (pid 2128) killing any children in process group
[   19.980263] init: write_file: Unable to open '/sys/android_power/request_state': No such file or directory
[   19.980331] init: write_file: Unable to write to '/sys/power/state': Invalid argument
[   20.026550] binder: send failed reply for transaction 410 to 1973:2181
[   20.043791] binder: undelivered transaction 412
[   20.048457] binder: undelivered death notification, 0000007fb407a500
[   24.095901] type=1400 audit(27.487:40): avc: denied { getattr } for pid=2194 comm="audioserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:audioserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   24.117097] type=1400 audit(27.507:41): avc: denied { getattr } for pid=2195 comm="cameraserver" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:cameraserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   25.006186] Mali<2>: [   25.011146] Session 0x70A06A00 with pid 2198 was granted higher priority.
[   25.032109] init: Starting service 'bootanim'...
[   25.087881] type=1400 audit(28.483:42): avc: denied { getattr } for pid=2213 comm="bootanimation" path="/vendor" dev="rootfs" ino=9027 scontext=u:r:bootanim:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
[   25.391018] surfaceflinger[2198]: unhandled level 1 translation fault (11) at 0x00000000, esr 0x92000045
[   25.400720] pgd = ffffffc070a4c000

Not quite sure what to do about this. Anyone out there that can give me a hand?

Thanks,
Mike

Your surfaceflinger service is unable to execute correctly.
Could you double check you don’t miss the following steps:
https://source.android.com/source/devices#620userspace

You need to have https://dl.google.com/dl/android/aosp/linaro-hikey-20170523-4b9ebaff.tgz self extracted in your android tree to have vendor libs (mali…) before building.

Thanks for the replay Loic!

Ahh, yep I did that. In fact here is the directory:

mike@mike-Z87-D3HP:/mnt/AOSP$ ls vendor/
linaro
mike@mike-Z87-D3HP:/mnt/AOSP$ ls vendor/linaro/hikey/
BoardConfigPartial.mk  BoardConfigVendor.mk  device-partial.mk  device-vendor.mk  proprietary
mike@mike-Z87-D3HP:/mnt/AOSP$ ls vendor/linaro/hikey/proprietary/
lib64  libGLES_mali.so
mike@mike-Z87-D3HP:/mnt/AOSP$ ls vendor/linaro/hikey/proprietary/lib64/
libGLES_mali.so
mike@mike-Z87-D3HP:/mnt/AOSP$ 

Does it look like anything is missing?

Thanks,
Mike

I have the same kind of issue on android 7.1.2 r9
I also checked that I have binaries you are talking about.

[   37.157169] init: Starting service 'zygote'...
[   37.166294] init: Starting service 'audioserver'...
[   37.175592] init: Starting service 'cameraserver'...
[   37.182356] init: couldn't write 2184 to /dev/cpuset/camera-daemon/tasks: No such file or directory
[   37.182542] init:ser087] init: Starting service 'netd'...
[   37.184390] init: Starting service 'surfaceflinger'...
[   37.195072] type=1400 audit(40.799:18): avc: denied { getattr } for pid=2183 comm="audioserver" path="/vendor" dev="rootfs" ino=1082 scontext=u:r:audioserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
&¢êtype=1400 audit(40.835:19): avc: denied { getattr } for pid=2184 comm="cameraserver" path="/ven       ino=1082 scontext=u:r:cameraserver:s0 tcontext=u:object_r:rootfs:s0 tclass=lnk_file permissive=0
6.467829] init: Service 'surfaceflinger' (pid 2187) killed by signal 6
[   37.474803] init: Service 'surfaceflinger' (pid 2187) killing any children in process group
[   37.483356] init: Service 'zygote' is being killed...
[   37.495236] init: Service 'zygote' (pid 2182) killed by signal 9
[   37.501407] init: Service 'zygote' (pid 2182) killing any children in process group
[   37.509327] init: write_file: Unable to open '/sys/android_power/request_state': No such file or directory
[   37.519342] init: write_file: Unable to write to '/sys/power/state': Invalid argument
[   37.527398] init: Service 'audioserver' is being killed...
[   37.533094] init: Service 'cameraserver' is being killed...
[   37.538934] init: Service 'media' is being killed...
[   37.544149] init: Service 'netd' is being killed...
[   37.549875] init: Service 'audioserver' (pid 2183) killed by signal 9
[   37.556498] init: Service 'audioserver' (pid 2183) killing any children in process group
[   37.565243] init: Service 'cameraserver' (pid 2184) killed by signal 9
[   37.571870] init: Service 'cameraserver' (pid 2184) killing any children in process group
[   37.580781] init: Service 'media' (pid 2185) killed by signal 9
[   37.586901] init: Service 'media' (pid 2185) killing any children in process group
[   37.595082] init: Service 'netd' (pid 2186) killed by signal 9
[   37.601092] init: Service 'netd' (pid 2186) killing any children in process group
[   37.608971] init: Untracked pid 2212 killed by signal 9
[   37.614367] init: Untracked pid 2233 killed by signal 9

Yes seems to be the same issue, this is maybe a global issue on Hikey.
For debug purpose, could you please try the following in your adb shell:
$ su
$ setenforce 0

Hi Loic,
thank you for your answer.
I executed setenforce 0 but I do not see any difference. What did you expect precisely ?

Wanted to know if the crash could be linked to an access issue/missing SELinux rule.

Do you want me to check something specific in the serial traces once I have executed the setenforce command ?

Yes, SurfaceFlinger seems to be killed by signal 6 (SIGABRT), could be interesting to have the abort message/backtrace.
You should able to find this in logcat after the crash.
something like this:

$ logcat | grep DEBUG
01-01 00:10:42.116 2738 2738 F DEBUG : Build fingerprint: ‘Android/hikey960/hikey960:P/OC/259:userdebug/test-keys’
01-01 00:10:42.125 2738 2738 F DEBUG : Revision: ‘0’
01-01 00:10:42.128 2738 2738 F DEBUG : ABI: ‘arm64’
01-01 00:10:42.132 2738 2738 F DEBUG : pid: 2735, tid: 2735, name: app_process64 >>> /system

01-01 00:10:42.160 2738 2738 F DEBUG : x0 0000000000000000 x1 0000000000000aaf x2

01-01 00:10:42.194 2738 2738 F DEBUG : backtrace:
01-01 00:10:42.194 2738 2738 F DEBUG : #00 pc 000000000001d994 /system/lib64/libc.so (abort+120)
01-01 00:10:42.194 2738 2738 F DEBUG : #01 pc 0000000000007f74 /system/lib64/liblog.so

Hi Loic, here are the traces.

01-01 00:00:53.772  2347  2347 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 00:00:53.772  2347  2347 F DEBUG   : Build fingerprint: 'generic/hikey/hikey:7.1.2/N2G47R/frq02510021249:userdebug/test-keys'
01-01 00:00:53.772  2347  2347 F DEBUG   : Revision: '0'
01-01 00:00:53.772  2347  2347 F DEBUG   : ABI: 'arm64'
01-01 00:00:53.772  2347  2347 F DEBUG   : pid: 2332, tid: 2332, name: surfaceflinger  >>> /system/bin/surfaceflinger <<<
01-01 00:00:53.773  2347  2347 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-01 00:00:53.776  2347  2347 F DEBUG   : Abort message: 'no suitable EGLConfig found, giving up'
01-01 00:00:53.776  2347  2347 F DEBUG   :     x0   0000000000000000  x1   000000000000091c  x2   0000000000000006  x3   0000000000000008
01-01 00:00:53.776  2347  2347 F DEBUG   :     x4   6579614c74656700  x5   0000000000000000  x6   0000007fb7f4a000  x7   0000000000000000
01-01 00:00:53.777  2347  2347 F DEBUG   :     x8   0000000000000083  x9   ffffffffffffffdf  x10  0000000000000000  x11  0000000000000001
01-01 00:00:53.777  2347  2347 F DEBUG   :     x12  ffffffffffffffff  x13  0000000000000000  x14  0000000000000000  x15  000aa152864779ee
01-01 00:00:53.777  2347  2347 F DEBUG   :     x16  0000007fb7a9aee0  x17  0000007fb7a442e4  x18  00000000ffffffff  x19  0000007fb7ffeb40
01-01 00:00:53.777  2347  2347 F DEBUG   :     x20  0000000000000006  x21  0000007fb7ffea98  x22  0000000000000000  x23  0000000000000001
01-01 00:00:53.777  2347  2347 F DEBUG   :     x24  0000000000000001  x25  0000007fb79d53a8  x26  0000007fb79d5360  x27  ff025bafc4389e94
01-01 00:00:53.777  2347  2347 F DEBUG   :     x28  0000000000000000  x29  0000007ffffff260  x30  0000007fb7a4178c
01-01 00:00:53.777  2347  2347 F DEBUG   :     sp   0000007ffffff240  pc   0000007fb7a442ec  pstate 0000000060000000
01-01 00:00:53.784  2329  2329 I cameraserver: ServiceManager: 0xf6b19380
01-01 00:00:53.785  2347  2347 F DEBUG   : 
01-01 00:00:53.785  2347  2347 F DEBUG   : backtrace:
01-01 00:00:53.785  2329  2329 I CameraService: CameraService started (pid=2329)
01-01 00:00:53.785  2329  2329 I CameraService: CameraService process starting
01-01 00:00:53.785  2347  2347 F DEBUG   :     #00 pc 000000000006b2ec  /system/lib64/libc.so (tgkill+8)
01-01 00:00:53.786  2347  2347 F DEBUG   :     #01 pc 0000000000068788  /system/lib64/libc.so (pthread_kill+64)
01-01 00:00:53.786  2329  2329 W BatteryNotifier: batterystats service unavailable!
01-01 00:00:53.786  2347  2347 F DEBUG   :     #02 pc 0000000000023ce8  /system/lib64/libc.so (raise+24)
01-01 00:00:53.786  2347  2347 F DEBUG   :     #03 pc 000000000001c76c  /system/lib64/libc.so (abort+52)
01-01 00:00:53.786  2347  2347 F DEBUG   :     #04 pc 0000000000010ad8  /system/lib64/libcutils.so (__android_log_assert+232)
01-01 00:00:53.786  2329  2329 W BatteryNotifier: batterystats service unavailable!
01-01 00:00:53.786  2347  2347 F DEBUG   :     #05 pc 000000000003ba70  /system/lib64/libsurfaceflinger.so
01-01 00:00:53.786  2347  2347 F DEBUG   :     #06 pc 000000000003b4c8  /system/lib64/libsurfaceflinger.so
01-01 00:00:53.786  2347  2347 F DEBUG   :     #07 pc 0000000000040484  /system/lib64/libsurfaceflinger.so (_ZN7android14SurfaceFlinger4initEv+808)
01-01 00:00:53.786  2329  2329 E CameraService: Could not load camera HAL module: -2 (No such file or directory)
01-01 00:00:53.786  2347  2347 F DEBUG   :     #08 pc 0000000000001350  /system/bin/surfaceflinger
01-01 00:00:53.786  2347  2347 F DEBUG   :     #09 pc 000000000001a594  /system/lib64/libc.so (__libc_init+88)
01-01 00:00:53.786  2347  2347 F DEBUG   :     #10 pc 00000000000011ec  /system/bin/surfaceflinger
01-01 00:00:53.837  2312  2312 W Resources: Preloaded drawable resource #0x108025c (android:drawable/dialog_background_material) that varies with configuration!!
01-01 00:00:53.838  2312  2312 W Resources: Preloaded drawable resource #0x1080298 (android:drawable/editbox_dropdown_background_dark) that varies with configuration!!
01-01 00:00:53.842  2312  2312 W Resources: Preloaded color resource #0x10600ea (android:color/material_grey_800) that varies with configuration!!
01-01 00:00:53.843  2312  2312 W Resources: Preloaded drawable resource #0x10802c9 (android:drawable/floating_popup_background_dark) that varies with configuration!!
01-01 00:00:53.852  2312  2312 W Resources: Preloaded drawable resource #0x108030b (android:drawable/ic_clear_disabled) that varies with configuration!!
01-01 00:00:53.853  2312  2312 W Resources: Preloaded drawable resource #0x1080310 (android:drawable/ic_clear_normal) that varies with configuration!!
01-01 00:00:53.856  2312  2312 W Resources: Preloaded drawable resource #0x1080359 (android:drawable/ic_go) that varies with configuration!!
01-01 00:00:53.861  2312  2312 W Resources: Preloaded drawable resource #0x1080038 (android:drawable/ic_menu_close_clear_cancel) that varies with configuration!!
01-01 00:00:53.864  2312  2312 W Resources: Preloaded drawable resource #0x1080045 (android:drawable/ic_menu_more) that varies with configuration!!
01-01 00:00:53.874  2312  2312 W Resources: Preloaded drawable resource #0x10804eb (android:drawable/menu_background_fill_parent_width) that varies with configuration!!
01-01 00:00:53.879  1743  1743 W         : debuggerd: resuming target 2332
01-01 00:00:53.901  2330  2330 I mediaserver: ServiceManager: 0xf66193e0
01-01 00:00:53.903  2330  2330 W BatteryNotifier: batterystats service unavailable!
01-01 00:00:53.986  1803  1803 I ServiceManager: service 'media.audio_flinger' died
01-01 00:00:53.986  1803  1803 I ServiceManager: service 'media.audio_policy' died
01-01 00:00:53.986  1803  1803 I ServiceManager: service 'media.radio' died
01-01 00:00:53.986  1803  1803 I ServiceManager: service 'media.sound_trigger_hw' died
01-01 00:00:53.986  1803  1803 I ServiceManager: service 'media.log' died
01-01 00:00:53.991  1803  1803 I ServiceManager: service 'media.camera' died
01-01 00:00:53.997  1803  1803 I ServiceManager: service 'media.player' died
01-01 00:00:53.997  1803  1803 I ServiceManager: service 'media.resource_manager' died
01-01 00:00:56.771  2376  2376 D AndroidRuntime: >>>>>> START com.android.internal.os.ZygoteInit uid 0 <<<<<<

OK, thanks, SurfaceFlinger stop itself due to:
2347 2347 F DEBUG : Abort message: 'no suitable EGLConfig found, giving up'

Is there any error before in the logcat related to ‘hwcomposer’, ‘libEGL’, ‘mali’… ?

Hi Loic,
again many thanks for your help, I really appreciate !

here are some aditional traces:

  31 01-01 00:00:11.428  1804  1804 D libEGL  : loaded /vendor/lib64/egl/libGLES_mali.so
  39 01-01 00:00:11.746  1804  1804 E         : ERROR in Mali driver:
  43 01-01 00:00:11.747  1804  1804 W libEGL  : eglInitialize(0x1) failed (EGL_BAD_ALLOC)
  79 01-01 00:00:11.833  1804  1804 E SurfaceFlinger: hwcomposer module not found

Thanks, it definitely seems to be a compatibility issue with the current Mali binaries.

btw this topic seems to be a duplicate:

yes you are right.
Thank you Loic

Hello, is this problem fixed in the main branch of Hikey?

I’ve encountered this discussion as I have some problem when my own hikey with USB devices.
On adb shell, as I print out dmesg, I get this message.

[ 12.758762] init: couldn’t write 1964 to /dev/cpuset/camera-daemon/tasks: No such file or directory

I just wanted to make sure this issue with the main branch for hikey kernel is resolved.
Thank you.

Yes original issue is a compatibility problem without older version, It should be ok on master branch.
If you don’t have any other issue, you should not worry about the init error message (which is not related to this topic).