0001 ==============================
0002 Upgrading BIOS using spi-intel
0003 ==============================
0004
0005 Many Intel CPUs like Baytrail and Braswell include SPI serial flash host
0006 controller which is used to hold BIOS and other platform specific data.
0007 Since contents of the SPI serial flash is crucial for machine to function,
0008 it is typically protected by different hardware protection mechanisms to
0009 avoid accidental (or on purpose) overwrite of the content.
0010
0011 Not all manufacturers protect the SPI serial flash, mainly because it
0012 allows upgrading the BIOS image directly from an OS.
0013
0014 The spi-intel driver makes it possible to read and write the SPI serial
0015 flash, if certain protection bits are not set and locked. If it finds
0016 any of them set, the whole MTD device is made read-only to prevent
0017 partial overwrites. By default the driver exposes SPI serial flash
0018 contents as read-only but it can be changed from kernel command line,
0019 passing "spi_intel.writeable=1".
0020
0021 Please keep in mind that overwriting the BIOS image on SPI serial flash
0022 might render the machine unbootable and requires special equipment like
0023 Dediprog to revive. You have been warned!
0024
0025 Below are the steps how to upgrade MinnowBoard MAX BIOS directly from
0026 Linux.
0027
0028 1) Download and extract the latest Minnowboard MAX BIOS SPI image
0029 [1]. At the time writing this the latest image is v92.
0030
0031 2) Install mtd-utils package [2]. We need this in order to erase the SPI
0032 serial flash. Distros like Debian and Fedora have this prepackaged with
0033 name "mtd-utils".
0034
0035 3) Add "spi_intel.writeable=1" to the kernel command line and reboot
0036 the board (you can also reload the driver passing "writeable=1" as
0037 module parameter to modprobe).
0038
0039 4) Once the board is up and running again, find the right MTD partition
0040 (it is named as "BIOS")::
0041
0042 # cat /proc/mtd
0043 dev: size erasesize name
0044 mtd0: 00800000 00001000 "BIOS"
0045
0046 So here it will be /dev/mtd0 but it may vary.
0047
0048 5) Make backup of the existing image first::
0049
0050 # dd if=/dev/mtd0ro of=bios.bak
0051 16384+0 records in
0052 16384+0 records out
0053 8388608 bytes (8.4 MB) copied, 10.0269 s, 837 kB/s
0054
0055 6) Verify the backup::
0056
0057 # sha1sum /dev/mtd0ro bios.bak
0058 fdbb011920572ca6c991377c4b418a0502668b73 /dev/mtd0ro
0059 fdbb011920572ca6c991377c4b418a0502668b73 bios.bak
0060
0061 The SHA1 sums must match. Otherwise do not continue any further!
0062
0063 7) Erase the SPI serial flash. After this step, do not reboot the
0064 board! Otherwise it will not start anymore::
0065
0066 # flash_erase /dev/mtd0 0 0
0067 Erasing 4 Kibyte @ 7ff000 -- 100 % complete
0068
0069 8) Once completed without errors you can write the new BIOS image::
0070
0071 # dd if=MNW2MAX1.X64.0092.R01.1605221712.bin of=/dev/mtd0
0072
0073 9) Verify that the new content of the SPI serial flash matches the new
0074 BIOS image::
0075
0076 # sha1sum /dev/mtd0ro MNW2MAX1.X64.0092.R01.1605221712.bin
0077 9b4df9e4be2057fceec3a5529ec3d950836c87a2 /dev/mtd0ro
0078 9b4df9e4be2057fceec3a5529ec3d950836c87a2 MNW2MAX1.X64.0092.R01.1605221712.bin
0079
0080 The SHA1 sums should match.
0081
0082 10) Now you can reboot your board and observe the new BIOS starting up
0083 properly.
0084
0085 References
0086 ----------
0087
0088 [1] https://firmware.intel.com/sites/default/files/MinnowBoard%2EMAX_%2EX64%2E92%2ER01%2Ezip
0089
0090 [2] http://www.linux-mtd.infradead.org/