You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Android.mk 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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. # Additional firmware library sources needed by VbSelectFirmware() call
  29. VBSF_SRCS = \
  30. firmware/lib/cryptolib/padding.c \
  31. firmware/lib/cryptolib/rsa.c \
  32. firmware/lib/cryptolib/rsa_utility.c \
  33. firmware/lib/cryptolib/sha1.c \
  34. firmware/lib/cryptolib/sha256.c \
  35. firmware/lib/cryptolib/sha512.c \
  36. firmware/lib/cryptolib/sha_utility.c \
  37. firmware/lib/stateful_util.c \
  38. firmware/lib/vboot_common.c \
  39. firmware/lib/region-fw.c \
  40. # Additional firmware library sources needed by VbSelectAndLoadKernel() call
  41. VBSLK_SRCS = \
  42. firmware/lib/cgptlib/cgptlib.c \
  43. firmware/lib/cgptlib/cgptlib_internal.c \
  44. firmware/lib/cgptlib/crc32.c \
  45. firmware/lib/gpt_misc.c \
  46. firmware/lib/utility_string.c \
  47. firmware/lib/vboot_api_kernel.c \
  48. firmware/lib/vboot_audio.c \
  49. firmware/lib/vboot_display.c \
  50. firmware/lib/vboot_kernel.c \
  51. firmware/lib/region-kernel.c \
  52. VBINIT_SRCS += \
  53. firmware/stub/tpm_lite_stub.c \
  54. firmware/stub/utility_stub.c \
  55. firmware/stub/vboot_api_stub_init.c \
  56. firmware/stub/vboot_api_stub_region.c
  57. VBSF_SRCS += \
  58. firmware/stub/vboot_api_stub_sf.c
  59. VBSLK_SRCS += \
  60. firmware/stub/vboot_api_stub.c \
  61. firmware/stub/vboot_api_stub_disk.c \
  62. firmware/stub/vboot_api_stub_stream.c
  63. UTILLIB_SRCS = \
  64. cgpt/cgpt_create.c \
  65. cgpt/cgpt_add.c \
  66. cgpt/cgpt_boot.c \
  67. cgpt/cgpt_show.c \
  68. cgpt/cgpt_repair.c \
  69. cgpt/cgpt_prioritize.c \
  70. cgpt/cgpt_common.c \
  71. futility/dump_kernel_config_lib.c \
  72. host/lib/crossystem.c \
  73. host/lib/file_keys.c \
  74. host/lib/fmap.c \
  75. host/lib/host_common.c \
  76. host/lib/host_key.c \
  77. host/lib/host_keyblock.c \
  78. host/lib/host_misc.c \
  79. host/lib/util_misc.c \
  80. host/lib/host_signature.c \
  81. host/lib/signature_digest.c
  82. # host/arch/${HOST_ARCH}/lib/crossystem_arch.c \
  83. LOCAL_SRC_FILES := \
  84. $(VBINIT_SRCS) \
  85. $(VBSF_SRCS) \
  86. $(VBSLK_SRCS) \
  87. $(UTILLIB_SRCS)
  88. LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES)
  89. LOCAL_STATIC_LIBRARIES := libcrypto_static
  90. include $(BUILD_HOST_STATIC_LIBRARY)
  91. include $(CLEAR_VARS)
  92. LOCAL_MODULE := futility-host
  93. LOCAL_IS_HOST_MODULE := true
  94. LOCAL_MODULE_CLASS := EXECUTABLES
  95. generated_sources := $(call local-generated-sources-dir)
  96. ifeq ($(HOST_OS),darwin)
  97. LOCAL_CFLAGS += -DHAVE_MACOS
  98. endif
  99. # These are required to access large disks and files on 32-bit systems.
  100. LOCAL_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
  101. FUTIL_STATIC_SRCS = \
  102. futility/futility.c \
  103. futility/cmd_dump_fmap.c \
  104. futility/cmd_gbb_utility.c \
  105. futility/misc.c
  106. FUTIL_SRCS = \
  107. ${FUTIL_STATIC_SRCS} \
  108. futility/cmd_dump_kernel_config.c \
  109. futility/cmd_load_fmap.c \
  110. futility/cmd_pcr.c \
  111. futility/cmd_show.c \
  112. futility/cmd_sign.c \
  113. futility/cmd_vbutil_firmware.c \
  114. futility/cmd_vbutil_kernel.c \
  115. futility/cmd_vbutil_key.c \
  116. futility/cmd_vbutil_keyblock.c \
  117. futility/file_type.c \
  118. futility/traversal.c \
  119. futility/vb1_helper.c
  120. # ${FUTIL_STATIC_WORKAROUND_SRCS:%.c=${BUILD}/%.o} \
  121. LOCAL_SRC_FILES := \
  122. $(FUTIL_SRCS) \
  123. $(generated_sources)/futility_cmds.c: ${FUTIL_SRCS:%=${LOCAL_PATH}/%}
  124. @echo making $< from ${FUTIL_SRCS}
  125. @rm -f $@ $@_t $@_commands
  126. @mkdir -p $(dir $@)
  127. @grep -hoRE '^DECLARE_FUTIL_COMMAND\([^,]+' $^ \
  128. | sed 's/DECLARE_FUTIL_COMMAND(\(.*\)/_CMD(\1)/' \
  129. | sort >>$@_commands
  130. @external/vboot_reference/scripts/getversion.sh >> $@_t
  131. @echo '#define _CMD(NAME) extern const struct' \
  132. 'futil_cmd_t __cmd_##NAME;' >> $@_t
  133. @cat $@_commands >> $@_t
  134. @echo '#undef _CMD' >> $@_t
  135. @echo '#define _CMD(NAME) &__cmd_##NAME,' >> $@_t
  136. @echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $@_t
  137. @cat $@_commands >> $@_t
  138. @echo '0}; /* null-terminated */' >> $@_t
  139. @echo '#undef _CMD' >> $@_t
  140. @mv $@_t $@
  141. @rm -f $@_commands
  142. LOCAL_GENERATED_SOURCES := $(generated_sources)/futility_cmds.c
  143. LOCAL_STATIC_LIBRARIES := libvboot_util-host
  144. LOCAL_SHARED_LIBRARIES := libcrypto-host
  145. include $(BUILD_HOST_EXECUTABLE)