How to compile Kernel for Android 12 that works? avc: denied

I was able to compile AOSP 12 and load onto VIM3.

I find similar to this post, that pre-built kernel 4.19 (default) would stutter in homescreen while 5.4 is smooth and 5.10 would not even get to homescreen.

When using kernel 5.4, it has this warning "serial console enabled. Performance impacted." thing that I want to disable - hence I went to the journey of compiling the kernel.

I followed all the instructions of compiling the kernel like from here:
https://gitlab.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/Khadas_VIM3
and even tried with GKI like here:
https://gitlab.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa/-/wikis/GKI-kernel

Though I am a newbie in this space, I have had some experience bringing up kernel + device tree from “scratch” on other platforms.

I am now hit with a bunch of “avc: denied” errors and quick googling suggests that it is “selinux” and I have forced this in BoardConfigCommon.mk

BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive

and it is still showing that avc: denied messages. All my own built kernels variants (GKI or from hikey-linaro meson branch) are hit with this issue and wont boot to homescreen.

Any tips on how to proceed?

Sample errors:

[  132.894580] type=1400 audit(132.681:3026): avc: denied { open } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_config_prop:s0" dev="tmpfs" ino=19658 scontext=u:r:flags_health_check1
[  133.085334] type=1400 audit(132.681:3027): avc: denied { getattr } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_config_prop:s0" dev="tmpfs" ino=19658 scontext=u:r:flags_health_ch1
[  133.109060] type=1400 audit(132.681:3028): avc: denied { map } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_config_prop:s0" dev="tmpfs" ino=19658 scontext=u:r:flags_health_check:1
[  133.132664] type=1400 audit(132.681:3029): avc: denied { open } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_prop:s0" dev="tmpfs" ino=19659 scontext=u:r:flags_health_check:s0 tco1
[  133.155160] type=1400 audit(132.681:3030): avc: denied { getattr } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_prop:s0" dev="tmpfs" ino=19659 scontext=u:r:flags_health_check:s0 1
[  133.177926] type=1400 audit(132.681:3031): avc: denied { map } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:adbd_prop:s0" dev="tmpfs" ino=19659 scontext=u:r:flags_health_check:s0 tcon1
[  133.200353] type=1400 audit(132.681:3032): avc: denied { open } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_config_prop:s0" dev="tmpfs" ino=19660 scontext=u:r:flags_health_chec1
[  133.224245] type=1400 audit(132.681:3033): avc: denied { getattr } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_config_prop:s0" dev="tmpfs" ino=19660 scontext=u:r:flags_health_c1
[  133.248396] type=1400 audit(132.681:3034): avc: denied { map } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_config_prop:s0" dev="tmpfs" ino=19660 scontext=u:r:flags_health_check1
[  133.272200] type=1400 audit(132.681:3035): avc: denied { open } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_prop:s0" dev="tmpfs" ino=19661 scontext=u:r:flags_health_check:s0 tc1
[  133.294913] type=1400 audit(132.681:3036): avc: denied { getattr } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_prop:s0" dev="tmpfs" ino=19661 scontext=u:r:flags_health_check:s01
[  133.317827] type=1400 audit(132.681:3037): avc: denied { map } for comm="flags_health_ch" path="/dev/__properties__/u:object_r:apexd_prop:s0" dev="tmpfs" ino=19661 scontext=u:r:flags_health_check:s0 tco1

For those who stumble upon this question later - I was able to migrate to Tiramisu AOSP 13 master branch and changed to kernel 5.15 with console removed to “increase performance.”

Thanks to Dmitry (maintainer for yukawa) to point out, in general one can follow this instructions directly:
https://source.android.com/setup/build/devices#vim3_and_vim3l_boards

I had in recent past tried a few times using master branch, at times it may not compile clean - depending on the time you pull the branch. Your mileage may vary, but with piecing things together, should get a good baseline to start with.