Search code examples
androidlinuxmacosmakefileandroid-source

Host out binaries are missing when building AOSP on macos


I'm building AOSP (12) on macOS Monterey with M1. Overall it works well (successfully generates images even while macOS is not officially supported).

However, I've also built the same tree for the same target (just rsync-ed files) on a linux machine, and I see the difference between out/host/$platform/bin files.

Here are the files for linux-x86 (129 files):

aapt
aapt2
adb
add_img_to_target_files
aftltool
ahat
apex_compression_tool
apexer
apksigner
appcompat.sh
append2simg
aprotoc
assemble_vintf
atest-dev
avbtool
badblocks
bcc
bcc_strip_attr
bit
blk_alloc_to_base_fs
boot_signer
brillo_update_payload
brotli
bsdiff
BugReport
build_image
build_sepolicy
build_super_image
build_verity_metadata
build_verity_tree
care_map_generator
checkfc
check_ota_package_signature
check_partition_sizes
checkpolicy
checkseapp
check_target_files_signatures
check_target_files_vintf
checkvintf
conv_apex_manifest
conv_linker_config
deapexer
debugfs_static
defrag.f2fs
delta_generator
dexdiag
dexdump
dexlist
dump.f2fs
e2fsck
e2fsdroid
fastboot
fc_sort
fec
fec32
find_shareduid_violation
flags_health_check
fsck.f2fs
fs_config
generate_verity_key
host_init_verifier
hprof-conv
idmap2
img2simg
imgdiff
img_from_target_files
incident_report
insertkeys.py
ld.mc
lib
lpdump
lpmake
lpunpack
lz4
make_f2fs
make_f2fs_casefold
make_recovery_patch
mdnsd
merge_target_files
minigzip
mkbootfs
mkbootimg
mke2fs
mke2fs.conf
mkerofsimage.sh
mkf2fsuserimg.sh
mkfs.erofs
mksquashfs
mksquashfsimage.sh
mkuserimg_mke2fs
oatdump
ota_from_target_files
post_process_props
property_info_checker
repack_bootimg
resize2fs
resize.f2fs
secilc
sefcontext_compile
sepolicy-analyze
sepolicy_tests
sgdisk
sign_apex
signapk
sign_target_files_apks
simg2img
sload_f2fs
sqlite3
tinyplay
toybox
treble_sepolicy_tests
tune2fs
tzdatacheck
unpack_bootimg
unwind_info
unwind_reg_info
unwind_symbols
update_host_simulator
update-vndk-list.sh
validatekeymaps
validate_target_files
veridex
verity_signer
verity_verifier
version_policy
viewcompiler
vintffm
zipalign
zopflipng

And here are the files for darwin-x86 (77 files):

BugReport
aapt2
adb
aprotoc
assemble_vintf
atest-dev
avbtool
badblocks
bcc
bcc_strip_attr
bit
blk_alloc_to_base_fs
boot_signer
brotli
bsdiff
build_image
build_sepolicy
build_super_image
check_partition_sizes
checkfc
checkpolicy
checkseapp
checkvintf
conv_linker_config
deapexer
debugfs_static
defrag.f2fs
dump.f2fs
e2fsck
e2fsdroid
fastboot
fc_sort
fec
flags_health_check
fsck.f2fs
idmap2
imgdiff
incident_report
insertkeys.py
ld.mc
lpdump
lpmake
lz4
make_f2fs
make_f2fs_casefold
mdnsd
minigzip
mkbootfs
mkbootimg
mke2fs
mke2fs.conf
mkf2fsuserimg.sh
mkuserimg_mke2fs
post_process_props
property_info_checker
resize.f2fs
resize2fs
secilc
sefcontext_compile
sepolicy-analyze
sepolicy_tests
sgdisk
signapk
simg2img
sload_f2fs
sqlite3
toybox
treble_sepolicy_tests
tune2fs
tzdatacheck
unpack_bootimg
update-vndk-list.sh
validatekeymaps
version_policy
viewcompiler
vintffm
zopflipng

I used the same commands on both machines: mmma and then a regular make to get these results.

Consequently, make dist works well on the Linux machine, and doesn't work on macOS machine as at least host_init_verifier is missing.

What can be wrong?


Solution

  • Okay, found out that:

    1. otatools is disabled on darwin (build/make/core/Makefile).

    2. host_init_verifier is also disabled on darwin:

    build/core/definitions.mk:

    ifdef TARGET_BUILD_UNBUNDLED
    # TODO (b/185624993): Remove the chck on TARGET_BUILD_UNBUNDLED when host_init_verifier can run
    # without requiring the HIDL interface map.
    $(2): $(1)
    else ifneq ($(HOST_OS),darwin)
    # Host init verifier doesn't exist on darwin.
    $(2): \
        $(1) \
        $(HOST_INIT_VERIFIER) \
        $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
        $(call intermediates-dir-for,ETC,passwd_system_ext)/passwd_system_ext \
        $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
        $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
        $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
        $(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
        $(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
        $(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
        $(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
        $(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts
        $(hide) $(HOST_INIT_VERIFIER) \
          -p $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
          -p $(call intermediates-dir-for,ETC,passwd_system_ext)/passwd_system_ext \
          -p $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
          -p $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
          -p $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
          --property-contexts=$(call intermediates-dir-for,ETC,plat_property_contexts)/plat_property_contexts \
          --property-contexts=$(call intermediates-dir-for,ETC,system_ext_property_contexts)/system_ext_property_contexts \
          --property-contexts=$(call intermediates-dir-for,ETC,product_property_contexts)/product_property_contexts \
          --property-contexts=$(call intermediates-dir-for,ETC,vendor_property_contexts)/vendor_property_contexts \
          --property-contexts=$(call intermediates-dir-for,ETC,odm_property_contexts)/odm_property_contexts \
          $$<
    else
    $(2): $(1)
    endif
        @echo "Copy init script: $$@"
        $$(copy-file-to-target)
    endef