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 5// Minimal makefile capable of compiling futility to sign images 6 7package { 8 default_applicable_licenses: ["external_vboot_reference_license"], 9} 10 11// Added automatically by a large-scale-change that took the approach of 12// 'apply every license found to every target'. While this makes sure we respect 13// every license restriction, it may not be entirely correct. 14// 15// e.g. GPL in an MIT project might only apply to the contrib/ directory. 16// 17// Please consider splitting the single license below into multiple licenses, 18// taking care not to lose any license_kind information, and overriding the 19// default license using the 'licenses: [...]' property on targets as needed. 20// 21// For unused files, consider creating a 'fileGroup' with "//visibility:private" 22// to attach the license to, and including a comment whether the files may be 23// used in the current project. 24// See: http://go/android-license-faq 25license { 26 name: "external_vboot_reference_license", 27 visibility: [":__subpackages__"], 28 license_kinds: [ 29 "SPDX-license-identifier-BSD", 30 "SPDX-license-identifier-LGPL", 31 ], 32 license_text: [ 33 "LICENSE", 34 ], 35} 36 37cc_defaults { 38 name: "vboot_defaults", 39 40 cflags: [ 41 "-Wall", 42 "-Werror", 43 "-Wno-address-of-packed-member", 44 "-Wno-ignored-qualifiers", 45 "-Wno-macro-redefined", 46 "-Wno-pointer-arith", 47 "-Wno-sign-compare", 48 "-Wno-typedef-redefinition", 49 "-Wno-unused-parameter", 50 ], 51} 52 53cc_library_host_static { 54 name: "libvboot_util", 55 defaults: ["vboot_defaults"], 56 57 cflags: [ 58 // These are required to access large disks and files on 32-bit systems. 59 "-D_GNU_SOURCE", 60 "-D_FILE_OFFSET_BITS=64", 61 ], 62 63 export_include_dirs: [ 64 "firmware/include", 65 "firmware/lib/include", 66 "firmware/lib/cgptlib/include", 67 "firmware/lib/cryptolib/include", 68 "firmware/lib/tpm_lite/include", 69 "firmware/2lib/include", 70 "host/include", 71 "host/lib/include", 72 ], 73 74 srcs: [ 75 // Firmware library sources needed by VbInit() call 76 "firmware/lib/crc8.c", 77 "firmware/lib/utility.c", 78 "firmware/lib/vboot_api_init.c", 79 "firmware/lib/vboot_common_init.c", 80 "firmware/lib/vboot_nvstorage.c", 81 "firmware/lib/vboot_nvstorage_rollback.c", 82 "firmware/lib/region-init.c", 83 84 // Additional firmware library sources needed by VbSelectFirmware() call 85 "firmware/lib/cryptolib/padding.c", 86 "firmware/lib/cryptolib/rsa.c", 87 "firmware/lib/cryptolib/rsa_utility.c", 88 "firmware/lib/cryptolib/sha1.c", 89 "firmware/lib/cryptolib/sha256.c", 90 "firmware/lib/cryptolib/sha512.c", 91 "firmware/lib/cryptolib/sha_utility.c", 92 "firmware/lib/stateful_util.c", 93 "firmware/lib/vboot_api_firmware.c", 94 "firmware/lib/vboot_common.c", 95 "firmware/lib/vboot_firmware.c", 96 "firmware/lib/region-fw.c", 97 98 // Additional firmware library sources needed by VbSelectAndLoadKernel() call 99 "firmware/lib/cgptlib/cgptlib.c", 100 "firmware/lib/cgptlib/cgptlib_internal.c", 101 "firmware/lib/cgptlib/crc32.c", 102 "firmware/lib/gpt_misc.c", 103 "firmware/lib/utility_string.c", 104 "firmware/lib/vboot_api_kernel.c", 105 "firmware/lib/vboot_audio.c", 106 "firmware/lib/vboot_display.c", 107 "firmware/lib/vboot_kernel.c", 108 "firmware/lib/region-kernel.c", 109 110 "firmware/stub/tpm_lite_stub.c", 111 "firmware/stub/utility_stub.c", 112 "firmware/stub/vboot_api_stub_init.c", 113 "firmware/stub/vboot_api_stub_region.c", 114 115 "firmware/stub/vboot_api_stub_sf.c", 116 117 "firmware/stub/vboot_api_stub.c", 118 "firmware/stub/vboot_api_stub_disk.c", 119 "firmware/stub/vboot_api_stub_stream.c", 120 121 "cgpt/cgpt_create.c", 122 "cgpt/cgpt_add.c", 123 "cgpt/cgpt_boot.c", 124 "cgpt/cgpt_show.c", 125 "cgpt/cgpt_repair.c", 126 "cgpt/cgpt_prioritize.c", 127 "cgpt/cgpt_common.c", 128 "futility/dump_kernel_config_lib.c", 129 "host/lib/crossystem.c", 130 "host/lib/file_keys.c", 131 "host/lib/fmap.c", 132 "host/lib/host_common.c", 133 "host/lib/host_key.c", 134 "host/lib/host_keyblock.c", 135 "host/lib/host_misc.c", 136 "host/lib/util_misc.c", 137 "host/lib/host_signature.c", 138 "host/lib/signature_digest.c", 139 140 // host/arch/${HOST_ARCH}/lib/crossystem_arch.c 141 ], 142 143 static_libs: ["libcrypto"], 144 145 target: { 146 darwin: { 147 cflags: [ 148 "-DHAVE_MACOS", 149 "-DO_LARGEFILE=0", 150 ], 151 }, 152 }, 153} 154 155filegroup { 156 name: "futility_srcs", 157 srcs: [ 158 "futility/futility.c", 159 "futility/cmd_dump_fmap.c", 160 "futility/cmd_gbb_utility.c", 161 "futility/misc.c", 162 163 "futility/cmd_dump_kernel_config.c", 164 "futility/cmd_load_fmap.c", 165 "futility/cmd_pcr.c", 166 "futility/cmd_show.c", 167 "futility/cmd_sign.c", 168 "futility/cmd_vbutil_firmware.c", 169 "futility/cmd_vbutil_kernel.c", 170 "futility/cmd_vbutil_key.c", 171 "futility/cmd_vbutil_keyblock.c", 172 "futility/file_type.c", 173 "futility/traversal.c", 174 "futility/vb1_helper.c", 175 ], 176} 177 178genrule { 179 name: "futility_cmds", 180 cmd: "grep -hoRE '^DECLARE_FUTIL_COMMAND\\([^,]+' $(locations :futility_srcs) | sed 's/DECLARE_FUTIL_COMMAND(\\(.*\\)/_CMD(\\1)/' | sort >>$(genDir)/commands" + 181 " && $(location scripts/getversion.sh) >> $(out)" + 182 " && echo '#define _CMD(NAME) extern const struct futil_cmd_t __cmd_##NAME;' >> $(out)" + 183 " && cat $(genDir)/commands >> $(out)" + 184 " && echo '#undef _CMD' >> $(out)" + 185 " && echo '#define _CMD(NAME) &__cmd_##NAME,' >> $(out)" + 186 " && echo 'const struct futil_cmd_t *const futil_cmds[] = {' >> $(out)" + 187 " && cat $(genDir)/commands >> $(out)" + 188 " && echo '0}; /* null-terminated */' >> $(out)" + 189 " && echo '#undef _CMD' >> $(out)", 190 srcs: [ 191 ":futility_srcs", 192 "scripts/getversion.sh", 193 ], 194 out: ["futility_cmds.c"], 195} 196 197cc_binary_host { 198 name: "futility-host", 199 defaults: ["vboot_defaults"], 200 201 srcs: [":futility_srcs"], 202 generated_sources: ["futility_cmds"], 203 204 cflags: [ 205 // These are required to access large disks and files on 32-bit systems. 206 "-D_GNU_SOURCE", 207 "-D_FILE_OFFSET_BITS=64", 208 ], 209 210 static_libs: ["libvboot_util"], 211 shared_libs: ["libcrypto"], 212 213 target: { 214 darwin: { 215 cflags: ["-DHAVE_MACOS"], 216 }, 217 }, 218} 219