I built Xenial kernel with ACS override patch for my own, and I think there should be some other guys need this kind of kernel, so I setup a personal PPA and upload my kernel there. Here is how I did it.

  1. First of all, to build a debian package, you have to have a PGP key and upload the key to your launchpad account. You should find other pages describes how to do it, I'm going to go too detail about this. After you have a PGP key and have it setup in your account, here are the setting you need for your environment. For me, I put the settings in .zshenv.

    environment settings
    1
    2
    3
    export GPGKEY=4D36D0ED
    export DEBFULLNAME="Chia-Lin Kao (AceLan)"
    export DEBEMAIL="acelan.kao@canonical.com" %}

  2. Create your own PPA on launchpad.

    For me, its
    1
    https://launchpad.net/~acelankao/+archive/ubuntu/ubuntu-xenial

  3. Get the source code by git

    clone the kernel source code
    1
    git clone git://kernel.ubuntu.com/ubuntu/ubuntu-xenial

  4. Before jumping into ubuntu-xenial directory, I would like you to download the kernel origin tarball which can help you to not upload the whole kernel source tarball every time dput the package to launchpad. You can find the orig tarball link from here.

    linux-source 4.4.0
    1
    https://packages.ubuntu.com/xenial/linux-source-4.4.0
    Download the tarball like this
    1
    wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_4.4.0.orig.tar.gz

  5. Enter the ubuntu-xenial directory and apply the patches you want.

    I got the ACS override patch from here
    1
    https://github.com/zman0900/linux-vfio-aur/blob/master/override_for_missing_acs_capabilities.patch
    Remember to commit your changes.

  6. Update configs if needed

    1
    fakeroot debian/rules updateconfigs

  7. Get the latest ABI files if it's not included in debian.master/abi/

    check the latest ABI version
    1
    head -n1 debian.master/changelog
    download ABI files
    1
    ./debian/scripts/misc/getabis 4.4.0 109.132

  8. Adding your flavour name and version

    1
    dch -i -c debian.master/changelog
    here is my result
    1
    2
    3
    4
    5
    linux (4.4.0-109.132+acs1) xenial; urgency=medium

    * ACS override patch

    -- Chia-Lin Kao (AceLan) <acelan.kao@canonical.com> Sat, 13 Jan 2018 11:52:57 +0800

  9. Commit the changes in step 6, 7, and 8.

    1
    2
    git add debian.master
    git ci -sm "UBUNTU: 4.4.0-109.132+acs1"

  10. Update changelog file

    1
    fakeroot debian/rules clean

  11. Generate diff, dsc, and changes files. It might fail if you've tried building kernels in the directory, so it's better to clean up the ubuntu-xenial directory before you go.

    1
    2
    git clean -fd
    debuild -S -sa -I -i

  12. We are almost there. Uploading your kernel and see how it goes.

    1
    2
    cd ..
    dput ppa:acelankao/ubuntu-xenial linux_4.4.0-109.132+acs1_source.changes

If you don't want to build your kernel on PPA, you can build it locally after step 5 and run

1
fakeroot debian/rules do_extras_package=false do_tools=0 no_dumpfile=1 clean binary-generic binary-headers

logs for next release steps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
acelan@acelan ~/workspace/ubuntu-xenial (git)-[master] % git checkout -b Ubuntu-4.4.0-116+acs Ubuntu-4.4.0-116.140
Switched to a new branch 'Ubuntu-4.4.0-116+acs'

acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % git am ../0001-Ubuntu_Xenial_4.4.0_31_override_for_missing_acs_capa.patch
Applying: Ubuntu_Xenial_4.4.0_31_override_for_missing_acs_capabilities-kernel.patch

acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % ./debian/scripts/misc/getabis 4.4.0 116.140
Fetching generic(armhf)...extracting linux-image...GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic-lpae(armhf)...extracting linux-image...GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic(amd64)...extracting linux-image linux-image-extra...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching lowlatency(amd64)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic(i386)...extracting linux-image linux-image-extra...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching lowlatency(i386)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic(arm64)...extracting linux-image...GCC: (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic(ppc64el)...extracting linux-image linux-image-extra...GCC: (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching generic(s390x)...extracting linux-image linux-image-extra...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching powerpc-smp(powerpc)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching powerpc64-smp(powerpc)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching powerpc-e500mc(powerpc)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
Fetching powerpc64-emb(powerpc)...extracting linux-image...GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609...done.
...

acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % dch -i -c debian.master/changelog
acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % git add -u

acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % git ci -sm "UBUNTU: 4.4.0-116.140+acs1"
[Ubuntu-4.4.0-116+acs e3648e1] UBUNTU: 4.4.0-116.140+acs1
55 files changed, 1 insertion(+), 1 deletion(-)
delete mode 100644 debian.master/abi/4.4.0-115.139/abiname
create mode 100644 debian.master/abi/4.4.0-116.140/abiname
...

acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % fakeroot debian/rules clean
acelan@acelan ~/workspace/ubuntu-xenial (git)-[Ubuntu-4.4.0-116+acs] % debuild -S -sa -I -i
...