Possible bug in AOSP source built system.img for Hikey970

Hello All,

I have been facing an issue where the Hikey970 boot fails with source built system.img. I followed the procedure as follows:

After converting the system.img to a raw image using simg2img tool and mounting it, following is
the directory structure in the image.

nand@nand:/mnt/storage2$ ls -lh
total 680K
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 acct
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 apex
lrw-r--r--.  1 root root   11 Dec 10 11:22 bin -> /system/bin
lrw-r--r--.  1 root root   50 Dec 10 11:22 bugreports -> /data/user_de/0/com.android.shell/files/bugreports
drwxrwx---.  2 nand 2001 4.0K Dec  5 15:50 cache
lrw-r--r--.  1 root root   13 Dec 10 11:22 charger -> /sbin/charger
dr-xr-xr-x.  2 root root 4.0K Dec  5 15:50 config
lrw-r--r--.  1 root root   17 Dec 10 11:22 d -> /sys/kernel/debug
drwxrwx--x.  2 nand nand 4.0K Dec  5 15:50 data
-rw-------.  1 root root 1.7K Dec  5 15:50 default.prop
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 dev
lrw-r--r--.  1 root root   11 Dec 10 11:22 etc -> /system/etc
-rw-r-----.  1 root 2000 1.5K Dec  5 15:50 fstab.hikey970
lrwxr-x---.  1 root 2000   16 Dec 10 11:22 init -> /system/bin/init
-rwxr-x---.  1 root 2000 1.1K Dec  5 15:50 init.environ.rc
-rwxr-x---.  1 root 2000 1.4K Dec  5 15:50 init.hikey970.power.rc
-rwxr-x---.  1 root 2000 3.2K Dec  5 15:50 init.hikey970.rc
-rwxr-x---.  1 root 2000 4.2K Dec  5 15:50 init.hikey970.usb.rc
-rwxr-x---.  1 root 2000  31K Dec  5 15:50 init.rc
-rwxr-x---.  1 root 2000 7.6K Dec  5 15:50 init.usb.configfs.rc
-rwxr-x---.  1 root 2000 5.6K Dec  5 15:50 init.usb.rc
-rwxr-x---.  1 root 2000  511 Dec  5 15:50 init.zygote32.rc
-rwxr-x---.  1 root 2000  875 Dec  5 15:50 init.zygote64_32.rc
drwx------.  2 root root  16K Dec 10 11:23 lost+found
drwxr-xr-x.  2 root nand 4.0K Dec  5 15:50 mnt
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 odm
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 oem
-rw-r--r--.  1 root root  26K Dec  6 10:52 plat_file_contexts
-rw-r--r--.  1 root root 7.7K Dec  6 10:52 plat_hwservice_contexts
-rw-r--r--.  1 root root 7.8K Dec  6 10:52 plat_property_contexts
-rw-r--r--.  1 root root 1.5K Dec  6 10:52 plat_seapp_contexts
-rw-r--r--.  1 root root  16K Dec  6 10:52 plat_service_contexts
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 proc
lrw-r--r--.  1 root root   15 Dec 10 11:22 product -> /system/product
lrw-r--r--.  1 root root   24 Dec 10 11:22 product_services -> /system/product_services
drwxr-x---.  2 root 2000 4.0K Dec  6 09:34 sbin
lrw-r--r--.  1 root root   21 Dec 10 11:22 sdcard -> /storage/self/primary
-rw-r--r--.  1 root root 427K Dec  6 10:52 sepolicy
drwxr-x--x.  2 root 1028 4.0K Dec  5 15:50 storage
drwxr-xr-x.  2 root root 4.0K Dec  5 15:50 sys
drwxr-xr-x. 19 root root 4.0K Dec  6 10:57 system
-rw-r--r--.  1 root root  375 Dec  5 15:50 ueventd.hikey970.rc
-rw-r--r--.  1 root root 5.3K Dec  5 15:50 ueventd.rc
lrw-r--r--.  1 root root   14 Dec 10 11:22 vendor -> /system/vendor
-rw-r--r--.  1 root root 7.4K Dec  6 10:52 vendor_file_contexts
-rw-r--r--.  1 root root    0 Dec  6 10:52 vendor_hwservice_contexts
-rw-r--r--.  1 root root  329 Dec  6 10:52 vendor_property_contexts
-rw-r--r--.  1 root root    0 Dec  6 10:52 vendor_seapp_contexts
-rw-r--r--.  1 root root   44 Dec  6 10:52 vendor_service_contexts
-rw-r--r--.  1 root root   65 Dec  6 10:52 vndservice_contexts

The contents however do not match with the contents of the default pre-built system.img provided by 96 boards which is:

nand@nand:/mnt/storage2$ ls -lh
total 180K
drwxr-xr-x. 37 root root 4.0K Apr 27  2018 app
drwxr-xr-x.  3 root 2000 8.0K Apr 27  2018 bin
-rw-------.  1 root root 2.2K Apr 27  2018 build.prop
-rw-r--r--.  1 root root  73K Apr 27  2018 compatibility_matrix.xml
drwxr-xr-x. 13 root root 4.0K Apr 27  2018 etc
drwxr-xr-x.  2 root root 4.0K Apr 27  2018 fake-libs
drwxr-xr-x.  2 root root 4.0K Apr 27  2018 fake-libs64
drwxr-xr-x.  2 root root 8.0K Apr 27  2018 fonts
drwxr-xr-x.  5 root root 4.0K Apr 27  2018 framework
drwxr-xr-x.  6 root root  12K Apr 27  2018 lib
drwxr-xr-x.  6 root root  12K Apr 27  2018 lib64
drwx------.  2 root root  16K Apr 27  2018 lost+found
-rw-r--r--.  1 root root 2.8K Apr 27  2018 manifest.xml
drwxr-xr-x.  3 root root 4.0K Apr 27  2018 media
drwxr-xr-x. 37 root root 4.0K Apr 27  2018 priv-app
drwxr-xr-x.  8 root root 4.0K Apr 27  2018 usr
drwxr-xr-x.  7 root 2000 4.0K Apr 27  2018 vendor
drwxr-xr-x.  2 root 2000 4.0K Apr 27  2018 xbin

I confirmed this behavior with multiple iterations.
This source built system.img fails to boot.

Is this a bug ? Is there something missing in the Documentation which causes this?

Any suggestions/comments are welcome.

Thank you for your time,

regards,
Nishad