Building a kernel for Mobian


As super user :

dpkg --add-architecture arm64
apt-get update
apt-get dist-upgrade
apt-get install g++-aarch64-linux-gnu build-essential crossbuild-essential-arm64 git debootstrap u-boot-tools device-tree-compiler libncurses-dev flex bison libssl-dev rsync kmod

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

ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make pine64_defconfig


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


ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j4 bindeb-pkg KERNELRELEASE="5.9-sunxi64-test" KDEB_PKGVERSION="1"

KERNELRELEASE should include the string sunxi64 (in case of ?PineTab/PinePhone)

Backup .config file

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 dpkg -i /path_to/linux-image-5.9-sunxi64-test_1_arm64.deb

And then use a hard reboot to test it.


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: