Categories
Articles

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!