Debian Linux on the My Cloud PR4100 / PR2100

Here’s how to get hardware control with much less effort / time by building an in-tree kernel module.

Install the 4.9 kernel, headers and source. At the moment this is a meta package for linux-image-4.9.0-8, or the 4.9.110-3 kernel. This may bump in the future

sudo apt install linux-image-amd64 linux-headers-$(uname -r) linux-source \
  gcc make libc6-dev binutils-dev bc

Verify that the current kernel is 4.9.0-8-amd64 with uname -r
If it isn’t, update the grub bootloader to select the correct menuentry by setting the grub default.

Prepare kernel build directory and extract the source

mkdir ~/kbuild && cd ~/kbuild
tar xf /usr/src/linux-source-4.9.tar.xz
cd linux-source-4.9

Get the module symvers from the headers. This file is generated when you build the full kernel, so we save a few hours by skipping this.

cp /usr/src/linux-headers-$(uname -r)/Module.symvers .

Get the corresponding kernel config

cp /boot/config-$(uname -r) .config

Verify if the kernel source version matches the current version.

uname -r
make kernelversion

If these previous commands did not match, edit the first lines of the Makefile like this. (thanks @neversaydie)

SUBLEVEL = 0
EXTRAVERSION = -8-amd64

Enable the Intel LPSS UART driver in the kernel config.

Directly with an editor

Enable these 2 parameters in the .config in your favorite editor

CONFIG_SERIAL_8250_LPSS=m
CONFIG_DW_DMAC_PCI=m

Note that these parameters may change in future kernels.

or select it in the menu
sudo apt install libncurses5-dev
make nconfig

Enable support as a module.

   -> Device Drivers
     -> Character devices
       -> Serial drivers
        -> <M> Support for serial ports on Intel LPSS platforms. 

Save and exit.

Now compile the module

make prepare
make modules_prepare
make M=scripts/mod
make M=drivers/tty/serial

And install it

sudo make M=drivers/tty/serial modules_install
sudo depmod
sudo modprobe 8250_lpss

Verify it’s active

lsmod | grep 8250_lpss

This lighter module is easier to keep in sync with the mainline kernel.
All that’s left is to put all this in a post-install script.

1 Like