How to build a bootable AOSP10 image files for Hikey970

I had bought a brand new “Hikey970 96Boards consumer edition” development board last month.

Successfully booted AOSP factory images from below URL.

I was planning to add my own custom HMI Applications for the board. In-order to build the custom application I have to build AOSP 10 workspace.

Had used the following steps to build the latest master branch for hikey970.

While building the default AOSP master branch there were lot of errors while building AOSP master branch for hikey970. Modified codebase is as follows
https://drive.google.com/file/d/1M1hkG9Af96pcHa9m0-ZNOc8tg8-ZjZ3P/view?usp=sharing
AOSP build was successful and all binaries were generated successfully but the system was not booting when I place system.img.

System was not booting

[ 6.242263] ueventd: Parsing file /ueventd.hikey970.rc…
[ 6.302912] cgroup: “memory” requires setting use_hierarchy to 1 on the root
[ 6.310260] audit: type=1400 audit(25.011:3): avc: denied { create } for pid=1 comm=“init” name=“cgroup.procs” scontext=u:r:init:s0 tcontext=u:object_r:cgroup:s0 tclass=file permissive=1
[ 6.320239] ueventd: Coldboot took 0.077 seconds
[ 6.337384] Registered swp emulation handler
[ 6.342177] audit: type=1400 audit(25.043:4): avc: denied { add_name } for pid=1 comm=“init” name=“enabled” scontext=u:r:init:s0 tcontext=u:object_r:sysfs:s0 tclass=dir permissive=1
[ 6.358628] audit: type=1400 audit(25.063:5): avc: denied { create } for pid=1 comm=“init” name=“enabled” scontext=u:r:init:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[ 6.381045] EXT4-fs (sdd12): mounted filesystem without journal. Opts: (null)
[ 6.381218] watchdogd: watchdogd started (interval 10, margin 20)!
[ 6.381232] watchdogd: Failed to open /dev/watchdog: No such file or directory
[ 6.402968] EXT4-fs (sdd5): Ignoring removed nomblk_io_submit option
[ 6.411602] EXT4-fs (sdd5): recovery complete
[ 6.416208] EXT4-fs (sdd5): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit
[ 6.451054] EXT4-fs (sdd5): mounted filesystem with ordered data mode. Opts: discard,noauto_da_alloc,data=ordered,user_xattr,discard,barrier=1
[ 6.465071] EXT4-fs (sdd15): Ignoring removed nomblk_io_submit option
[ 6.492065] EXT4-fs (sdd15): recovery complete
[ 6.496773] EXT4-fs (sdd15): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit
[ 6.523963] EXT4-fs (sdd15): mounted filesystem with ordered data mode. Opts: discard,noauto_da_alloc,data=ordered,user_xattr,discard,barrier=1
[ 6.540141] audit: type=1400 audit(25.239:6): avc: denied { setattr } for pid=1 comm=“init” name=“slabinfo” dev=“proc” ino=4026532068 scontext=u:r:init:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=1
[ 6.559548] audit: type=1400 audit(25.259:7): avc: denied { write } for pid=1 comm=“init” name="/" dev=“debugfs” ino=1 scontext=u:r:init:s0 tcontext=u:object_r:debugfs:s0 tclass=dir permissive=1
[ 6.577111] audit: type=1400 audit(25.279:8): avc: denied { add_name } for pid=1 comm=“init” name=“sched_features” scontext=u:r:init:s0 tcontext=u:object_r:debugfs:s0 tclass=dir permissive=1
[ 6.594337] audit: type=1400 audit(25.295:9): avc: denied { create } for pid=1 comm=“init” name=“sched_features” scontext=u:r:init:s0 tcontext=u:object_r:debugfs:s0 tclass=file permissive=1
[ 6.628144] audit: type=1400 audit(25.327:10): avc: denied { write } for pid=56 comm=“kdevtmpfs” name="/" dev=“devtmpfs” ino=1025 scontext=u:r:kernel:s0 tcontext=u:object_r:device:s0 tclass=dir permissive=1
[ 6.646950] file system registered
[ 6.828213] (stk) :ldisc installation timeout[ 6.832415] (stk) :ldisc_install = 0
** (stk) : timed out waiting for ldisc to be un-installed[ 7.963932] (stk) :ldisc_install = 1**
** (stk) :ldisc installation timeout[ 8.975083] (stk) :ldisc_install = 0**
** (stk) : timed out waiting for ldisc to be un-installed**[ 10.107921] (stk) :ldisc_install = 1
(stk) :ldisc installation timeout[ 11.119073] (stk) :ldisc_install = 0
(stk) : timed out waiting for ldisc to be un-installed[ 12.251955] (stk) :ldisc_install = 1
(stk) :ldisc installation timeout[ 13.263108] (stk) :ldisc_install = 0
(stk) : timed out waiting for ldisc to be un-installed[ 14.395917] (stk) :ldisc_install = 1
(stk) :ldisc installation timeout[ 15.407079] (stk) :ldisc_install = 0
(stk) : timed out waiting for ldisc to be un-installed[ 16.434934] Bluetooth: st_register failed -22

Is there any fixed steps in building the AOSP10 workspace for hikey970 without modifying the master branch code ?
Could you please confirm whether am I on the right branch?

OR

Could you suggest me the steps to successfully built a bootable collection of images for hikey970?

OR

Could you please suggest me the steps to successfully build an AOSP 10 binaries which can boot into the system without any kernel panics or SYSTEM_AS_ROOT issues?

Thanking you in advance.

Board based on the Kirin 970 - HI3670 Application Processor
More info: http://www.96boards.org/product/hikey970/ (Website coming soon…)
Buy now: https://www.seeedstudio.com/HiKey-970-Development-Board-p-3046.html

If your goal was to run android, you bought the wrong board. Hikey970 has never been well supported for Android, and you invariably end up where you are now. My recommendation for you would be to start with the working upstream support for hikey960 and adapt it to the 970. Alternatively, read your logs and figure out from that what is going wrong and what needs to be changed to make it work.

Thank you very much @doitright.

Could you please recommend me with some reference URLs for enabling my hikey970 board to adhere with hikey960 implementation?

I mentioned that support for the 960 is upstream. Look there. And look at the history for your 970 device repository to see what was done to make it compliant with the 970, since it was based on the upstream 960 – a long time ago.

It is probably not going to be fun when you start addressing the kernel. I think the 960 is running on 5.4 GKI, but you won’t be able to go there with the 970 without a ton of work, however, you should be able to get it working on the existing kernel without too much effort.