Creating bootable media for depthcharge based devices

Depthcharge, the ChromeOS bootloader, is one of the available payloads for coreboot (and also Libreboot) and as such mostly found on Chromebooks. This guide shows how to create bootable media, e.g. an installation media USB drive, for those devices.

Installing required tools
The guide assumes that the current platform is a Gentoo Linux one. The majority of steps however can be performed from any distribution, just translate the Gentoo-specific way of doing things (such as installing software) to the other distribution's practices.

Install, , and :

Some drivers might also require proprietary firmware available from.

Preparing the partitions
This is the recommended partition layout and size:

Depthcharge requires some specific parameters to be set. These signal the bootloader the presence of a valid kernel partition:

Create a filesystem on the root partition and mount it:

Install a Gentoo rootfs
Get a stage3 tarball from the main website's download section that is suitable for the architecture (e.g. ) of the target device and extract it to the bootable media's root filesystem:

Switch the bootable media’s Gentoo to unstable to ensure the availability of the latest version of and speed up the bootable media. Replace with the target device's architecture, e.g.  for ARMv7-A based devices.

Set the bootable media’s root password to “gentoo”, cf. Setting a default root password:

Finish this step by unmounting the bootable media’s root filesystem:

Creating a cross-compiler
Create a local overlay for the cross toolchain. Follow Custom repository for crossdev, section "Crossdev", on the Gentoo wiki.

Then install and create the cross toolchain. Replace with the system tuple fitting the target architecture, e.g.  for ARMv7-A based target devices with at least VFPv3-D16 (also commonly referred to as hardfloat, HardFP or hf).

Finally prepare cross-compiling the kernel. Replace with the target device's architecture, e.g.  for ARMv7-A based devices and replace  again with the system tuple fitting the target architecture, e.g. . Mind the trailing "".

Configuring the Linux kernel
If all necessary drivers are built into the kernel (i.e. no loadable modules are needed to boot the target device) there's no need to have an initramfs, which keeps things simple. Especially if the host system's architecture differs from the target device's architecture creating an initramfs would at least involve cross-compiling busybox. With that in mind configure as usual, cf. Configuring the Linux kernel.

Build the kernel and device tree binaries:

From the kernel build directory, copy the zImage and the target device's device tree binary to the desired working directory. Replace with the filename of the target device's device tree binary, e.g.  for the Asus Chromebook C201 (which is based on Rockchip's RK3288 SoC and a board with the codename "Veyron Speedy").

Change to the desired working directory:

Create the configuration file for the FIT image with the following content. Again replace with the filename of the target device's device tree binary, e.g.  for the Asus Chromebook C201.

Pack the FIT image:

Create a file that contains the CMDLINE parameters.

Sign and pack the kernel:

Install the kernel to the kernel partition.

Finalizing
Now boot the target device from the created media, log in and configure the network. Once the network connection is working prepare Portage:

Finally install required tools,, , and :

External resources

 * PDF: Additional information on depthcharge: Google, Depthcharge - The ChromeOS bootloader (PDF), ChromeOS firmware summit, 2014. Retrieved on June 21st, 2019