New ROM Release – 190915

Apart from automation being an end in itself, I wanted to be able to easily put new SeaBIOS payloads into the firmware mods, and ensure consistency. All the firmware mods now contain the same version of SeaBIOS (from the master branch), the major additional feature (for some models at least) being SD card support.

I expect to make further payload updates as and when salient features become available in SeaBIOS master. When an update is made there will be a small period (probably less than an hour) where the script goes into maintenance mode, and I test the payload on one of each of the last 4 generations of Chromebook (Sandy/Ivybridge, Haswell, Baytrail and Broadwell). Please use the community to direct all feedback.

Patch For linux_recovery.sh

It seems the ChromeOS recovery script isn’t working for me the last few weeks. It fails with:

ERROR: The config file isn't valid.

Looking at the script and config file, it’s because the config file is currently coming in with a line space in each model stanza, which means the script thinks the first and second halves of the stanza are actually separate stanzas.

I fixed it with the following patch:

--- linux_recovery.sh 2014-12-16 04:00:00.000000000 +0000
+++ linux_recovery.new 2015-09-07 14:53:00.771904673 +0100
@@ -381,6 +381,9 @@
 sha1)
 sha1="$val"
 ;;
+ *)
+ skipping=yes
+ ;;
 esac
 else
 # Between paragraphs. Time to check what we've found so far.

Basically what it’s doing here is saying, “if we don’t find a valid recognised key (or indeed we find an empty line ;) skip that line”. Does the job …

Save the above text to linux_recovery.patch and apply it with:

patch -p0 < linux_recovery.patch

Now, if someone can tell me where to find valid HWID’s, I’d appreciate it, as the config file doesn’t have them any more. Note: this doesn’t fix the script as a whole. Seems to be pretty broken ATM.

Donate for Chromebook + SeaBIOS support.

So, you made it here – well done.

All donations towards infrastructure & Chromebooks are gratefully received. You can use one of the buttons in the sidebar to do so.

Please note: regardless of donation, I do not provide support for putting Windows on Chromebooks, as a matter of choice.

Please also note: this website, and my exploits herein, have absolutely no association with my employer.

Thank you & happy computing.

EHCI Debug Gadget & ChromeOS Flashrom on BBB in Arch Linux

su root
cd

EHCI Debug Gadget

pacman -Syu wget
reboot
wget http://www.coreboot.org/images/8/88/Ehci-debug-gadget-patches.tar.gz
tar -xzf Ehci-debug-gadget-patches.tar.gz
cp usbdebug-gadget/g_dbgp.ko /lib/modules/`uname -r`/kernel/drivers/usb/gadget
cat /dev/ttyGS0

ChromeOS Flashrom

pacman -Syu git make gcc dtc
git clone https://chromium.googlesource.com/chromiumos/third_party/flashrom -b firmware-nyan-5771.B
cd flashrom
make CONFIG_SATAMV=0 CONFIG_LINUX_I2C=yes NOWARNERROR=yes CONFIG_LINUX_SPI=yes
cd
echo BB-SPIDEV0 > /sys/devices/platform/bone_capemgr/slots
flashrom/flashrom -p linux_spi:dev=/dev/spidev1.0

 

Procedure for building ChromeOS Flashrom on BeagleBone Black

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.

ntpdate ntp0.esat.net

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.

Procedure to get sound working in Fedora 22 on ASUS C300 Chromebook

This will probably work with other distro’s/Baytrail Chromebook models.

  1. Get to a terminal.
  2. Type “alsamixer”.
  3. Press the brightness down key AKA F6.
  4. Find “Left Speaker Mixer Left DAC” and press “m” to unmute.
  5. Find “Right Speaker Mixer Right DAC” and press “m” to unmute.
  6. Update your distro to hopefully as new a kernel as possible (mine went to 4.1.4-200). This ensures that the sound card has the latest available firmware.
  7. Reboot.
  8. Enjoy shiny (and possibly slightly dodgy) sound.

Test ASUS C300 SeaBIOS image with full SD/eMMC support

Thanks to Kevin O’Connor’s brilliant work this week, I now have an image for you to test. Please bear in mind that I’ve only tested this to the extent that I’ve loaded Fedora 22 onto the eMMC and booted from it. There is no guarantee that it won’t do something horrid to your data, so don’t put anything important on there unless you have a backup.

As the keyboard doesn’t yet work in syslinux using the new image, you’ll have to use the latest image from the script to boot your LiveUSB, install you distro to the eMMC, and then flash the test image to get it to boot from the eMMC.

https://johnlewis.ie/asus-c300-test.cbfs

28279d9a9f7b4d7a2d5cb443beac0080

https://johnlewis.ie/Chromebook-ROMs/utils/flashrom

c1ae2905688a04be992526be38fff11d

(From where the files are downloaded).

sudo ./flashrom -w -i BOOT_STUB:asus-c300-test.cbfs

Link to the code:

https://github.com/KevinOConnor/seabios/tree/baytrail-testing

Baytrail WIP

Thanks to some big, recent donations I’ve managed to pick up an ASUS C300 and I’m working with Kevin O’Conner (of the SeaBIOS project) to get upstream SeaBIOS working properly on Baytrail Chromebooks.

What’s been found so far:

  1. Interrupts are not working at all, hence why the boot menu gets stuck.
  2. At least on some of the Baytrail Chromebooks, the SD/eMMC controller is in ACPI mode which SeaBIOS doesn’t currently pick up, hence why the eMMC and SD cards won’t work at all, at boot, on some models.
  3. Once interrupts are (hopefully) working and an address hard-coded for the SD/eMMC controller, it should mean that the keyboard works (both internal and external), the boot menu doesn’t need a key press any more, and both eMMC and SD are bootable.

Hopefully won’t be too long before we have some good news for Baytrail hopefuls.

Build Your Own Baytrail BOOT_STUB

You’ll need git, gcc, ncurses-devel, iasl and possibly other tools installed.

Presumably from your home directory, run:

git clone https://github.com/KevinOConnor/seabios.git -b baytrail-testing baytrail-seabios

to download Kevin O’Connor’s Baytrail specific SeaBIOS sources. Change into the baytrail-seabios directory:

cd baytrail-seabios

Create a valid .config, and build:

echo -e 'CONFIG_COREBOOT=y\n# CONFIG_HARDWARE_IRQ is not set' > .config
make olddefconfig
make

and download the shellball for your device:

export MODEL=your_model_name
mkdir ${MODEL}
cd ${MODEL}
lftp https://johnlewis.ie/Chromebook-ROMs/shellballs/${MODEL}
mirror

Now we are going to prepare a new CBFS and download a statically linked cbfstool:

cp bios.bin bios.bin.new
wget https://johnlewis.ie/Chromebook-ROMs/utils/cbfstool
chmod +x cbfstool
./cbfstool bios.bin.new print

to confirm everything has gone okay so far. Now we have to remove the existing payloads, add a new one, plus config files, and write out the CBFS:

./cbfstool bios.bin.new remove -n fallback/vboot
./cbfstool bios.bin.new remove -n fallback/payload
./cbfstool bios.bin.new add-payload -n fallback/payload -f ../out/bios.bin.elf -c lzma
./cbfstool bios.bin.new add -n etc/boot-menu-message -f ../chromeos/etc/boot-menu-message -t raw
./cbfstool bios.bin.new add -n etc/boot-menu-key -f ../chromeos/etc/boot-menu-key -t raw
./cbfstool bios.bin.new add -n bootorder -f ../chromeos/bootorder -t raw
./cbfstool bios.bin.new add-int -i 0xd091f000 -n etc/sdcard0
./cbfstool bios.bin.new add-int -i 0xd091c000 -n etc/sdcard1
dd bs=1M skip=7 if=bios.bin.new of=bios.cbfs.new

Time to get flashy:

wget https://johnlewis.ie/Chromebook-ROMs/utils/flashrom
chmod +x flashrom
sudo ./flashrom -w -i BOOT_STUB:bios.cbfs.new

Assuming you haven’t received any errors thus far, it may be safe to reboot. Didn’t work? Something went wrong? Get yourself a RPi/BBB, suitable jumper wires, and Pomona 5250 SOIC clip!