While working on AOKP 7.0, I came across an interesting error:
libsepol.context_from_record: could not create context structure
/home/alaskalinuxuser/Documents/projects/phones/compile/build_aokp7/out/target/product/jfltetmo/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp: line 475 has invalid context u:object_r:misc_partition:s0
Error: could not load context file from /home/alaskalinuxuser/Documents/projects/phones/compile/build_aokp7/out/target/product/jfltetmo/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp
The reason this was interesting, is because I could not find the sepolicy file to change in my device trees to fix this. Generally, when there is an sepolicy issue, I look through my device tree (in this case, jf-common/sepolicy) and edit those files to solve the issue. However, this time, the issue did not stem directly from one of those files. In the end, I opened build_aokp7/out/target/product/jfltetmo/obj/ETC/file_contexts.bin_intermediates/file_contexts.device.tmp and removed line 475, which was causing the error. That did allow the build to continue, but only time will tell if that was the right answer or not.
Linux – keep it simple.