README.md 2.55 KB
Newer Older
1 2 3
Chromebook Firmware Utilities
-----------------------------

4
# Installing
5

6 7 8
This repository contains tools to build and flash Chromebook firmwares.  It
uses Git LFS in order to manage binary files, so please follow these steps to
be able to use it:
9 10

```
11
sudo apt install git-lfs  # on Debian...
12 13 14 15 16 17
git clone https://gitlab.collabora.com/chromium/flash-tools.git
cd flash-tools
git lfs fetch
git lfs checkout
```

18 19 20 21 22 23
# Flashing

The [`servoflash.py`](https://gitlab.collabora.com/chromium/flash-tools/-/blob/master/servoflash.py) tool can be used to flash firmware images onto Chromebook
devices using a Servo interface.  It uses a specific `flashrom` binary with its
library dependencies copied from the Chromium OS SDK.  They can be found in the
local `bin` and `lib` directories in this repository.
24

25 26 27 28 29 30 31
To flash a firmware image, the target device needs to be in the Google Servo
config file which is typically `/etc/google-servo.conf`.  This is where the
device serial numbers are associated with their names.  There also needs to be
a `servod` service running to be able to access the device.

Here's a sample command to flash a firmware, given all the preconditions
mentioned above are met:
32 33 34 35 36 37 38 39 40

```
./servoflash.py \
  --device=rk3399-gru-kevin-cbg-0 \
  --firmware=depthcharge-rk3399-gru-kevin-20180806.dev.bin
```

It can take a few minutes.  There should be these messages around the end,
which can vary depending on the type of Chromebook:
41

42 43 44 45
```
Erasing and writing flash chip... Verifying flash... VERIFIED.
SUCCESS
```
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70

# Building

The Chromebook firmware needs to be rebuilt and flashed with extra patches and
configuration options turned on in order to enable the serial console in the
bootloader and boot with a kernel image and ramdisk supplied over TFTP
interactively.  The standard firmware shipped with the products is only
configured to boot the Chrome OS image present on the device, with no serial
console and no way to override it.  This is not suitable for automating the
Chromebook in a test lab such as LAVA, or for doing low-level kernel
development.

Building the firmware for a Chromebook can be non-trivial.  To make things
easier, this repository contains a Docker container and some helper scripts to
build firmware images for some known device types.

The
[`cros-build/bootstrap.sh`](https://gitlab.collabora.com/chromium/flash-tools/-/blob/master/cros-build/bootstrap.sh)
script can be used to create local directories, then build the Docker container
which will be using them and start it.  It takes only one argument which is the
device type.  For example:

```
./bootstrap.sh octopus
```