\input texinfo
@documentencoding UTF-8

@ifnottex
@paragraphindent 0
@end ifnottex
@titlepage
@title ASUS Chromebook C201 installation guide
@end titlepage

@node Top
@top ASUS Chromebook C201 installation guide

@menu
* ASUS Chromebook C201 installation guide::
* Installing Libreboot to the SPI flash::
@end menu

@node ASUS Chromebook C201 installation guide
@chapter ASUS Chromebook C201 installation guide
@anchor{#asus-chromebook-c201-installation-guide}
These instructions are for installing Libreboot to the ASUS Chromebook C201. Since the device ships with Coreboot, the installation instructions are the same before and after flashing Libreboot for the first time.

@strong{DO NOT BUY THIS LAPTOP YET!!!!!!!!!!! This is intended mainly for developers at the moment (libreboot developers, and developers of libre GNU/Linux distributions). This laptop currently has @em{zero} support from libre distros. Parabola theoretically supports it, by installing Arch first and then migrating to Parabola using the migration guide on the Parabola wiki, but it's not very well tested and does not have many packages - in our opinion, Parabola does not really support this laptop. There are also several issues. Read @uref{../hcl/c201.html,this page} for more information. This laptop can still be used reasonably, in freedom, but it requires a lot of work. Most users will be disappointed.}

@strong{If you are using libreboot_src or git, then make sure that you built the sources first (see @uref{../git/index.html#build,../git/index.html#build}).}

Look at the @ref{#rom,list of ROM images} to see which image is compatible with your device.

Libreboot can be installed internally from the device, with sufficient privileges. The installation process requires using @strong{Google's modified version of flashrom}, that has support for reflashing the Chromebook's SPI flash. Otherwise, flashing externally will work with the upstream flashrom version.

@strong{Google's modified version of flashrom} is free software and its source code is made available by Google: @uref{https://chromium.googlesource.com/chromiumos/third_party/flashrom/,flashrom}.@* It is not distributed along with Libreboot yet. However, it is preinstalled on the device, with ChromeOS.

Installing Libreboot internally requires sufficient privileges on the system installed on the device.@* When the device has ChromeOS installed (as it does initially), it is necessary to gain root privileges in ChromeOS, to be able to access a root shell.

@itemize
@item
@ref{#root_chromeos,Gaining root privileges on ChromeOS}
@item
@ref{#preparing_device,Preparing the device for the installation}
@itemize
@item
@ref{#configuring_verified_boot_parameters,Configuring verified boot parameters}
@item
@ref{#removing_write_protect_screw,Removing the write protect screw}
@end itemize

@item
@uref{,Installing Libreboot to the SPI flash}
@itemize
@item
@ref{#installing_libreboot_internally,Installing Libreboot internally, from the device}
@item
@ref{#installing_libreboot_externally,Installing Libreboot externally, with a SPI flash programmer}
@end itemize

@end itemize

@uref{../index.html,Back to main index}

Gaining root privileges on ChromeOS

In order to gain root privileges on ChromeOS, developer mode has to be enabled from the recovery mode screen and debugging features have to be enabled in ChromeOS.

Instructions to access the @uref{../depthcharge/index.html#recovery_mode_screen,recovery mode screen} and @uref{../depthcharge/index.html#enabling_developer_mode,enabling developer mode} are available on the page dedicated to @uref{../depthcharge/index.html,depthcharge}.

Once developer mode is enabled, the device will boot to the @uref{../depthcharge/index.html#developer_mode_screen,developer mode screen}. ChromeOS can be booted by waiting for 30 seconds (the delay is shortened in Libreboot) or by pressing @strong{Ctrl + D}

After the system has booted, root access can be enabled by clicking on the @strong{Enable debugging features} link. A confirmation dialog will ask whether to proceed.@* After confirming by clicking @strong{Proceed}, the device will reboot and ask for the root password to set. Finally, the operation has to be confirmed by clicking @strong{Enable}.

After setting the root password, it becomes possible to log-in as root. A tty prompt can be obtained by pressing @strong{Ctrl + Alt + Next}. The @strong{Next} key is the one on the top left of the keyboard.

Preparing the device for the installation

Before installing Libreboot on the device, both its software and hardware has to be prepared to allow the installation procedure and to ensure that security features don't get in the way.
@menu
* Configuring verified boot parameters::
* Removing the write protect screw::
@end menu

@node Configuring verified boot parameters
@section Configuring verified boot parameters
@anchor{#configuring-verified-boot-parameters}
It is recommended to have access to the @uref{../depthcharge/index.html#developer_mode_screen,developer mode screen} and to @uref{../depthcharge/index.html#configuring_verified_boot_parameters,configure the following verified boot parameters}:

@itemize
@item
Kernels signature verification: @emph{disabled}
@item
External media boot: @emph{enabled}
@end itemize

Those changes can be reverted later, when the device is known to be in a working state.

@node Removing the write protect screw
@section Removing the write protect screw
@anchor{#removing-the-write-protect-screw}
Since part of the SPI flash is write-protected by a screw, it is necessary to remove the screw to remove the write protection and allow writing Libreboot to the @emph{read-only} part of the flash.

To access the screw, the device has to be opened. There are 8 screws to remove from the bottom of the device, as shown on the picture below. Two are hidden under the top pads. After removing the screws, the keyboard plastic part can be carefully detached from the rest. @strong{Beware: there are cables attached to it!} It is advised to flip the keyboard plastic part over, as shown on the picture below. The write protect screw is located next to the SPI flash chip, circled in red in the picture below. It has to be removed.

@uref{../resources/images/c201/screws.jpg,@image{../resources/images/c201/screws,,,Screws,jpg}} @uref{../resources/images/c201/wp-screw.jpg,@image{../resources/images/c201/wp-screw,,,WP screw,jpg}}

The write protect screw can be put back in place later, when the device is known to be in a working state.

@node Installing Libreboot to the SPI flash
@chapter Installing Libreboot to the SPI flash
@anchor{#installing-libreboot-to-the-spi-flash}
The SPI flash (that holds Libreboot) is divided into various partitions that are used to implement parts of the CrOS security system. Libreboot is installed in the @emph{read-only} coreboot partition, that becomes writable after removing the write-protect screw.
@menu
* Installing Libreboot internally from the device::
* Installing Libreboot externally with a SPI flash programmer::
@end menu

@node Installing Libreboot internally from the device
@section Installing Libreboot internally, from the device
@anchor{#installing-libreboot-internally-from-the-device}
Before installing Libreboot to the SPI flash internally, the device has to be reassembled.

All the files from the @strong{veyron_speedy} release (or build) have to be transferred to the device.

The following operations have to be executed with root privileges on the device (e.g. using the @emph{root} account). In addition, the @strong{cros-flash-replace} script has to be made executable:@* # @strong{chmod a+x cros-flash-replace}@*

The SPI flash has to be read first:@* # @strong{flashrom -p host -r flash.img}@* @strong{Note: it might be a good idea to copy the produced flash.img file at this point and store it outside of the device for backup purposes.}

Then, the @strong{cros-flash-replace} script has to be executed as such:@* # @strong{./cros-flash-replace flash.img coreboot ro-frid}@* If any error is shown, it is definitely a bad idea to go further than this point.

The resulting flash image can then be flashed back:@* # @strong{flashrom -p host -w flash.img}@*

You should also see within the output the following:@* @strong{"Verifying flash... VERIFIED."}

Shut down. The device will now boot to Libreboot.

@node Installing Libreboot externally with a SPI flash programmer
@section Installing Libreboot externally, with a SPI flash programmer
@anchor{#installing-libreboot-externally-with-a-spi-flash-programmer}
Before installing Libreboot to the SPI flash internally, the device has to be opened.

The SPI flash is located next to the write protect screw. Its layout is indicated in the picture below. Note that it is not necessary to connect @strong{WP#} since removing the screw already connects it to ground. Before writing to the chip externally, the battery connector has to be detached. It is located under the heat spreader, that has to be unscrewed from the rest of the case. The battery connector is located on the right and has colorful cables, as shown on the picture below.

@uref{../resources/images/c201/spi-flash-layout.jpg,@image{../resources/images/c201/spi-flash-layout,,,SPI flash layout,jpg}} @uref{../resources/images/c201/battery-connector.jpg,@image{../resources/images/c201/battery-connector,,,Battery connector,jpg}}

All the files from the @strong{veyron_speedy} release (or build) have to be transferred to the host.

The following operations have to be executed with root privileges on the host (e.g. using the @emph{root} account). In addition, the @strong{cros-flash-replace} script has to be made executable:@* # @strong{chmod a+x cros-flash-replace}@*

The SPI flash has to be read first (using the right spi programmer):@* # @strong{flashrom -p @emph{programmer} -r flash.img}@* @strong{Note: it might be a good idea to copy the produced flash.img file at this point and store it outside of the device for backup purposes.}

Then, the @strong{cros-flash-replace} script has to be executed as such:@* # @strong{./cros-flash-replace flash.img coreboot ro-frid}@* If any error is shown, it is definitely a bad idea to go further than this point.

The resulting flash image can then be flashed back (using the right spi programmer):@* # @strong{flashrom -p @emph{programmer} -w flash.img}@*

You should also see within the output the following:@* @strong{"Verifying flash... VERIFIED."}

The device will now boot to Libreboot.

@ref{#pagetop,Back to top of page.}

Copyright © 2015 Paul Kocialkowski <contact@@paulk.fr>@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found at @uref{../resources/licenses/gfdl-1.3.txt,gfdl-1.3.txt}

Updated versions of the license (when available) can be found at @uref{https://www.gnu.org/licenses/licenses.html,https://www.gnu.org/licenses/licenses.html}

UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.

TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.

The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.

@bye
