1-------------------------------------------------------------------------------
2flashrom README
3-------------------------------------------------------------------------------
4
5flashrom is a utility for detecting, reading, writing, verifying and erasing
6flash chips. It is often used to flash BIOS/EFI/coreboot/firmware images
7in-system using a supported mainboard, but it also supports flashing of network
8cards (NICs), SATA controller cards, and other external devices which can
9program flash chips.
10
11It supports a wide range of flash chips (most commonly found in SOIC8, DIP8,
12SOIC16, WSON8, PLCC32, DIP32, TSOP32, and TSOP40 packages), which use various
13protocols such as LPC, FWH, parallel flash, or SPI.
14
15Do not use flashrom on laptops (yet)! The embedded controller (EC) present in
16many laptops might interact badly with any attempts to communicate with the
17flash chip and may brick your laptop.
18
19Please make a backup of your flash chip before writing to it.
20
21Please see the flashrom(8) manpage.
22
23
24Packaging
25---------
26
27To package flashrom and remove dependencies on Git, either use
28make export
29or
30make tarball
31
32'make export' will export all flashrom files from the Git repository at
33revision HEAD into a directory named "$EXPORTDIR/flashrom-$RELEASENAME"
34and will additionally add a "versioninfo.inc" file in that directory to
35contain the Git revision of the exported tree and a date for the manual
36page.
37
38'make tarball' will simply tar up the result of make export and compress
39it with bzip2.
40
41The snapshot tarballs are the result of 'make tarball' and require no
42further processing.
43
44
45Build Instructions
46------------------
47
48To build flashrom you need to install the following software:
49
50 * pciutils+libpci (if you want support for mainboard or PCI device flashing)
51 * libusb (if you want FT2232, Dediprog or USB-Blaster support)
52 * libftdi (if you want FT2232 or USB-Blaster support)
53 * libjaylink (if you want support for SEGGER J-Link and compatible devices)
54
55Linux et al:
56
57 * pciutils / libpci
58 * pciutils-devel / pciutils-dev / libpci-dev
59 * zlib-devel / zlib1g-dev (needed if libpci was compiled with libz support)
60
61On FreeBSD, you need the following ports:
62
63 * devel/gmake
64 * devel/libpci
65
66On OpenBSD, you need the following ports:
67
68 * devel/gmake
69 * sysutils/pciutils
70
71To compile on Linux, use:
72
73 make
74
75To compile on FreeBSD, OpenBSD or DragonFly BSD, use:
76
77 gmake
78
79To compile on Nexenta, use:
80
81 make
82
83To compile on Solaris, use:
84
85 gmake LDFLAGS="-L$pathtolibpci" CC="gcc -I$pathtopciheaders" CFLAGS=-O2
86
87To compile on NetBSD (with pciutils, libftdi, libusb installed in /usr/pkg/), use:
88
89 gmake
90
91To compile and run on Darwin/Mac OS X:
92
93 Install DirectHW from coresystems GmbH.
94 DirectHW is available at http://www.coreboot.org/DirectHW .
95
96To cross-compile on Linux for DOS:
97
98 Get packages of the DJGPP cross compiler and install them:
99 djgpp-filesystem djgpp-gcc djgpp-cpp djgpp-runtime djgpp-binutils
100 As an alternative, the DJGPP web site offers packages for download as well:
101 djcross-binutils-2.29.1-1ap.x86_64.rpm
102 djcross-gcc-7.2.0-1ap.x86_64.rpm
103 djcrx-2.05-5.x86_64.rpm
104 The cross toolchain packages for your distribution may have slightly different
105 names (look for packages named *djgpp*).
106
107 Alternatively, you could use a script to build it from scratch:
108 https://github.com/andrewwutw/build-djgpp
109
110 You will need the libpci and libgetopt library source trees and
111 their compiled static libraries and header files installed in some
112 directory say libpci-libgetopt/, which will be later specified with
113 LIBS_BASE parameter during flashrom compilation. Easiest way to
114 handle it is to put pciutils, libgetopt and flashrom directories
115 in one subdirectory. There will be an extra subdirectory libpci-libgetopt
116 created, which will contain compiled libpci and libgetopt.
117
118 Download pciutils 3.5.6 and apply http://flashrom.org/File:Pciutils-3.5.6.patch.gz
119 Compile pciutils, using following command line:
120
121 make ZLIB=no DNS=no HOST=i386-djgpp-djgpp CROSS_COMPILE=i586-pc-msdosdjgpp- \
122 PREFIX=/ DESTDIR=$PWD/../libpci-libgetopt \
123 STRIP="--strip-program=i586-pc-msdosdjgpp-strip -s" install install-lib
124
125 Download and compile with 'make' http://flashrom.org/File:Libgetopt.tar.gz
126
127 Copy the libgetopt.a to ../libpci-libgetopt/lib and
128 getopt.h to ../libpci-libgetopt/include
129
130 Enter the flashrom directory.
131
132 make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip LIBS_BASE=../libpci-libgetopt/ strip
133
134 If you like, you can compress the resulting executable with UPX:
135
136 upx -9 flashrom.exe
137
138 To run flashrom.exe, download http://flashrom.org/File:Csdpmi7b.zip and
139 unpack CWSDPMI.EXE into the current directory or one in PATH.
140
141To cross-compile on Linux for Windows:
142
143 Get packages of the MinGW cross compiler and install them:
144 mingw32-filesystem mingw32-cross-cpp mingw32-cross-binutils mingw32-cross-gcc
145 mingw32-runtime mingw32-headers
146 The cross toolchain packages for your distribution may have slightly different
147 names (look for packages named *mingw*).
148 PCI-based programmers (internal etc.) are not supported on Windows.
149 Run (change CC= and STRIP= settings where appropriate)
150 make CC=i686-w64-mingw32-gcc STRIP=i686-w64-mingw32-strip
151
152Processor architecture dependent features:
153
154 On non-x86 architectures a few programmers don't work (yet) because they
155 use port-based I/O which is not directly available on non-x86. Those
156 programmers will be disabled automatically if you run "make".
157
158Compiler quirks:
159
160If you are using clang and if you want to enable only one driver, you may hit an
161overzealous compiler warning from clang. Compile with "make WARNERROR=no" to
162force it to continue and enjoy.
163
164Installation
165------------
166
167In order to install flashrom and the manpage into /usr/local, type:
168
169 make install
170
171For installation in a different directory use DESTDIR, e.g. like this:
172
173 make DESTDIR=/usr install
174
175If you have insufficient permissions for the destination directory, use sudo
176by adding sudo in front of the commands above.
177
178
179Contact
180-------
181
182The official flashrom website is:
183
184 http://www.flashrom.org/
185
186The IRC channel is
187
188 #flashrom at irc.freenode.net
189
190The mailing list address is
191
192 flashrom@flashrom.org
193