Build image from source code fails


I am trying to build image from source code, but have some problems.

I checked out AOSP repository, and copied SLA folders ‘device’ and ‘vendor’ to AOSP source tree. I also copied folder ‘kernel-3.18’.

I configured lunch full_amt6797_64_open-eng and started build with make -j8 PLATFORM_FASTBOOT_EMPTY_STORAGE=yes -k (I also tried simply make -j8), and it failed with a message:

device/mediatek/common/sepolicy/em_svr.te:91:WARNING 'unrecognized character' at token ''' on line 15399:
# Purpose : Battery Log can change temperature
device/mediatek/common/sepolicy/em_svr.te:91:WARNING 'unrecognized character' at token ''' on line 15405:
#line 91
device/mediatek/common/sepolicy/teei_daemon.te:30:ERROR 'unknown type teei_client_device' at token ';' on line 24905:
#define for mlsconstrain
typeattribute teei_client_device mlstrustedobject;
checkpolicy:  error(s) encountered while parsing configuration

I understand that everybody else has no problems building from source, where is my mistake?

Thank you.

Hi Kurtus

From the log, we can see the selinux config file have a mistake. So I suggest that you can check the ‘device’ folder. If there is not mistake in the device folder. You can try build with ‘make PLATFORM_FASTBOOT_EMPTY_STORAGE=yes -k’(no -j8).


Thanks for update, Ekko. Do you mean that multithread build could be a problem? j8 is only about that. I checked your selinux config files and there are definitely errors there. For example, in em_svr.te there is syntax error at the line 91:
should be
Possibly, the second error (fatal) also is in your config files?

There were also not fatal errors during kernel build, e.g.
python: can’t open file ‘device/mediatek/build/build/tools/’: [Errno 2] No such file or directory
kernel-3.18/ recipe for target ‘check-kernel-config’ failed
make: [check-kernel-config] Error 2 (ignored)

Hi Kurtus

1.The error
python: can’t open file ‘device/mediatek/build/build/tools/’: [Errno 2] No such file or directory
is not influences the build. Because the build system deal the error.
2. Can you tell me what changes you did for the device folders?

Hi Ekko,

Thank you for your support.

I put in ‘device’ folder subfolders ‘mediatek’ and ‘amt’ from sla.tar.gz I downloaded from I re-downloaded this file two times, copied device and vendor folders to AOSP tree and tried to build from scratch. With the same result - fatal failure on parsing ‘device/mediatek/common/sepolicy/teei_daemon.te’ file.

Hi Kurtus:

Sorry for the late reply.

Could you copied prebuilts and packages folders to the AOSP? The prebuilts folders can influences build.


Of course I copied everything. You asked only about ‘device’ folder…

I ran in to the exact same issue when trying to build AOSP with lunch full_amt6797_64_open-eng

I meet the same issue, and my solution below.

  1. add type teei_client_device dev_type; in teei_daemon.te
  2. remove or comment type teei_client_device dev_type; in the device.te
  3. make (without -jN)

currently, it works…