Asus Chromebook C201

Specs
The 4gb variant is definitely preferable.
 * Internal name: veyron/speedy
 * SoC: Rockchip RK3288
 * CPU: Quad-core ARM Cortex-A17 @ 1.8 GHz
 * GPU: Mali T764
 * Audio: Rockchip I2S
 * 11.6" screen @ 1366x768
 * Ram: 2 or 4gb

What works and what doesn't
Mainline support is close to complete, so using should yield the best overall experience of all options.

Considerations

 * A USB ethernet dongle is recommended until Gentoo is running. Ensure the module is included with the kernel or built-in if using the Devsus script to create a bootable USB.
 * This laptop is speedy for its size, but still takes a long time to emerge larger packages. Heavy use of distcc and crossdev's armv7a-hardfloat-linux-gnueabi target during testing.
 * There is only 16GB of internal storage space available. Using an SD card for /home and a decent USB flash drive to compile larger packages on (firefox/libreoffice) is recommended.
 * Decide on using either a mainline kernel (>=sys-kernel/gentoo-sources-4.20 works) or the ChromeOS kernel (linux 3.14). Despite a large majority claiming loss of functionality on newer kernels, this was not the case during testing; in fact, it fixed several issues from harmless warning messages in logs to X locking up entirely.
 * Adding the arm_support overlay is recommended.
 * Backing up the ChromeOS partition (mmcblk0) is highly recommended, however it is not difficult restore ChromeOS after a failure. Create a restore USB medium through desktop Chrome or download the files manually to write to a USB drive.

Preparation
First, enable developer mode, unsigned boot and booting from external mediums. Look here for more information.

This laptop uses a depthcharge payload to boot, thus standard minimal ISOs will not work here. Creating a Devsus image and writing it to a flash drive to use for the installation medium is recommended. If this is done, modify the kernel config file to include modules for either brcmfmac SDIO or the USB wifi/ethernet dongle.

Once booted into the minimal environment and have obtained an internet connection via either wifi or an ethernet dongle, obtain from whatever distribution is running. We will now wipe ChromeOS and setup a partition for the kernel, and leave the rest for root.

Partition the rest of the free space as desired with gdisk. Put the root filesystem directly after the kernel partition.

If planning to use the kernel on a USB drive, simply dd it to the internal storage and copy all modules from it:

Optionally, copy the firmware blobs previously backed up earlier to lib/firmware on the internal storage root.

Base installation
At this point, follow generic stage3 install steps. Mount the root filesystem wherever and setup stage3/Portage:

Proceed to chroot and emerge world and whatever else.

4.20+ kernel deployment
Requirements:

Configure as usual. For reference adhere to the config provided here.

Build kernel and dtbs:

From the kernel build directory, copy the zImage and the rk3288-veyron-speedy.dtb to the desired working directory:

Create a Custom Initramfs. Create it as a separate file (cf. Custom Initramfs - Creating a separate file):

Change to the desired working directory:

Create the configuration file ("gentoo.its") for the FIT image with the following content :

Pack the FIT image:

Create a file ("kernel.flags") for the CMDLINE parameters:

Sign and repack the kernel:

Install the kernel to the kernel partition:

4.13+ kernel configuration
Requirements:


 * (if building on another machine) crossdev with the armv7a-hardfloat-linux-gnueabi target
 * (if building on another machine) crossdev with the armv7a-hardfloat-linux-gnueabi target
 * (if building on another machine) crossdev with the armv7a-hardfloat-linux-gnueabi target

Clone the RockMyy repo:

Download the following gist:

https://gist.github.com/anonymous/d0ce3911c933562154ca2e3f5fe602c5

Save 0007-brcmfmac-wififix.patch to patches/kernel/v4.13

Save c201_kerngen.sh & kernel.its to.

Save config-latest to ./config/v4.13/

Create a file named cmdline in the current directory.

Put the following in it, replace rootfstype:

The CPU governor defaults to conservative. If ondemand, or other modules, are desired, set MAKE_CONFIG=menuconfig to enter menuconfig.

Otherwise:

If all goes well, this will put the kernel as ./kernel and the modules in ./modules

Now scp/copy this file and folder to the C201. Once done, or if compiling on the C201, install them:

This kernel can be used with the Devsus USB as well.

Built-in wifi
Built-in wifi requires the proprietary binary firmware blob "brcmfmac4354-sdio.bin" (provided by ). This binary expects a nvram,. Create it with the content provided by the ChromiumOS project: https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/overlay-veyron/chromeos-base/chromeos-bsp-veyron/files/firmware/brcmfmac4354-sdio.txt The chromiumos project considers this file belonging to the BSP (Board Support package) and sees no sense in upstreaming the file to linux-firmware.

ACPI
This handles alternating between speaker and headphone jack when one is plugged in, as well as lid suspend when the charger is unplugged. Power button support can be added if desired, though keep in mind the device will simply turn on again when the lid is closed.

ALSA/Pulse quirks
Add the following if using Pulseaudio:

See InstallingDebianOn/Asus/C201#Audio for further information. VEYRON-I2S shipped with alsa, so it's unlikely to need to add Google's UCM files.

HDMI is not tested. It appeared under 3.14 as RockchipHDMI, but is missing under 4.13. Possibly a kernel config or UCM issue.

Keybinds
xbacklight doesn't work, however, a backlight device exists. This script can be used in tandem with xbindkeys as a replacement for xbacklight:

Provide the delta for the backlight as an argument, positive or negative.

This file is read-only by default, add this script to the local service if desired:

This script needs to be marked executable by doing

If reassigning the function keys for another purpose is desired, edit the /usr/share/X11/xkb/symbols/pc file.

In the following example, the search key (LWIN) has been remapped to Caps and set some of the function keys to much-needed movement keys. Also, the power button was remapped to the Delete key:

Restart X for these changes to take effect.

To remove old files in /var/lib/xkb:

Touchpad
Ensure the evdev and synaptics INPUT_DEVICES are set in make.conf.

Put 50-synaptics.conf in /etc/X11/xorg.conf.d

Google tools
The package contains utilities for Chromebooks, such as cgpt or crossystem, which is used to control firmware flags (USB boot, default boot device, etc). For this to work, if desired, mosys is also needed. Ebuilds for this can be acquired here: https://github.com/doughdemon/felix-overlay

Other quirks
If the bluetooth module is loaded at any time and the system is suspended, both the bluetooth and wireless driver will stop working. A temporary fix is to blacklist the btsdio module:

does not work here. Query /sys/devices/virtual/thermal/thermal_zoneX/temp to get temperatures. This will average the two CPU sensors up and output in a sane format:

does not display the correct discharge time. This can be obtained through upower:

External resources
Thanks to Miouyouyou and dimkr for their projects!
 * https://notabug.org/dimkr/devsus
 * https://github.com/Miouyouyou/RockMyy
 * http://www.synkhronix.com/journal/gentoo-chromebook
 * https://wiki.debian.org/InstallingDebianOn/Asus/C201
 * Archlinuxarm, Rockchip git