/linux-samus

Linux 4.8 on Pixel 2015

Primary LanguageCOtherNOASSERTION

Linux for Chromebook Pixel 2015

Chat with us on #linux-samus on freenode.net

This repository contains packages for Debian and Arch Linux that installs the Linux kernel 4.8 with a set of patches that enable sound support. The Linux 4.8 kernel has built-in support for the Pixel screen and keyboard leds as well as its touchpad and touchscreen. This makes the Pixel 2015 fully supported with this kernel tree.

The patches that were built in this repo in prior releases are no longer needed as support for the sound card has (finally) been submitted upstream. This repo temporarily includes the upstream patches and a patched tree until they make it in an official Linux release. See https://lkml.org/lkml/2016/8/14/207.

The provided kernel config is also somewhat optimized for the Pixel 2015.

Current kernel version: 4.8.13

Installation

The easiest way to get going is to install the packages if you are running Ubuntu, Debian or Arch Linux.

Ubuntu / Debian

$ git clone --depth=1 https://github.com/raphael/linux-samus
$ cd linux-samus/build/debian
$ sudo dpkg -i *.deb

Arch Linux

Install the linux-samus4 package from the AUR:

$ yaourt -S linux-samus4

Other distributions

The entire kernel patched tree is located under build/linux, compile and install using the usual instructions for installing kernels. For example:

$ git clone --depth=1 https://github.com/raphael/linux-samus
$ cd linux-samus/build/linux
$ make nconfig
$ make -j4
$ sudo make modules_install
$ sudo make install

NOTE the steps above are just the standard kernel build steps and may differ depending on your distro/setup.

Post-install steps

Once installed reboot and load the kernel.

Sound

Setup

Taken from GalliumOS/galliumos-distro#100 (comment):

The below scripts are also provided in the scripts/setup folder.

To enable audio:

amixer -c 0 cset name='DAC1 MIXL DAC1 Switch' on
amixer -c 0 cset name='DAC1 MIXR DAC1 Switch' on

To switch to speakers (note channel swapping)

amixer -c 0 cset name='Headphone Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' on
amixer -c 0 cset name='Speaker Switch' on

To switch to headphones (note channel unswapping)

amixer -c 0 cset name='Speaker Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 R Switch' off
amixer -c 0 cset name='Stereo DAC MIXR DAC1 L Switch' off
amixer -c 0 cset name='Stereo DAC MIXL DAC1 L Switch' on
amixer -c 0 cset name='Stereo DAC MIXR DAC1 R Switch' on
amixer -c 0 cset name='OUT1 Playback Switch' on
amixer -c 0 cset name='OUT2 Playback Switch' on
amixer -c 0 cset name='Headphone Switch' on

User settings and control

The following commands will toggle mute, decrease volume and increase volume, respectively.

amixer -q -D pulse sset Master toggle
amixer -q -D pulse sset Master 5%-
amixer -q -D pulse sset Master 5%+

Users upgrading from pre-4.7 Samus kernel

To get sound working, you must unwind some of the previous samus sound settings:

  1. edit the file /etc/pulse/default.pa and ensure these lines are commentted out:
#load-module module-alsa-sink device=hw:0,0
#load-module module-alsa-source device=hw:0,1
#load-module module-alsa-source device=hw:0,2
  1. remove the following folders: /opt/samus and /usr/share/alsa/ucm/bdw-rt5677
  2. edit the file /etc/acpi/handler.sh and remove any samus entries

NOTE: settings to toggle headphone/speaker during plug) and unplug) events still need to be implemented.

Touchpad

Since Linux 4.3 the Atmel chip needs to be reconfigured to guarantee that the touchpad works. See issue #73 for details. The linux-samus/scripts/setup/touchpad directory contains a script that does the reconfig:

$ cd linux-samus/scripts/setup/touchpad
$ ./enable-atmel.sh

This is only needed to be run once.

Xorg

To enable X11 acceleration run the xaccel.sh script:

$ cd linux-samus/scripts/setup/xorg
$ ./xaccel.sh

Brightness

The script scripts/setup/brightness/brightness can be used to control the brightness level.

$ cd scripts/setup/brightness
$ ./brightness --help
Increase or decrease screen brightness
Usage: brightness --increase | --decrease

Put scripts/setup/brightness in your path and bind the F6 key to brightness --decrease and the F7 key to brightness --increase for an almost native experience.

Similarly the script script/setup/brightness/keyboard_led can be used to control the keyboard backlight, bind the ALT-F6 key to keyboard_led --decrease and ALT-F7 to keyboard_led --increase.

Both these scripts require write access to files living under /sys which get mounted read-only for non-root users on boot by default. If your system uses systemd (e.g. ArchLinux) then the file script/setup/brightness/enable-brightness.service contains the definition for a systemd service that makes the files above writable to non-root user. Run systemctl enable enable-brightness.service for the service to run on boot.

systemd
./setup.systemd.sh

The same directory also contains setup.systemd.sh. When executed, it copies scripts to /usr/local/bin and configures systemd to run the script enable-brightness.sh on boot.

OpenRC
./setup.openrc.sh

The same directory also contains setup.openrc.sh. When executed, it copies scripts to /usr/local/bin and configures OpenRC to run the script enable-brightness.sh on boot using the local service.

Contributions

This repo exists so that we can all benefit from one another's work. Thomas Sowell's linux-samus repo was both an inspiration and help in building it. The hope is that others (you) will also feel inspired and contribute back. PRs are encouraged!