Building a kernel for Mobian


As super user :

apt-get update
apt-get dist-upgrade
apt-get install gcc-aarch64-linux-gnu build-essential git debootstrap u-boot-tools device-tree-compiler libncurses-dev flex bison libssl-dev rsync kmod fakeroot git-buildpackage debhelper

Mobian-maintained kernel

Get sources

git clone pinephone-linux
cd pinephone-linux/

Apply patches in debian/patches

gbp pq import

applies those patches listed in debian/patches/series to a patch-queue/BRANCH branch (man page). (quilt push is an alternative means to achive this)

Generate .config from known working config

env ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debian/rules .config


env ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make menuconfig


fakeroot env ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- debian/rules binary

Backup .config file

env ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make savedefconfig

Testing debian package

You can mount with NFS your host folder or copy the debian package over ssh using scp.

On the target, you might be able to install the package with

sudo apt install /path/to/linux-image-x.y-sunxi64_x.y+sunxi64-1_arm64.deb

And then use a hard reboot to test it.

Downstream kernel



In the case of a boot failure, you can follow this tutorial to re-enable the previous kernel by editing /boot/extlinux/extlinux.conf and change the default label to boot to the previous kernel.

Update Process

Rebasing is used over merging so we have all our commits on top of upstream and we're less likely to forget anything when rebasing over a newer kernel branch.

The following steps are used: