denysvitali / linux-on-pixel-c

Documentation on how to run a Linux Distro on the Google Pixel C (2015)
MIT License
61 stars 5 forks source link
arch archlinux c google kernel linux pixel pixel-c tegra tegra210

Linux on Pixel C

This repo aims at documenting how to run GNU/Linux on a Google Pixel C (2015) device.

Pixel C running Arch Linux ARM


!!! WARNING !!! : The repo is now moved here


Introduction

What is the Google Pixel C?

The Pixel C is a 10.2 inch Android tablet, made by Google, which was released on December 8, 2015. It didn't had much success apparently, but its hardware is definitively still a flagship killer.

Unfortunately it runs Android, which doesn't seem to be really a productive / development oriented operating system, therefore we decided to port a Linux distro to it, to make it more productive and fast.

What distro are currently supported / planned?

Arch Linux ARM

Right now we've got Arch Linux Arm to work on the device. We haven't tried other distros yet, but PR are always welcome.

Void Linux

@q66 is planning a port of Void Linux.

What's the development status?

We are still in an alpha stage, the device boots with the latest kernel (4.17-rc2 as of 2018-05-04) but has still many a couple of issues that makes it hard to use as a daily driver.

What are the issues right now?

You can follow the issues here: if you happen to know how to solve one of these problems, please help us! Even the smallest comment may bring us one step forward.

What works?

How can I get in touch with the team?

We have a Telegram Group and an IRC channel on freenode (#linux-on-pixel-c). Joining on the group or the channel is the same - the chats are linked together.

Prerequisites

Using an USB Ethernet adapter

Plug the ethernet cable, then plug the USB Ethernet adapter to your Pixel C. As soon as the adapter is detected, the Pixel C (if it booted correctly) will get an IP address via DHCP. Use the IP to log-in

Running Linux on your Pixel C

WARNING: You may void your warranty. I am not responsible for bricked devices, dead SD cards, or thermonuclear wars. Seriously though, if after a kernel modification you've made, the device gets too hot: you probably messed up with the thermal sensor and you may need to consider a force shutdown (by pressing Power + Vol- until the device powers itself off) before any damage may appear. Whilst I played around with my Pixel C on my own and never had any problem whatsoever, you may not be as lucky as I was. If you are not sure about a modification you've made, keep the device monitored. Don't put yourself in danger, we still need you.

WARNING: If you're going to put your rootfs in /data/ you need dm-verity and encryption OFF, or a newly formatted /data partion. Otherwise the system won't be able to boot into Linux. You can still put the rootfs in /system to avoid formatting the /data partition.

Prepare the filesystem

Choose one of the following (the first one is strongly recommended):

  1. Latest version of the RootFS
  2. My (OLD!) custom made FS with xfce + lightdm
  3. The Official ALARM rootfs

Be aware that the official ALARM rootfs requires an USB Ethernet adapter since the Wireless connection to a "PixelC" hotspot isn't preconfigured. You will also need to configure your Desktop Manager and your Sessions, all without seeing anything on the screen.

Default login for the project's rootfs:

Username Password
alarm alarm
root root

Default login for my custom-made FS (2):

Username Password
alarm pixelcalarm

Default login for the original ALARM rootfs (3):

Username Password
alarm alarm

Extract the filesystem

NOTE: You may need this busybox binary, personally I had some troubles when extracting tar.gz files with TWRP included busybox (returns "Killed" after some files extracted / has many segfaults). Therefore you may need to adb push busybox-armv6l /cache; chmod u+x /cache/busybox-armv6l and then call /cache/busybox-armv6l tar -xvf ... instead

Using /data partition

This is the default setup, all the kernel releases (boot images) are created assuming you want to boot from /data/Arch

  1. Boot in TWRP
  2. adb push arch-xfce-lightdm.tar.gz /data/
  3. adb shell (gets a shell into the device)
  4. cd /data
  5. tar -xvf arch-xfce-lightdm.tar.gz

Using /system partition

This is a different approach, it is useful because saves you the /data partition (in case you don't want to wipe it), but the filesystem will be limited to 3.76GB and you'll need a different initramfs (therefore you'll need a different prebuilt boot.img).

  1. Boot in TWRP
  2. adb push arch-xfce-lightdm.tar.gz /cache/
  3. adb shell (gets a shell into the device)
  4. mount -o rw /dev/block/mmcblk0p4 /system (mounts /system in r/w)
  5. rm -rf /system/* (deletes the content of /system)
  6. tar -xvf /cache/arch-xfce-lightdm.tar.gz -C /system (extracts the FS to /system)

Use this boot.img. Be aware, it is unsigned, therefore you can only use it with fastboot boot boot.img.unsigned.

From prebuilt images

Prebuilt boot.img images aren't available yet, but you can still boot the system by putting the Pixel C in fastboot mode and doing

Prebuilt images are available here, just flash the latest boot.img with the following command.

Note: The images that use /system instead of /data/Arch are marked as Pre-Release and are labelled as such.

fastboot flash boot boot.img
fastboot boot boot.img

From sources

Requirements

Preparation

Pull the dvitali/android-build-tools image with docker pull dvitali/android-build-tools or build it yourself from this repository.

Run the container with: docker run -v kernel:/kernel -it dvitali/android-build-tools:latest

This will give you a shell (zsh) from where you can compile the kernel - all the necessary tools are there.

If you need another shell, just do docker exec -it containerName zsh (where containerName is the name of the container, which can be found with docker ps)

Compilation

Run the following commands in the docker container:

cd /kernel
git clone https://github.com/denysvitali/linux-smaug/ -b linux-4.13-rc4 linux-smaug
cd linux-smaug/
make -j$(nproc)
./build-image.sh
wget https://ded1.denv.it/pixel-c/ramdisk.gz -O /kernel/ramdisk.gz

For the last command, you can use your own ramdisk, or compile it from my source.

Mounting the kernel dir

Mount the kernel dir in your home:

mkdir ~/kernel
sudo mount -o bind /var/lib/docker/volumes/kernel/_data ~/kernel

Flashing the image

sudo fastboot boot ~/kernel/linux-smaug/Image.fit ~/kernel/ramdisk.gz

Boot

If your screen looks like this after booting the image, wonderful! It means that it is booting (don't be scared about the static).

I honestly was really scared at first, but don't worry, if my Pixel C didn't die after all I did, this won't be harmful

Static showing on Pixel C

Resources

Arch Linux Forums: How to compile the Pixel C Kernel
Thierry's Blog: Booting a Pixel C tablet with a custom kernel
Git at Google: Kernel for Tegra
GitHub: Mathieu's Kernel for Smaug (4.11-RC1)
GitHub: Mathieu's Ramdisk
GitHub: My Kernel for Smaug (4.13-RC4)
GitHub: My initramfs
Pixel C partitions

Contributors

Support the project

Donate to the major contributors of this project

Don't like to donate money to strangers?

Donate some money to the Linux Foundation or the EFF.

Don't have money to spend?

Give us some help by solving some of the issues! The more we are working on this project, the faster we could all enjoy the Linux experience on our tablets!

Don't have a Pixel C?

You can still help us! We've got you covered: in the dmesg folder we've put some dmesg outputs to help us find / spot some errors and fix some bugs. Take a look!