Why do this? – Because you want to try to make sure you have a version of flashrom that will recognise all Chromebook SPI chips. Also, you may just want to write an area of the ROM instead of the whole thing (such as BOOT_STUB or RW_LEGACY) and upstream Flashrom doesn’t allow you to do that.
Before beginning you will need to make sure your BBB is connected to the internet. If you’re connecting using the micro-USB cable, you will need to do some network setup. On the computer the BBB is attached to run:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 192.168.7.0/24 -o wlp1s0 -j MASQUERADE
Where wlp1s0 is the name of the internet connected interface on the BBB attached computer.
On the BBB run:
route add default gw 192.168.7.1
Also make sure you have a valid DNS server/forwarder entered in /etc/resolv.conf (nameserver=) and that you run ntpdate to make sure the BBB’s time and date are correct (for validation of HTTPS certs, and also making sure any rebuilds get done properly due to modification time) e.g.
Install essential dependencies:
apt-get install build-essential libpci-dev libfdt-dev
Clone a suitable branch of the ChromeOS Flashrom repo (I chose this one as a reasonably new ARM Chromebook’s Flashrom, so hopefully it’s quite up to date):
git clone https://chromium.googlesource.com/chromiumos/third_party/flashrom -b firmware-nyan-5771.B
Change into the flashrom directory and run:
make CONFIG_SATAMV=0 CONFIG_LINUX_I2C=yes NOWARNERROR=yes CONFIG_LINUX_SPI=yes
Follow the “spidev” setup instructions from https://blogs.fsfe.org/the_unconventional/2015/06/08/setting-up-a-beaglebone-black-to-flash-coreboot/
Reboot, and from your home directory run:
flashrom/flashrom -p linux_spi:dev=/dev/spidev1.0
You will getting an error about the EEPROM, but that means it’s working, believe it or not. :D
Test with a command such as:
flashrom/flashrom -p linux_spi:dev=/dev/spidev1.0 -w -i BOOT_STUB:some_boot_stub.cbfs
I’m not sure if “enjoy” is the right word.