Asus Chromebook C201/Installing Gentoo

From Gentoo Wiki
Jump to:navigation Jump to:search

This guide is about installing Gentoo on an Asus Chromebook C201.

Additional hardware requirements

  • USB ethernet adapter
Gentoo’s ARMv7-A stage3 tarballs don’t include net-wireless/wpa_supplicant. While it is possible to install Gentoo leveraging solely the built-in wifi, a USB ethernet adapter can spare a lot of effort. Otherwise net-wireless/wpa_supplicant needs to be installed on the installation media which probably involves a bit of cross-compilation.

Obtaining installation media

Consult the guide on creating bootable media for depthcharge based devices for instructions on how to manually create the installation media.

Preparing the device

To be able to boot from external media like USB drives, the Asus Chromebook C201 first needs to be switched into developer mode[1].

This can be achieved by pressing Esc+Refresh+Power when the device is switched off to enter the recovery mode screen.

Pressing Ctrl+D and then following subsequent on-screen instructions enables the developer mode.

Finally one of the verified boot parameters needs to be modified: Boot the device and enter Chrome OS' crosh shell, e.g. by opening Chromium Browser and hitting Ctrl+Alt+T. Enable booting from external media:

root #crossystem dev_boot_usb=1

Booting the installation media

Power on and when the boot screen is displayed press Ctrl+U to boot from the installation media. Log in (in case the installation media was manually created following the instructions referred to above the username is ‘root’ and the password is ‘gentoo’).

Configuring the installation media

Throughout these instructions the Gentoo Handbook for AMD64 (there is none for ARM) will be referenced a lot. In large parts the installation instructions from the Gentoo Handbooks are not too architecture specific. Nevertheless mind that discrepancy.

Begin with configuring the network.

Once a network connection is established make sure Portage is set up:

root #emerge-webrsync

Now install required tools (sys-block/parted and sys-boot/vboot-utils):

root #emerge --ask sys-block/parted sys-boot/vboot-utils

Creating a backup of the eMMC

This step is highly recommended, although optional.
The letter “X” in the following command needs to be replaced with the number corresponding to the internal eMMC storage.
root #dd if=/dev/mmcblkX of=/PATH/TO/ARBITRARY_BACKUP_LOCATION/c201backup.img

Preparing the disks

Cf. Preparing the disks.

Recommended partition layout and size - a GUID Partition Table (GPT) is mandatory:

/dev/mmcblkXp1 kernel partition 64MiB
/dev/mmcblkXp2 root partition available space
The letter “X” in the following commands needs to be replaced with the number corresponding to the internal eMMC storage.
This will delete all data on /dev/mmcblkX. Doublecheck e.g. with lsblk as on Google's 3.14 kernel, the eMMC storage is presented as mmcblk0, and the SD is presented as mmcblk2. On newer kernels, this can be reversed, with internal storage being mmcblk2.
root #parted /dev/mmcblkX mklabel gpt
root #parted -a optimal /dev/mmcblkX unit mib mkpart Kernel 1 65
root #parted -a optimal /dev/mmcblkX unit mib mkpart root 65 100%
If applicable, encrypt the root partition now. This makes an initramfs mandatory.

Finish the preparation of the partitions by creating a filesystem on the root partition. Replace ROOTFS_TYPE with any suitable filesystem type, e.g. ext4 or btrfs.

root #mkfs.ROOTFS_TYPE /dev/mmcblkXp2

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

root #cgpt add -i 1 -t kernel -l Kernel -S 1 -T 5 -P 15 /dev/mmcblkX

Mount the root partition:

root #mkdir /mnt/gentoo
root #mount /dev/mmcblkXp2 /mnt/gentoo

Installing the Gentoo installation files

Choose an ARMv7a|HardFP stage3 from the main website's download section or consider going for an armv7a_hardfp-musl stage3 from the Hardened musl project. Follow Installing the Gentoo installation files from the Handbook.

Installing the Gentoo base system

Skip "Mounting the boot partition", apart from that follow the Handbook for Installing the Gentoo base system.

At this point all subsequent actions continue to be performed inside the chroot environment immediately on the new Gentoo Linux installation.

Configuring the Linux kernel

Install the tools required for deploying the kernel (dev-embedded/u-boot-tools, sys-apps/dtc and sys-boot/vboot-utils):

root #emerge --ask dev-embedded/u-boot-tools sys-apps/dtc sys-boot/vboot-utils

Configure sys-kernel/gentoo-sources as usual, cf. Configuring the Linux kernel. Alternatively refer to the RockMyy repository to include Mali GPU drivers.

Building the kernel and device tree binaries

user $make -j5 zImage dtbs modules

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

user $cp -a arch/arm/boot/zImage /PATH/TO/ARBITRARY_WORKING_DIRECTORY

Optional: Creating a custom initramfs

Follow instructions from the Custom Initramfs article. Embed the initramfs into the kernel. Alternatively create it as a separate file (cf. Custom Initramfs - Creating a separate file):

user $find /PATH/TO/INITRAMFS/ -print0 | cpio --null --create --verbose --format=newc | gzip --best > /PATH/TO/ARBITRARY_WORKING_DIRECTORY/initrd.img

Creating the FIT image

Change to the directory where the kernel, the device tree binary and (optionally) the initramfs are located:


Create the configuration file ("gentoo.its") for the Flattened Image Tree (FIT) with the following content[2]. Again replace DTBINARY with the filename of the target device's device tree binary, e.g. rk3288-veyron-speedy.dtb for the Asus Chromebook C201.

If there is no need for an initramfs or it's embedded into the kernel, make sure to create the FIT configuration file without the ramdisk@1 section and the following reference to that section.
FILE gentoo.its

/ {
    description = "Linux kernel image with one or more FDT blobs";
    #address-cells = <1>;
    images {
            description = "vmlinuz";
            data = /incbin/("zImage");
            type = "kernel_noload";
            arch = "arm";
            os = "linux";
            compression = "none";
                algo = "sha1";
            description = "dtb";
            data = /incbin/("DTBINARY");
            type = "flat_dt";
            arch = "arm";
            compression = "none";
                algo = "sha1";
            description = "initrd.img";
            data = /incbin/("initrd.img");
            type = "ramdisk";
            arch = "arm";
            os = "linux";
            compression = "none";
                algo = "sha1";
    configurations {
        default = "conf@1";
            kernel = "kernel@1";
            fdt = "fdt@1";
            ramdisk = "ramdisk@1";

Pack the FIT image:

user $sync
user $mkimage -f gentoo.its gentoo.itb

Preparing verified boot

Create a file ("kernel.flags") for the CMDLINE parameters. Replace ROOTFS_TYPE with the root partition's filesystem type, e.g. ext4 or btrfs.

If a custom initramfs is used it is likely that this file can be left empty, though setting the console might still prove useful.
FILE kernel.flags
console=tty1 root=/dev/mmcblkXp2 rootfstype=ROOTFS_TYPE rootwait

Sign and pack the kernel:

user $sync
user $futility --debug vbutil_kernel --arch arm --version 1 --keyblock /usr/share/vboot/devkeys/kernel.keyblock --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --bootloader kernel.flags --config kernel.flags --vmlinuz gentoo.itb --pack vmlinuz.signed

Installing the kernel

Install the modules, keeping them small to save some space:

root #make INSTALL_MOD_STRIP=1 modules_install
The letter “X” in the following command needs to be replaced with the number corresponding to the internal eMMC storage.

Install the kernel image to the kernel partition:

root #sync && dd if=vmlinuz.signed of=/dev/mmcblkXp1

Configuring the system

Consult the Handbook again for Configuring the system.

Installing system tools

Stick with the Handbook: Installing system tools

Skip the chapter Configuring the bootloader (this one) in the Handbook, as the bootloader (depthcharge) is part of the C201's system firmware.


Finalize the new Gentoo installation according to the handbook. To use wifi remember to install net-wireless/wpa_supplicant:

root #emerge –ask net-wireless/wpa-supplicant

Also keep in mind that the built-in wifi requires proprietary firmware.

External resources


  1. Developer mode screen, Libreboot documentation on depthcharge. Retrieved on February 25th, 2019
  2. Installing Debian On ASUS C201, DebianOn. Retrieved on February 26th, 2019