Skip to content

Instantly share code, notes, and snippets.

@jzacsh

jzacsh/README.md Secret

Last active June 26, 2016 05:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jzacsh/a83105bf4c0bd2d98c9b to your computer and use it in GitHub Desktop.
Save jzacsh/a83105bf4c0bd2d98c9b to your computer and use it in GitHub Desktop.
librem13 build instruction for pospeselr/linux-purism

Building, Install, Testing Purism's Kernel Work

Background

I have a Librem13 laptop and so have the need (and interest) to compile the latest - not yet upstreamed - Linux work that Purism is doing to get the Librem13's trackpads to work.

The above-mentioned work seems to mostly be a Linux driver by Richard Pospeselr based on a lot of reverse engineering efforts.

Quickstart; Your Trackpad has a Sad

If your trackpad isn't working, just do the following and ignore the other sections of this document:

git clone https://github.com/kylerankin/psmouse-byd-dkms/ &&
  cd psmouse-byd-dkms/ &&
  ./install.sh

Troubleshooting Missing Pieces

I first got an error about a package i needed, which was only available on Purism's self-hosted repositories:

# ensure these lines are in your /etc/apt/sources.list:
deb http://repo.pureos.net/pureosrepo pureos main
deb http://repo.pureos.net/purism stretch main

source (and apt-get update, obvs).

If you still want to poke around and see what you can change/fix/test, keep reading.


How-To Build & Test

tl;dr understand and run step 2, below

disclaimer: I'll assume you've read Debian's "compiling a kernel", or not, but you've at least done: sudo apt-get install libncurses5-dev

step 0: only one time:

git clone https://github.com/pospeselr/linux-purism pospeselr-linux-purism
cd pospeselr-linux-purism/data

(... because root directory is uninteresting, skip straight to data/)

step 1: hack the driver

$EDITOR drivers/input/mouse/byd.c

protip: 1st time, just skip to step #2

step 2: building kernel

cp /boot/config-4.2.3purism-rc2 ./.config &&
  make olddefconfig &&
  time {
    CONCURRENCY_LEVEL=4 \
      make deb-pkg LOCALVERSION=-pospeselrzacsh KDEB_PKGVERSION=$(make kernelversion)-1
  } 2>&1 |
      tee -a ../../kernel-build$(printf '_%s' $(date --iso && date +%s)).log
# took me 52 minutes on the first clean[1] build

Warning on the above script:

  • replace LOCALVERSION='s value with something meaningful to you... (eg: trying-jzacsh-instructions)
  • increment -1 on KDEB_PKGVERSION each time you run this
  • below assumes pwd is [richard's repo]/data/, per step 0

step 3: install generated deb package

sudo dpkg -i ../[pkg of your choice].deb
# eg: linux-image-4.2.0-rc6-gnupurism-rc2-pospeselrzacsh_4.2.0-rc6-gnu-1_amd64.deb

Further Information & Links

Most of my information is copy/pasted from these three places:

  1. forum post: "tracking Purism's eng efforts"
  2. forum post: "right-click 2 finger click ontrackpad"
  3. irc chats: IRC chats with pospeselr himself, in #purism on freenode.net
  4. forum post: "opening librem13, ... distro what is pureos"

linux-libre, build.sh, kernel docs

If, like me, you're only familiar with the kerel.org's and debian docs than ./data/ folder is confusing. However, pospeselr has explained that he just CDs into it and follows general "how to compile linux" instructions, which is what this readme does. Also, the ./build.sh script may seem simple, but for some reason always fails for me. cding into the original ./data/ dir - as my instructions do - results in successful builds for me.


[1]: Note: make distclean picks up changes that seem to be committed to the repository for some reason. It's unclear to me if this is a normal linux-libre fork pattern or not.

@b3
Copy link

b3 commented Mar 8, 2016

Maybe you could add these lines in the Troubleshooting Missing Pieces section so that one can copy/paste directly the lines being root (since by default user is not in suoders file and curl is not installed) :

wget --quiet -O - http://repo.puri.sm/pureosrepo/purism_key/purism_public.asc | apt-key add -
cat <<EOF >>/etc/apt/sources.list
deb http://repo.pureos.net/pureosrepo pureos main
deb http://repo.pureos.net/purism stretch main
EOF
apt-get update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment