I've used this before to build the index - hope it's useful. Ensure login as root to get mac_admin permission.
build root filesystem as ext4 filesystem: cd $ANDROID_BUILD_TOP make_ext4fs -S out/target/product/generic/root/file_contexts -l 5000000 -a \/ out/target/product/generic/root.img out/target/product/generic/root mkdir/mnt/android cd $ANDROID_BUILD_TOP/out/target/product/generic mount -t ext4 -o loop ./root.img /mnt/android mount -t ext4 -o loop ./system.img /mnt/android/system ... and the others load APOL and using sepolicy create the file contexts database from /mnt/android ________________________________ From: E. Paul Ratazzi <[email protected]> To: "[email protected]" <[email protected]> Sent: Wednesday, 18 September 2013, 15:40 Subject: Generating File Contexts Index? I'm using apol to help me understand my SEAndroid sepolicy file. I'd also like to use apol's capability to search file contexts, but an index file is needed. I'm wondering what would be the easiest way to generate a file context index for the SEAndroid images I'm experimenting with. Off the top of my head, I can think a few different ways to do this, including: 1) add secmds (along with libsefs, etc.) to what's in system/core/toolbox, then run indexcon from inside the live device; 2) install yaffs2 kernel support in my SELinux build environment, mount system.img (perhaps after using simg2img), etc. and run indexcon from the build environment; 3) generate an index at build time at the same time the labeling is done; 4) others? Am I missing an obvious way of doing this? Are there any tools hidden somewhere in the build tree that might make one of the above approaches easier? Thanks for your insight and suggestions, Paul
