Mika Westerberg | 8afda8b | 2016-11-28 15:06:24 +0300 | [diff] [blame] | 1 | Upgrading BIOS using intel-spi |
| 2 | ------------------------------ |
| 3 | |
| 4 | Many Intel CPUs like Baytrail and Braswell include SPI serial flash host |
| 5 | controller which is used to hold BIOS and other platform specific data. |
| 6 | Since contents of the SPI serial flash is crucial for machine to function, |
| 7 | it is typically protected by different hardware protection mechanisms to |
| 8 | avoid accidental (or on purpose) overwrite of the content. |
| 9 | |
| 10 | Not all manufacturers protect the SPI serial flash, mainly because it |
| 11 | allows upgrading the BIOS image directly from an OS. |
| 12 | |
| 13 | The intel-spi driver makes it possible to read and write the SPI serial |
| 14 | flash, if certain protection bits are not set and locked. If it finds |
| 15 | any of them set, the whole MTD device is made read-only to prevent |
| 16 | partial overwrites. By default the driver exposes SPI serial flash |
| 17 | contents as read-only but it can be changed from kernel command line, |
| 18 | passing "intel-spi.writeable=1". |
| 19 | |
| 20 | Please keep in mind that overwriting the BIOS image on SPI serial flash |
| 21 | might render the machine unbootable and requires special equipment like |
| 22 | Dediprog to revive. You have been warned! |
| 23 | |
| 24 | Below are the steps how to upgrade MinnowBoard MAX BIOS directly from |
| 25 | Linux. |
| 26 | |
| 27 | 1) Download and extract the latest Minnowboard MAX BIOS SPI image |
| 28 | [1]. At the time writing this the latest image is v92. |
| 29 | |
| 30 | 2) Install mtd-utils package [2]. We need this in order to erase the SPI |
| 31 | serial flash. Distros like Debian and Fedora have this prepackaged with |
| 32 | name "mtd-utils". |
| 33 | |
| 34 | 3) Add "intel-spi.writeable=1" to the kernel command line and reboot |
| 35 | the board (you can also reload the driver passing "writeable=1" as |
| 36 | module parameter to modprobe). |
| 37 | |
| 38 | 4) Once the board is up and running again, find the right MTD partition |
| 39 | (it is named as "BIOS"): |
| 40 | |
| 41 | # cat /proc/mtd |
| 42 | dev: size erasesize name |
| 43 | mtd0: 00800000 00001000 "BIOS" |
| 44 | |
| 45 | So here it will be /dev/mtd0 but it may vary. |
| 46 | |
| 47 | 5) Make backup of the existing image first: |
| 48 | |
| 49 | # dd if=/dev/mtd0ro of=bios.bak |
| 50 | 16384+0 records in |
| 51 | 16384+0 records out |
| 52 | 8388608 bytes (8.4 MB) copied, 10.0269 s, 837 kB/s |
| 53 | |
| 54 | 6) Verify the backup |
| 55 | |
| 56 | # sha1sum /dev/mtd0ro bios.bak |
| 57 | fdbb011920572ca6c991377c4b418a0502668b73 /dev/mtd0ro |
| 58 | fdbb011920572ca6c991377c4b418a0502668b73 bios.bak |
| 59 | |
| 60 | The SHA1 sums must match. Otherwise do not continue any further! |
| 61 | |
| 62 | 7) Erase the SPI serial flash. After this step, do not reboot the |
| 63 | board! Otherwise it will not start anymore. |
| 64 | |
| 65 | # flash_erase /dev/mtd0 0 0 |
| 66 | Erasing 4 Kibyte @ 7ff000 -- 100 % complete |
| 67 | |
| 68 | 8) Once completed without errors you can write the new BIOS image: |
| 69 | |
| 70 | # dd if=MNW2MAX1.X64.0092.R01.1605221712.bin of=/dev/mtd0 |
| 71 | |
| 72 | 9) Verify that the new content of the SPI serial flash matches the new |
| 73 | BIOS image: |
| 74 | |
| 75 | # sha1sum /dev/mtd0ro MNW2MAX1.X64.0092.R01.1605221712.bin |
| 76 | 9b4df9e4be2057fceec3a5529ec3d950836c87a2 /dev/mtd0ro |
| 77 | 9b4df9e4be2057fceec3a5529ec3d950836c87a2 MNW2MAX1.X64.0092.R01.1605221712.bin |
| 78 | |
| 79 | The SHA1 sums should match. |
| 80 | |
| 81 | 10) Now you can reboot your board and observe the new BIOS starting up |
| 82 | properly. |
| 83 | |
| 84 | References |
| 85 | ---------- |
| 86 | |
| 87 | [1] https://firmware.intel.com/sites/default/files/MinnowBoard.MAX_.X64.92.R01.zip |
| 88 | [2] http://www.linux-mtd.infradead.org/ |