[HOWTO] build Debian-flavor kernel packages for Armbian

Recommended Posts

before you start:

    Armbian already provides kernel build script in armbian build framework, and you can download these packages via `apt`

    in common cases, you shouldn't build kernel yourself, even you want to build a customer kernel package, you should use armbian build framework.

    because you can get best supports.


   so below content is only for experts.


prepare source code:

    1, stable linux kernel source code:



   2, armbian build framework, for patches and kernel config


   3, debian linux build rules:

      git clone https://salsa.debian.org/kernel-team/linux.git --depth=1

     optional: checkout to a branch to build a different kernel version, current version is 5.5.8

   4, add patches to debian linux build rules:

      copy all family patches to <debian-rules>/debian/patches/

      add all your patches to <debian-rules>/debian/patches/series

     make sure all your patch are appliable to mainline kernel.

     optional: remove all debian's kernel patch, only leave armbian kernel patch.

 5, apply the patches.

    apt install devscripts

    cd <debian-rules>

   debian/bin/genorig.py <path-to-stable-linux>

   debian/rules orig

6, copy kernel config to <debian-rules>/config/[armhf, arm64]/config


prepare native armhf/arm64 build env

1, donwload armbian's prebuild rootfs, or use debootstrap.

2, mount dev, sys, proc, tmp to armhf/arm64 rootfs. reference: https://github.com/armbian/build/blob/master/lib/image-helpers.sh#L27

3, mount <debian-rules> to armhf/arm64 rootfs.


start build, in chroot rootfs

1, cd <debian-rule>

2, apt install devscripts fakeroot

3, debian/rules debian/control DEBIAN_KERNEL_DISABLE_INSTALLER=true

4, debuild -i -us -uc -b # do it only once, to let build system promt missing build depends. you need to install all build depends at this step.

5, fakeroot debian/rules binary or fakeroot debian/rules binary-arch

6, long wait.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.