Pi Zero W Flashrom and USB Gadget Debug

 

dd Raspbian image to microsd:

dd bs=4M if=2017-03-02-raspbian-jessie.img of=/dev/sdb status=progress

Boot from SD (Pi Zero will not start without it).
Connect to wireless.
Enable SSH on startup:

sudo systemctl enable ssh
sudo systemctl start ssh

Flashrom:

Log in over SSH and enable the SPI:

sudo vim /boot/config.txt

and uncomment:

dtparam=spi=on

Then reboot.

Install libraries necessary to compile ChromeOS Flashrom:

sudo apt install libpci-dev libfdt-dev libusb-dev libusb-1.0-0-dev

Clone ChromeOS Flashrom master:

git clone https://chromium.googlesource.com/chromiumos/third_party/flashrom

Build it:

make CONFIG_SATAMV=0 CONFIG_LINUX_I2C=yes NOWARNERROR=yes CONFIG_LINUX_SPI=yes

Test with:

flashrom/flashrom -V -r backup.rom -p linux_spi:dev=/dev/spidev1.0

USB Debug Gadget

The usual update routine:

sudo apt-get update -y
sudo apt-get upgrade -y

Update the kernel:

sudo rpi-update

Get rpi-source:

sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source

Make it executable:

sudo chmod +x /usr/bin/rpi-source

Tell the update mechanism that this is the latest version of the script:

/usr/bin/rpi-source -q --tag-update

Get the kernel files thingies:

rpi-source
cd linux

Enable g_dbgp in menuconfig as a module – Device Drivers -> USB Support -> USB Gadget Support -> EHCI Debug Device Gadget:

make menuconfig

Prepare the newly selected module(s) for actual building:

make modules_prepare

Apply updated 4.x EHCI debug patches:

tar -xJf debug_patches.tar.xz
patch -p0 < dbgp.patch
patch -p0 < gadget.patch
patch -p0 < u_serial.patch

Continue reading Pi Zero W Flashrom and USB Gadget Debug