flashrom-gerrit
Threads by month
- ----- 2026 -----
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
March 2021
- 1 participants
- 263 discussions
Change in flashrom[master]: chipset_enable.c: Mark Intel Q67 as DEP
by Angel Pons (Code Review) Nov. 1, 2021
by Angel Pons (Code Review) Nov. 1, 2021
Nov. 1, 2021
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/47797 )
Change subject: chipset_enable.c: Mark Intel Q67 as DEP
......................................................................
chipset_enable.c: Mark Intel Q67 as DEP
Tested reading, writing and erasing the internal flash chip using an HP
Elite 8200 mainboard with an Intel Q67 PCH. However, since ME-enabled
chipsets are marked as DEP instead of OK, this one shall also be.
Change-Id: I2bd431c5c72824654b6b5b840f9af55dfe9d3554
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M chipset_enable.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/97/47797/1
diff --git a/chipset_enable.c b/chipset_enable.c
index 04ff9d8..5e4a547 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -1829,7 +1829,7 @@
{0x8086, 0x1c4b, B_FS, NT, "Intel", "HM67", enable_flash_pch6},
{0x8086, 0x1c4c, B_FS, NT, "Intel", "Q65", enable_flash_pch6},
{0x8086, 0x1c4d, B_FS, NT, "Intel", "QS67", enable_flash_pch6},
- {0x8086, 0x1c4e, B_FS, NT, "Intel", "Q67", enable_flash_pch6},
+ {0x8086, 0x1c4e, B_FS, DEP, "Intel", "Q67", enable_flash_pch6},
{0x8086, 0x1c4f, B_FS, DEP, "Intel", "QM67", enable_flash_pch6},
{0x8086, 0x1c50, B_FS, NT, "Intel", "B65", enable_flash_pch6},
{0x8086, 0x1c52, B_FS, NT, "Intel", "C202", enable_flash_pch6},
--
To view, visit https://review.coreboot.org/c/flashrom/+/47797
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2bd431c5c72824654b6b5b840f9af55dfe9d3554
Gerrit-Change-Number: 47797
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange
4
5
Change in ...flashrom[master]: freebsd_spi: Use malloc() instead of alloca()
by David Hendricks (Code Review) Oct. 10, 2021
by David Hendricks (Code Review) Oct. 10, 2021
Oct. 10, 2021
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/30765
Change subject: freebsd_spi: Use malloc() instead of alloca()
......................................................................
freebsd_spi: Use malloc() instead of alloca()
Change-Id: I03ff2bd1e20bea014333945771b560f17387ebd6
Signed-off-by: David Hendricks <david.hendricks(a)gmail.com>
---
M freebsd_spi.c
1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/65/30765/1
diff --git a/freebsd_spi.c b/freebsd_spi.c
index 215be20..7514912 100644
--- a/freebsd_spi.c
+++ b/freebsd_spi.c
@@ -145,7 +145,11 @@
/* FreeBSD uses a single buffer for rx and tx. Allocate a temporary one to avoid overwriting anything. */
size_t tmpcnt = readcnt + writecnt;
- unsigned char *tmpbuf = alloca(tmpcnt);
+ unsigned char *tmpbuf = malloc(tmpcnt);
+ if (!tmpbuf) {
+ msg_perr("Out of memory!\n");
+ return -1;
+ }
bzero(tmpbuf, tmpcnt);
memcpy(tmpbuf, txbuf, writecnt);
@@ -164,12 +168,14 @@
if (ioctl(fd, SPIGENIOC_TRANSFER, &msg) == -1) {
msg_cerr("%s: ioctl: %s\n", __func__, strerror(errno));
+ free(tmpbuf);
return -1;
}
if (rxbuf)
memcpy(rxbuf, tmpbuf + writecnt, readcnt);
+ free(tmpbuf);
return 0;
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/30765
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I03ff2bd1e20bea014333945771b560f17387ebd6
Gerrit-Change-Number: 30765
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange
1
1
Change in ...flashrom[master]: Add freebsd_spi programmer
by David Hendricks (Code Review) Oct. 10, 2021
by David Hendricks (Code Review) Oct. 10, 2021
Oct. 10, 2021
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/30764
Change subject: Add freebsd_spi programmer
......................................................................
Add freebsd_spi programmer
Based on linux_spi, using FreeBSD's spigen(4) interface.
Change-Id: I4e1689416fbb309df94807f51635bc1f4b53e0c8
Signed-off-by: Greg V <greg(a)unrelenting.technology>
---
M Makefile
M flashrom.8.tmpl
M flashrom.c
A freebsd_spi.c
M programmer.h
5 files changed, 246 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/64/30764/1
diff --git a/Makefile b/Makefile
index 1ff578c..7e709dc 100644
--- a/Makefile
+++ b/Makefile
@@ -379,6 +379,14 @@
endif
endif
+ifneq ($(TARGET_OS), FreeBSD)
+ifeq ($(CONFIG_FREEBSD_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_FREEBSD_SPI=yes
+else
+override CONFIG_FREEBSD_SPI = no
+endif
+endif
+
###############################################################################
# General architecture-specific settings.
# Like above for the OS, below we verify user-supplied options depending on the target architecture.
@@ -647,6 +655,9 @@
CONFIG_LINUX_MTD ?= yes
CONFIG_LINUX_SPI ?= yes
+# Enable FreeBSD spigen interface by default. We disable them on non-FreeBSD targets.
+CONFIG_FREEBSD_SPI ?= yes
+
# Always enable ITE IT8212F PATA controllers for now.
CONFIG_IT8212 ?= yes
@@ -945,6 +956,11 @@
PROGRAMMER_OBJS += linux_spi.o
endif
+ifeq ($(CONFIG_FREEBSD_SPI), yes)
+FEATURE_CFLAGS += -D'CONFIG_FREEBSD_SPI=1'
+PROGRAMMER_OBJS += freebsd_spi.o
+endif
+
ifeq ($(CONFIG_MSTARDDC_SPI), yes)
# This is a totally ugly hack.
FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'")
diff --git a/flashrom.8.tmpl b/flashrom.8.tmpl
index c557af7..092f070 100644
--- a/flashrom.8.tmpl
+++ b/flashrom.8.tmpl
@@ -319,6 +319,8 @@
.sp
.BR "* linux_spi" " (for SPI flash ROMs accessible via /dev/spidevX.Y on Linux)"
.sp
+.BR "* freebsd_spi" " (for SPI flash ROMs accessible via /dev/spigenX.Y on FreeBSD)"
+.sp
.BR "* usbblaster_spi" " (for SPI flash ROMs attached to an Altera USB-Blaster compatible cable)"
.sp
.BR "* nicintel_eeprom" " (for SPI EEPROMs on Intel Gigabit network cards)"
@@ -1065,6 +1067,25 @@
.sp
Please note that the linux_spi driver only works on Linux.
.SS
+.BR "freebsd_spi " programmer
+.IP
+You have to specify the SPI controller to use with the
+.sp
+.B " flashrom \-p freebsd_spi:dev=/dev/spigenX.Y"
+.sp
+syntax where
+.B /dev/spigenX.Y
+is the FreeBSD device node for your SPI controller.
+.sp
+In case the device supports it, you can set the SPI clock frequency with the optional
+.B spispeed
+parameter. The frequency is parsed as kilohertz.
+Example that sets the frequency to 8 MHz:
+.sp
+.B " flashrom \-p freebsd_spi:dev=/dev/spigenX.Y,spispeed=8000"
+.sp
+Please note that the freebsd_spi driver only works on FreeBSD.
+.SS
.BR "mstarddc_spi " programmer
.IP
The Display Data Channel (DDC) is an I2C bus present on VGA and DVI connectors, that allows exchanging
diff --git a/flashrom.c b/flashrom.c
index 59a7531..624bcfb 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -377,6 +377,18 @@
},
#endif
+#if CONFIG_FREEBSD_SPI == 1
+ {
+ .name = "freebsd_spi",
+ .type = OTHER,
+ .devs.note = "Device files /dev/spigen*.*\n",
+ .init = freebsd_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = internal_delay,
+ },
+#endif
+
#if CONFIG_USBBLASTER_SPI == 1
{
.name = "usbblaster_spi",
diff --git a/freebsd_spi.c b/freebsd_spi.c
new file mode 100644
index 0000000..215be20
--- /dev/null
+++ b/freebsd_spi.c
@@ -0,0 +1,186 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2011 Sven Schnelle <svens(a)stackframe.org>
+ * Copyright (C) 2018 Greg V <greg(a)unrelenting.technology>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#if CONFIG_FREEBSD_SPI == 1
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/ioccom.h>
+#include <sys/spigenio.h>
+#include "flash.h"
+#include "chipdrivers.h"
+#include "programmer.h"
+#include "spi.h"
+
+/* Tested on:
+ * Xunlong Orange Pi PC (Allwinner H3) */
+
+/* Same as in spi(8) */
+#define DEFAULT_BUFFER_SIZE 8192
+
+static int fd = -1;
+
+static int freebsd_spi_shutdown(void *data);
+static int freebsd_spi_send_command(struct flashctx *flash, unsigned int writecnt,
+ unsigned int readcnt,
+ const unsigned char *txbuf,
+ unsigned char *rxbuf);
+static int freebsd_spi_read(struct flashctx *flash, uint8_t *buf,
+ unsigned int start, unsigned int len);
+static int freebsd_spi_write_256(struct flashctx *flash, const uint8_t *buf,
+ unsigned int start, unsigned int len);
+
+static const struct spi_master spi_master_freebsd = {
+ .type = SPI_CONTROLLER_FREEBSD,
+ .features = SPI_MASTER_4BA,
+ .max_data_read = MAX_DATA_UNSPECIFIED, /* TODO? */
+ .max_data_write = MAX_DATA_UNSPECIFIED, /* TODO? */
+ .command = freebsd_spi_send_command,
+ .multicommand = default_spi_send_multicommand,
+ .read = freebsd_spi_read,
+ .write_256 = freebsd_spi_write_256,
+ .write_aai = default_spi_write_aai,
+};
+
+int freebsd_spi_init(void)
+{
+ char *p, *endp, *dev;
+ uint32_t speed_hz = 0;
+ /* FIXME: make the following configurable by CLI options. */
+ /* SPI mode 0 (beware this also includes: MSB first, CS active low and others */
+ const uint8_t mode = 0;
+
+ p = extract_programmer_param("spispeed");
+ if (p && strlen(p)) {
+ speed_hz = (uint32_t)strtoul(p, &endp, 10) * 1000;
+ if (p == endp) {
+ msg_perr("%s: invalid clock: %s kHz\n", __func__, p);
+ free(p);
+ return 1;
+ }
+ }
+ free(p);
+
+ dev = extract_programmer_param("dev");
+ if (!dev || !strlen(dev)) {
+ msg_perr("No SPI device given. Use flashrom -p "
+ "freebsd_spi:dev=/dev/spigenX.Y\n");
+ free(dev);
+ return 1;
+ }
+
+ msg_pdbg("Using device %s\n", dev);
+ if ((fd = open(dev, O_RDWR)) == -1) {
+ msg_perr("%s: failed to open %s: %s\n", __func__,
+ dev, strerror(errno));
+ free(dev);
+ return 1;
+ }
+ free(dev);
+
+ if (register_shutdown(freebsd_spi_shutdown, NULL))
+ return 1;
+ /* We rely on the shutdown function for cleanup from here on. */
+
+ if (speed_hz > 0) {
+ if (ioctl(fd, SPIGENIOC_SET_CLOCK_SPEED, &speed_hz) == -1) {
+ msg_perr("%s: failed to set speed to %d Hz: %s\n",
+ __func__, speed_hz, strerror(errno));
+ return 1;
+ }
+
+ msg_pdbg("Using %d kHz clock\n", speed_hz/1000);
+ }
+
+ if (ioctl(fd, SPIGENIOC_SET_SPI_MODE, &mode) == -1) {
+ msg_perr("%s: failed to set SPI mode to 0x%02x: %s\n",
+ __func__, mode, strerror(errno));
+ return 1;
+ }
+
+ register_spi_master(&spi_master_freebsd);
+ return 0;
+}
+
+static int freebsd_spi_shutdown(void *data)
+{
+ if (fd != -1) {
+ close(fd);
+ fd = -1;
+ }
+ return 0;
+}
+
+static int freebsd_spi_send_command(struct flashctx *flash, unsigned int writecnt,
+ unsigned int readcnt,
+ const unsigned char *txbuf,
+ unsigned char *rxbuf)
+{
+ if (fd == -1)
+ return -1;
+ /* The implementation currently does not support requests that
+ don't start with sending a command. */
+ if (writecnt == 0)
+ return SPI_INVALID_LENGTH;
+
+ /* FreeBSD uses a single buffer for rx and tx. Allocate a temporary one to avoid overwriting anything. */
+ size_t tmpcnt = readcnt + writecnt;
+ unsigned char *tmpbuf = alloca(tmpcnt);
+
+ bzero(tmpbuf, tmpcnt);
+ memcpy(tmpbuf, txbuf, writecnt);
+
+ /* Command/data separation is pretty useless, spi(8) only uses the command. */
+ struct spigen_transfer msg = {
+ .st_command = {
+ .iov_base = (void*)tmpbuf,
+ .iov_len = tmpcnt,
+ },
+ .st_data = {
+ .iov_base = NULL,
+ .iov_len = 0,
+ },
+ };
+
+ if (ioctl(fd, SPIGENIOC_TRANSFER, &msg) == -1) {
+ msg_cerr("%s: ioctl: %s\n", __func__, strerror(errno));
+ return -1;
+ }
+
+ if (rxbuf)
+ memcpy(rxbuf, tmpbuf + writecnt, readcnt);
+
+ return 0;
+}
+
+static int freebsd_spi_read(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len)
+{
+ return spi_read_chunked(flash, buf, start, len, DEFAULT_BUFFER_SIZE);
+}
+
+static int freebsd_spi_write_256(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len)
+{
+ return spi_write_chunked(flash, buf, start, len, DEFAULT_BUFFER_SIZE);
+}
+
+#endif // CONFIG_FREEBSD_SPI == 1
diff --git a/programmer.h b/programmer.h
index 311992a..30687ed 100644
--- a/programmer.h
+++ b/programmer.h
@@ -103,6 +103,9 @@
#if CONFIG_LINUX_SPI == 1
PROGRAMMER_LINUX_SPI,
#endif
+#if CONFIG_FREEBSD_SPI == 1
+ PROGRAMMER_FREEBSD_SPI,
+#endif
#if CONFIG_USBBLASTER_SPI == 1
PROGRAMMER_USBBLASTER_SPI,
#endif
@@ -548,6 +551,11 @@
int linux_spi_init(void);
#endif
+/* freebsd_spi.c */
+#if CONFIG_FREEBSD_SPI == 1
+int freebsd_spi_init(void);
+#endif
+
/* dediprog.c */
#if CONFIG_DEDIPROG == 1
int dediprog_init(void);
@@ -623,6 +631,9 @@
#if CONFIG_LINUX_SPI == 1
SPI_CONTROLLER_LINUX,
#endif
+#if CONFIG_FREEBSD_SPI == 1
+ SPI_CONTROLLER_FREEBSD,
+#endif
#if CONFIG_SERPROG == 1
SPI_CONTROLLER_SERPROG,
#endif
--
To view, visit https://review.coreboot.org/c/flashrom/+/30764
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I4e1689416fbb309df94807f51635bc1f4b53e0c8
Gerrit-Change-Number: 30764
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange
1
2
Change in flashrom[master]: util/ich_descriptors_tool: Use GNU-style printf in MinGW
by David Hendricks (Code Review) Oct. 1, 2021
by David Hendricks (Code Review) Oct. 1, 2021
Oct. 1, 2021
David Hendricks has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43052 )
Change subject: util/ich_descriptors_tool: Use GNU-style printf in MinGW
......................................................................
util/ich_descriptors_tool: Use GNU-style printf in MinGW
This allows MinGW targets to use certain printf formatting
identifiers such as "%v" by adding -D__USE_MINGW_ANSI_STDIO=1 to
the CFLAGS. This is also done in flashrom's top-level Makefile.
Reported on https://github.com/flashrom/flashrom/issues/149
Change-Id: I644be8b5b607cc77b4be2121c443f0d41d8da687
Signed-off-by: David Hendricks <david.hendricks(a)gmail.com>
---
M util/ich_descriptors_tool/Makefile
1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/52/43052/1
diff --git a/util/ich_descriptors_tool/Makefile b/util/ich_descriptors_tool/Makefile
index c32e30b..8962431 100644
--- a/util/ich_descriptors_tool/Makefile
+++ b/util/ich_descriptors_tool/Makefile
@@ -41,6 +41,10 @@
CFLAGS += -Wno-format
endif
+ifeq ($(TARGET_OS), MinGW)
+CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
+endif
+
ifeq ($(WARNERROR), yes)
CFLAGS += -Werror
endif
--
To view, visit https://review.coreboot.org/c/flashrom/+/43052
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I644be8b5b607cc77b4be2121c443f0d41d8da687
Gerrit-Change-Number: 43052
Gerrit-PatchSet: 1
Gerrit-Owner: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-MessageType: newchange
4
5
Change in flashrom[master]: ft2232_spi.c: change the chunksize to 280
by Simon Buhrow (Code Review) Sept. 27, 2021
by Simon Buhrow (Code Review) Sept. 27, 2021
Sept. 27, 2021
Simon Buhrow has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/43282 )
Change subject: ft2232_spi.c: change the chunksize to 280
......................................................................
ft2232_spi.c: change the chunksize to 280
Signed-off-by: Simon Buhrow <simon.buhrow(a)posteo.de>
Change-Id: I5e096937834fc8fc8623c8c59ade529de081b72a
---
M ft2232_spi.c
1 file changed, 12 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/82/43282/1
diff --git a/ft2232_spi.c b/ft2232_spi.c
index 0799af4..0a8d631 100644
--- a/ft2232_spi.c
+++ b/ft2232_spi.c
@@ -398,7 +398,18 @@
msg_perr("Unable to set latency timer (%s).\n", ftdi_get_error_string(ftdic));
}
- if (ftdi_write_data_set_chunksize(ftdic, 270)) {
+ if (ftdi_write_data_set_chunksize(ftdic, 280)) {
+ /*
+ * 280 bytes =
+ * + 9 B (CMD)
+ * + 1 B (WREN)
+ * + 9 B (CMD)
+ * + 1 B (op)
+ * + 4 B (addr)
+ * + 256 B (page data)
+ *
+ * With op: PageProgram or Erase; CMD: FTDI-Chip commands
+ */
msg_perr("Unable to set chunk size (%s).\n", ftdi_get_error_string(ftdic));
}
--
To view, visit https://review.coreboot.org/c/flashrom/+/43282
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I5e096937834fc8fc8623c8c59ade529de081b72a
Gerrit-Change-Number: 43282
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Buhrow
Gerrit-MessageType: newchange
4
17
Change in ...flashrom[master]: layout: Introduce layout_next()
by Nico Huber (Code Review) July 1, 2021
by Nico Huber (Code Review) July 1, 2021
July 1, 2021
Hello Angel Pons, Arthur Heymans, David Hendricks, Thomas Heijligen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/flashrom/+/33542
to review the following change.
Change subject: layout: Introduce layout_next()
......................................................................
layout: Introduce layout_next()
And use it to compare the layouts in flashrom_layout_read_from_ifd()
in depth.
Change-Id: I284958471c61344d29d92c95d88475065a9ca9aa
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M layout.c
M layout.h
M libflashrom.c
3 files changed, 20 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/42/33542/1
diff --git a/layout.c b/layout.c
index e49189e..684615c 100644
--- a/layout.c
+++ b/layout.c
@@ -252,7 +252,7 @@
return lowest;
}
-const struct romentry *layout_next_included(
+const struct romentry *layout_next(
const struct flashrom_layout *const layout, const struct romentry *iterator)
{
const struct romentry *const end = layout->entries + layout->num_entries;
@@ -262,14 +262,21 @@
else
iterator = &layout->entries[0];
- for (; iterator < end; ++iterator) {
- if (!iterator->included)
- continue;
+ if (iterator < end)
return iterator;
- }
return NULL;
}
+const struct romentry *layout_next_included(
+ const struct flashrom_layout *const layout, const struct romentry *iterator)
+{
+ while ((iterator = layout_next(layout, iterator))) {
+ if (iterator->included)
+ break;
+ }
+ return iterator;
+}
+
/**
* @addtogroup flashrom-layout
* @{
diff --git a/layout.h b/layout.h
index 53a20d6..f5444e2 100644
--- a/layout.h
+++ b/layout.h
@@ -66,5 +66,6 @@
int process_include_args(struct flashrom_layout *l, const struct layout_include_args *const args);
const struct romentry *layout_next_included_region(const struct flashrom_layout *, chipoff_t);
const struct romentry *layout_next_included(const struct flashrom_layout *, const struct romentry *);
+const struct romentry *layout_next(const struct flashrom_layout *, const struct romentry *);
#endif /* !__LAYOUT_H__ */
diff --git a/libflashrom.c b/libflashrom.c
index af62002..6743d50 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -345,8 +345,13 @@
goto _finalize_ret;
}
- if (chip_layout->base.num_entries != dump_layout.base.num_entries ||
- memcmp(chip_layout->entries, dump_layout.entries, sizeof(dump_layout.entries))) {
+ const struct romentry *chip_entry = layout_next(&chip_layout->base, NULL);
+ const struct romentry *dump_entry = layout_next(&dump_layout.base, NULL);
+ while (chip_entry && dump_entry && !memcmp(chip_entry, dump_entry, sizeof(*chip_entry))) {
+ chip_entry = layout_next(&chip_layout->base, chip_entry);
+ dump_entry = layout_next(&dump_layout.base, dump_entry);
+ }
+ if (chip_entry || dump_entry) {
msg_cerr("Descriptors don't match!\n");
ret = 5;
goto _finalize_ret;
--
To view, visit https://review.coreboot.org/c/flashrom/+/33542
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I284958471c61344d29d92c95d88475065a9ca9aa
Gerrit-Change-Number: 33542
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: newchange
5
25
Change in flashrom[master]: support variable-size SPI chip for dummy programmer
by Namyoon Woo (Code Review) June 26, 2021
by Namyoon Woo (Code Review) June 26, 2021
June 26, 2021
Namyoon Woo has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/44879 )
Change subject: support variable-size SPI chip for dummy programmer
......................................................................
support variable-size SPI chip for dummy programmer
This is designed for firmware updater to pack firmware image
preserving some specific partitions in any size.
BUG=none
TEST=ran the command line below:
$ flashrom -p dummy:image=${TMP_FILE},size=16777216, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f
$ flashrom -p dummy:image=${TMP_FILE},size=auto, \
emulate=VARIABLE_SIZE -w ${IMG} -V -f
Signed-off-by: Namyoon Woo <namyoon(a)google.com>
Change-Id: Iff266e151459561b126ecfd1c47420b385be1db2
---
M chipdrivers.h
M dummyflasher.c
M flashchips.c
M flashchips.h
4 files changed, 159 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/79/44879/1
diff --git a/chipdrivers.h b/chipdrivers.h
index 3c7d146..cf03811 100644
--- a/chipdrivers.h
+++ b/chipdrivers.h
@@ -196,6 +196,9 @@
int probe_en29lv640b(struct flashctx *flash);
int write_en29lv640b(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
+/* dummyflasher.c */
+int probe_variable_size(struct flashctx *flash);
+
/* edi.c */
int edi_chip_block_erase(struct flashctx *flash, unsigned int page, unsigned int size);
int edi_chip_write(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
diff --git a/dummyflasher.c b/dummyflasher.c
index e1a1d80..4024f2a 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -21,6 +21,7 @@
#include "flash.h"
#include "chipdrivers.h"
#include "programmer.h"
+#include "flashchips.h"
/* Remove the #define below if you don't want SPI flash chip emulation. */
#define EMULATE_SPI_CHIP 1
@@ -33,6 +34,13 @@
#if EMULATE_CHIP
#include <sys/types.h>
#include <sys/stat.h>
+
+#if EMULATE_SPI_CHIP
+/* The name of variable-size virtual chip. A 4MB flash example:
+ * flashrom -p dummy:emulate=VARIABLE_SIZE,size=4194304
+ */
+#define VARIABLE_SIZE_CHIP_NAME "VARIABLE_SIZE"
+#endif
#endif
#if EMULATE_CHIP
@@ -44,6 +52,7 @@
EMULATE_SST_SST25VF032B,
EMULATE_MACRONIX_MX25L6436,
EMULATE_WINBOND_W25Q128FV,
+ EMULATE_VARIABLE_SIZE,
};
static enum emu_chip emu_chip = EMULATE_NONE;
static char *emu_persistent_image = NULL;
@@ -147,6 +156,12 @@
return 0;
}
+/* Values for the 'size' parameter */
+enum {
+ SIZE_UNKNOWN = -1,
+ SIZE_AUTO = -2,
+};
+
int dummy_init(void)
{
char *bustext = NULL;
@@ -154,6 +169,7 @@
unsigned int i;
#if EMULATE_SPI_CHIP
char *status = NULL;
+ int size = SIZE_UNKNOWN; /* size for VARIOUS_SIZE chip device */
#endif
#if EMULATE_CHIP
struct stat image_stat;
@@ -272,6 +288,31 @@
free(tmp);
#if EMULATE_CHIP
+#if EMULATE_SPI_CHIP
+ tmp = extract_programmer_param("size");
+ if (tmp) {
+ int multiplier = 1;
+ if (!strcmp(tmp, "auto"))
+ size = SIZE_AUTO;
+ else if (strlen(tmp)) {
+ int remove_last_char = 1;
+ switch (tmp[strlen(tmp) - 1]) {
+ case 'k': case 'K':
+ multiplier = 1024;
+ break;
+ case 'm': case 'M':
+ multiplier = 1024 * 1024;
+ break;
+ default:
+ remove_last_char = 0;
+ break;
+ }
+ if (remove_last_char) tmp[strlen(tmp) - 1] = '\0';
+ size = atoi(tmp) * multiplier;
+ }
+ }
+#endif
+
tmp = extract_programmer_param("emulate");
if (!tmp) {
msg_pdbg("Not emulating any flash chip.\n");
@@ -343,6 +384,42 @@
emu_jedec_ce_c7_size = emu_chip_size;
msg_pdbg("Emulating Winbond W25Q128FV SPI flash chip (RDID)\n");
}
+
+ emu_persistent_image = extract_programmer_param("image");
+ /* Will be freed by shutdown function if necessary. */
+ if (!emu_persistent_image) {
+ /* Nothing else to do. */
+ goto dummy_init_out;
+ }
+
+ if (!strncmp(tmp, VARIABLE_SIZE_CHIP_NAME,
+ strlen(VARIABLE_SIZE_CHIP_NAME))) {
+ if (size == SIZE_UNKNOWN) {
+ msg_perr("%s: the size parameter is not given.\n",
+ __func__);
+ free(tmp);
+ return 1;
+ } else if (size == SIZE_AUTO) {
+ if (stat(emu_persistent_image, &image_stat)) {
+ msg_perr("%s: no image so cannot use automatic size.\n",
+ __func__);
+ free(tmp);
+ return 1;
+ }
+ size = image_stat.st_size;
+ }
+ emu_chip = EMULATE_VARIABLE_SIZE;
+ emu_chip_size = size;
+ emu_max_byteprogram_size = 256;
+ emu_max_aai_size = 0;
+ emu_jedec_se_size = 4 * 1024;
+ emu_jedec_be_52_size = 32 * 1024;
+ emu_jedec_be_d8_size = 64 * 1024;
+ emu_jedec_ce_60_size = emu_chip_size;
+ emu_jedec_ce_c7_size = emu_chip_size;
+ msg_pdbg("Emulating generic SPI flash chip (size=%d bytes)\n",
+ emu_chip_size);
+ }
#endif
if (emu_chip == EMULATE_NONE) {
msg_perr("Invalid chip specified for emulation: %s\n", tmp);
@@ -376,12 +453,6 @@
msg_pdbg("Filling fake flash chip with 0xff, size %i\n", emu_chip_size);
memset(flashchip_contents, 0xff, emu_chip_size);
- /* Will be freed by shutdown function if necessary. */
- emu_persistent_image = extract_programmer_param("image");
- if (!emu_persistent_image) {
- /* Nothing else to do. */
- goto dummy_init_out;
- }
/* We will silently (in default verbosity) ignore the file if it does not exist (yet) or the size does
* not match the emulated chip. */
if (!stat(emu_persistent_image, &image_stat)) {
@@ -610,6 +681,16 @@
if (readcnt > 2)
readarr[2] = 0x18;
break;
+ case EMULATE_VARIABLE_SIZE:
+ if (readcnt > 0)
+ readarr[0] = (VARIABLE_SIZE_MANUF_ID >> 8) & 0xff;
+ if (readcnt > 1)
+ readarr[1] = VARIABLE_SIZE_MANUF_ID & 0xff;
+ if (readcnt > 2)
+ readarr[2] = (VARIABLE_SIZE_DEVICE_ID >> 8) & 0xff;
+ if (readcnt > 3)
+ readarr[3] = VARIABLE_SIZE_DEVICE_ID & 0xff;
+ break;
default: /* ignore */
break;
}
@@ -840,6 +921,7 @@
case EMULATE_SST_SST25VF032B:
case EMULATE_MACRONIX_MX25L6436:
case EMULATE_WINBOND_W25Q128FV:
+ case EMULATE_VARIABLE_SIZE:
if (emulate_spi_chip_response(writecnt, readcnt, writearr,
readarr)) {
msg_pdbg("Invalid command sent to flash chip!\n");
@@ -862,3 +944,47 @@
return spi_write_chunked(flash, buf, start, len,
spi_write_256_chunksize);
}
+
+#if EMULATE_CHIP && EMULATE_SPI_CHIP
+int probe_variable_size(struct flashctx *flash)
+{
+ int i;
+
+ /* Skip the probing if we don't emulate this chip. */
+ if (emu_chip != EMULATE_VARIABLE_SIZE)
+ return 0;
+
+ /*
+ * This will break if one day flashctx becomes read-only.
+ * Once that happens, we need to have special hacks in functions:
+ *
+ * erase_and_write_flash() in flashrom.c
+ * read_flash_to_file()
+ * handle_romentries()
+ * ...
+ *
+ * Search "total_size * 1024" in code.
+ */
+ if (emu_chip_size % 1024)
+ msg_perr("%s: emu_chip_size is not multipler of 1024.\n",
+ __func__);
+ flash->chip->total_size = emu_chip_size / 1024;
+ msg_cdbg("%s: set flash->total_size to %dK bytes.\n", __func__,
+ flash->chip->total_size);
+
+ /* Update eraser count */
+ for (i = 0; i < NUM_ERASEFUNCTIONS; i++) {
+ struct block_eraser *eraser = &flash->chip->block_erasers[i];
+ if (eraser->block_erase == NULL)
+ break;
+
+ eraser->eraseblocks[0].count = emu_chip_size /
+ eraser->eraseblocks[0].size;
+ msg_cdbg("%s: eraser.size=%d, .count=%d\n",
+ __func__, eraser->eraseblocks[0].size,
+ eraser->eraseblocks[0].count);
+ }
+
+ return 1;
+}
+#endif
diff --git a/flashchips.c b/flashchips.c
index 8b5b5cc..e99073b 100644
--- a/flashchips.c
+++ b/flashchips.c
@@ -18759,6 +18759,27 @@
{
.vendor = "Generic",
+ .name = "Variable Size SPI chip",
+ .bustype = BUS_SPI,
+ .manufacture_id = VARIABLE_SIZE_MANUF_ID,
+ .model_id = VARIABLE_SIZE_DEVICE_ID,
+ .total_size = 64, /* This size is set temporarily */
+ .page_size = 256,
+ .tested = TEST_OK_PREW,
+ .probe = probe_variable_size,
+ .block_erasers =
+ {
+ {
+ .eraseblocks = { {64 * 1024, 1} },
+ .block_erase = spi_block_erase_d8,
+ }
+ },
+ .write = spi_chip_write_256,
+ .read = spi_chip_read,
+ },
+
+ {
+ .vendor = "Generic",
.name = "unknown SPI chip (RDID)",
.bustype = BUS_SPI,
.manufacture_id = GENERIC_MANUF_ID,
diff --git a/flashchips.h b/flashchips.h
index 5b7937f..85010ea 100644
--- a/flashchips.h
+++ b/flashchips.h
@@ -36,6 +36,9 @@
#define PROGMANUF_ID 0xFFFE /* dummy ID for opaque chips behind a programmer */
#define PROGDEV_ID 0x01 /* dummy ID for opaque chips behind a programmer */
+#define VARIABLE_SIZE_MANUF_ID 0x3eaf
+#define VARIABLE_SIZE_DEVICE_ID 0x10af
+
#define ALLIANCE_ID 0x52 /* Alliance Semiconductor */
#define ALLIANCE_AS29F002B 0x34
#define ALLIANCE_AS29F002T 0xB0
--
To view, visit https://review.coreboot.org/c/flashrom/+/44879
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Iff266e151459561b126ecfd1c47420b385be1db2
Gerrit-Change-Number: 44879
Gerrit-PatchSet: 1
Gerrit-Owner: Namyoon Woo <namyoon(a)google.com>
Gerrit-MessageType: newchange
4
24
Change in ...flashrom[master]: layout: Drop `count` parameter of flashrom_layout_empty()
by Nico Huber (Code Review) June 26, 2021
by Nico Huber (Code Review) June 26, 2021
June 26, 2021
Hello Angel Pons, Arthur Heymans, David Hendricks, Thomas Heijligen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/flashrom/+/33544
to review the following change.
Change subject: layout: Drop `count` parameter of flashrom_layout_empty()
......................................................................
layout: Drop `count` parameter of flashrom_layout_empty()
Change-Id: I22c180c9971068b1ae101845ce88484c6842b852
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M flashrom.c
M ich_descriptors.c
M layout.c
M libflashrom.h
4 files changed, 5 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/44/33544/1
diff --git a/flashrom.c b/flashrom.c
index cb91cef..eeaa067 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1332,7 +1332,7 @@
return -1;
/* Fill default layout covering the whole chip. */
- if (flashrom_layout_empty(&flash->default_layout, 1) ||
+ if (flashrom_layout_empty(&flash->default_layout) ||
flashrom_layout_add_region(flash->default_layout,
0, flash->chip->total_size * 1024 - 1, "complete flash") ||
flashrom_layout_include_region(flash->default_layout, "complete flash"))
diff --git a/ich_descriptors.c b/ich_descriptors.c
index 8383801..1d35cca 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -1170,7 +1170,7 @@
if (read_ich_descriptors_from_dump(dump, len, &cs, &desc))
return 1;
- if (flashrom_layout_empty(layout, ARRAY_SIZE(regions)))
+ if (flashrom_layout_empty(layout))
return 2;
ssize_t i;
diff --git a/layout.c b/layout.c
index 3560a18..9d633bb 100644
--- a/layout.c
+++ b/layout.c
@@ -33,7 +33,7 @@
struct flashrom_layout *get_global_layout(void)
{
if (!global_layout)
- flashrom_layout_empty(&global_layout, 0);
+ flashrom_layout_empty(&global_layout);
return global_layout;
}
@@ -264,12 +264,11 @@
* @brief Create a new, empty layout.
*
* @param layout Pointer to returned layout reference.
- * @param count Number of layout entries to allocate.
*
* @return 0 on success,
* 1 if out of memory.
*/
-int flashrom_layout_empty(struct flashrom_layout **const layout, const unsigned int count)
+int flashrom_layout_empty(struct flashrom_layout **layout)
{
*layout = malloc(sizeof(**layout));
if (!*layout) {
diff --git a/libflashrom.h b/libflashrom.h
index 90f3e2c..785217e 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -62,7 +62,7 @@
int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len);
struct flashrom_layout;
-int flashrom_layout_empty(struct flashrom_layout **layout, unsigned int count);
+int flashrom_layout_empty(struct flashrom_layout **);
int flashrom_layout_read_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len);
int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **,
struct flashrom_flashctx *, off_t offset, size_t length);
--
To view, visit https://review.coreboot.org/c/flashrom/+/33544
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I22c180c9971068b1ae101845ce88484c6842b852
Gerrit-Change-Number: 33544
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: newchange
5
10
Change in ...flashrom[master]: layout: Introduce flashrom_layout_empty()
by Nico Huber (Code Review) June 26, 2021
by Nico Huber (Code Review) June 26, 2021
June 26, 2021
Hello Angel Pons, Arthur Heymans, David Hendricks, Thomas Heijligen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/flashrom/+/33543
to review the following change.
Change subject: layout: Introduce flashrom_layout_empty()
......................................................................
layout: Introduce flashrom_layout_empty()
It initializes an empty layout. Currently the maximum number of entries
has to be specified, which will vanisch once we use dynamic allocation.
Change-Id: I2ae7246493ff592e631cce924777925c7825e398
Signed-off-by: Nico Huber <nico.h(a)gmx.de>
---
M cli_classic.c
M flash.h
M flashrom.c
M ich_descriptors.c
M ich_descriptors.h
M layout.c
M libflashrom.c
M libflashrom.h
8 files changed, 54 insertions(+), 37 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/43/33543/1
diff --git a/cli_classic.c b/cli_classic.c
index 2e07612..a98be47 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -673,8 +673,10 @@
out_shutdown:
programmer_shutdown();
out:
- for (i = 0; i < chipcount; i++)
+ for (i = 0; i < chipcount; i++) {
+ flashrom_layout_release(flashes[i].default_layout);
free(flashes[i].chip);
+ }
layout_cleanup(&include_args);
free(filename);
diff --git a/flash.h b/flash.h
index 5bbfa0a..84de7a7 100644
--- a/flash.h
+++ b/flash.h
@@ -252,7 +252,7 @@
chipaddr virtual_registers;
struct registered_master *mst;
const struct flashrom_layout *layout;
- struct single_layout fallback_layout;
+ struct flashrom_layout *default_layout;
struct {
bool force;
bool force_boardmismatch;
diff --git a/flashrom.c b/flashrom.c
index e355731..3436a59 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -1331,15 +1331,12 @@
if (!flash->chip)
return -1;
- /* Fill fallback layout covering the whole chip. */
- struct single_layout *const fallback = &flash->fallback_layout;
- fallback->base.entries = &fallback->entry;
- fallback->base.max_entries = 1;
- fallback->base.num_entries = 0;
- if (flashrom_layout_add_region(&fallback->base,
+ /* Fill default layout covering the whole chip. */
+ if (flashrom_layout_empty(&flash->default_layout, 1) ||
+ flashrom_layout_add_region(flash->default_layout,
0, flash->chip->total_size * 1024 - 1, "complete flash") ||
- flashrom_layout_include_region(&fallback->base, "complete flash"))
- return -1;
+ flashrom_layout_include_region(flash->default_layout, "complete flash"))
+ return -1;
tmp = flashbuses_to_text(flash->chip->bustype);
msg_cinfo("%s %s flash chip \"%s\" (%d kB, %s) ", force ? "Assuming" : "Found",
diff --git a/ich_descriptors.c b/ich_descriptors.c
index b2c5d4c..8383801 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -1156,7 +1156,9 @@
* 1 if the descriptor couldn't be parsed,
* 2 when out of memory.
*/
-int layout_from_ich_descriptors(struct ich_layout *const layout, const void *const dump, const size_t len)
+int layout_from_ich_descriptors(
+ struct flashrom_layout **const layout,
+ const void *const dump, const size_t len)
{
static const char *const regions[] = {
"fd", "bios", "me", "gbe", "pd", "reg5", "bios2", "reg7", "ec", "reg9", "ie",
@@ -1168,10 +1170,8 @@
if (read_ich_descriptors_from_dump(dump, len, &cs, &desc))
return 1;
- memset(layout, 0x00, sizeof(*layout));
- layout->base.entries = layout->entries;
- layout->base.max_entries = ARRAY_SIZE(layout->entries);
- layout->base.num_entries = 0;
+ if (flashrom_layout_empty(layout, ARRAY_SIZE(regions)))
+ return 2;
ssize_t i;
for (i = 0; i < min(ich_number_of_regions(cs, &desc.content), ARRAY_SIZE(regions)); ++i) {
@@ -1179,8 +1179,11 @@
const chipoff_t limit = ICH_FREG_LIMIT(desc.region.FLREGs[i]);
if (limit <= base)
continue;
- if (flashrom_layout_add_region(&layout->base, base, limit, regions[i]))
+ if (flashrom_layout_add_region(*layout, base, limit, regions[i])) {
+ flashrom_layout_release(*layout);
+ *layout = NULL;
return 2;
+ }
}
return 0;
}
diff --git a/ich_descriptors.h b/ich_descriptors.h
index 4225286..498af21 100644
--- a/ich_descriptors.h
+++ b/ich_descriptors.h
@@ -562,11 +562,6 @@
struct ich_desc_upper_map upper;
};
-struct ich_layout {
- struct flashrom_layout base;
- struct romentry entries[MAX_NUM_FLREGS];
-};
-
ssize_t ich_number_of_regions(enum ich_chipset cs, const struct ich_desc_content *content);
ssize_t ich_number_of_masters(enum ich_chipset cs, const struct ich_desc_content *content);
@@ -585,6 +580,6 @@
int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc);
int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx);
-int layout_from_ich_descriptors(struct ich_layout *, const void *dump, size_t len);
+int layout_from_ich_descriptors(struct flashrom_layout **, const void *dump, size_t len);
#endif /* __ICH_DESCRIPTORS_H__ */
diff --git a/layout.c b/layout.c
index 0978a67..8198f17 100644
--- a/layout.c
+++ b/layout.c
@@ -37,7 +37,7 @@
if (flashctx->layout && flashctx->layout->num_entries)
return flashctx->layout;
else
- return &flashctx->fallback_layout.base;
+ return flashctx->default_layout;
}
#ifndef __LIBPAYLOAD__
@@ -270,6 +270,29 @@
*/
/**
+ * @brief Create a new, empty layout.
+ *
+ * @param layout Pointer to returned layout reference.
+ * @param count Number of layout entries to allocate.
+ *
+ * @return 0 on success,
+ * 1 if out of memory.
+ */
+int flashrom_layout_empty(struct flashrom_layout **const layout, const unsigned int count)
+{
+ *layout = malloc(sizeof(**layout) + count * sizeof(struct romentry));
+ if (!*layout) {
+ msg_gerr("Error creating layout: %s\n", strerror(errno));
+ return 1;
+ }
+
+ (*layout)->entries = (void *)((char *)*layout + sizeof(**layout));
+ (*layout)->max_entries = count;
+ (*layout)->num_entries = 0;
+ return 0;
+}
+
+/**
* @brief Add another region to an existing layout.
*
* @param layout The existing layout.
diff --git a/libflashrom.c b/libflashrom.c
index aa43e65..d891944 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -205,13 +205,14 @@
ret = 0;
/* We found one chip, now check that there is no second match. */
if (probe_flash(®istered_masters[i], flash_idx + 1, &second_flashctx, 0) != -1) {
+ flashrom_layout_release(second_flashctx.default_layout);
ret = 3;
break;
}
}
}
if (ret) {
- free(*flashctx);
+ flashrom_flash_release(*flashctx);
*flashctx = NULL;
}
return ret;
@@ -235,6 +236,7 @@
*/
void flashrom_flash_release(struct flashrom_flashctx *const flashctx)
{
+ flashrom_layout_release(flashctx->default_layout);
free(flashctx);
}
@@ -310,16 +312,10 @@
#ifndef __FLASHROM_LITTLE_ENDIAN__
return 6;
#else
- struct ich_layout dump_layout;
+ struct flashrom_layout *dump_layout, *chip_layout;
int ret = 1;
void *const desc = malloc(0x1000);
- struct ich_layout *const chip_layout = malloc(sizeof(*chip_layout));
- if (!desc || !chip_layout) {
- msg_gerr("Out of memory!\n");
- goto _free_ret;
- }
-
if (prepare_flash_access(flashctx, true, false, false, false))
goto _free_ret;
@@ -332,7 +328,7 @@
}
msg_cinfo("done.\n");
- if (layout_from_ich_descriptors(chip_layout, desc, 0x1000)) {
+ if (layout_from_ich_descriptors(&chip_layout, desc, 0x1000)) {
msg_cerr("Couldn't parse the descriptor!\n");
ret = 3;
goto _finalize_ret;
@@ -345,11 +341,11 @@
goto _finalize_ret;
}
- const struct romentry *chip_entry = layout_next(&chip_layout->base, NULL);
- const struct romentry *dump_entry = layout_next(&dump_layout.base, NULL);
+ const struct romentry *chip_entry = layout_next(chip_layout, NULL);
+ const struct romentry *dump_entry = layout_next(dump_layout, NULL);
while (chip_entry && dump_entry && !memcmp(chip_entry, dump_entry, sizeof(*chip_entry))) {
- chip_entry = layout_next(&chip_layout->base, chip_entry);
- dump_entry = layout_next(&dump_layout.base, dump_entry);
+ chip_entry = layout_next(chip_layout, chip_entry);
+ dump_entry = layout_next(dump_layout, dump_entry);
}
if (chip_entry || dump_entry) {
msg_cerr("Descriptors don't match!\n");
@@ -365,7 +361,7 @@
finalize_flash_access(flashctx);
_free_ret:
if (ret)
- free(chip_layout);
+ flashrom_layout_release(chip_layout);
free(desc);
return ret;
#endif
diff --git a/libflashrom.h b/libflashrom.h
index 2b84bd4..90f3e2c 100644
--- a/libflashrom.h
+++ b/libflashrom.h
@@ -62,6 +62,7 @@
int flashrom_image_verify(struct flashrom_flashctx *, const void *buffer, size_t buffer_len);
struct flashrom_layout;
+int flashrom_layout_empty(struct flashrom_layout **layout, unsigned int count);
int flashrom_layout_read_from_ifd(struct flashrom_layout **, struct flashrom_flashctx *, const void *dump, size_t len);
int flashrom_layout_read_fmap_from_rom(struct flashrom_layout **,
struct flashrom_flashctx *, off_t offset, size_t length);
--
To view, visit https://review.coreboot.org/c/flashrom/+/33543
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2ae7246493ff592e631cce924777925c7825e398
Gerrit-Change-Number: 33543
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: David Hendricks <david.hendricks(a)gmail.com>
Gerrit-Reviewer: Thomas Heijligen <src(a)posteo.de>
Gerrit-MessageType: newchange
5
26
Change in flashrom[master]: build system: Replace Makefile with a call to use meson
by Patrick Georgi (Code Review) June 4, 2021
by Patrick Georgi (Code Review) June 4, 2021
June 4, 2021
Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/46875 )
Change subject: build system: Replace Makefile with a call to use meson
......................................................................
build system: Replace Makefile with a call to use meson
Change-Id: Ice42ab92a36c54f8f446f58dd73f628994f179d6
Signed-off-by: Patrick Georgi <pgeorgi(a)google.com>
---
M Makefile
1 file changed, 1 insertion(+), 1,723 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/75/46875/1
diff --git a/Makefile b/Makefile
index 241814a..40bbe35 100644
--- a/Makefile
+++ b/Makefile
@@ -1,1723 +1 @@
-#
-# This file is part of the flashrom project.
-#
-# Copyright (C) 2005 coresystems GmbH <stepan(a)coresystems.de>
-# Copyright (C) 2009,2010,2012 Carl-Daniel Hailfinger
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-
-PROGRAM = flashrom
-
-###############################################################################
-# Defaults for the toolchain.
-
-# If you want to cross-compile, just run e.g.
-# make CC=i586-pc-msdosdjgpp-gcc
-# You may have to specify STRIP/AR/RANLIB as well.
-#
-# Note for anyone editing this Makefile: gnumake will happily ignore any
-# changes in this Makefile to variables set on the command line.
-STRIP ?= strip
-INSTALL = install
-DIFF = diff
-PREFIX ?= /usr/local
-MANDIR ?= $(PREFIX)/share/man
-CFLAGS ?= -Os -Wall -Wextra -Wno-unused-parameter -Wshadow -Wmissing-prototypes -Wwrite-strings
-EXPORTDIR ?= .
-RANLIB ?= ranlib
-PKG_CONFIG ?= pkg-config
-BUILD_DETAILS_FILE ?= build_details.txt
-
-# The following parameter changes the default programmer that will be used if there is no -p/--programmer
-# argument given when running flashrom. The predefined setting does not enable any default so that every
-# user has to declare the programmer he wants to use on every run. The rationale for this to be not set
-# (to e.g. the internal programmer) is that forgetting to specify this when working with another programmer
-# easily puts the system attached to the default programmer at risk (e.g. you want to flash coreboot to another
-# system attached to an external programmer while the default programmer is set to the internal programmer, and
-# you forget to use the -p parameter. This would (try to) overwrite the existing firmware of the computer
-# running flashrom). Please do not enable this without thinking about the possible consequences. Possible
-# values are those specified in enum programmer in programmer.h (which depend on other CONFIG_* options
-# evaluated below, namely those that enable/disable the various programmers).
-# Compilation will fail for unspecified values.
-CONFIG_DEFAULT_PROGRAMMER ?= PROGRAMMER_INVALID
-# The following adds a default parameter for the default programmer set above (only).
-CONFIG_DEFAULT_PROGRAMMER_ARGS ?= ''
-# Example: compiling with
-# make CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_SERPROG CONFIG_DEFAULT_PROGRAMMER_ARGS="dev=/dev/ttyUSB0:1500000"
-# would make executing './flashrom' (almost) equivialent to './flashrom -p serprog:dev=/dev/ttyUSB0:1500000'.
-
-# If your compiler spits out excessive warnings, run make WARNERROR=no
-# You shouldn't have to change this flag.
-WARNERROR ?= yes
-
-ifeq ($(WARNERROR), yes)
-CFLAGS += -Werror
-endif
-
-ifdef LIBS_BASE
-PKG_CONFIG_LIBDIR ?= $(LIBS_BASE)/lib/pkgconfig
-override CPPFLAGS += -I$(LIBS_BASE)/include
-override LDFLAGS += -L$(LIBS_BASE)/lib -Wl,-rpath -Wl,$(LIBS_BASE)/lib
-endif
-
-ifeq ($(CONFIG_STATIC),yes)
-override PKG_CONFIG += --static
-override LDFLAGS += -static
-endif
-
-# Set LC_ALL=C to minimize influences of the locale.
-# However, this won't work for the majority of relevant commands because they use the $(shell) function and
-# GNU make does not relay variables exported within the makefile to their evironment.
-LC_ALL=C
-export LC_ALL
-
-dummy_for_make_3_80:=$(shell printf "Build started on %s\n\n" "$$(date)" >$(BUILD_DETAILS_FILE))
-
-# Provide an easy way to execute a command, print its output to stdout and capture any error message on stderr
-# in the build details file together with the original stdout output.
-debug_shell = $(shell export LC_ALL=C ; { echo 'exec: export LC_ALL=C ; { $(subst ','\'',$(1)) ; }' >&2; \
- { $(1) ; } | tee -a $(BUILD_DETAILS_FILE) ; echo >&2 ; } 2>>$(BUILD_DETAILS_FILE))
-
-###############################################################################
-# General OS-specific settings.
-# 1. Prepare for later by gathering information about host and target OS
-# 2. Set compiler flags and parameters according to OSes
-# 3. Likewise verify user-supplied CONFIG_* variables.
-
-# HOST_OS is only used to work around local toolchain issues.
-HOST_OS ?= $(shell uname)
-ifeq ($(findstring MINGW, $(HOST_OS)), MINGW)
-# Explicitly set CC = gcc on MinGW, otherwise: "cc: command not found".
-CC = gcc
-endif
-
-ifneq ($(HOST_OS), SunOS)
-STRIP_ARGS = -s
-endif
-
-# Determine the destination OS.
-# IMPORTANT: The following line must be placed before TARGET_OS is ever used
-# (of course), but should come after any lines setting CC because the line
-# below uses CC itself.
-override TARGET_OS := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E os.h 2>/dev/null \
- | tail -1 | cut -f 2 -d'"'))
-
-ifeq ($(TARGET_OS), Darwin)
-override CPPFLAGS += -I/opt/local/include -I/usr/local/include
-override LDFLAGS += -L/opt/local/lib -L/usr/local/lib
-endif
-
-ifeq ($(TARGET_OS), FreeBSD)
-override CPPFLAGS += -I/usr/local/include
-override LDFLAGS += -L/usr/local/lib
-endif
-
-ifeq ($(TARGET_OS), OpenBSD)
-override CPPFLAGS += -I/usr/local/include
-override LDFLAGS += -L/usr/local/lib
-endif
-
-ifeq ($(TARGET_OS), NetBSD)
-override CPPFLAGS += -I/usr/pkg/include
-override LDFLAGS += -L/usr/pkg/lib
-endif
-
-ifeq ($(TARGET_OS), DragonFlyBSD)
-override CPPFLAGS += -I/usr/local/include
-override LDFLAGS += -L/usr/local/lib
-endif
-
-ifeq ($(TARGET_OS), DOS)
-EXEC_SUFFIX := .exe
-# DJGPP has odd uint*_t definitions which cause lots of format string warnings.
-override CFLAGS += -Wno-format
-LIBS += -lgetopt
-# Bus Pirate, Serprog and PonyProg are not supported under DOS (missing serial support).
-ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
-else
-override CONFIG_BUSPIRATE_SPI = no
-endif
-ifeq ($(CONFIG_SERPROG), yes)
-UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
-else
-override CONFIG_SERPROG = no
-endif
-ifeq ($(CONFIG_PONY_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes
-else
-override CONFIG_PONY_SPI = no
-endif
-# Digilent SPI, Dediprog, Developerbox, USB-Blaster, PICkit2, CH341A and FT2232 are not supported under DOS (missing USB support).
-ifeq ($(CONFIG_DIGILENT_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_DIGILENT_SPI=yes
-else
-override CONFIG_DIGILENT_SPI = no
-endif
-ifeq ($(CONFIG_DEDIPROG), yes)
-UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
-else
-override CONFIG_DEDIPROG = no
-endif
-ifeq ($(CONFIG_DEVELOPERBOX_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_DEVELOPERBOX_SPI=yes
-else
-override CONFIG_DEVELOPERBOX_SPI = no
-endif
-ifeq ($(CONFIG_ENE_LPC), yes)
-UNSUPPORTED_FEATURES += CONFIG_ENE_LPC=yes
-else
-override CONFIG_ENE_LPC = no
-endif
-ifeq ($(CONFIG_FT2232_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
-else
-override CONFIG_FT2232_SPI = no
-endif
-ifeq ($(CONFIG_MEC1308), yes)
-UNSUPPORTED_FEATURES += CONFIG_MEC1308=yes
-else
-override CONFIG_MEC1308 = no
-endif
-ifeq ($(CONFIG_USBBLASTER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes
-else
-override CONFIG_USBBLASTER_SPI = no
-endif
-ifeq ($(CONFIG_PICKIT2_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_PICKIT2_SPI=yes
-else
-override CONFIG_PICKIT2_SPI = no
-endif
-ifeq ($(CONFIG_CH341A_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_CH341A_SPI=yes
-else
-override CONFIG_CH341A_SPI = no
-endif
-ifeq ($(CONFIG_STLINKV3_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_STLINKV3_SPI=yes
-else
-override CONFIG_STLINKV3_SPI = no
-endif
-ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
-else
-override CONFIG_LSPCON_I2C_SPI = no
-endif
-ifeq ($(CONFIG_REALTEK_MST_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_REALTEK_MST_I2C_SPI=yes
-else
-override CONFIG_REALTEK_MST_I2C_SPI = no
-endif
-# libjaylink is also not available for DOS
-ifeq ($(CONFIG_JLINK_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_JLINK_SPI=yes
-else
-override CONFIG_JLINK_SPI = no
-endif
-endif
-
-# FIXME: Should we check for Cygwin/MSVC as well?
-ifeq ($(TARGET_OS), MinGW)
-EXEC_SUFFIX := .exe
-# MinGW doesn't have the ffs() function, but we can use gcc's __builtin_ffs().
-FLASHROM_CFLAGS += -Dffs=__builtin_ffs
-# Some functions provided by Microsoft do not work as described in C99 specifications. This macro fixes that
-# for MinGW. See http://sourceforge.net/p/mingw-w64/wiki2/printf%20and%20scanf%20family/ */
-FLASHROM_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
-
-# National Instruments USB-845x is Windows only for now
-CONFIG_NI845X_SPI ?= no
-
-# For now we disable all PCI-based programmers on Windows/MinGW (no libpci).
-ifeq ($(CONFIG_INTERNAL), yes)
-UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
-else
-override CONFIG_INTERNAL = no
-endif
-ifeq ($(CONFIG_RAYER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
-else
-override CONFIG_RAYER_SPI = no
-endif
-ifeq ($(CONFIG_RAIDEN), yes)
-UNSUPPORTED_FEATURES += CONFIG_RAIDEN=yes
-else
-override CONFIG_RAIDEN = no
-endif
-ifeq ($(CONFIG_NIC3COM), yes)
-UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
-else
-override CONFIG_NIC3COM = no
-endif
-ifeq ($(CONFIG_GFXNVIDIA), yes)
-UNSUPPORTED_FEATURES += CONFIG_GFXNVIDIA=yes
-else
-override CONFIG_GFXNVIDIA = no
-endif
-ifeq ($(CONFIG_SATASII), yes)
-UNSUPPORTED_FEATURES += CONFIG_SATASII=yes
-else
-override CONFIG_SATASII = no
-endif
-ifeq ($(CONFIG_ATAHPT), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
-else
-override CONFIG_ATAHPT = no
-endif
-ifeq ($(CONFIG_ATAVIA), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAVIA=yes
-else
-override CONFIG_ATAVIA = no
-endif
-ifeq ($(CONFIG_ATAPROMISE), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAPROMISE=yes
-else
-override CONFIG_ATAPROMISE = no
-endif
-ifeq ($(CONFIG_ENE_LPC), yes)
-UNSUPPORTED_FEATURES += CONFIG_ENE_LPC=yes
-else
-override CONFIG_ENE_LPC = no
-endif
-ifeq ($(CONFIG_IT8212), yes)
-UNSUPPORTED_FEATURES += CONFIG_IT8212=yes
-else
-override CONFIG_IT8212 = no
-endif
-ifeq ($(CONFIG_DRKAISER), yes)
-UNSUPPORTED_FEATURES += CONFIG_DRKAISER=yes
-else
-override CONFIG_DRKAISER = no
-endif
-ifeq ($(CONFIG_MEC1308), yes)
-UNSUPPORTED_FEATURES += CONFIG_MEC1308=yes
-else
-override CONFIG_MEC1308 = no
-endif
-ifeq ($(CONFIG_NICREALTEK), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
-else
-override CONFIG_NICREALTEK = no
-endif
-ifeq ($(CONFIG_NICNATSEMI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
-else
-override CONFIG_NICNATSEMI = no
-endif
-ifeq ($(CONFIG_NICINTEL), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL=yes
-else
-override CONFIG_NICINTEL = no
-endif
-ifeq ($(CONFIG_NICINTEL_EEPROM), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL_EEPROM=yes
-else
-override CONFIG_NICINTEL_EEPROM = no
-endif
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL_SPI=yes
-else
-override CONFIG_NICINTEL_SPI = no
-endif
-ifeq ($(CONFIG_OGP_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_OGP_SPI=yes
-else
-override CONFIG_OGP_SPI = no
-endif
-ifeq ($(CONFIG_SATAMV), yes)
-UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
-else
-override CONFIG_SATAMV = no
-endif
-ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
-else
-override CONFIG_LSPCON_I2C_SPI = no
-endif
-ifeq ($(CONFIG_REALTEK_MST_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_REALTEK_MST_I2C_SPI=yes
-else
-override CONFIG_REALTEK_MST_I2C_SPI = no
-endif
-endif
-
-ifneq ($(TARGET_OS), MinGW)
-# NI USB-845x only supported on Windows at the moment
-ifeq ($(CONFIG_NI845X_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NI845X_SPI=yes
-else
-override CONFIG_NI845X_SPI = no
-endif
-endif
-
-ifeq ($(TARGET_OS), libpayload)
-ifeq ($(MAKECMDGOALS),)
-.DEFAULT_GOAL := libflashrom.a
-$(info Setting default goal to libflashrom.a)
-endif
-FLASHROM_CFLAGS += -DSTANDALONE
-ifeq ($(CONFIG_DUMMY), yes)
-UNSUPPORTED_FEATURES += CONFIG_DUMMY=yes
-else
-override CONFIG_DUMMY = no
-endif
-# libpayload does not provide the romsize field in struct pci_dev that the atapromise code requires.
-ifeq ($(CONFIG_ATAPROMISE), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAPROMISE=yes
-else
-override CONFIG_ATAPROMISE = no
-endif
-# Bus Pirate, Serprog and PonyProg are not supported with libpayload (missing serial support).
-ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
-else
-override CONFIG_BUSPIRATE_SPI = no
-endif
-ifeq ($(CONFIG_SERPROG), yes)
-UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
-else
-override CONFIG_SERPROG = no
-endif
-ifeq ($(CONFIG_PONY_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_PONY_SPI=yes
-else
-override CONFIG_PONY_SPI = no
-endif
-# Dediprog, Developerbox, USB-Blaster, PICkit2, CH341A and FT2232 are not supported with libpayload (missing libusb support).
-ifeq ($(CONFIG_DEDIPROG), yes)
-UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
-else
-override CONFIG_DEDIPROG = no
-endif
-ifeq ($(CONFIG_DEVELOPERBOX_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_DEVELOPERBOX_SPI=yes
-else
-override CONFIG_DEVELOPERBOX_SPI = no
-endif
-ifeq ($(CONFIG_ENE_LPC), yes)
-UNSUPPORTED_FEATURES += CONFIG_ENE_LPC=yes
-else
-override CONFIG_ENE_LPC = no
-endif
-ifeq ($(CONFIG_FT2232_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
-else
-override CONFIG_FT2232_SPI = no
-endif
-ifeq ($(CONFIG_MEC1308), yes)
-UNSUPPORTED_FEATURES += CONFIG_MEC1308=yes
-else
-override CONFIG_MEC1308 = no
-endif
-ifeq ($(CONFIG_USBBLASTER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_USBBLASTER_SPI=yes
-else
-override CONFIG_USBBLASTER_SPI = no
-endif
-ifeq ($(CONFIG_PICKIT2_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_PICKIT2_SPI=yes
-else
-override CONFIG_PICKIT2_SPI = no
-endif
-ifeq ($(CONFIG_STLINKV3_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_STLINKV3_SPI=yes
-else
-override CONFIG_STLINKV3_SPI = no
-endif
-ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_LSPCON_I2C_SPI=yes
-else
-override CONFIG_LSPCON_I2C_SPI = no
-endif
-ifeq ($(CONFIG_REALTEK_MST_I2C_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_REALTEK_MST_I2C_SPI=yes
-else
-override CONFIG_REALTEK_MST_I2C_SPI = no
-endif
-ifeq ($(CONFIG_CH341A_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_CH341A_SPI=yes
-else
-override CONFIG_CH341A_SPI = no
-endif
-endif
-
-ifneq ($(TARGET_OS), Linux)
-# Android is handled internally as separate OS, but it supports CONFIG_LINUX_SPI and CONFIG_MSTARDDC_SPI
-ifneq ($(TARGET_OS), Android)
-ifeq ($(CONFIG_LINUX_MTD), yes)
-UNSUPPORTED_FEATURES += CONFIG_LINUX_MTD=yes
-else
-override CONFIG_LINUX_MTD = no
-endif
-ifeq ($(CONFIG_LINUX_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_LINUX_SPI=yes
-else
-override CONFIG_LINUX_SPI = no
-endif
-ifeq ($(CONFIG_MSTARDDC_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_MSTARDDC_SPI=yes
-else
-override CONFIG_MSTARDDC_SPI = no
-endif
-endif
-endif
-
-ifeq ($(TARGET_OS), Android)
-# Android on x86 (currently) does not provide raw PCI port I/O operations
-ifeq ($(CONFIG_RAYER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
-else
-override CONFIG_RAYER_SPI = no
-endif
-endif
-
-ifeq ($(TARGET_OS), Linux)
-CONFIG_LINUX_I2C_HELPER = yes
-endif
-
-###############################################################################
-# General architecture-specific settings.
-# Like above for the OS, below we verify user-supplied options depending on the target architecture.
-
-# Determine the destination processor architecture.
-# IMPORTANT: The following line must be placed before ARCH is ever used
-# (of course), but should come after any lines setting CC because the line
-# below uses CC itself.
-override ARCH := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E archtest.c 2>/dev/null \
- | tail -1 | cut -f 2 -d'"'))
-override ENDIAN := $(strip $(call debug_shell,$(CC) $(CPPFLAGS) -E endiantest.c 2>/dev/null \
- | tail -1))
-
-# Disable the internal programmer on unsupported architectures (everything but x86 and mipsel)
-ifneq ($(ARCH)-little, $(filter $(ARCH),x86 mips)-$(ENDIAN))
-ifeq ($(CONFIG_INTERNAL), yes)
-UNSUPPORTED_FEATURES += CONFIG_INTERNAL=yes
-else
-override CONFIG_INTERNAL = no
-endif
-endif
-
-# PCI port I/O support is unimplemented on PPC/MIPS/SPARC and unavailable on ARM.
-# Right now this means the drivers below only work on x86.
-ifneq ($(ARCH), x86)
-ifeq ($(CONFIG_NIC3COM), yes)
-UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
-else
-override CONFIG_NIC3COM = no
-endif
-ifeq ($(CONFIG_NICREALTEK), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
-else
-override CONFIG_NICREALTEK = no
-endif
-ifeq ($(CONFIG_NICNATSEMI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
-else
-override CONFIG_NICNATSEMI = no
-endif
-ifeq ($(CONFIG_RAYER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
-else
-override CONFIG_RAYER_SPI = no
-endif
-ifeq ($(CONFIG_ATAHPT), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
-else
-override CONFIG_ATAHPT = no
-endif
-ifeq ($(CONFIG_ATAPROMISE), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAPROMISE=yes
-else
-override CONFIG_ATAPROMISE = no
-endif
-ifeq ($(CONFIG_SATAMV), yes)
-UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
-else
-override CONFIG_SATAMV = no
-endif
-endif
-
-# Disable all drivers needing raw access (memory, PCI, port I/O) on
-# architectures with unknown raw access properties.
-# Right now those architectures are alpha hppa m68k sh s390
-ifneq ($(ARCH),$(filter $(ARCH),x86 mips ppc arm sparc arc))
-ifeq ($(CONFIG_RAYER_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
-else
-override CONFIG_RAYER_SPI = no
-endif
-ifeq ($(CONFIG_NIC3COM), yes)
-UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
-else
-override CONFIG_NIC3COM = no
-endif
-ifeq ($(CONFIG_GFXNVIDIA), yes)
-UNSUPPORTED_FEATURES += CONFIG_GFXNVIDIA=yes
-else
-override CONFIG_GFXNVIDIA = no
-endif
-ifeq ($(CONFIG_SATASII), yes)
-UNSUPPORTED_FEATURES += CONFIG_SATASII=yes
-else
-override CONFIG_SATASII = no
-endif
-ifeq ($(CONFIG_ATAHPT), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
-else
-override CONFIG_ATAHPT = no
-endif
-ifeq ($(CONFIG_ATAVIA), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAVIA=yes
-else
-override CONFIG_ATAVIA = no
-endif
-ifeq ($(CONFIG_ATAPROMISE), yes)
-UNSUPPORTED_FEATURES += CONFIG_ATAPROMISE=yes
-else
-override CONFIG_ATAPROMISE = no
-endif
-ifeq ($(CONFIG_DRKAISER), yes)
-UNSUPPORTED_FEATURES += CONFIG_DRKAISER=yes
-else
-override CONFIG_DRKAISER = no
-endif
-ifeq ($(CONFIG_NICREALTEK), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICREALTEK=yes
-else
-override CONFIG_NICREALTEK = no
-endif
-ifeq ($(CONFIG_NICNATSEMI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICNATSEMI=yes
-else
-override CONFIG_NICNATSEMI = no
-endif
-ifeq ($(CONFIG_NICINTEL), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL=yes
-else
-override CONFIG_NICINTEL = no
-endif
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL_SPI=yes
-else
-override CONFIG_NICINTEL_SPI = no
-endif
-ifeq ($(CONFIG_NICINTEL_EEPROM), yes)
-UNSUPPORTED_FEATURES += CONFIG_NICINTEL_EEPROM=yes
-else
-override CONFIG_NICINTEL_EEPROM = no
-endif
-ifeq ($(CONFIG_OGP_SPI), yes)
-UNSUPPORTED_FEATURES += CONFIG_OGP_SPI=yes
-else
-override CONFIG_OGP_SPI = no
-endif
-ifeq ($(CONFIG_SATAMV), yes)
-UNSUPPORTED_FEATURES += CONFIG_SATAMV=yes
-else
-override CONFIG_SATAMV = no
-endif
-ifeq ($(CONFIG_IT8212), yes)
-UNSUPPORTED_FEATURES += CONFIG_IT8212=yes
-else
-override CONFIG_IT8212 = no
-endif
-endif
-
-###############################################################################
-# Flash chip drivers and bus support infrastructure.
-
-CHIP_OBJS = jedec.o stm50.o w39.o w29ee011.o \
- sst28sf040.o 82802ab.o \
- sst49lfxxxc.o sst_fwhub.o edi.o flashchips.o spi.o spi25.o spi25_statusreg.o \
- spi95.o opaque.o sfdp.o en29lv640b.o at45db.o writeprotect.o
-
-###############################################################################
-# Library code.
-
-LIB_OBJS = libflashrom.o layout.o flashrom.o udelay.o programmer.o helpers.o ich_descriptors.o fmap.o
-
-###############################################################################
-# Frontend related stuff.
-
-CLI_OBJS = cli_classic.o cli_output.o cli_common.o print.o
-
-# versioninfo.inc stores metadata required to build a packaged flashrom. It is generated by the export rule and
-# imported below. If versioninfo.inc is not found and the variables are not defined by the user, the info will
-# be obtained using util/getrevision.sh, which is the common case during development.
--include versioninfo.inc
-VERSION ?= $(shell ./util/getrevision.sh --revision)
-MAN_DATE ?= $(shell ./util/getrevision.sh --date $(PROGRAM).8.tmpl 2>/dev/null)
-
-SCMDEF := -D'FLASHROM_VERSION="$(VERSION)"'
-
-# No spaces in release names unless set explicitly
-RELEASENAME ?= $(shell echo "$(VERSION)" | sed -e 's/ /_/')
-
-# Inform user of the version string
-$(info Replacing all version templates with $(VERSION).)
-
-# If a VCS is found then try to install hooks.
-$(shell ./util/getrevision.sh -c 2>/dev/null && ./util/git-hooks/install.sh)
-
-###############################################################################
-# Default settings of CONFIG_* variables.
-
-# Always enable internal/onboard support for now.
-CONFIG_INTERNAL ?= yes
-
-# Always enable serprog for now.
-CONFIG_SERPROG ?= yes
-
-# RayeR SPIPGM hardware support
-CONFIG_RAYER_SPI ?= yes
-
-# ChromiumOS servo DUT debug board hardware support
-CONFIG_RAIDEN ?= yes
-
-# PonyProg2000 SPI hardware support
-CONFIG_PONY_SPI ?= yes
-
-# Always enable 3Com NICs for now.
-CONFIG_NIC3COM ?= yes
-
-# Enable NVIDIA graphics cards. Note: write and erase do not work properly.
-CONFIG_GFXNVIDIA ?= yes
-
-# Always enable SiI SATA controllers for now.
-CONFIG_SATASII ?= yes
-
-# Highpoint (HPT) ATA/RAID controller support.
-# IMPORTANT: This code is not yet working!
-CONFIG_ATAHPT ?= no
-
-# VIA VT6421A LPC memory support
-CONFIG_ATAVIA ?= yes
-
-# Promise ATA controller support.
-CONFIG_ATAPROMISE ?= no
-
-# ENE LPC interface keyboard controller
-CONFIG_ENE_LPC ?= yes
-
-# Always enable FT2232 SPI dongles for now.
-CONFIG_FT2232_SPI ?= yes
-
-# Microchip MEC1308 Embedded Controller
-CONFIG_MEC1308 ?= yes
-
-# Always enable Altera USB-Blaster dongles for now.
-CONFIG_USBBLASTER_SPI ?= yes
-
-# MSTAR DDC support needs more tests/reviews/cleanups.
-CONFIG_MSTARDDC_SPI ?= no
-
-# Always enable PICkit2 SPI dongles for now.
-CONFIG_PICKIT2_SPI ?= yes
-
-# Always enable STLink V3
-CONFIG_STLINKV3_SPI ?= yes
-
-# Disables LSPCON support until the i2c helper supports multiple systems.
-CONFIG_LSPCON_I2C_SPI ?= no
-
-# Disables REALTEK_MST support until the i2c helper supports multiple systems.
-CONFIG_REALTEK_MST_I2C_SPI ?= no
-
-# Always enable dummy tracing for now.
-CONFIG_DUMMY ?= yes
-
-# Always enable Dr. Kaiser for now.
-CONFIG_DRKAISER ?= yes
-
-# Always enable Realtek NICs for now.
-CONFIG_NICREALTEK ?= yes
-
-# Disable National Semiconductor NICs until support is complete and tested.
-CONFIG_NICNATSEMI ?= no
-
-# Always enable Intel NICs for now.
-CONFIG_NICINTEL ?= yes
-
-# Always enable SPI on Intel NICs for now.
-CONFIG_NICINTEL_SPI ?= yes
-
-# Always enable EEPROM on Intel NICs for now.
-CONFIG_NICINTEL_EEPROM ?= yes
-
-# Always enable SPI on OGP cards for now.
-CONFIG_OGP_SPI ?= yes
-
-# Always enable Bus Pirate SPI for now.
-CONFIG_BUSPIRATE_SPI ?= yes
-
-# Always enable Dediprog SF100 for now.
-CONFIG_DEDIPROG ?= yes
-
-# Always enable Developerbox emergency recovery for now.
-CONFIG_DEVELOPERBOX_SPI ?= yes
-
-# Always enable Marvell SATA controllers for now.
-CONFIG_SATAMV ?= yes
-
-# Enable Linux spidev and MTD interfaces by default. We disable them on non-Linux targets.
-CONFIG_LINUX_MTD ?= yes
-CONFIG_LINUX_SPI ?= yes
-
-# Always enable ITE IT8212F PATA controllers for now.
-CONFIG_IT8212 ?= yes
-
-# Winchiphead CH341A
-CONFIG_CH341A_SPI ?= yes
-
-# Digilent Development board JTAG
-CONFIG_DIGILENT_SPI ?= yes
-
-# Disable J-Link for now.
-CONFIG_JLINK_SPI ?= no
-
-# Disable wiki printing by default. It is only useful if you have wiki access.
-CONFIG_PRINT_WIKI ?= no
-
-# Disable all features if CONFIG_NOTHING=yes is given unless CONFIG_EVERYTHING was also set
-ifeq ($(CONFIG_NOTHING), yes)
- ifeq ($(CONFIG_EVERYTHING), yes)
- $(error Setting CONFIG_NOTHING=yes and CONFIG_EVERYTHING=yes does not make sense)
- endif
- $(foreach var, $(filter CONFIG_%, $(.VARIABLES)),\
- $(if $(filter yes, $($(var))),\
- $(eval $(var)=no)))
-endif
-
-# Enable all features if CONFIG_EVERYTHING=yes is given
-ifeq ($(CONFIG_EVERYTHING), yes)
-$(foreach var, $(filter CONFIG_%, $(.VARIABLES)),\
- $(if $(filter no, $($(var))),\
- $(eval $(var)=yes)))
-endif
-
-ifeq ($(CONFIG_ENABLE_LIBUSB1_PROGRAMMERS), no)
-override CONFIG_CH341A_SPI = no
-override CONFIG_DEDIPROG = no
-override CONFIG_DIGILENT_SPI = no
-override CONFIG_DEVELOPERBOX_SPI = no
-override CONFIG_PICKIT2_SPI = no
-override CONFIG_RAIDEN = no
-override CONFIG_STLINKV3_SPI = no
-override CONFIG_LSPCON_I2C_SPI = no
-override CONFIG_REALTEK_MST_I2C_SPI = no
-endif
-ifeq ($(CONFIG_ENABLE_LIBPCI_PROGRAMMERS), no)
-override CONFIG_INTERNAL = no
-override CONFIG_NIC3COM = no
-override CONFIG_GFXNVIDIA = no
-override CONFIG_SATASII = no
-override CONFIG_ATAHPT = no
-override CONFIG_ATAVIA = no
-override CONFIG_ATAPROMISE = no
-override CONFIG_ENE_LPC = no
-override CONFIG_IT8212 = no
-override CONFIG_DRKAISER = no
-override CONFIG_MEC1308 = no
-override CONFIG_NICREALTEK = no
-override CONFIG_NICNATSEMI = no
-override CONFIG_NICINTEL = no
-override CONFIG_NICINTEL_SPI = no
-override CONFIG_NICINTEL_EEPROM = no
-override CONFIG_OGP_SPI = no
-override CONFIG_SATAMV = no
-endif
-
-# Bitbanging SPI infrastructure, default off unless needed.
-ifeq ($(CONFIG_RAYER_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_PONY_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_INTERNAL), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-ifeq ($(CONFIG_OGP_SPI), yes)
-override CONFIG_BITBANG_SPI = yes
-else
-CONFIG_BITBANG_SPI ?= no
-endif
-endif
-endif
-endif
-endif
-
-###############################################################################
-# Handle CONFIG_* variables that depend on others set (and verified) above.
-
-# The external DMI decoder (dmidecode) does not work in libpayload. Bail out if the internal one got disabled.
-ifeq ($(TARGET_OS), libpayload)
-ifeq ($(CONFIG_INTERNAL), yes)
-ifeq ($(CONFIG_INTERNAL_DMI), no)
-UNSUPPORTED_FEATURES += CONFIG_INTERNAL_DMI=no
-else
-override CONFIG_INTERNAL_DMI = yes
-endif
-endif
-endif
-
-# Use internal DMI/SMBIOS decoder by default instead of relying on dmidecode.
-CONFIG_INTERNAL_DMI ?= yes
-
-###############################################################################
-# Programmer drivers and programmer support infrastructure.
-# Depending on the CONFIG_* variables set and verified above we set compiler flags and parameters below.
-
-FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER=$(CONFIG_DEFAULT_PROGRAMMER)'
-FEATURE_CFLAGS += -D'CONFIG_DEFAULT_PROGRAMMER_ARGS="$(CONFIG_DEFAULT_PROGRAMMER_ARGS)"'
-
-ifeq ($(CONFIG_INTERNAL), yes)
-FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1'
-PROGRAMMER_OBJS += processor_enable.o chipset_enable.o board_enable.o cbtable.o internal.o
-ifeq ($(ARCH), x86)
-PROGRAMMER_OBJS += it87spi.o it85spi.o sb600spi.o amd_imc.o wbsio_spi.o mcp6x_spi.o
-PROGRAMMER_OBJS += ichspi.o dmi.o
-ifeq ($(CONFIG_INTERNAL_DMI), yes)
-FEATURE_CFLAGS += -D'CONFIG_INTERNAL_DMI=1'
-endif
-else
-endif
-NEED_LIBPCI += CONFIG_INTERNAL
-endif
-
-ifeq ($(CONFIG_ENE_LPC), yes)
-FEATURE_CFLAGS += -D'CONFIG_ENE_LPC=1'
-PROGRAMMER_OBJS += ene_lpc.o
-NEED_RAW_ACCESS += CONFIG_ENE_LPC
-NEED_LIBPCI += CONFIG_ENE_LPC
-endif
-
-ifeq ($(CONFIG_MEC1308), yes)
-FEATURE_CFLAGS += -D'CONFIG_MEC1308=1'
-PROGRAMMER_OBJS += mec1308.o
-NEED_RAW_ACCESS += CONFIG_MEC1308
-NEED_LIBPCI += CONFIG_MEC1308
-endif
-
-ifeq ($(CONFIG_SERPROG), yes)
-FEATURE_CFLAGS += -D'CONFIG_SERPROG=1'
-PROGRAMMER_OBJS += serprog.o
-NEED_SERIAL += CONFIG_SERPROG
-NEED_POSIX_SOCKETS += CONFIG_SERPROG
-endif
-
-ifeq ($(CONFIG_RAYER_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_RAYER_SPI=1'
-PROGRAMMER_OBJS += rayer_spi.o
-NEED_RAW_ACCESS += CONFIG_RAYER_SPI
-endif
-
-ifeq ($(CONFIG_RAIDEN), yes)
-FEATURE_CFLAGS += -D'CONFIG_RAIDEN=1'
-PROGRAMMER_OBJS += raiden_debug_spi.o
-endif
-
-ifeq ($(CONFIG_PONY_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_PONY_SPI=1'
-PROGRAMMER_OBJS += pony_spi.o
-NEED_SERIAL += CONFIG_PONY_SPI
-endif
-
-ifeq ($(CONFIG_BITBANG_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_BITBANG_SPI=1'
-PROGRAMMER_OBJS += bitbang_spi.o
-endif
-
-ifeq ($(CONFIG_NIC3COM), yes)
-FEATURE_CFLAGS += -D'CONFIG_NIC3COM=1'
-PROGRAMMER_OBJS += nic3com.o
-NEED_LIBPCI += CONFIG_NIC3COM
-endif
-
-ifeq ($(CONFIG_GFXNVIDIA), yes)
-FEATURE_CFLAGS += -D'CONFIG_GFXNVIDIA=1'
-PROGRAMMER_OBJS += gfxnvidia.o
-NEED_LIBPCI += CONFIG_GFXNVIDIA
-endif
-
-ifeq ($(CONFIG_SATASII), yes)
-FEATURE_CFLAGS += -D'CONFIG_SATASII=1'
-PROGRAMMER_OBJS += satasii.o
-NEED_LIBPCI += CONFIG_SATASII
-endif
-
-ifeq ($(CONFIG_ATAHPT), yes)
-FEATURE_CFLAGS += -D'CONFIG_ATAHPT=1'
-PROGRAMMER_OBJS += atahpt.o
-NEED_LIBPCI += CONFIG_ATAHPT
-endif
-
-ifeq ($(CONFIG_ATAVIA), yes)
-FEATURE_CFLAGS += -D'CONFIG_ATAVIA=1'
-PROGRAMMER_OBJS += atavia.o
-NEED_LIBPCI += CONFIG_ATAVIA
-endif
-
-ifeq ($(CONFIG_ATAPROMISE), yes)
-FEATURE_CFLAGS += -D'CONFIG_ATAPROMISE=1'
-PROGRAMMER_OBJS += atapromise.o
-NEED_LIBPCI += CONFIG_ATAPROMISE
-endif
-
-ifeq ($(CONFIG_IT8212), yes)
-FEATURE_CFLAGS += -D'CONFIG_IT8212=1'
-PROGRAMMER_OBJS += it8212.o
-NEED_LIBPCI += CONFIG_IT8212
-endif
-
-ifeq ($(CONFIG_FT2232_SPI), yes)
-# This is a totally ugly hack.
-FEATURE_CFLAGS += $(call debug_shell,grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_FT2232_SPI=1'")
-NEED_LIBFTDI += CONFIG_FT2232_SPI
-PROGRAMMER_OBJS += ft2232_spi.o
-endif
-
-ifeq ($(CONFIG_USBBLASTER_SPI), yes)
-# This is a totally ugly hack.
-FEATURE_CFLAGS += $(call debug_shell,grep -q "FTDISUPPORT := yes" .features && printf "%s" "-D'CONFIG_USBBLASTER_SPI=1'")
-NEED_LIBFTDI += CONFIG_USBBLASTER_SPI
-PROGRAMMER_OBJS += usbblaster_spi.o
-endif
-
-ifeq ($(CONFIG_PICKIT2_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_PICKIT2_SPI=1'
-PROGRAMMER_OBJS += pickit2_spi.o
-NEED_LIBUSB1 += CONFIG_PICKIT2_SPI
-endif
-
-ifeq ($(CONFIG_STLINKV3_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_STLINKV3_SPI=1'
-PROGRAMMER_OBJS += stlinkv3_spi.o
-NEED_LIBUSB1 += CONFIG_STLINKV3_SPI
-endif
-
-ifeq ($(CONFIG_LSPCON_I2C_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_LSPCON_I2C_SPI=1'
-PROGRAMMER_OBJS += lspcon_i2c_spi.o
-endif
-
-ifeq ($(CONFIG_REALTEK_MST_I2C_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_REALTEK_MST_I2C_SPI=1'
-PROGRAMMER_OBJS += realtek_mst_i2c_spi.o
-endif
-
-ifneq ($(NEED_LIBFTDI), )
-FTDILIBS := $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ; $(PKG_CONFIG) --libs libftdi1 || $(PKG_CONFIG) --libs libftdi || printf "%s" "-lftdi -lusb")
-FEATURE_CFLAGS += $(call debug_shell,grep -q "FT232H := yes" .features && printf "%s" "-D'HAVE_FT232H=1'")
-FTDI_INCLUDES := $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)" ; $(PKG_CONFIG) --cflags-only-I libftdi1)
-FEATURE_CFLAGS += $(FTDI_INCLUDES)
-FEATURE_LIBS += $(call debug_shell,grep -q "FTDISUPPORT := yes" .features && printf "%s" "$(FTDILIBS)")
-# We can't set NEED_LIBUSB0 here because that would transform libftdi auto-enabling
-# into a hard requirement for libusb, defeating the purpose of auto-enabling.
-endif
-
-ifeq ($(CONFIG_DUMMY), yes)
-FEATURE_CFLAGS += -D'CONFIG_DUMMY=1'
-PROGRAMMER_OBJS += dummyflasher.o
-endif
-
-ifeq ($(CONFIG_DRKAISER), yes)
-FEATURE_CFLAGS += -D'CONFIG_DRKAISER=1'
-PROGRAMMER_OBJS += drkaiser.o
-NEED_LIBPCI += CONFIG_DRKAISER
-endif
-
-ifeq ($(CONFIG_NICREALTEK), yes)
-FEATURE_CFLAGS += -D'CONFIG_NICREALTEK=1'
-PROGRAMMER_OBJS += nicrealtek.o
-NEED_LIBPCI += CONFIG_NICREALTEK
-endif
-
-ifeq ($(CONFIG_NICNATSEMI), yes)
-FEATURE_CFLAGS += -D'CONFIG_NICNATSEMI=1'
-PROGRAMMER_OBJS += nicnatsemi.o
-NEED_LIBPCI += CONFIG_NICNATSEMI
-endif
-
-ifeq ($(CONFIG_NICINTEL), yes)
-FEATURE_CFLAGS += -D'CONFIG_NICINTEL=1'
-PROGRAMMER_OBJS += nicintel.o
-NEED_LIBPCI += CONFIG_NICINTEL
-endif
-
-ifeq ($(CONFIG_NICINTEL_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_NICINTEL_SPI=1'
-PROGRAMMER_OBJS += nicintel_spi.o
-NEED_LIBPCI += CONFIG_NICINTEL_SPI
-endif
-
-ifeq ($(CONFIG_NICINTEL_EEPROM), yes)
-FEATURE_CFLAGS += -D'CONFIG_NICINTEL_EEPROM=1'
-PROGRAMMER_OBJS += nicintel_eeprom.o
-NEED_LIBPCI += CONFIG_NICINTEL_EEPROM
-endif
-
-ifeq ($(CONFIG_OGP_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_OGP_SPI=1'
-PROGRAMMER_OBJS += ogp_spi.o
-NEED_LIBPCI += CONFIG_OGP_SPI
-endif
-
-ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_BUSPIRATE_SPI=1'
-PROGRAMMER_OBJS += buspirate_spi.o
-NEED_SERIAL += CONFIG_BUSPIRATE_SPI
-endif
-
-ifeq ($(CONFIG_DEDIPROG), yes)
-FEATURE_CFLAGS += -D'CONFIG_DEDIPROG=1'
-PROGRAMMER_OBJS += dediprog.o
-NEED_LIBUSB1 += CONFIG_DEDIPROG
-endif
-
-ifeq ($(CONFIG_DEVELOPERBOX_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_DEVELOPERBOX_SPI=1'
-PROGRAMMER_OBJS += developerbox_spi.o
-NEED_LIBUSB1 += CONFIG_DEVELOPERBOX_SPI
-endif
-
-ifeq ($(CONFIG_SATAMV), yes)
-FEATURE_CFLAGS += -D'CONFIG_SATAMV=1'
-PROGRAMMER_OBJS += satamv.o
-NEED_LIBPCI += CONFIG_SATAMV
-endif
-
-ifeq ($(CONFIG_LINUX_MTD), yes)
-# This is a totally ugly hack.
-FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_MTD_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_MTD=1'")
-PROGRAMMER_OBJS += linux_mtd.o
-endif
-
-ifeq ($(CONFIG_LINUX_SPI), yes)
-# This is a totally ugly hack.
-FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_SPI_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_LINUX_SPI=1'")
-PROGRAMMER_OBJS += linux_spi.o
-endif
-
-ifeq ($(CONFIG_MSTARDDC_SPI), yes)
-# This is a totally ugly hack.
-FEATURE_CFLAGS += $(call debug_shell,grep -q "LINUX_I2C_SUPPORT := yes" .features && printf "%s" "-D'CONFIG_MSTARDDC_SPI=1'")
-NEED_LINUX_I2C += CONFIG_MSTARDDC_SPI
-PROGRAMMER_OBJS += mstarddc_spi.o
-endif
-
-ifeq ($(CONFIG_CH341A_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_CH341A_SPI=1'
-PROGRAMMER_OBJS += ch341a_spi.o
-NEED_LIBUSB1 += CONFIG_CH341A_SPI
-endif
-
-ifeq ($(CONFIG_DIGILENT_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_DIGILENT_SPI=1'
-PROGRAMMER_OBJS += digilent_spi.o
-NEED_LIBUSB1 += CONFIG_DIGILENT_SPI
-endif
-
-ifeq ($(CONFIG_JLINK_SPI), yes)
-NEED_LIBJAYLINK += CONFIG_JLINK_SPI
-FEATURE_CFLAGS += -D'CONFIG_JLINK_SPI=1'
-PROGRAMMER_OBJS += jlink_spi.o
-endif
-
-ifeq ($(CONFIG_NI845X_SPI), yes)
-FEATURE_CFLAGS += -D'CONFIG_NI845X_SPI=1'
-
-ifeq ($(CONFIG_NI845X_LIBRARY_PATH),)
-# if the user did not specified the NI-845x headers/lib path
-# do a guess for both 32 and 64 bit Windows versions
-NI845X_LIBS += -L'${PROGRAMFILES}\National Instruments\NI-845x\MS Visual C'
-NI845X_LIBS += -L'${PROGRAMFILES(x86)}\National Instruments\NI-845x\MS Visual C'
-NI845X_INCLUDES += -I'${PROGRAMFILES}\National Instruments\NI-845x\MS Visual C'
-NI845X_INCLUDES += -I'${PROGRAMFILES(x86)}\National Instruments\NI-845x\MS Visual C'
-else
-NI845X_LIBS += -L'$(CONFIG_NI845X_LIBRARY_PATH)'
-NI845X_INCLUDES += -I'$(CONFIG_NI845X_LIBRARY_PATH)'
-endif
-
-FEATURE_CFLAGS += $(NI845X_INCLUDES)
-LIBS += -lni845x
-PROGRAMMER_OBJS += ni845x_spi.o
-endif
-
-ifeq ($(CONFIG_LINUX_I2C_HELPER), yes)
-LIB_OBJS += i2c_helper_linux.o
-FEATURE_CFLAGS += -D'CONFIG_I2C_SUPPORT=1'
-endif
-
-ifneq ($(NEED_SERIAL), )
-LIB_OBJS += serial.o custom_baud.o
-endif
-
-ifneq ($(NEED_POSIX_SOCKETS), )
-ifeq ($(TARGET_OS), SunOS)
-LIBS += -lsocket -lnsl
-endif
-endif
-
-ifneq ($(NEED_LIBPCI), )
-CHECK_LIBPCI = yes
-# This is a dirty hack, but it saves us from checking all PCI drivers and all platforms manually.
-# libpci may need raw memory, MSR or PCI port I/O on some platforms.
-# Individual drivers might have the same needs as well.
-NEED_RAW_ACCESS += $(NEED_LIBPCI)
-FEATURE_CFLAGS += -D'NEED_PCI=1'
-FEATURE_CFLAGS += $(call debug_shell,grep -q "OLD_PCI_GET_DEV := yes" .libdeps && printf "%s" "-D'OLD_PCI_GET_DEV=1'")
-
-PROGRAMMER_OBJS += pcidev.o
-ifeq ($(TARGET_OS), NetBSD)
-# The libpci we want is called libpciutils on NetBSD and needs NetBSD libpci.
-PCILIBS += -lpciutils -lpci
-else
-PCILIBS += -lpci
-endif
-endif
-
-ifneq ($(NEED_RAW_ACCESS), )
-# Raw memory, MSR or PCI port I/O access.
-FEATURE_CFLAGS += -D'NEED_RAW_ACCESS=1'
-PROGRAMMER_OBJS += physmap.o hwaccess.o
-
-ifeq ($(TARGET_OS), NetBSD)
-# For (i386|x86_64)_iopl(2).
-PCILIBS += -l$(shell uname -p)
-else
-ifeq ($(TARGET_OS), OpenBSD)
-# For (i386|amd64)_iopl(2).
-PCILIBS += -l$(shell uname -m)
-else
-ifeq ($(TARGET_OS), Darwin)
-# DirectHW framework can be found in the DirectHW library.
-PCILIBS += -framework IOKit -framework DirectHW
-endif
-endif
-endif
-
-endif
-
-
-ifneq ($(NEED_LIBUSB1), )
-CHECK_LIBUSB1 = yes
-FEATURE_CFLAGS += -D'NEED_LIBUSB1=1'
-PROGRAMMER_OBJS += usbdev.o usb_device.o
-# FreeBSD and DragonflyBSD use a reimplementation of libusb-1.0 that is simply called libusb
-ifeq ($(TARGET_OS),$(filter $(TARGET_OS),FreeBSD DragonFlyBSD))
-USB1LIBS += -lusb
-else
-ifeq ($(TARGET_OS),NetBSD)
-override CPPFLAGS += -I/usr/pkg/include/libusb-1.0
-USB1LIBS += -lusb-1.0
-else
-USB1LIBS += $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"; $(PKG_CONFIG) --libs libusb-1.0 || printf "%s" "-lusb-1.0")
-override CPPFLAGS += $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"; $(PKG_CONFIG) --cflags-only-I libusb-1.0 || printf "%s" "-I/usr/include/libusb-1.0")
-endif
-endif
-endif
-
-ifneq ($(NEED_LIBJAYLINK), )
-CHECK_LIBJAYLINK = yes
-JAYLINKLIBS += $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"; $(PKG_CONFIG) --libs libjaylink)
-override CPPFLAGS += $(call debug_shell,[ -n "$(PKG_CONFIG_LIBDIR)" ] && export PKG_CONFIG_LIBDIR="$(PKG_CONFIG_LIBDIR)"; $(PKG_CONFIG) --cflags-only-I libjaylink)
-endif
-
-ifeq ($(CONFIG_PRINT_WIKI), yes)
-FEATURE_CFLAGS += -D'CONFIG_PRINT_WIKI=1'
-CLI_OBJS += print_wiki.o
-endif
-
-FEATURE_CFLAGS += $(call debug_shell,grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'")
-
-# We could use PULLED_IN_LIBS, but that would be ugly.
-FEATURE_LIBS += $(call debug_shell,grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
-
-FEATURE_CFLAGS += $(call debug_shell,grep -q "CLOCK_GETTIME := yes" .features && printf "%s" "-D'HAVE_CLOCK_GETTIME=1'")
-FEATURE_LIBS += $(call debug_shell,grep -q "CLOCK_GETTIME := yes" .features && printf "%s" "-lrt")
-
-LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
-OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS)
-
-all: hwlibs features $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
-ifeq ($(ARCH), x86)
- @+$(MAKE) -C util/ich_descriptors_tool/ TARGET_OS=$(TARGET_OS) EXEC_SUFFIX=$(EXEC_SUFFIX)
-endif
-
-$(PROGRAM)$(EXEC_SUFFIX): $(OBJS)
- $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(LIBS) $(PCILIBS) $(FEATURE_LIBS) $(USBLIBS) $(USB1LIBS) $(JAYLINKLIBS) $(NI845X_LIBS)
-
-libflashrom.a: $(LIBFLASHROM_OBJS)
- $(AR) rcs $@ $^
- $(RANLIB) $@
-
-# TAROPTIONS reduces information leakage from the packager's system.
-# If other tar programs support command line arguments for setting uid/gid of
-# stored files, they can be handled here as well.
-TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --group=root")
-
-%.o: %.c .features
- $(CC) -MMD $(CFLAGS) $(CPPFLAGS) $(FLASHROM_CFLAGS) $(FEATURE_CFLAGS) $(SCMDEF) -o $@ -c $<
-
-# Make sure to add all names of generated binaries here.
-# This includes all frontends and libflashrom.
-# We don't use EXEC_SUFFIX here because we want to clean everything.
-clean:
- rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a *.o *.d $(PROGRAM).8 $(PROGRAM).8.html $(BUILD_DETAILS_FILE)
- @+$(MAKE) -C util/ich_descriptors_tool/ clean
-
-distclean: clean
- rm -f .features .libdeps
-
-strip: $(PROGRAM)$(EXEC_SUFFIX)
- $(STRIP) $(STRIP_ARGS) $(PROGRAM)$(EXEC_SUFFIX)
-
-# to define test programs we use verbatim variables, which get exported
-# to environment variables and are referenced with $$<varname> later
-
-define COMPILER_TEST
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export COMPILER_TEST
-
-compiler: featuresavailable
- @printf "Checking for a C compiler... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$COMPILER_TEST" > .test.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .test.c -o .test$(EXEC_SUFFIX) >&2 && \
- echo "found." || { echo "not found."; \
- rm -f .test.c .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @rm -f .test.c .test$(EXEC_SUFFIX)
- @printf "Target arch is "
- @# FreeBSD wc will output extraneous whitespace.
- @echo $(ARCH)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \
- ( echo "unknown (\"$(ARCH)\"). Aborting."; exit 1)
- @printf "%s\n" '$(ARCH)'
- @printf "Target OS is "
- @# FreeBSD wc will output extraneous whitespace.
- @echo $(TARGET_OS)|wc -w|grep -q '^[[:blank:]]*1[[:blank:]]*$$' || \
- ( echo "unknown (\"$(TARGET_OS)\"). Aborting."; exit 1)
- @printf "%s\n" '$(TARGET_OS)'
-ifeq ($(TARGET_OS), libpayload)
- @$(CC) --version 2>&1 | grep -q coreboot || \
- ( echo "Warning: It seems you are not using coreboot's reference compiler."; \
- echo "This might work but usually does not, please beware." )
-endif
-
-define LIBPCI_TEST
-/* Avoid a failing test due to libpci header symbol shadowing breakage */
-#define index shadow_workaround_index
-#if !defined __NetBSD__
-#include <pci/pci.h>
-#else
-#include <pciutils/pci.h>
-#endif
-struct pci_access *pacc;
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- pacc = pci_alloc();
- return 0;
-}
-endef
-export LIBPCI_TEST
-
-define PCI_GET_DEV_TEST
-/* Avoid a failing test due to libpci header symbol shadowing breakage */
-#define index shadow_workaround_index
-#if !defined __NetBSD__
-#include <pci/pci.h>
-#else
-#include <pciutils/pci.h>
-#endif
-struct pci_access *pacc;
-struct pci_dev *dev = {0};
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- pacc = pci_alloc();
- dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
- return 0;
-}
-endef
-export PCI_GET_DEV_TEST
-
-define LIBUSB1_TEST
-#include <stddef.h>
-#include <libusb.h>
-int main(int argc, char **argv)
-{
- (void)argc;
- (void)argv;
- libusb_init(NULL);
- return 0;
-}
-endef
-export LIBUSB1_TEST
-
-define LIBJAYLINK_TEST
-#include <stddef.h>
-#include <libjaylink/libjaylink.h>
-int main(int argc, char **argv)
-{
- struct jaylink_context *ctx;
-
- (void)argc;
- (void)argv;
-
- jaylink_init(&ctx);
- jaylink_exit(ctx);
-
- return 0;
-}
-endef
-export LIBJAYLINK_TEST
-
-hwlibs: compiler
- @printf "" > .libdeps
-ifeq ($(CHECK_LIBPCI), yes)
- @printf "Checking for libpci headers... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LIBPCI_TEST" > .test.c
- @printf "\nexec: %s\n" "$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
- echo "found." || { echo "not found."; echo; \
- echo "The following features require libpci: $(NEED_LIBPCI)."; \
- echo "Please install libpci headers or disable all features"; \
- echo "mentioned above by specifying make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @printf "Checking version of pci_get_dev... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$PCI_GET_DEV_TEST" > .test.c
- @printf "\nexec: %s\n" "$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
- ( echo "new version (including PCI domain parameter)."; echo "OLD_PCI_GET_DEV := no" >> .libdeps ) || \
- ( echo "old version (without PCI domain parameter)."; echo "OLD_PCI_GET_DEV := yes" >> .libdeps ) } 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
- @printf "Checking if libpci is present and sufficient... " | tee -a $(BUILD_DETAILS_FILE)
- @printf "\nexec: %s\n" "$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS)" >>$(BUILD_DETAILS_FILE)
- @{ { { { $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) 2>>$(BUILD_DETAILS_FILE) >&2 && \
- echo "yes." || { echo "no."; \
- printf "Checking if libz+libpci are present and sufficient..." ; \
- { printf "\nexec: %s\n" "$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) -lz" >>$(BUILD_DETAILS_FILE) ; \
- $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(PCILIBS) -lz >&2 && \
- echo "yes." && echo "NEEDLIBZ := yes" > .libdeps } || { echo "no."; echo; \
- echo "The following features require libpci: $(NEED_LIBPCI)."; \
- echo "Please install libpci (package pciutils) and/or libz or disable all features"; \
- echo "mentioned above by specifying make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
-endif
-ifeq ($(CHECK_LIBUSB1), yes)
- @printf "Checking for libusb-1.0 headers... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LIBUSB1_TEST" > .test.c
- @printf "\nexec: %s\n" "$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
- echo "found." || { echo "not found."; echo; \
- echo "The following features require libusb-1.0: $(NEED_LIBUSB1)."; \
- echo "Please install libusb-1.0 headers or disable all features"; \
- echo "mentioned above by specifying make CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @printf "Checking if libusb-1.0 is usable... " | tee -a $(BUILD_DETAILS_FILE)
- @printf "\nexec: %s\n" "$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USB1LIBS)" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(USB1LIBS) >&2 && \
- echo "yes." || { echo "no."; \
- echo "The following features require libusb-1.0: $(NEED_LIBUSB1)."; \
- echo "Please install libusb-1.0 or disable all features"; \
- echo "mentioned above by specifying make CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
-endif
-ifeq ($(CHECK_LIBJAYLINK), yes)
- @printf "Checking for libjaylink headers... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LIBJAYLINK_TEST" > .test.c
- @printf "\nexec: %s\n" "$(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) -c $(CPPFLAGS) $(CFLAGS) .test.c -o .test.o >&2 && \
- echo "found." || { echo "not found."; echo; \
- echo "The following feature requires libjaylink: $(NEED_LIBJAYLINK)."; \
- echo "Please install libjaylink headers or disable the feature"; \
- echo "mentioned above by specifying make CONFIG_JLINK_SPI=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o; exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @printf "Checking if libjaylink is usable... " | tee -a $(BUILD_DETAILS_FILE)
- @printf "\nexec: %s\n" "$(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(JAYLINKLIBS)" >>$(BUILD_DETAILS_FILE)
- @{ { { { { $(CC) $(LDFLAGS) .test.o -o .test$(EXEC_SUFFIX) $(LIBS) $(JAYLINKLIBS) >&2 && \
- echo "yes." || { echo "no."; \
- echo "The following feature requires libjaylink: $(NEED_LIBJAYLINK)."; \
- echo "Please install libjaylink or disable the feature"; \
- echo "mentioned above by specifying make CONFIG_JLINK_SPI=no"; \
- echo "See README for more information."; echo; \
- rm -f .test.c .test.o .test$(EXEC_SUFFIX); exit 1; }; } 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
- @rm -f .test.c .test.o .test$(EXEC_SUFFIX)
-endif
-
-.features: features
-
-# If a user does not explicitly request a non-working feature, we should
-# silently disable it. However, if a non-working (does not compile) feature
-# is explicitly requested, we should bail out with a descriptive error message.
-# We also have to check that at least one programmer driver is enabled.
-featuresavailable:
-ifeq ($(PROGRAMMER_OBJS),)
- @echo "You have to enable at least one programmer driver!"
- @false
-endif
-ifneq ($(UNSUPPORTED_FEATURES), )
- @echo "The following features are unavailable on your machine: $(UNSUPPORTED_FEATURES)"
- @false
-endif
-
-define FTDI_TEST
-#include <stdlib.h>
-#include <ftdi.h>
-struct ftdi_context *ftdic = NULL;
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return ftdi_init(ftdic);
-}
-endef
-export FTDI_TEST
-
-define FTDI_232H_TEST
-#include <ftdi.h>
-enum ftdi_chip_type type = TYPE_232H;
-endef
-export FTDI_232H_TEST
-
-define UTSNAME_TEST
-#include <sys/utsname.h>
-struct utsname osinfo;
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- uname (&osinfo);
- return 0;
-}
-endef
-export UTSNAME_TEST
-
-define LINUX_MTD_TEST
-#include <mtd/mtd-user.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_MTD_TEST
-
-define LINUX_SPI_TEST
-#include <linux/types.h>
-#include <linux/spi/spidev.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_SPI_TEST
-
-define LINUX_I2C_TEST
-#include <linux/i2c-dev.h>
-#include <linux/i2c.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- return 0;
-}
-endef
-export LINUX_I2C_TEST
-
-define CLOCK_GETTIME_TEST
-#include <time.h>
-
-int main(int argc, char **argv)
-{
- struct timespec res;
- clock_gettime(CLOCK_REALTIME, &res);
- return 0;
-}
-endef
-export CLOCK_GETTIME_TEST
-
-define NI845X_TEST
-#include <ni845x.h>
-
-int main(int argc, char **argv)
-{
- (void) argc;
- (void) argv;
- char I2C_Device[256];
- NiHandle Dev_Handle;
- uInt32 NumberFound = 0;
- ni845xFindDevice(I2C_Device, &Dev_Handle, &NumberFound);
- ni845xCloseFindDeviceHandle(Dev_Handle);
- return 0;
-}
-endef
-export NI845X_TEST
-
-features: compiler
- @echo "FEATURES := yes" > .features.tmp
-ifneq ($(NEED_LIBFTDI), )
- @printf "Checking for FTDI support... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$FTDI_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >&2 && \
- ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ; \
- printf "Checking for FT232H support in libftdi... " ; \
- echo "$$FTDI_232H_TEST" >> .featuretest.c ; \
- printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS)" >>$(BUILD_DETAILS_FILE) ; \
- { $(CC) $(CPPFLAGS) $(CFLAGS) $(FTDI_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(FTDILIBS) $(LIBS) >&2 && \
- ( echo "found."; echo "FT232H := yes" >> .features.tmp ) || \
- ( echo "not found."; echo "FT232H := no" >> .features.tmp ) } \
- ) || \
- ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) } \
- 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
-endif
-ifeq ($(CONFIG_LINUX_MTD), yes)
- @printf "Checking if Linux MTD headers are present... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LINUX_MTD_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \
- ( echo "yes."; echo "LINUX_MTD_SUPPORT := yes" >> .features.tmp ) || \
- ( echo "no."; echo "LINUX_MTD_SUPPORT := no" >> .features.tmp ) } \
- 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
-endif
-ifeq ($(CONFIG_LINUX_SPI), yes)
- @printf "Checking if Linux SPI headers are present... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LINUX_SPI_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \
- ( echo "yes."; echo "LINUX_SPI_SUPPORT := yes" >> .features.tmp ) || \
- ( echo "no."; echo "LINUX_SPI_SUPPORT := no" >> .features.tmp ) } \
- 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
-endif
-ifneq ($(NEED_LINUX_I2C), )
- @printf "Checking if Linux I2C headers are present... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$LINUX_I2C_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \
- ( echo "yes."; echo "LINUX_I2C_SUPPORT := yes" >> .features.tmp ) || \
- ( echo "no."; echo "LINUX_I2C_SUPPORT := no" >> .features.tmp ) } \
- 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
-endif
-ifeq ($(CONFIG_NI845X_SPI), yes)
- @printf "Checking for NI USB-845x installation... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$NI845X_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(NI845X_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(NI845X_LIBS) $(LIBS)" >>$(BUILD_DETAILS_FILE)
-
- @ { { { { { $(CC) $(CPPFLAGS) $(CFLAGS) $(NI845X_INCLUDES) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) $(NI845X_LIBS) $(LIBS) >&2 && \
- ( echo "yes."; echo "NI845X_SUPPORT := yes" >> .features.tmp ) || \
- { echo -e "\nUnable to find NI-845x headers or libraries."; \
- echo "Please pass the NI-845x library path to the make with the CONFIG_NI845X_LIBRARY_PATH parameter,"; \
- echo "or disable the NI-845x support by specifying make CONFIG_NI845X_SPI=no"; \
- echo "For the NI-845x 17.0 the library path is:"; \
- echo " On 32 bit systems: C:\Program Files)\National Instruments\NI-845x\MS Visual C"; \
- echo " On 64 bit systems: C:\Program Files (x86)\National Instruments\NI-845x\MS Visual C"; \
- exit 1; }; } \
- 2>>$(BUILD_DETAILS_FILE); echo $? >&3 ; } | tee -a $(BUILD_DETAILS_FILE) >&4; } 3>&1;} | { read rc ; exit ${rc}; } } 4>&1
-endif
- @printf "Checking for utsname support... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$UTSNAME_TEST" > .featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \
- ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \
- ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) } 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
- @printf "Checking for clock_gettime support... " | tee -a $(BUILD_DETAILS_FILE)
- @echo "$$CLOCK_GETTIME_TEST" >.featuretest.c
- @printf "\nexec: %s\n" "$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -lrt .featuretest.c -o .featuretest$(EXEC_SUFFIX)" >>$(BUILD_DETAILS_FILE)
- @ { $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -lrt .featuretest.c -o .featuretest$(EXEC_SUFFIX) >&2 && \
- ( echo "found."; echo "CLOCK_GETTIME := yes" >>.features.tmp ) || \
- ( echo "not found."; echo "CLOCK_GETTIME := no" >>.features.tmp ) } \
- 2>>$(BUILD_DETAILS_FILE) | tee -a $(BUILD_DETAILS_FILE)
- @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
- @rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
-
-$(PROGRAM).8.html: $(PROGRAM).8
- @groff -mandoc -Thtml $< >$@
-
-$(PROGRAM).8: $(PROGRAM).8.tmpl
- @# Add the man page change date and version to the man page
- @sed -e 's#.TH FLASHROM 8 .*#.TH FLASHROM 8 "$(MAN_DATE)" "$(VERSION)" "$(MAN_DATE)"#' <$< >$@
-
-install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
- mkdir -p $(DESTDIR)$(PREFIX)/sbin
- mkdir -p $(DESTDIR)$(MANDIR)/man8
- $(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
- $(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
-
-libinstall: libflashrom.a libflashrom.h
- mkdir -p $(DESTDIR)$(PREFIX)/lib
- $(INSTALL) -m 0644 libflashrom.a $(DESTDIR)$(PREFIX)/lib
- mkdir -p $(DESTDIR)$(PREFIX)/include
- $(INSTALL) -m 0644 libflashrom.h $(DESTDIR)$(PREFIX)/include
-
-_export: $(PROGRAM).8
- @rm -rf "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
- @mkdir -p "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
- @git archive HEAD | tar -x -C "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
-# Generate versioninfo.inc containing metadata that would not be available in exported sources otherwise.
- @echo "VERSION = $(VERSION)" > "$(EXPORTDIR)/flashrom-$(RELEASENAME)/versioninfo.inc"
- @echo "MAN_DATE = $(MAN_DATE)" >> "$(EXPORTDIR)/flashrom-$(RELEASENAME)/versioninfo.inc"
-# Restore modification date of all tracked files not marked 'export-ignore' in .gitattributes.
-# sed is required to filter out file names having the attribute set.
-# The sed program saves the file name in the hold buffer and then checks if the respective value is 'set'.
-# If so it ignores the rest of the program, which otherwise restores the file name and prints it.
- @git ls-tree -r -z -t --full-name --name-only HEAD | \
- git check-attr -z --stdin export-ignore | \
- sed -zne 'x;n;n;{/^set$$/b;};x;p;' | \
- xargs -0 sh -c 'for f; do \
- touch -d $$(git log --pretty=format:%cI -1 HEAD -- "$$f") \
- "$(EXPORTDIR)/flashrom-$(RELEASENAME)/$$f"; \
- done' dummy_arg0
-
-export: _export
- @echo "Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/"
-
-tarball: _export
- @tar -cj --format=ustar -f "$(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2" -C $(EXPORTDIR)/ \
- $(TAROPTIONS) "flashrom-$(RELEASENAME)/"
-# Delete the exported directory again because it is most likely what's expected by the user.
- @rm -rf "$(EXPORTDIR)/flashrom-$(RELEASENAME)"
- @echo Created "$(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2"
-
-libpayload: clean
- make CC="CC=i386-elf-gcc lpgcc" AR=i386-elf-ar RANLIB=i386-elf-ranlib
-
-.PHONY: all install clean distclean compiler hwlibs features _export export tarball featuresavailable libpayload
-
-# Disable implicit suffixes and built-in rules (for performance and profit)
-.SUFFIXES:
-
--include $(OBJS:.o=.d)
+$(error flashrom uses meson for its build process. See mesonbuild.com)
--
To view, visit https://review.coreboot.org/c/flashrom/+/46875
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ice42ab92a36c54f8f446f58dd73f628994f179d6
Gerrit-Change-Number: 46875
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
4
8