Translation(s): none

DebianOn is an effort to document how to install, configure and use Debian on some specific hardware. Therefore potential buyers would know if that hardware is supported and owners would know how get the best out of that hardware.

The purpose is not to duplicate the Debian Official Documentation, but to document how to install Debian on some specific hardware.

If you need help to get Debian running on your hardware, please have a look at our user support channels where you may find specific channels (mailing list, IRC channel) dedicated to certain types of hardware.

Models covered
Asus Chromebook Flip C101PA

Sub-models options :
- SoC: Rockchip RK3399
- CPU: dual-core 2.0GHz Cortex-A72 and quad-core 1.4GHz Cortex-A53 processor
- GPU: Mali T860MP4
- Screen size: 10.1" 1280x800 LED display
- Ram: 4GB LPDDR3 RAM - Disk: 16GB eMMC

Overall Status

Core Components

Boot Standard Kernel:

{OK}

LAN network card:

{OK}

Detect hard drives:

{OK}

Extra Features

CPU Frequency Scaling

[?]

Hibernation

/!\

Sleep / Suspend

/!\

Xorg

{OK}

- OpenGL

[?]

- Resize-and-Rotate(randr)

{OK}

Switch to External Screen

{OK}

Mouse

- Built-in (Touchpad)

{OK}

Wireless/Wifi

X-(

Keyboard's Hotkeys

[?]

Legend :
{OK} = OK ; {X} Unsupported(No Driver) ; /!\ = Error (Couldn't get it working); [?] Unknown, Not Test ; [-] Not-applicable
{i} = Configuration Required; X-( = Only works with a non-free driver and or firmware

Bootloader

ARM Chromebooks ship with Coreboot using Depthcharge as the payload. Depthcharge expects a signed custom kernel format which can reside on a dedicated partition on the sdcard or on the internal ssd. Depthcharge supports following boot options:

Preparations

NOTE: the preparations - enable developer mode and external media boot and partition the sdcard - are based on the instructions on the ?ArchLinux Wiki (see references below).

A. Enable Developer Mode and USB Boot

On the Chromebook (ChromeOS)

In order to be able to boot an alternate kernel - e.g one not signed by Google - you need to enable Developer Mode. In addition to this, in order to boot from extrnal media - e.g. from USB - you need to enable USB Boot.

  1. Turn off the laptop.
  2. To invoke Recovery mode, you hold down the ESC and Refresh keys and poke the Power button.
  3. At the Recovery screen press Ctrl-D (there's no prompt - you have to know to do it).
  4. Confirm switching to developer mode by pressing enter, and the laptop will reboot and reset the system. This takes about 10-15 minutes. After enabling developer mode, you will need to press Ctrl-D each time you boot or wait 30 seconds in order for the boot process to resume. Please note that 'switching to recovery mode will delete any content or data stored on the system'.
  5. After booting into developer mode, hold Ctrl and Alt and poke the T key. This will open up the crosh shell.
  6. Type shell to get into a bash shell.
  7. Type sudo su to become root.
  8. Then type this to enable USB booting:
        crossystem dev_boot_usb=1 dev_boot_signed_only=0
    Reboot the system to allow the change to take effect.

B. Partition the sdcard

On the Chromebook (ChromeOS)

Insert a sdcard on the chromebook. Get a root shell as described in the previous section.

Umount sdcard partitions:

umount /dev/mmcblk1*

Start fdisk to create a GPT partition table:

fdisk /dev/mmcblk1

Type g to create a new empty GPT partition table; write the partition table and exit by typing w.

Partition the sdcard:

cgpt create /dev/mmcblk1
cgpt add -i 1 -t kernel -b 8192 -s 65536 -l Kernel -S 1 -T 5 -P 10 /dev/mmcblk1

To create the rootfs partition, we first need to calculate how big to make the partition using information from cgpt show. Look for the number under the start column for Sec GPT table which is 15633375 in this example:

localhost / # cgpt show /dev/mmcblk1
       start        size    part  contents
           0           1          PMBR
           1           1          Pri GPT header
        8192       65536      1   Label: "Kernel"
                                  Type: ChromeOS kernel
                                  UUID: E3DA8325-83E1-2C43-BA9D-8B29EFFA5BC4
                                  Attr: priority=10 tries=5 successful=1

    15633375          32          Sec GPT table
    15633407           1          Sec GPT header


cgpt add -i 2 -t data -b 73728 -s `expr 15633375 - 73728` -l Root /dev/sda
partx -a /dev/mmcblk1

Create an ext4 file system on the root partition (e.g. the second partition on the sdcard):

mkfs.ext4 /dev/mmcblk1p2

Installation

1. Create Debian rootfs

On another laptop running Debian

Insert the sdcard and use debootstrap to create a debian rootfs on the root partition:

sudo mount /dev/mmcblk0p2 dev/mnt
sudo debootstrap sid dev/mnt
sudo chroot dev/mnt

After chroot-ing to the new filesystem, set the hostname, the root password, create a user and install some useful packages:

passwd
adduser eramon
cat "chupito" > /etc/hostname
apt-get install locales wicd-curses sudo xserver-xorg gnome
dpkg-reconfigure locales
visudo
exit
sudo sync

Insert the sdcard back in the chromebook.

2. Build Debian kernel

In order to avoid cross-compiling, I did all kernel building directly on the ChromeOS, ch-rooting to the new created root filesystem on the sdcard.

On the Chromebook (ChromeOS)

Open a developer shell as described before. Change root to the new root filesystem on the second partition on the sdcard:

sudo chroot /dev/mmcblk1p2 /bin/bash

Since the kernel configuration requires some modifications, it's necessary to build the Debian kernel package manually. For building a customized debian kernel package, I followed the instructions on the Kernel Team Handbook - “Building a custom kernel from Debian kernel source” (see links below).

First get the kernel source code:

apt-get install linux-source-4.19
tar xaf /usr/src/linux-source-4.19.16.tar.xz

Install build dependencies:

apt-get install build-essential, fakeroot, build-dep, devscripts

Run the following command in order to generate the default configuration:

make defconfig

Edit .config in order to include the missing kernel modules:

vi .config
...
        CONFIG_MOUSE_PS2_ELANTECH=m
        CONFIG_MOUSE_ELAN_I2C=m
        CONFIG_TOUCHSCREEN_ELAN=m
...

Build the kernel package:

make deb-pkg

Install the debian package - the .deb file is generated by a succesfull build:

dpkg -i linux-image-4.19.16-1_arm64.deb

This will install - among others- the following files:

/boot/initrd-img-4.19.16
/boot/dtbs/rockchip/rk3399-gru-bob.dtb

4. Create the Kernel Image

To create an image bootable by depthcharge we need the mkimage and the vbutil_tools: Install vboot-kernel-utils:

sudo apt-get install vboot-kernel-utils u-boot-tools

The chromebooks are device tree-based platforms. So for the kernel configuration, the bootloader payload (depthcharge) uses a flatened image tree for whose definition an .its file must be writen.

First find out and prepare the files referenced by the.its file:

NOTE: the .its file and a script including the commands which follow are available in github (see resources below).

Write the kernel.its file which must include one configuration with one kernel, one device tree blob and a ramdisk:

/dts-v1/;

/ {
    description = "Debian kernel image with one blob for the Asus C101 (Bob) and initramfs";

    images {
        kernel@1{
            description = "kernel";
            data = /incbin/("linux/debian/arch/arm64/boot/Image");
            type = "kernel_noload";
            arch = "arm64";
            os = "linux";
            compression = "none";
            load = <0>;
            entry = <0>;
        };
        fdt@1{
            description = "rk3399-gru-bob.dtb";
            data = /incbin/("linux/debian/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dtb");
            type = "flat_dt";
            arch = "arm64";
            compression = "none";
            hash@1{
                algo = "sha1";
            };
        };
        ramdisk@1 {
           description = "initramfs";
           data = /incbin/("/boot/initrd.img-4.19.16");
           type = "ramdisk";
           arch = "arm64";
           compression = "none";
           hash@1 {
                algo = "sha1";
           };
        };
    };
    configurations {
        default = "conf@1";
        conf@1{
            kernel = "kernel@1";
            fdt = "fdt@1";
            ramdisk = "ramdisk@1";
        };
    };
};

Make image:

mkimage -D "-I dts -O dtb -p 2048" -f debkernel.its vmlinux.uimg

Find out the partition UID of the root partition on the sdcard:

ls -l /dev/disk/by-partuuid/

Prepare the cmdline:

echo "console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 console=tty0 init=/sbin/init root=PARTUUID=8089a851-b5d9-8940-a72a-b632807ffafc rootwait rw loglevel=4" > cmdline_debian

Generate an empty bootloader.bin file:

dd if=/dev/zero of=bootloader.bin bs=512 count=1

Run vbutil in order to generate a boot image for the chromebook:

vbutil_kernel 
        --pack vmlinux.kpart 
        --version 1 
        --vmlinuz vmlinux.uimg 
        --arch aarch64 
        --keyblock /usr/share/vboot/devkeys/kernel.keyblock 
        --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk 
        --config cmdline_debian 
        --bootloader bootloader.bin

5. Flash the kernel

Flash the new generated image to the ROOT-D partition on the chromebook, sync and reboot:

sudo dd if=vmlinuz.kpart of=/dev/mmcblk1p14
sudo sync
sudo reboot

Done :) Debian on the chromebook: a debian rootfs and a customized, self-built debian kernel. If you are happy with Debian running on the sdcard, you are done. If you prefer to install debian directly to the chromebook, see next section.

6. Resize and create partitions on internal eMMC

On the Chromebook - running Debian on the sdcard

Note: once Debian installed to the internal eMMC, ChromeOS won't boot anymore. Unfortunately there is no way to dual-boot at the moment (without sdcard).

Reboot to the new Debian system on the sdcard by pressing Ctrl-U on the boot screen.

First of all you need to resize the existing partitions, in order to make some room.

Using gparted (or gdisk), resize the so-called "STATE" partition from 10G to 1G:

8671232    10485760       1  Label: "STATE"
                             Type: Linux data
                             UUID: 1F4D5818-8E6B-0746-B1F9-E2E206777C85

Create two new partitions:

Set the priority, tries and succesful flag for the KERN-D partition:

sudo cgpt add -i 1 -S 1 -T 0 -P 2 /dev/mmcblk0

We need to modify the partition id of the rootfs in the cmdline in order to refer to the one on the internal disk and not to the one on the sdcard:

ls -l /dev/disk/by-partuuid/
...
echo "console=ttyS2,115200n8 earlyprintk=ttyS2,115200n8 console=tty0 init=/sbin/init root=PARTUUID=c5e4e377-6d8f-4747-aa1f-6a8eeddf031a rootwait rw loglevel=4" > cmdline_debian

Run vbutil - exactly as we did before - to apply the modified cmdline:

vbutil_kernel 
        --pack vmlinux.kpart 
        --version 1 
        --vmlinuz vmlinux.uimg 
        --arch aarch64 
        --keyblock /usr/share/vboot/devkeys/kernel.keyblock 
        --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk 
        --config cmdline_debian 
        --bootloader bootloader.bin

Flash the modified kernel image to the KERN-D partition and reboot:

sudo dd if=vmlinux.kpart of=/dev/mmcblk1p13
sudo sync
sudo reboot

Mount the ROOT-D partition and create a new rootfs using debootstrap - same as we did before. Don't forget to set the root password or to set a new user/password in order to be able to log in. Afterwards you should be able to boot into the new rootfs with the kernel on the internal storage by pressing Ctrl-D when booting.

Configuration

Sound

The sound is not working, although the corresponding modules seem to be in place after comparing with a running ChromeOS system on the same device.

In addition, the sound settings in gnome only showed a “dummy output” as sound device. Apparently Debian does not include users in the audio group by default, so adding the user to the group improved the situation:

adduser eramon audio 

Although the sound wasn’t still working after doing that, I was able to see two proper output devices in the sound settings in gnome.

Mouse

The touchpad works perfectly after adding the ELAN kernel modules mentioned in the "Installation" section.

Power Management

Unfortunately suspend and hibernation do not work properly. The system does not always recover from suspend and after closing the lid manually, the system is not able to recover.

WiFi

It works fine after installing following package:

sudo apt-get install firmware-libertas

Warning: in order to install this firmware the contrib non-free sources must be included in /etc/apt/sources.list

NOTE: Before getting the wi-fi to work, I used an ethernet cable and an usb-to-ethernet adapter


System Summary

lspci

eramon@chupito:~$ lspci -nn
00:00.0 PCI bridge [0604]: Fuzhou Rockchip Electronics Co., Ltd RK3399 PCI Express Root Port [1d87:0100]
01:00.0 Ethernet controller [0200]: Marvell Technology Group Ltd. Device [1b4b:2b42] (rev 11)

lsusb

eramon@chupito:~$ lsusb
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 1286:204e Marvell Semiconductor, Inc. 
Bus 002 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 13d3:5696 IMC Networks 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

https://archlinuxarm.org/platforms/armv8/rockchip/asus-chromebook-flip-c101pa

https://eramons.github.io/techblog/post/asuschromebook_debian

https://github.com/eramons/chromebook

https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#s-common-official

TODO Link to Bug Report (add ELAN modules to debian kernel)

Credits

Eva Ramon debian@empanadilla.net


CategoryLaptopComputer