Asus Chromebook C201

From Gentoo Wiki
Jump to: navigation, search

The Asus Chromebook C201 is a Rockchip RK3288-C (ARMv7-A, Cortex-A17) based, exceptionally free (libre) software friendly portable computer. It's a lightweight (ca. 980g) and, thanks to the Rockchip RK3288-C system on chip (SoC), pretty fast device. Its most distinguishing feature, however, is that it is one of only a few devices already supported by Libreboot[1]. Thus the factory firmware can optionally be replaced with entirely libre firmware. Instructions on how to do this can be found on the Libreboot website.

Hardware

Make/model Notes
Board Veyron-Speedy filename of device tree binary: rk3288-veyron-speedy.dtb
SoC Rockchip RK3288-C
RAM 4GB 2GB version available, DDR3
Firmware Coreboot with depthcharge payload[2] physical write-protection (screw), Libreboot supported
Boot media eMMC, SDXC or USB

SoC

Component Make/model Status Kernel driver(s) Kernel version Notes
CPU 4 x ARM Cortex-A17 Works 4.15 max @1,8GHz
GPU Mali-T764 WIP Panfrost 5.2 status updates, code
USB 2.0 Works 4.15 2 * USB-A
HDMI Untested dwhdmi
Analog Audio Rockchip I2S Works N/A 5.2

Peripherals

Component Make/model Status Kernel driver(s) Kernel version Notes
Display 11.6" @ 1366x768 Works 4.15 xorg-server via fbdev works
WiFi Broadcom Works brcmfmac 4.15 works with proprietary blobs
Touchpad Elan I2C Works elan_i2c 4.15
Bluetooth Untested
Embedded controller Google Works cros_ec 4.15

Mainline support is close to complete[3], so using sys-kernel/gentoo-sources should yield the best overall experience of all options.

Obtaining installation media

Create the installation media manually. Alternatively have a look at Devsus.

Installing Gentoo

Consult Asus Chromebook C201/Installing Gentoo for instructions on how to install Gentoo on the Asus Chromebook C201.

Built-in wifi

Built-in wifi requires the proprietary binary firmware blob brcmfmac4354-sdio.bin, provided by sys-kernel/linux-firmware:

root #emerge --ask sys-kernel/linux-firmware

Furthermore the aforementioned binary expects a nvram, /lib/firmware/brcm/brcmfmac4354-sdio.txt. 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 considers upstreaming the file to sys-kernel/linux-firmware as being pointless.[4]

For additional background information regarding this nvram, consult the Linux Wireless wiki.

Example configurations

make.conf

FILE /etc/portage/make.conf
CFLAGS="-O2 -pipe -march=armv7-a -mtune=cortex-a17 -mfpu=neon -mfloat-abi=hard -pipe -fomit-frame-pointer -fstack-protector-strong"
CXXFLAGS="${CFLAGS}"
CHOST="armv7a-unknown-linux-gnueabihf"
INPUT_DEVICES="libinput"
VIDEO_CARDS="fbdev"

ACPI

FILE /etc/acpi/default.sh
#!/bin/sh
# /etc/acpi/default.sh
# Default acpi script that takes an entry for all actions

set $*

group=${1%%/*}
action=${1#*/}
device=$2
id=$3
value=$4

log_unhandled() {
	logger "ACPI event unhandled: $*"
}

case "$group" in
	jack)
		case "$id" in
			'plug')
				amixer -D hw:0 cset name='Left Speaker Mixer Left DAC Switch' off
				amixer -D hw:0 cset name='Right Speaker Mixer Right DAC Switch' off
				amixer -D hw:0 cset name='Headphone Switch Left' on
                                amixer -D hw:0 cset name='Headphone Switch Right' on
				;;
			'unplug')
				amixer -D hw:0 cset name='Left Speaker Mixer Left DAC Switch' on
                                amixer -D hw:0 cset name='Right Speaker Mixer Right DAC Switch' on
				amixer -D hw:0 cset name='Headphone Switch Left' off
                                amixer -D hw:0 cset name='Headphone Switch Right' off
				;;
			*) uhd $+;;
		esac
		log_unhandled $*
	;;
	button)
		case "$action" in
			#power)
					#pm-suspend
			#		log_unhandled $*
			#	;;

			lid)
				case "$id" in
					close) if [ $(cat /sys/class/power_supply/gpio-charger/online) -eq 0 ]; then
                                                        pm-suspend
                                                fi;;
					open) :;;
					*) uhd $*;;
				esac
				log_unhandled $*
				;;

			*)	log_unhandled $* ;;
		esac
		;;

	*)	log_unhandled $* ;;
esac

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.

Note
It seems some mixer control names changed from 3.x to 4.x (i.e. Right Headphone Switch vs. Headphone Switch Right). If using a 3.x kernel, and this isn't working properly, ensure the names match up to what amixer says they should be.

Pulseaudio configuration

Add the following if using Pulseaudio:

FILE /etc/pulse/default.pa
load-module module-alsa-sink device=sysdefault
load-module module-alsa-source device=sysdefault

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:

FILE c201_backlight.sh
#!/bin/bash
if [ "$(($(cat /sys/devices/platform/backlight/backlight/backlight/brightness)+$1))" -gt "255" ];then
        echo 255 > /sys/devices/platform/backlight/backlight/backlight/brightness
        exit
fi
if [ "$(($(cat /sys/devices/platform/backlight/backlight/backlight/brightness)+$1))" -lt "0" ]; then
        echo 0 > /sys/devices/platform/backlight/backlight/backlight/brightness
        exit
fi

echo $(($(cat /sys/devices/platform/backlight/backlight/backlight/brightness)+$1)) > /sys/devices/platform/backlight/backlight/backlight/brightness

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:

FILE /etc/local.d/backlight-permissions.start
chmod 666 /sys/devices/platform/backlight/backlight/backlight/brightness

This script needs to be marked executable by doing chmod +x

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:

FILE /usr/share/X11/xkb/symbols/pckeys added to "pc105" xkb_symbols
key <LWIN>   {      [ Caps_Lock             ]       };
    key <FK01>   {      [ Home                  ]       };
    key <FK02>   {      [ End                   ]       };
    key <FK03>   {      [ Page_Up               ]       };
    key <FK04>   {      [ Page_Down             ]       };
FILE /usr/share/X11/xkb/symbols/inetreplaced items
key <POWR>   {      [ Delete                ]       };

Restart X for these changes to take effect.

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

root #rm -rf /var/lib/xkb/*

Tips and tricks

  • There is only 16GB of internal storage space available. Consider using an SD card for /home and to compile larger packages on.
  • 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.
  • Do not disable cros' developer mode! If the kernel fails to boot, the machine will not be able to boot from the install medium and will be forced to "powerwash" the Chromebook. Even if the kernel boots, crossystem/mosys is needed to change these flags. This is the solution if this happens on Libreboot, though wait for partition 5 to complete instead.

Known issues

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:

root #echo "blacklist btsdio" > /etc/modprobe.d/blacklist-btsdio.conf

sys-apps/lm_sensors 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:

user $echo "$((($(cat /sys/devices/virtual/thermal/thermal_zone1/temp)+$(cat /sys/devices/virtual/thermal/thermal_zone2/temp))/2000))"

sys-power/acpi does not display the correct discharge time. This can be obtained through upower:

user $upower -i /org/freedesktop/UPower/devices/battery_sbs_20_000b

External resources

References

  1. List of supported hardware, Libreboot. Retrieved on June 21st, 2019
  2. Depthcharge, Developer Information for Chrome OS Devices. Retrieved on June 21st, 2019
  3. Status Matrix, Rockchip open source Document. Retrieved on February 26th, 2019
  4. ChromiumOS Git at Google. Retrieved on February 25th, 2019