Android.mk 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # Copyright 2015 The Chromium OS Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. # Minimal makefile capable of compiling futility to sign images
  5. LOCAL_PATH := $(call my-dir)
  6. include $(CLEAR_VARS)
  7. LOCAL_MODULE := libvboot_util-host
  8. ifeq ($(HOST_OS),darwin)
  9. LOCAL_CFLAGS += -DHAVE_MACOS
  10. endif
  11. # These are required to access large disks and files on 32-bit systems.
  12. LOCAL_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
  13. LOCAL_C_INCLUDES += \
  14. $(LOCAL_PATH)/firmware/include \
  15. $(LOCAL_PATH)/firmware/lib/include \
  16. $(LOCAL_PATH)/firmware/lib/cgptlib/include \
  17. $(LOCAL_PATH)/firmware/lib/cryptolib/include \
  18. $(LOCAL_PATH)/firmware/lib/tpm_lite/include \
  19. $(LOCAL_PATH)/firmware/2lib/include \
  20. $(LOCAL_PATH)/host/include \
  21. $(LOCAL_PATH)/host/lib/include
  22. # Firmware library sources needed by VbInit() call
  23. VBINIT_SRCS = \
  24. firmware/lib/crc8.c \
  25. firmware/lib/utility.c \
  26. firmware/lib/vboot_api_init.c \
  27. firmware/lib/vboot_common_init.c \
  28. firmware/lib/vboot_nvstorage.c \
  29. firmware/lib/vboot_nvstorage_rollback.c \
  30. firmware/lib/region-init.c \
  31. # Additional firmware library sources needed by VbSelectFirmware() call
  32. VBSF_SRCS = \
  33. firmware/lib/cryptolib/padding.c \
  34. firmware/lib/cryptolib/rsa.c \
  35. firmware/lib/cryptolib/rsa_utility.c \
  36. firmware/lib/cryptolib/sha1.c \
  37. firmware/lib/cryptolib/sha256.c \
  38. firmware/lib/cryptolib/sha512.c \
  39. firmware/lib/cryptolib/sha_utility.c \
  40. firmware/lib/stateful_util.c \
  41. firmware/lib/vboot_common.c \
  42. firmware/lib/region-fw.c \
  43. # Additional firmware library sources needed by VbSelectAndLoadKernel() call
  44. VBSLK_SRCS = \
  45. firmware/lib/cgptlib/cgptlib.c \
  46. firmware/lib/cgptlib/cgptlib_internal.c \
  47. firmware/lib/cgptlib/crc32.c \
  48. firmware/lib/gpt_misc.c \
  49. firmware/lib/utility_string.c \
  50. firmware/lib/vboot_api_kernel.c \
  51. firmware/lib/vboot_audio.c \
  52. firmware/lib/vboot_display.c \
  53. firmware/lib/vboot_kernel.c \
  54. firmware/lib/region-kernel.c \
  55. VBINIT_SRCS += \
  56. firmware/stub/tpm_lite_stub.c \
  57. firmware/stub/utility_stub.c \
  58. firmware/stub/vboot_api_stub_init.c \
  59. firmware/stub/vboot_api_stub_region.c
  60. VBSF_SRCS += \
  61. firmware/stub/vboot_api_stub_sf.c
  62. VBSLK_SRCS += \
  63. firmware/stub/vboot_api_stub.c \
  64. firmware/stub/vboot_api_stub_disk.c \
  65. firmware/stub/vboot_api_stub_stream.c
  66. UTILLIB_SRCS = \
  67. cgpt/cgpt_create.c \
  68. cgpt/cgpt_add.c \
  69. cgpt/cgpt_boot.c \
  70. cgpt/cgpt_show.c \
  71. cgpt/cgpt_repair.c \
  72. cgpt/cgpt_prioritize.c \
  73. cgpt/cgpt_common.c \
  74. futility/dump_kernel_config_lib.c \
  75. host/lib/crossystem.c \
  76. host/lib/file_keys.c \
  77. host/lib/fmap.c \
  78. host/lib/host_common.c \
  79. host/lib/host_key.c \
  80. host/lib/host_keyblock.c \
  81. host/lib/host_misc.c \
  82. host/lib/util_misc.c \
  83. host/lib/host_signature.c \
  84. host/lib/signature_digest.c
  85. # host/arch/${HOST_ARCH}/lib/crossystem_arch.c \
  86. LOCAL_SRC_FILES := \
  87. $(VBINIT_SRCS) \
  88. $(VBSF_SRCS) \
  89. $(VBSLK_SRCS) \
  90. $(UTILLIB_SRCS)
  91. LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES)
  92. LOCAL_STATIC_LIBRARIES := libcrypto_static
  93. include $(BUILD_HOST_STATIC_LIBRARY)
  94. include $(CLEAR_VARS)
  95. LOCAL_MODULE := futility-host
  96. LOCAL_IS_HOST_MODULE := true
  97. LOCAL_MODULE_CLASS := EXECUTABLES
  98. generated_sources := $(call local-generated-sources-dir)
  99. ifeq ($(HOST_OS),darwin)
  100. LOCAL_CFLAGS += -DHAVE_MACOS
  101. endif
  102. # These are required to access large disks and files on 32-bit systems.
  103. LOCAL_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
  104. FUTIL_STATIC_SRCS = \
  105. futility/futility.c \
  106. futility/cmd_dump_fmap.c \
  107. futility/cmd_gbb_utility.c \
  108. futility/misc.c
  109. FUTIL_SRCS = \
  110. ${FUTIL_STATIC_SRCS} \
  111. futility/cmd_dump_kernel_config.c \
  112. futility/cmd_load_fmap.c \
  113. futility/cmd_pcr.c \
  114. futility/cmd_show.c \
  115. futility/cmd_sign.c \
  116. futility/cmd_vbutil_firmware.c \
  117. futility/cmd_vbutil_kernel.c \
  118. futility/cmd_vbutil_key.c \
  119. futility/cmd_vbutil_keyblock.c \
  120. futility/file_type.c \
  121. futility/traversal.c \
  122. futility/vb1_helper.c
  123. # ${FUTIL_STATIC_WORKAROUND_SRCS:%.c=${BUILD}/%.o} \
  124. LOCAL_SRC_FILES := \
  125. $(FUTIL_SRCS) \
  126. $(generated_sources)/futility_cmds.c: ${FUTIL_SRCS:%=${LOCAL_PATH}/%}
  127. @echo making $< from ${FUTIL_SRCS}
  128. @rm -f $@ $@_t $@_commands
  129. @mkdir -p $(dir $@)
  130. @grep -hoRE '^DECLARE_FUTIL_COMMAND\([^,]+' $^ \
  131. | sed 's/DECLARE_FUTIL_COMMAND(\(.*\)/_CMD(\1)/' \
  132. | sort >>$@_commands
  133. @external/vboot_reference/scripts/getversion.sh >> $@_t
  134. @echo '#define _CMD(NAME) extern const struct' \
  135. 'futil_cmd_t __cmd_##NAME;' >> $@_t
  136. @cat $@_commands >> $@_t
  137. @echo '#undef _CMD' >> $@_t
  138. @echo '#define _CMD(NAME) &__cmd_##NAME,' >> $@_t
  139. @echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $@_t
  140. @cat $@_commands >> $@_t
  141. @echo '0}; /* null-terminated */' >> $@_t
  142. @echo '#undef _CMD' >> $@_t
  143. @mv $@_t $@
  144. @rm -f $@_commands
  145. LOCAL_GENERATED_SOURCES := $(generated_sources)/futility_cmds.c
  146. LOCAL_STATIC_LIBRARIES := libvboot_util-host
  147. LOCAL_SHARED_LIBRARIES := libcrypto-host
  148. include $(BUILD_HOST_EXECUTABLE)