Coreboot installation on Chromebook ASUS C201PA

Goal

In this manual I will try to explain how to install Coreboot (2018 year version) on the Chromebook ASUS C201PA (later referred in the manual simply as C201) with the Paper build system. At the time of writing up this manual (Q1 2018), Libreboot didn’t have any updated sources for this laptop, so I decided it would be better to use Coreboot.

Introduction

There exists a Libreboot Chromebook ASUS C201 installation guide, and I would suggest you to read that first for easier understanding and detailed insight about what we’ll be trying to achieve through this manual. The steps are not identical, you will actually be installing Coreboot, which is a different project, but it might give you some ideas first about similar hardware and software being used here. I suggest that you read more about the Coreboot project, before proceeding with the installation. First of all before proceeding with anything you should already have a working GNU/Linux operating system on the C201. This manual does not explain how to install a GNU/Linux distribution on the C201, so you will need to find this information elsewhere. At the time of trying out this Coreboot installation I had a working GNU/Linux Debian 9 Stretch operating system on the SD card and Chrome operating system on the eMMC internal flash drive. This is my review of the summary by Paul Kocialkowski’s sets of instructions. Paul is a Libreboot and Coreboot developer who was willing to assist me getting this properly installed on my computer. The summary of all performed commands is written into a text file, so make sure to double check that, because this website wrongly renders and displays some of the characters.

Requirements

  • Secondary laptop (the same laptop could also be used)
  • USB key
  • Thin piece of plastic (guitar pick) for laptop disassembly
  • Installation of additional programs “apt-get install flashrom gnupg”

Laptop disassembly instructions

First step that you need to do is removing the write protect screw, which is inside the laptop. Refer to the similar Libreboot manual to read more about it. First you need to unscrew 8 screws which are holding the laptop together. Two of them are below the plastic caps/stands. Use something like a sharp piece of plastic to slide below them and remove them. You will need to open up the chasis of the C201. Best thing that can help you with that is by using some very thin piece of plastic, something like a guitar pick would be good. I did not have that and have used a credit card which was already a bit too thick to slide inside. You need to divide the shiny silver upper part and the lower blue part of the C201 by placing a piece of plastic in between and sliding it all around the lower part of the laptop. Beware that inside the laptop are the plastic clips which are holding the two parts together so don’t go too deep with the piece of plastic, not to break those clips. When you manage to divide the bottom and upper part of the laptop you need to beware not to divide those two parts up completelly, because inside there are two striped connectors (one black wider one for keyboard and one white thin one for touchpad), so be carefull when detaching those straps not to tear them apart (you don’t really need to detach them, you can also line up the parts). When you have opened up the laptop put it into such position. Then you unscrew the inner screw which is being marked inside of the white circle on the photo. That screw is the write protection screw for Coreboot, so without it you will be able to install Coreboot. When that is done, just assemble the laptop back together by pushing both parts (shiny silver upper part and bottom blue part) and save the screw.

Installation

Boot into Chrome OS. You will need some storage to transfer the files from Chrome OS to your other computer, an USB key is fine. You need to be in Chrome OS developer mode. Log in as root user into Chrome OS. This is done with Ctrl + Alt + F1 (top right arrow). Sometimes the root doesn’t have the password set, so just use the enter key to bypass password. You should see a visible # as a prompt. Insert the USB key. It will probably automatically mount itself, in my case it has mounted under /media/removable/USBDRIVE . If the USB key doesn’t automatically mount, you will need to perform the mounting commands. You need to put a file (flash.img) on the USB key. Go to the USB key directory.

  • # cd /media/removable/USBDRIVE
  • # flashrom -p host -r flash.img

Copy file flash.img to USB key. Power off the computer and stick the USB key into another computer. Boot into your favourite GNU/Linux distribution. Install Paul Kocialkowski’s gnupg public key (fingerprint 01B7 0C5D 940C B63D 5FA6 12C2 84FD C1EA 8FEE 950C) for verifying the installer. Create a directory on the PC and copy file flash.img from USB key there. Run the following commands as normal user (non-root) on another computer:

  • gpg –recv-keys 8FEE950C
  • export DOWNLOAD_URL=http://jp.si/C201/paper-release-20180102/
  • wget “$DOWNLOAD_URL/tools/x86_64/libreboot-release/libreboot-release”
  • chmod a+x libreboot-release
  • ./libreboot-release prepare cros-scripts vboot-tools coreboot-depthcharge-veyron-speedy

You should see an output similar to this. Then continue with the following commands:

  • VBOOT_TOOLS_PATH=tools/x86_64/vboot/vboot-tools tools/x86_64/cros-scripts/cros-scripts/cros-firmware-prepare vpd flash.img extract vpd.bin
  • VBOOT_TOOLS_PATH=tools/x86_64/vboot/vboot-tools tools/x86_64/cros-scripts/cros-scripts/cros-firmware-prepare vpd images/coreboot/coreboot-depthcharge-veyron-speedy/coreboot.rom replace vpd.bin
  • cp images/coreboot/coreboot-depthcharge-veyron-speedy/coreboot.rom .

You should see an output similar to this. Copy coreboot.rom file to the USB key. Power up C201 again and boot into Chrome OS. Insert the USB key and go into USB key directory, then type as root:

  • # flashrom -p host -w coreboot.rom

You should see a message like this:

erasing and writing flash chip…..Verifying flash….VERIFIED

SUCCESS

Then check the output of the crossystem command

  • # crossystem | grep dev_boot

If you see:

dev_boot_usb=1 , dev_boot_legacy=0 , dev_boot_signed_only=0

Then it is OK to reboot the C201. And that’s it. Commands that can be used during the Coreboot boot menu are:

  • Ctrl+h = Pauses the screen
  • Ctrl+u = Boots the GNU/Linux distribution (default is ChromeOS)

Disclaimer

Be sure to read the disclaimer before proceeding with the installation.

Upgrading U-boot to 2015.07 on Compulab Utilite

Utilitie-introThis manual is about upgrading U-boot on Utilite Standard / Pro device.

Originally the default U-boot on Utilite has version U-Boot 2009.08-cm-fx6-0.87+tools (Oct 06 2013 – 13:46:27). Here we try to flash the chip to U-Boot 2015.07-cm-fx6-3 (Sep 02 2015 – 13:30:11 +0300). This is how you proceed.

  • Have the Micro SD card ready and partitioned with “vfat” on the first /dev/sdb1 partition. Your partition name can be different than /dev/sdb1, put in the Micro SD card into the PC slot and run “dmesg” it will reveal which device it is at the end. Run the “mkfs” command with filesystem un-mounted to create vfat partition.
  • # mkfs -t vfat /dev/sdb1
  • Download the latest U-boot release from Compulab Utilite website or from this alternative location.
  • Ensure the integrity of the file with md5sum utility.
  • # md5sum utilite-updater.tar.bz2
  • bf0d453aeb61a680e15e263eb3ff31bb utilite-updater.tar.bz2
  • Untar the archive on PC to get the firmware image (cm-fx6-firmware file) and update script.
  • # mkdir utilite-updater
  • # tar -xvf utilite-updater.tar.bz2 -C utilite-updater
  • Copy the “cm-fx6-firmware” file onto first partition example /mnt/sdcard1 of the Micro SD card.
  • # cp utilite-updater/cm-fx6-firmware /mnt/sdcard1
  • Insert the Micro SD card into Utilite and boot Utilite, your old U-boot will appear.
  • Perform these commands
  • CM-FX6 # mmc dev 2
  • mmc2 is current device
  • CM-FX6 # mmc rescan
  • CM-FX6 # fatls mmc 2
  • 512000 cm-fx6-firmware 1 file(s), 0 dir(s)
  • CM-FX6 # fatload mmc 2 10800000 cm-fx6-firmware
  • reading cm-fx6-firmware
  • 512000 bytes read
  • From here on we will flash the U-boot (be aware that anything above this step is dangerous and can break your device, make sure you keep it powered until you finish all the other steps !)
  • CM-FX6 # sf probe 0
  • JEDEC ID: 0xbf:0x25:0x41 2048 KiB SST25VF016B – 2MB at 0:0 is now current device
  • CM-FX6 # sf erase 0 80000
  • Erasing SPI NOR flash 0x0 [0x80000 bytes] ………………………………………………………………………………………………………………..SUCCESS
  • CM-FX6 # sf write 10800000 0 80000
  • Writing SPI NOR flash 0x0 [0x80000 bytes] <- ram 0x10800000 …….SUCCESS

This is all, you can disconnect Utilite and replug it back to power. You should see the new U-boot on it.

If you upgrade from a more recent U-boot like U-Boot 2014.04-cm-fx6-1.3 (Sep 16 2014 – 16:11:56), then your messages will appear like this:

  • CM-FX6 # fatload mmc 2 10800000 cm-fx6-firmware
    reading cm-fx6-firmware
    512000 bytes read in 58 ms (8.4 MiB/s)
  • CM-FX6 # sf probe 0
    SF: Detected M25PX16 with page size 256 Bytes, erase size 64 KiB, total 2 MiB
  • CM-FX6 # sf erase 0 80000
    SF: 524288 bytes @ 0x0 Erased: OK
  • CM-FX6 # sf write 10800000 0 80000
    SF: 524288 bytes @ 0x0 Written: OK

Links used for this manual:

I take no responsibility if you damage your Utilite device, this is not an official manual !

Compulab Utilite image with Ubuntu 14.04 LTS (Trusty Tahr)

Utilitie-introA new image for Utilite devices is available. Default Utilite images were based on Ubuntu 12.04 LTS (Precise Pangolin) now there is a new image with Ubuntu 14.04 LTS (Trusty Tahr). You can download it from here or from alternative download location. Once you have it on your hard drive, you can extract it to the Micro SD card. This is a 5 GB bootable image with lots of desktop applications, make sure you have at least 6 GB of available space on your Micro SD card. You can use this command to put the content of the file on your Micro SD card (be aware that it will erase all existing content on your SD card).

# xz -dc armhf-trusty-vpu-gpu.img.5G.xz | sudo dd of=/dev/<sdcard device node> bs=1M

After you are done, insert the Micro SD card into Utilite SD card slot and boot the device.

Rescue mode for Fonera+ (FON2201) Wi-Fi router / OpenWRT / Redboot / Wlan-si

fon-la-fonera-970-80Running customized OpenWRT/Wlan-SI image for a long time and then upgrading the router caused it to crash, the error was probably triggered with the telnet/ssh timeouts and probably a high CPU load on the router which disconnected me several times before I managed to write in the image. As suggested on Wlan-SI website, you should upgrade this type of router (and others) using their “nodeupgrade” [1] application. If you fail to boot into the new image, there is one thing you can still do to reflash over ethernet. A good idea is to put Redboot as the rescue method prior to flashing (but this manual won’t cover that step). So considering that Redboot is already installed here is how to proceed:

1. Install required  packages on a PC.

# apt-get install tftpd-hpa tftp telnet netcat

Configure tftpd-hpa download directory in /etc/default/tftpd-hpa where you will put firmware images.

2. Set your PC to listen on 192.168.1.2/255.255.255.0. Connect your PC ethernet port with any of the two ethernet ports on Fonera router.

3. If Redboot is installed on Fonera router, it will listen for a few seconds on IP 192.168.1.1 or 192.168.1.254 port 9000, simply telnet there [2] , you will see a message like this one:

== Executing boot script in 8.530 seconds - enter ^C to abort
^C
RedBoot>

Press Ctrl+c in your terminal to enter

If you have problems here that Ctrl+c doesn't work 
(and router therefore already bypasses the escape sequence into failed boot mode) you can try the following trick [3]:

# echo -e "\0377\0364\0377\0375\0006" >break.bin 
# nc 192.168.1.1 9000 <break.bin

Just press "enter" or telnet again to 192.168.1.1 9000, and you entered Redboot.

4. Installing firmware into Redboot [4]

RedBoot> 
RedBoot> ip_address -l 192.168.1.1/24
IP: 192.168.1.1/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.254
RedBoot> ip_address -h 192.168.1.2
IP: 192.168.1.1/255.255.255.0, Gateway: 0.0.0.0
Default server: 192.168.1.2
RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> load -r -v -b 0x80041000 foneraplus-v2_0b_33_gbb622cc-kernel.lzma
Using default protocol (TFTP)
-
Raw file loaded 0x80041000-0x800f0fff, assumed entry at 0x80041000
RedBoot> fis create kernel
... Erase from 0xa8030000-0xa80e0000: ...........
... Program from 0x80041000-0x800f1000 at 0xa8030000: ...........
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> load -r -v -b 0x80041000 foneraplus-v2_0b_33_gbb622cc-root.jffs2-64k
Using default protocol (TFTP)
|
Raw file loaded 0x80041000-0x80360fff, assumed entry at 0x80041000
RedBoot> fis create rootfs
... Erase from 0xa80e0000-0xa8400000: ..................................................
... Program from 0x80041000-0x80361000 at 0xa80e0000: ..................................................
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> fconfig
Run script at boot: true
Boot script: 
.. fis load -l kernel
.. exec
Enter script, terminate with empty line
>> fis load -l kernel
>> exec
>> (press enter here with a blank line)
Boot script timeout (1000ms resolution): 10
Use BOOTP for network configuration: false
Gateway IP address: 
Local IP address: 192.168.1.1
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.1.254
Console baud rate: 9600
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
... Erase from 0xa87e0000-0xa87f0000: .
... Program from 0x80ff0000-0x81000000 at 0xa87e0000: .
RedBoot> reset
This is all, wait some minutes then replug router in electricity.

Additionally:
Instead of image name foneraplus-v2_0b_33_gbb622cc-kernel.lzma 
you can use openwrt-atheros-vmlinux.lzma
Instead of image name foneraplus-v2_0b_33_gbb622cc-root.jffs2-64k 
you can use openwrt-atheros-root.squashfs

Download the OpenWRT firmwares here.

Manuals used in this procedure:

1. https://dev.wlan-si.net/wiki/Flashing/Nodeupgrade

2. http://wiki.openwrt.org/doc/techref/bootloader/redboot

3. http://www.dd-wrt.com/phpBB2/viewtopic.php?p=81815&sid=81c212ea61683ac3bbb9b626bc553ecd

4. http://wiki.openwrt.org/toh/fon/fonera2#method_1_with_tftp_server

I take no responsibility if you break the router using this manual (it has only been tested once), do it on your own risk !

Utilite computer 3.10.17 Linux kernel upgrade

Utilitie-introThis is the manual about how to (properly) compile Utilite-developed Linux kernel for the Utilite computer (Utilite Pro) running “Ubuntu 12.04 LTS (Precise Pangolin)”. It’s mostly written for my own reference in case of possible future upgrades, but some might find it useful, as otherwise the information seems to be scattered around the Internet. We will do the start in user-mode and finish it in superuser (root) mode. The commands in bold are those which you need to type on the command line. However, I am not responsible for any damage that you might experience trying out this manual on your Utilite Pro. These are unofficial instructions, if you want official instructions read information on the Utilite Forum and Wiki. So here we go …

1. First we are going to pull the kernel sources with git ( there is an online manual on how to use git ). This is a one-string command, so write all in one line.

$ git clone -b 'utilite/devel'
https://github.com/utilite-computer/linux-kernel --depth 1

2. Lets move inside the kernel tree.

$ cd linux-kernel

3. Let’s make default kernel .config

$ make cm_fx6_defconfig

4. Let’s define other settings with menuconfig. Beside of concatenating kernel image and DTB you need to make sure that the following kernel options are present in your .config :

CONFIG_ARM_APPENDED_DTB=y
CONFIG_ARM_ATAG_DTB_COMPAT=y
CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_EXTEND=y
CONFIG_CMDLINE_FROM_BOOTLOADER=y

$ make menuconfig

5. Clean before compiling.

$ make clean

6. Let’s compile. Option “-j8” means that we’ll be using 8 jobs on all 4 cores ( x 2 for SMP) on Utilite Pro for compiling ( it’s faster ). Approx. build time is 24 minutes.

$ make -j8 zImage

7. If you enabled DTB settings in the kernel .config, DTB should be made successfully. Approx. build time is 1 minute.

$ make -j8 imx6q-sbc-fx6m.dtb

8. Let’s make the modules. Approx. build time is 4 minutes.

$ make -j8 modules

9. Until this step everything can be done in user-mode. From here on you will need to perform all the additional steps as root or with “sudo” command. Let’s install the modules.

# make modules_install

10. Let’s install the firmware.

# make firmware_install

11. Let’s install the kernel headers.

# make headers_install

12. Now with all things in place and no errors, we are going to mount the boot partition on Utilite Pro ( this is a one-string command, so copy the whole string ).

# boot_partition=`cat /proc/cmdline | awk ‘{ for (i=1;i<=NF;i++) { if($i~/root=/) { print substr($i,6,length($i)-6)”1″ } } }’`

# mount $boot_partition /boot

13. DO NOT FORGET to backup your existing working kernel !

# cp /boot/uImage-cm-fx6 /boot/uImage-cm-fx6.bak

14. Move the newly built Linux kernel image into /boot .

# cat arch/arm/boot/zImage arch/arm/boot/dts/imx6q-sbc-fx6m.dtb > /boot/zImage-cm-fx6

15. Perform the last step to fit everything in place ( this is one-string long command, write everything together ).

# cd /boot; mkimage -A arm -O linux -T kernel -C none -a 0x10008000 -e 0x10008000 -n 3.10.17-cm-fx6-1-beta2-aufs -d zImage-cm-fx6 uImage-cm-fx6; rm -f zImage-cm-fx6

16. The result should be similar to this if all went well …

Image Name: 3.10.17-cm-fx6-1-beta2-aufs
Created: Tue Feb 17 13:53:34 2015
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 5460160 Bytes = 5332.19 kB = 5.21 MB
Load Address: 10008000
Entry Point: 10008000

17. un-mount the /boot partition.

# umount /boot

18. Reboot and pray !

# reboot

 

If all went well, you should have a new workable 3.10.17 kernel on Utilite Pro.

If you are unable to boot to the new kernel or if something was faulty, there are several things you can try for the rescue. Most information can be asked or found on the Utilite support forum. This is the best place to ask questions. You should enable serial console ( I won’t describe how you do this, you can find the information on the forum or wiki ). So after being connected with the serial console, the first thing you see starting is U-boot. There will be a similar output, compared to this one :

U-Boot 2009.08-cm-fx6-0.98+tools (Mar 10 2014 – 16:17:49)

CPU: Freescale i.MX6 family TO6.4 at 792 MHz
Temperature: 34 C, calibration data 0x59d4f769
mx6q pll1: 792MHz
mx6q pll2: 528MHz
mx6q pll3: 480MHz
mx6q pll8: 50MHz
ipg clock : 66000000Hz
ipg per clock : 66000000Hz
uart clock : 80000000Hz
cspi clock : 60000000Hz
ahb clock : 132000000Hz
axi clock : 264000000Hz
emi_slow clock: 29333333Hz
ddr clock : 528000000Hz
usdhc1 clock : 198000000Hz
usdhc2 clock : 198000000Hz
usdhc3 clock : 198000000Hz
usdhc4 clock : 198000000Hz
nfc clock : 11000000Hz
Board: CM-FX6:[ POR ]
Boot Device: SD
I2C: ready
RAM Configuration:
Bank #0: 10000000 1 GB
Bank #1: 80000000 1 GB
NAND: No NAND device found!!!
0 MiB
MMC: FSL_USDHC: 0,FSL_USDHC: 1,FSL_USDHC: 2
JEDEC ID: 0xbf:0x25:0x41
Reading SPI NOR flash 0xc0000 [0x2000 bytes] -> ram 0x17e030c0
SUCCESS

In: serial
Out: serial
Err: serial
Net: got MAC address from IIM: 00:00:00:00:00:00
FEC0
Hit any key to stop autoboot:

Here you have 3 seconds of time to hit any key and enter into the U-boot interface, where you can perform additional steps.

1. First step would be to boot the previous kernel. Define the previous kernel with “setenv”.

$ setenv kernel uImage-cm-fx6.bak

$ run bootcmd

This should at least bring you back to the previous kernel.

2. If you forgot what your previous kernel name was ( if you selected a different name ), you can try these commands :

$ sata init
$ fatls sata 0:1

This should list all available kernels in the /boot partition, so just select another name with “setenv”.

Good luck !

P. S. If you have tried this procedure and found any errors or know about the improvements, you are welcome to comment on the post and I will be glad to fix the article !