Coder Social home page Coder Social logo

flashrom / flashrom Goto Github PK

View Code? Open in Web Editor NEW
800.0 58.0 426.0 7.37 MB

Send patches to https://review.coreboot.org: https://www.flashrom.org/Development_Guidelines#GitHub

Home Page: https://review.coreboot.org/admin/repos/flashrom,general

License: GNU General Public License v2.0

C 90.25% Makefile 1.55% Shell 1.97% Meson 1.16% Rust 5.03% Nix 0.01% Dockerfile 0.03%
firmware-tools firmware-updater firmware-update firmware-updates

flashrom's Introduction

flashrom README

flashrom is a utility for detecting, reading, writing, verifying and erasing flash chips. It is often used to flash BIOS/EFI/coreboot/firmware images in-system using a supported mainboard, but it also supports flashing of network cards (NICs), SATA controller cards, and other external devices which can program flash chips.

It supports a wide range of flash chips (most commonly found in SOIC8, DIP8, SOIC16, WSON8, PLCC32, DIP32, TSOP32, and TSOP40 packages), which use various protocols such as LPC, FWH, parallel flash, or SPI.

Do not use flashrom on laptops (yet)! The embedded controller (EC) present in many laptops might interact badly with any attempts to communicate with the flash chip and may brick your laptop.

Please make a backup of your flash chip before writing to it.

Please see the flashrom(8) manpage classic_cli_manpage.

Building / installing / packaging

flashrom supports building with make and meson.

TLDR, building with meson

meson setup builddir
meson compile -C builddir
meson test -C builddir
meson install -C builddir

For full detailed instructions, follow the information in dev_guide/building_from_source

TLDR, building with make

make
make install

For full detailed instructions, follow the information in dev_guide/building_with_make

Contact

The official flashrom website is:

https://www.flashrom.org/

For available contact methods see contact

flashrom's People

Contributors

alanvgreen avatar audiohacked avatar dhendrix avatar djcampello avatar elyesh avatar felixsinger avatar hailfinger avatar heijligen avatar i-c-o-n avatar joursoir avatar lemenkov avatar libv avatar light2802 avatar martonmiklos avatar matmat avatar n-huber avatar nartemiev avatar pgeorgi avatar quasisec avatar reinauer avatar rminnich avatar roysjosh avatar ruikruik avatar sergiidmytruk avatar stefanct avatar subrata-b avatar tari avatar th3fanbus avatar urjaman avatar uwehermann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flashrom's Issues

how to program FM25Q08 chip?

system:macOs
install mode:brew install flashrom.

i saw this chip was defined in the flashchip.h
but flashrom can't recognize it.
why?

Anybody can port it to an Android app with non-root support?

A full-platform universal serprog programmer stm32-vserprog

There are two ways to use this programmer on the Android platform device. Currently, most mobile phone systems support the cdc_acm device and the otg function, but the ttyACM device needs to be completely root, and the Android own USB protocol is different from the standard Linux. So if you want to use this programmer without root, you have to develop your own app. This is a field I have never touched.

Similar applications may refer to Andprox

Reading old flash chip contents... Transaction error

System Information


        Manufacturer: Inspur
        Product Name: SA5212M5
        Version: 00001

Base Board Information

        Manufacturer: Inspur
        Product Name: NF5280M5
        Version: NF5280M5

BIOS Information

        Vendor: Inspur
        Version: 4.0.6
        Release Date: 03/07/2019

run log

[root@T64 ~/rt_flash_rom]# ./flashrom -p internal -r flashrom_backup.bin
flashrom  on Linux 3.10.107-1-tlinux2_nosign_test1-0047 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found chipset "Intel C622 Series Chipset (QS/PRQ)".
This chipset is marked as untested. If you are using an up-to-date version
of flashrom *and* were (not) able to successfully update your firmware with it,
then please email a report to [email protected] including a verbose (-V) log.
Thank you!
Enabling flash write... SPI Configuration is locked down.
FREG2: Management Engine region (0x00003000-0x007dffff) is locked.
Not all flash regions are freely accessible by flashrom. This is most likely
due to an active ME. Please see https://flashrom.org/ME for details.
At least some flash regions are read protected. You have to use a flash
layout and include only accessible regions. For write operations, you'll
additionally need the --noverify-all switch. See manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) mapped at physical address 0x0000000000000000.
Reading flash... Transaction error between offset 0x00003000 and 0x0000303f (= 0x00003000 + 63)!
Read operation failed!
FAILED.
[root@T64 ~/rt_flash_rom]# ./flashrom -p internal -w ./Fake_for_flash.bin
flashrom  on Linux 3.10.107-1-tlinux2_nosign_test1-0047 (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found chipset "Intel C622 Series Chipset (QS/PRQ)".
This chipset is marked as untested. If you are using an up-to-date version
of flashrom *and* were (not) able to successfully update your firmware with it,
then please email a report to [email protected] including a verbose (-V) log.
Thank you!
Enabling flash write... SPI Configuration is locked down.
FREG2: Management Engine region (0x00003000-0x007dffff) is locked.
Not all flash regions are freely accessible by flashrom. This is most likely
due to an active ME. Please see https://flashrom.org/ME for details.
At least some flash regions are read protected. You have to use a flash
layout and include only accessible regions. For write operations, you'll
additionally need the --noverify-all switch. See manpage for more details.
Enabling hardware sequencing because some important opcode is locked.
OK.
Found Programmer flash chip "Opaque flash chip" (32768 kB, Programmer-specific) mapped at physical address 0x0000000000000000.
Reading old flash chip contents... Transaction error between offset 0x00003000 and 0x0000303f (= 0x00003000 + 63)!
FAILED.
[root@T64 ~/rt_flash_rom]#

FT(2)232H Dual/Quad SPI

There are SPI flash chips like W25Q128FV that support dual/quad SPI (using 2/4 inputs/outputs) to double/quadruple speed.
I had a look on the source of flashrom but I am not sure if that would work with FT(2)232H.
Any comments on this?

error: redefinition of 'struct termios' on CentOS 7 ppc64le

Trying to build flashrom v1.1 on CentOS 7 for ppc64le fails like this (note that x86_64 works):

cc -MMD -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mcpu=power8 -mtune=power8 -I/usr/include/libusb-1.0    -D'CONFIG_DEFAULT_PROGRAMMER=PROGRAMMER_INVALID' -D'CONFIG_DEFAULT_PROGRAMMER_ARGS="''"' -D'CONFIG_SERPROG=1' -D'CONFIG_PONY_SPI=1' -D'CONFIG_BITBANG_SPI=1' -D'CONFIG_GFXNVIDIA=1' -D'CONFIG_SATASII=1' -D'CONFIG_ATAVIA=1' -D'CONFIG_IT8212=1' -D'CONFIG_FT2232_SPI=1' -D'CONFIG_USBBLASTER_SPI=1' -D'CONFIG_PICKIT2_SPI=1' -D'HAVE_FT232H=1' -I/usr/include/libftdi1 -I/usr/include/libusb-1.0   -D'CONFIG_DUMMY=1' -D'CONFIG_DRKAISER=1' -D'CONFIG_NICINTEL=1' -D'CONFIG_NICINTEL_SPI=1' -D'CONFIG_NICINTEL_EEPROM=1' -D'CONFIG_OGP_SPI=1' -D'CONFIG_BUSPIRATE_SPI=1' -D'CONFIG_DEDIPROG=1' -D'CONFIG_DEVELOPERBOX_SPI=1' -D'CONFIG_LINUX_MTD=1' -D'CONFIG_LINUX_SPI=1' -D'CONFIG_CH341A_SPI=1' -D'CONFIG_DIGILENT_SPI=1' -D'NEED_PCI=1'  -D'NEED_RAW_ACCESS=1' -D'NEED_LIBUSB0=1' -D'NEED_LIBUSB1=1' -D'HAVE_UTSNAME=1' -D'HAVE_CLOCK_GETTIME=1' -D'FLASHROM_VERSION="v1.1"' -o custom_baud.o -c custom_baud.c
In file included from custom_baud.c:23:0:
/usr/include/asm-generic/termbits.h:11:8: error: redefinition of 'struct termios'
 struct termios {
        ^
In file included from /usr/include/termios.h:40:0,
                 from /usr/include/bits/ioctl-types.h:5,
                 from /usr/include/sys/ioctl.h:29,
                 from custom_baud.c:21:
/usr/include/bits/termios.h:33:8: note: originally defined here
 struct termios {
        ^
make: *** [custom_baud.o] Error 1

byte mode and word mode selection

Hi all,
I'm going to implement porting the flashrom to PPC demoboard, and I'm going to use word mode (reading/writing on 16bit) on parallel flash (MX29GL640E). Is there anybody know how to support the word mode in flashrom, I didn't find at all, seems only byte mode is supported?

Many thanks!

question: FT232RL

Can FT232RL be used instead of FT232H?
I see that FT232RL has bit bang mode too.
mine is both 3.3v and 5v.

GigaDevice 25B256D support

Hey, I'm trying to look through the datasheet to spot the differences between 25B/25Q series so I could maybe try and see if I can bodge a patch for flashrom. Any help would be greatly appreciated!

GD25B256D datasheet

GD25Q256D datasheet

After a quick looksie the only difference seems to be that the B model lacks the HOLD# and RESET# on IO3 pins. So on the B series the QE bit is always 1. It seems like the chip is a drop in replacement for WINBOND_NEX_W25Q256_V unless I'm missing some difference.

There's support for GD25B128B so I guess i'll start trying to make sense of the source from there :)

MX25L25635F Support

I have seen that there is no support for the MX25L25635F flash. In fact, I have seen a reference to it within the "flashchips.h" file (MACRONIX_MX25L25635F), but there is no references to it within the flashchips array ("flashchips.c" file).

Is it still supported?

error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead

When compiling flashrom with libusb I get the following error after issuing make;

ch341a_spi.c: In functionch341a_spi.c: In function 'ch341a_spi_init':
ch341a_spi.c:447:2: error: 'libusb_set_debug' is deprecated: Use libusb_set_option instead [-Werror=deprecated-declarations]
libusb_set_debug(NULL, 3); // Enable information, warning and error messages (only).
^~~~~~~~~~~~~~~~

Feature request: verified read option

For those who use flashrom to externally read their bios chips, it is recommended that flashrom reads the chip multiple times until two dumps have a matching sha1/sha256/md5 checksum. Could flashrom do this and check file size automatically if provided a flag or by default with the option to disable?

Status NOT WORKING for W25Q80EW chip

Hello everyone,

Reading Winbond W25Q80EW chip fails with the following error:

sudo /usr/sbin/flashrom -p ch341a_spi -r data.bin

flashrom v0.9.9-r1954 on Linux 4.15.0-45-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "unknown Winbond (ex Nexcom) SPI chip" (0 kB, SPI) on ch341a_spi.
===
This flash part has status NOT WORKING for operations: PROBE READ ERASE WRITE
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to [email protected] if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Read is not working on this chip. Aborting.

The W25Q80EW doesn't appear in the list of supported device eventhough it should be supported by f577544

Some photos of the PCB and the ROM chip
https://ibb.co/qL864tD
https://ibb.co/vHXq8Ys

Copyright Notice for Source Code Distribution

Every code document of flashrom shows a copyright notice, and a COPYING document shows the GPLv2 license. The flashrom folder containing the source code lacks a NOTICE document. That document would notify the recipient of the source code about the license attached to it. If a NOTICE is in the flashrom folder, a person could build the free software after reading the NOTICE and README, and know where to get the license.

According to GPLv2: "attach the following notices to the program." Those notices following that line in the GPLv2 license would be the notices for the flashrom source code in a NOTICE document.

Flashrom error on EN25QH64 Failed to read 4100 bytes

No matter what clip I use I get this error reading an e540 bios

Found EON flash cjhip "EN25QH64" )8192 KB, SPI) on ch341a_spi
Reading flash...
cb_in: error:LIBUSB_TRANSFER_TIMED_OUT
ch341a_spiu_spi_send_command: Failed to read 4100 bytes
Read operation failed!
FAILED

Support for Winbond 25Q80JV

I've a Lenovo Legion Y520 laptop with Winbond 25Q80JVSIQ BIOS chip. flashrom detects it a W25Q80.V. Here's the log

flashrom v0.9.9-r1954 on Linux 4.15.0-20-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "W25Q80.V" (1024 kB, SPI) on ch341a_spi.
Reading flash... done.

Steps for adding new flash chip support? S25FL128L

I need to add S25FL128L flash chip to flashrom and flash it through C232HM DDHSL-0 Cable in USB to SPI Interface.
Here's data sheet for the flash chip. https://www.cypress.com/file/316171/download

Is there a guide on how to do this?
What are the things I need to do to get the information I needed and to create support for this flash chip? Thanks.

{
		.vendor		= "Spansion”, /* checked
		.name		= "S25FL128L”, /* checked
		.bustype	= BUS_SPI, /* checked
		.manufacture_id	= SPANSION_ID, /* checked
		.model_id	= SPANSION_S25FL128, /* checked
		.total_size	= 16384, /* checked
		.page_size	= 256, /* checked
		.feature_bits	= FEATURE_WRSR_WREN,
		.tested		= TEST_UNTESTED,
		.probe		= probe_spi_rdid,
		.probe_timing	= TIMING_ZERO,
		.block_erasers	=
		{
			{
				.eraseblocks = { {256 * 1024, 64} },
				.block_erase = spi_block_erase_d8,
			},
		},
		.printlock	= spi_prettyprint_status_register_bp2_srwd,
		.unlock		= spi_disable_blockprotect_bp2_srwd,
		.write		= spi_chip_write_256,
		.read		= spi_chip_read,
		.voltage	= {2700, 3600}, /* checked
},

Does not work without spispeed= on RPi

flashrom v0.9.9-r1954 on Linux 4.9.59-v7+ (armv7l) (the one coming with the most recent Raspbian GNU/Linux 9 (stretch)) does not seem to work without spispeed=... on RPi:

# Does NOT work
pi@raspberrypi:~ $ sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -r file.rom
(...)
Calibrating delay loop... OK.
Found Generic flash chip "unknown SPI chip (RDID)" (0 kB, SPI) on linux_spi.

Turns out it does work when specifying spispeed= :

# Works - SLOW reading
pi@raspberrypi:~ $ sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512 -r slow.rom

# Works - FAST reading
pi@raspberrypi:~ $ sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=30000 -r fast.rom

# Check whether both are identical
pi@raspberrypi:~ $ diff slow.rom fast.rom

ATMEL 24C01A

Hello,

I would like to dump the firmware of an Atmel 24C01A, but this flash chips is not a supported one.

I found 2 files, that could be of interest: flashchips.c and flashchips.h, but i do not know how to modify it in order to support the Atmel 24C01A chips.

If you could give me some advice about the procedure, it could be very helpful.

Thank in advance

Best regards

Hugo

Account for kernel lockdown mode in error messages

Some distros will enable the kernel lockdown mode if uefi secure boot is enabled. flashrom will error out with a generic: "ERROR: Could not get I/O privileges (Operation not permitted).
You need to be root." even if you are root. You can disable lockdown with SysRq+x.

print_supported_boards_helper

print.c:404:3: error: format not a string literal and no format arguments [-Werror=format-security]
msg_pinfo(test_state_to_text(b->working));

Platform Cable USB II support

Add support for the Platform Cable USB II cable.
The cable (in jTag mode) is supported by UrJTAG (code example) through libusb. As the cable can be operated in the SPI mode, it could be very handy in flashrom.
I have a cable so I could test the implementation. With some guidance, I could try to develop the support myself, although I am short in time recently.

Please help add support for S25FS512S

Hello,

Please add support for S25FS512S. The datasheet is located here: https://www.cypress.com/file/216376/download

I am trying to dump the SPI flash for the Tesla Model 3 autopilot computer. This is part of an automotive security research project I am doing.

I ran the following command:
flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=1024 -VVV

Here is the output, plus my wiring diagram:
https://docs.google.com/document/d/1XvWd8BaR-gnYAS-H_iBbYfKjL1RfijFcAdcFkTEuoiQ/edit

Please let me know if there are any further commands I should run.

USB Byte Blaster and MX25L4006E write error

I have a problem with programming an SPI memory which is officially supported by the tool.
I tried to program MX25L4006E SPI memory through USB Blaster. I used flashrom in version v0.9.9-r1954 (installed as Ubuntu package) and in version p1.0-141-g9cecc7e (compiled by myself). In both cases the tool reports error during verification:

flashrom p1.0-141-g9cecc7e on Linux 4.15.0-43-generic (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L4005(A/C)/MX25L4006E" (512 kB, SPI) on usbblaster_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... FAILED at 0x00000101! Expected=0x1f, Found=0x11, failed byte count from 0x00000000-0x0007ffff: 0x371
Your flash chip is in an unknown state.
Please report this on IRC at chat.freenode.net (channel #flashrom) or
mail [email protected], thanks!

I tried with two different memory devices. One of them is brand new. Reading back the content of the memory devices and comparing with the write source, I see the errors are exactly at the same locations. Thus I suspect a bug in the software.

Meson build broken after 3d8868

After 3d8868c meson build is broken

/home/asavah/kross/host/msib450ig/lib/gcc/x86_64-msib450ig-linux-gnu/9.2.1/../../../../x86_64-msib450ig-linux-gnu/bin/ld: flashrom@sha/flashchips.c.o:(.data.rel.ro+0x34840): undefined reference to `probe_spi_st95'
/home/asavah/kross/host/msib450ig/lib/gcc/x86_64-msib450ig-linux-gnu/9.2.1/../../../../x86_64-msib450ig-linux-gnu/bin/ld: flashrom@sha/flashchips.c.o:(.data.rel.ro+0x34878): undefined reference to `spi_block_erase_emulation'
collect2: error: ld returned 1 exit status

Root cause:
spi95.c was not added to meson.build

Suggested fix:

diff --git a/meson.build b/meson.build
index d778d71..0696ce4 100644
--- a/meson.build
+++ b/meson.build
@@ -321,6 +321,7 @@ srcs += 'programmer.c'
 srcs += 'sfdp.c'
 srcs += 'spi25.c'
 srcs += 'spi25_statusreg.c'
+srcs += 'spi95.c'
 srcs += 'spi.c'
 srcs += 'sst28sf040.c'
 srcs += 'sst49lfxxxc.c'

Question:
Are patches at least compile tested before merging?

[patch] Support for MB ASUS P4P800SE

--- flashrom.orig/board_enable.c        2018-01-23 23:30:42.346381000 +0300
+++ flashrom/board_enable.c 2018-01-24 01:20:30.603030000 +0300
@@ -2360,6 +2360,7 @@
        {0x8086, 0x2570, 0x1043, 0x80f2,  0x8086, 0x24d3, 0x1043, 0x80a6, "^P4P800-E$", NULL, NULL,           P3, "ASUS",        "P4P800-E Deluxe",       0,   OK, intel_ich_gpio21_raise},
        {0x8086, 0x2570, 0x1043, 0x80a5,  0x8086, 0x24d3, 0x1043, 0x80a6, "^P4P800-VM$", NULL, NULL,          P3, "ASUS",        "P4P800-VM",             0,   OK, intel_ich_gpio21_raise},
        {0x8086, 0x2570, 0x1043, 0x80f2,  0x8086, 0x24d3, 0x1043, 0x80a6, "^P4P800-X$", NULL, NULL,           P3, "ASUS",        "P4P800-X",              0,   OK, intel_ich_gpio21_raise},
+       {0x8086, 0x2570, 0x1043, 0x80f2,  0x8086, 0x24d3,      0,      0, "^P4P800SE$", NULL, NULL,           P3, "ASUS",        "P4P800SE",              0,   OK, intel_ich_gpio21_raise},
        {0x8086, 0x2570, 0x1043, 0x80b2,  0x8086, 0x24c3, 0x1043, 0x8089, "^P4PE-X/TE$",NULL, NULL,           P3, "ASUS",        "P4PE-X/TE",             0,   NT, intel_ich_gpio21_raise},
        {0x1039, 0x0651, 0x1043, 0x8081,  0x1039, 0x0962,      0,      0, NULL,         NULL, NULL,           P3, "ASUS",        "P4SC-E",                0,   OK, it8707f_write_enable_2e},
        {0x8086, 0x2570, 0x1043, 0x80A5,  0x105A, 0x24D3, 0x1043, 0x80A6, NULL,         NULL, NULL,           P3, "ASUS",        "P4SD-LA",               0,   NT, intel_ich_gpio32_raise},
diff -ur flashrom.orig/print.c flashrom/print.c
--- flashrom.orig/print.c       2018-01-23 23:30:42.376649000 +0300
+++ flashrom/print.c        2018-01-24 00:10:02.819518000 +0300
@@ -679,6 +679,7 @@
        B("ASUS",       "P4P800-E Deluxe",      OK, "http://www.asus.com/Motherboards/Intel_Socket_478/P4P800E_Deluxe/", NULL),
        B("ASUS",       "P4P800-VM",            OK, "http://www.asus.com/Motherboards/Intel_Socket_478/P4P800VM/", NULL),
        B("ASUS",       "P4P800-X",             OK, "http://www.asus.com/Motherboards/Intel_Socket_478/P4P800X/", NULL),
+       B("ASUS",       "P4P800SE",             OK, "https://www.asus.com/supportonly/P4P800 SE/", NULL),
        B("ASUS",       "P4PE-X/TE",            NT, "http://www.asus.com/999/html/events/mb/socket478/p4pe-x-te/overview.htm", NULL),
        B("ASUS",       "P4S533-X",             OK, NULL, NULL),
        B("ASUS",       "P4S800-MX",            OK, "http://www.asus.com/Motherboards/Intel_Socket_478/P4S800MX/", NULL),
# flashrom/flashrom -p internal -w P4P800SE-ASUS-1012.001
flashrom 0.9.9-115-g25fde40-dirty on FreeBSD 11.1-RELEASE (i386)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 4, resolution: 1ns).
Found chipset "Intel ICH5/ICH5R".
Enabling flash write... OK.
Enabling full flash access for board "ASUS P4P800SE"... OK.
Found PMC flash chip "Pm49FL004" (512 kB, LPC, FWH) mapped at physical address 0xfff80000.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

cli, chipname

Should it accept MX25L6406E and MX25L6408E for chip name? If not, and we need to provide "MX25L6406E/MX25L6408E" for chip name, why doesn't it appear in one piece on the supported chip list?

'''
Macronix MX25L6406E/ PREW 8192 SPI
MX25L6408E
'''

flashrom 1.2 doesn't build on aarch64-linux

The flashrom 1.2 fails to build on aarch64-linux platform with following, example on NixOS:

warning: ignoring the user-specified setting 'show-trace', because it is a restricted setting and you are not a trusted user
these derivations will be built:
  /nix/store/xn3j14fkrwx7kp5hw8y6w7q70lw3bqh9-flashrom-v1.2.tar.bz2.drv
  /nix/store/i0jr9ac4rhdbc5c0slypi35airr2sn8p-flashrom-1.2.drv
these paths will be fetched (0.34 MiB download, 1.69 MiB unpacked):
  /nix/store/01gfnyhy4bhzkpmbwmjxnwwr3j3ygxdn-pciutils-3.6.4
  /nix/store/8slc61jhfjjc72lvrllibq63sir8wwzk-libftdi-0.20
  /nix/store/9f4b297y86nhs23xwvbcb0fgxsgcwz77-libusb-compat-0.1.5
  /nix/store/l8a0sb0af1nsf93syrpylcmd6i0va2sk-libusb-1.0.23-dev
  /nix/store/mchviyg4qs0na767p7i0qh9bbrhqdyaj-libusb-compat-0.1.5-dev
copying path '/nix/store/01gfnyhy4bhzkpmbwmjxnwwr3j3ygxdn-pciutils-3.6.4' from 'https://cache.nixos.org'...
copying path '/nix/store/9f4b297y86nhs23xwvbcb0fgxsgcwz77-libusb-compat-0.1.5' from 'https://cache.nixos.org'...
building '/nix/store/xn3j14fkrwx7kp5hw8y6w7q70lw3bqh9-flashrom-v1.2.tar.bz2.drv'...
copying path '/nix/store/l8a0sb0af1nsf93syrpylcmd6i0va2sk-libusb-1.0.23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/mchviyg4qs0na767p7i0qh9bbrhqdyaj-libusb-compat-0.1.5-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/8slc61jhfjjc72lvrllibq63sir8wwzk-libftdi-0.20' from 'https://cache.nixos.org'...
trying https://download.flashrom.org/releases/flashrom-v1.2.tar.bz2
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  358k  100  358k    0     0   509k      0 --:--:-- --:--:-- --:--:--  509k
building '/nix/store/i0jr9ac4rhdbc5c0slypi35airr2sn8p-flashrom-1.2.drv'...
unpacking sources
unpacking source archive /nix/store/b4l06sy4cmdx0g673bfhjv25rvr5iwdk-flashrom-v1.2.tar.bz2
source root is flashrom-v1.2
setting SOURCE_DATE_EPOCH to timestamp 1581291272 of file flashrom-v1.2/versioninfo.inc
patching sources
updateAutotoolsGnuConfigScriptsPhase
configuring
no configure script, doing nothing
building
build flags: SHELL=/nix/store/2vbjxjz6yxdl74fcq2dhk45w07gk52dr-bash-4.4-p23/bin/bash
Replacing all version templates with v1.2.
Checking for a C compiler... found.
Target arch is unknown. Aborting.
make: *** [Makefile:1182: compiler] Error 1
builder for '/nix/store/i0jr9ac4rhdbc5c0slypi35airr2sn8p-flashrom-1.2.drv' failed with exit code 2
error: build of '/nix/store/i0jr9ac4rhdbc5c0slypi35airr2sn8p-flashrom-1.2.drv' failed```

Consider lowering memory footprint for read/write

In general flashrom is very memory light. But when it read from a flash ROM it allocates space for the whole ROM in memory. Fine on all modern hardware but flashrom is actually so well written I have got it running on 1980s hardware nicely and the limitation there is that the machines are RAM staved.

You might say well that is that but actually you could make flashrom just allocate enough for one chunk and then read/write after that chunk is used. I know its more work but please consider this a feature requrest for the future. Or perhaps make this option driver specific somehow.

Compilation fails with MingW due to missing strndup

I have tried to compile flashrom on Windows with MingW and ran to the following error:

libflashrom.c: In function 'flashrom_layout_parse_fmap':
libflashrom.c:389:4: error: implicit declaration of function 'strndup' [-Werror=implicit-function-declaration]
    strndup((const char *)fmap->areas[i].name, FMAP_STRLEN);
    ^~~~~~~
libflashrom.c:389:4: error: incompatible implicit declaration of built-in function 'strndup' [-Werror]
cc1.exe: all warnings being treated as errors
make: *** [libflashrom.o] Error 1

I am using gcc 6.3.0:

mm@mm-VBOX /v/Projektek/flashrom-gerrit
$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-i
sl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='Min
GW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libic
onv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)

What is the minimum supported MingW version? Since the strndup only used at one place would not it be possible to eliminate the usage of it?

Integrating with OSS-Fuzz

Greetings flashrom developers and contributors,

We’re reaching out because your project is an important part of the open source ecosystem, and we’d like to invite you to integrate with our fuzzing service, OSS-Fuzz. OSS-Fuzz is a free fuzzing infrastructure you can use to identify security vulnerabilities and stability bugs in your project. OSS-Fuzz will:

  • Continuously run at scale all the fuzzers you write.
  • Alert you when it finds issues.
  • Automatically close issues after they’ve been fixed by a commit.

Many widely used open source projects like OpenSSL, FFmpeg, LibreOffice, and ImageMagick are fuzzing via OSS-Fuzz, which helps them find and remediate critical issues.

Even though typical integrations can be done in < 100 LoC, we have a reward program in place which aims to recognize folks who are not just contributing to open source, but are also working hard to make it more secure.

We want to stress that anyone who meets the eligibility criteria and integrates a project with OSS-Fuzz is eligible for a reward.

If you're not interested in integrating with OSS-Fuzz, it would be helpful for us to understand why—lack of interest, lack of time, or something else—so we can better support projects like yours in the future.

If we’ve missed your question in our FAQ, feel free to reply or reach out to us at [email protected].

Thanks!

Tommy
OSS-Fuzz Team

FT(2)232H: broken GPIOL states during SPI read/write operations

I have a circuit where 4232H is connected to two SPI chips, where CS (chip select) is driven by 4232H GPIOLs 0 & 1. Even though it is possible to set GPIOL state with flashrom's csgpiol parameter, and chip detect operation would work correctly, all read & write operations will fail because flashrom will clear cs_bits. Actually, cs_bits represents a whole byte of values, out of which only single bit represents CS state, the rest lower bits are representing other 3 SPI pins (SCK, DO, DI) and 4 higher bits represent GPIOL bits 0-3:

flashrom/ft2232_spi.c

Lines 87 to 97 in 7bd31a4

/* The variables cs_bits and pindir store the values for the "set data bits low byte" MPSSE command that
* sets the initial state and the direction of the I/O pins. The pin offsets are as follows:
* SCK is bit 0.
* DO is bit 1.
* DI is bit 2.
* CS is bit 3.
*
* The default values (set below) are used for most devices:
* value: 0x08 CS=high, DI=low, DO=low, SK=low
* dir: 0x0b CS=output, DI=input, DO=output, SK=output
*/

In the the so called "Assert CS#" optimization attempt, the flashrom's ft2232_spi.c code sets all cs_bits to 0, which results in breaking desired csgpiol set by user:

buf[i++] = 0 & ~cs_bits; /* assertive */

By analyzing the USB traffic against same hardware setup on Windows machine that uses FTDI's (closed source?) LibMPSSE, it becomes clear that these CS assert & de-assert operations are performed only on CS bit, not the whole byte, resulting in the expected GPIOL states being preserved during read/write operations. I believe that flashrom should follow the same behaviour.

Can't build with CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no

Running make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no with revision ca598da from git master:

physmap.c:433:5: error: no previous prototype for 'setup_cpu_msr' [-Werror=missing-prototypes]
  433 | int setup_cpu_msr(int cpu)
      |     ^~~~~~~~~~~~~
physmap.c:455:6: error: no previous prototype for 'cleanup_cpu_msr' [-Werror=missing-prototypes]
  455 | void cleanup_cpu_msr(void)
      |      ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:1093: physmap.o] Error 1

Long Reading and Verifying on Rpi ft2232h W25Q128.V (~4m30s 16MB file)

Hello, i have trouble with programming falsh, because writing bin file is soo long.

real time delay is reading and verify procedure

Reading old flash chip contents     - ~2m12s
Erasing and writing flash chip      -    ~1s
Verifying flash                     - ~2m12s

my system:

pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.34-v7+ #1110 SMP Mon Apr 16 15:18:51 BST 2018 armv7l GNU/Linux
pi@raspberrypi:~ $ lsusb
Bus 001 Device 080: ID 0403:6010 Future Technology Devices International, Ltd FT2232C Dual USB-UART/FIFO IC
Bus 001 Device 104: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
Bus 001 Device 047: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 046: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

try write bin 16MB file
===============WRITE BIN

pi@raspberrypi:~/codes/ire_028 $ ls -l full_write_file.bin
-rw-r--r-- 1 pi pi 16777216 Jan 16 22:40 full_write_file.bin


pi@raspberrypi:~/codes/ire_028 $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -w full_write_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

real    4m25.709s
user    0m10.647s
sys     0m20.407s
===============READ BIN
pi@raspberrypi:~ $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -r read_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading flash... done.

real    2m13.035s
user    0m4.688s
sys     0m11.183s

pi@raspberrypi:~/codes/ire_028 $ ls -l read_file.bin
-rw-r--r-- 1 root root 16777216 Jan 16 22:38 read_file.bin

layout image burn is same effect:

===============WRITE BIN layout image
pi@raspberrypi:~/codes/ire_028 $ ls -l layout_write_file.bin
-rw-r--r-- 1 pi pi 16777216 Jan 16 22:52 layout_write_file.bin

pi@raspberrypi:~/codes/ire_028 $ cat rom.layout
00000000:00100000 image_one

pi@raspberrypi:~/codes/ire_028 $ time sudo flashrom -p ft2232_spi:type=2232H,port=A -c W25Q128.V -l rom.layout -i mprime -w layout_write_file.bin
flashrom v0.9.9-r1954 on Linux 4.14.34-v7+ (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using region: "mprime".
Calibrating delay loop... OK.
Found Winbond flash chip "W25Q128.V" (16384 kB, SPI) on ft2232_spi.
Reading old flash chip contents... done.
Erasing and writing flash chip... Erase/write done.
Verifying flash... VERIFIED.

real    4m25.941s
user    0m10.555s
sys     0m22.149s

thanks !

util/getrevision.sh missing from releases

I discovered that the file util/getrevision.sh is missing from the release packages on github and on the coreboot website. I picked approx. 3 of the newer releases in tar.gz and zip form to try to verify this for different versions.
Without this file, no version info is compiled into the flashrom executable, running flashrom --version does show double empty spaces around where I would expect the version info (github seems to discard multiple spaces here):
flashrom on Linux 4.4.0-53-generic (x86_64)
Also make complains, but runs nevertheless:

make: ./util/getrevision.sh: Command not found
make: ./util/getrevision.sh: Command not found
Replacing all version templates with .

Flash chip detect error

When I try to program mx25l51245g chip in Windows 10 LTS, flashrom will detect as mx66l51235 by mistake, then cause program failed! But in the Windows 10 1809 version of the system is normal.

Flashrom Version: v1.1-rc1
Programmer: stm32-vserprog-v3

Erase fails on some W25Q128FV and W25Q128JV using Raspberry Pi 2

EDIT: See the solution at the bottom. Can someone update the Wiki, please?

My programmer is a Raspberry Pi 2.
I have two batches of W25Q128FVs and one of W25Q128JVs.
One of the W25Q128FV batches can be erased and written perfectly using flashrom.
The other one and the W25Q128JV batch fail to erase the chip.
All of these chips can be erased and written on OpenWrt routers.
Even stranger: The batch that can be erased using flashrom can't be erased using a TL866 II Plus, while the others work perfectly fine.

GigaDevice chips GD25B64CSIG & GD25B128CSIG

Unless I'm mistaken.... It seems to be lacking support entirely for the smaller chip.
And perhaps it's just me but the larger chip although being detected as an identified chip, regardless of what chip type is selected manually I cannot get a consistent read. I'm unsure if it's because the chip isn't an exact match (which seems likely) or if it's due to something else. I'm using an RPi3B+ and a test clip. I know my power supply is adequate for my Pi, jumper wires are brand new, and short...I have tried multiple spispeed= parameters to no avail. Interested in figuring this out be it helping someone test things with my chips, or attempting to edit my own drivers from the datasheet.. but I will admit I would be completely out of my depth when it comes to code, so here's hoping the guides in the Wiki are REALLY good.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.