1package { 2 default_applicable_licenses: ["external_flashrom_license"], 3} 4 5license { 6 name: "external_flashrom_license", 7 visibility: [":__subpackages__"], 8 license_kinds: [ 9 "SPDX-license-identifier-BSD", 10 "SPDX-license-identifier-GPL", 11 "SPDX-license-identifier-GPL-2.0", 12 ], 13 license_text: [ 14 "COPYING", 15 "LICENSE", 16 ], 17} 18 19genrule { 20 name: "flashrom_version.h", 21 srcs: ["VERSION"], 22 cmd: "cat $(in) | xargs printf -- '#define FLASHROM_VERSION \"%s\"\n' > $(out)", 23 out: ["flashrom_version.h"], 24} 25 26cc_defaults { 27 name: "flashrom_defaults", 28 host_supported: true, 29 cflags: [ 30 "-Os", 31 "-std=c99", 32 "-Werror", 33 "-Wshadow", 34 "-Wmissing-prototypes", 35 "-Wwrite-strings", 36 "-Wno-unused-parameter", 37 "-Wno-address-of-packed-member", 38 "-Wno-enum-conversion", 39 "-Wno-missing-braces", 40 41 "-Wno-error=gnu-pointer-arith", 42 43 "-D_DEFAULT_SOURCE", 44 "-D_POSIX_C_SOURCE=200809L", 45 "-D_BSD_SOURCE", 46 "-D__BSD_VISIBLE", 47 "-D__XSI_VISIBLE", 48 "-D_NETBSD_SOURCE", 49 "-D_DARWIN_C_SOURCE", 50 51 "-DCONFIG_DEFAULT_PROGRAMMER_NAME=&programmer_internal", 52 "-DCONFIG_DEFAULT_PROGRAMMER_ARGS=\"\"", 53 "-DCONFIG_DELAY_MINIMUM_SLEEP_US=100000", 54 55 "-DHAVE_CLOCK_GETTIME=1", 56 "-DHAVE_STRNLEN=1", 57 "-DHAVE_GETOPT_H=1", 58 "-DHAVE_PCIUTILS_PCI_H=1", 59 "-DHAVE_UTSNAME=1", 60 61 // Only LittleEndian platforms are supported. Feel free to add BigEndian support. 62 "-D__FLASHROM_LITTLE_ENDIAN__", 63 "-include flashrom_version.h", 64 65 // programmers config 66 "-DCONFIG_DUMMY=1", 67 "-DCONFIG_INTERNAL=1", 68 "-DCONFIG_INTERNAL_DMI=1", 69 "-DCONFIG_IT8212=1", 70 "-DCONFIG_LINUX_MTD=1", 71 "-DCONFIG_LINUX_SPI=1", 72 "-DCONFIG_MEDIATEK_I2C_SPI=1", 73 "-DCONFIG_PARADE_LSPCON=1", 74 "-DCONFIG_RAIDEN_DEBUG_SPI=1", 75 "-DCONFIG_REALTEK_MST_I2C_SPI=1", 76 "-DCONFIG_SERPROG=1", 77 "-DCONFIG_STLINKV3_SPI=1", 78 79 "-DCONFIG_CROS_EC=1", 80 "-DUSE_BIG_LOCK=1", 81 ], 82 83 generated_headers: ["flashrom_version.h"], 84 85 include_dirs: ["external/libusb/include/libusb"], 86 87 static_libs: ["libpci"], 88 shared_libs: ["libusb"], 89} 90 91cc_library { 92 name: "libflashrom", 93 defaults: ["flashrom_defaults"], 94 host_supported: true, 95 vendor_available: true, 96 visibility: ["//external/vboot_reference"], 97 init_rc: ["flashrom.rc"], 98 99 target: { 100 linux: { 101 cflags: ["-DIS_WINDOWS=0"], 102 srcs: [ 103 "custom_baud_linux.c", 104 "hwaccess_physmap.c", 105 ], 106 }, 107 linux_x86: { 108 srcs: [ 109 "hwaccess_x86_msr.c", 110 "hwaccess_x86_io.c", 111 ], 112 }, 113 linux_x86_64: { 114 srcs: [ 115 "hwaccess_x86_msr.c", 116 "hwaccess_x86_io.c", 117 ], 118 }, 119 windows: { 120 cflags: ["-DIS_WINDOWS=1"], 121 srcs: ["custom_baud.c"], 122 }, 123 }, 124 125 arch: { 126 x86: { 127 srcs: [ 128 "processor_enable.c", 129 "chipset_enable.c", 130 "board_enable.c", 131 "cbtable.c", 132 "internal.c", 133 "internal_par.c", 134 "it87spi.c", 135 "sb600spi.c", 136 "superio.c", 137 "amd_imc.c", 138 "wbsio_spi.c", 139 "mcp6x_spi.c", 140 "ichspi.c", 141 "dmi.c", 142 "pcidev.c", 143 "known_boards.c", 144 ], 145 }, 146 x86_64: { 147 srcs: [ 148 "processor_enable.c", 149 "chipset_enable.c", 150 "board_enable.c", 151 "cbtable.c", 152 "internal.c", 153 "internal_par.c", 154 "it87spi.c", 155 "sb600spi.c", 156 "superio.c", 157 "amd_imc.c", 158 "wbsio_spi.c", 159 "mcp6x_spi.c", 160 "ichspi.c", 161 "dmi.c", 162 "pcidev.c", 163 "known_boards.c", 164 ], 165 }, 166 arm: { 167 srcs: [ 168 "board_enable.c", 169 "cbtable.c", 170 "chipset_enable.c", 171 "internal.c", 172 "internal_par.c", 173 "processor_enable.c", 174 "pcidev.c", 175 "known_boards.c", 176 ], 177 }, 178 arm64: { 179 srcs: [ 180 "board_enable.c", 181 "cbtable.c", 182 "chipset_enable.c", 183 "internal.c", 184 "internal_par.c", 185 "processor_enable.c", 186 "pcidev.c", 187 "known_boards.c", 188 ], 189 }, 190 }, 191 192 srcs: [ 193 "82802ab.c", 194 "at45db.c", 195 "bitbang_spi.c", 196 "edi.c", 197 "en29lv640b.c", 198 "erasure_layout.c", 199 "flashchips.c", 200 "flashrom.c", 201 "fmap.c", 202 "helpers.c", 203 "helpers_fileio.c", 204 "ich_descriptors.c", 205 "jedec.c", 206 "printlock.c", 207 "layout.c", 208 "libflashrom.c", 209 "opaque.c", 210 "parallel.c", 211 "print.c", 212 "programmer.c", 213 "programmer_table.c", 214 "s25f.c", 215 "sfdp.c", 216 "spi25.c", 217 "spi25_statusreg.c", 218 "spi95.c", 219 "spi.c", 220 "sst28sf040.c", 221 "sst49lfxxxc.c", 222 "sst_fwhub.c", 223 "stm50.c", 224 "w29ee011.c", 225 "w39.c", 226 "writeprotect.c", 227 "writeprotect_ranges.c", 228 "udelay.c", 229 230 "power.c", 231 "action_descriptor.c", 232 "flashchips_crosbl.c", 233 "cros_ec.c", 234 "big_lock.c", 235 "file_lock.c", 236 237 // Programmers 238 "dummyflasher.c", 239 "it8212.c", 240 "linux_mtd.c", 241 "linux_spi.c", 242 "parade_lspcon.c", 243 "i2c_helper_linux.c", 244 "mediatek_i2c_spi.c", 245 "raiden_debug_spi.c", 246 "usb_device.c", 247 "realtek_mst_i2c_spi.c", 248 "serprog.c", 249 "serial.c", 250 "stlinkv3_spi.c", 251 "usbdev.c", 252 253 // Platform 254 "platform/endian_little.c", 255 "platform/memaccess.c", 256 ], 257 258 export_include_dirs: ["include"], 259 static_libs: ["libz"], 260 261} 262 263cc_binary { 264 name: "flashrom", 265 defaults: ["flashrom_defaults"], 266 vendor: true, 267 268 srcs: [ 269 "cli_classic.c", 270 "cli_common.c", 271 "cli_output.c", 272 ], 273 274 shared_libs: ["libflashrom"], 275} 276