Skip to content

How to build custom Pop!_OS kernel? (with patch) #296

@bluetiger9

Description

@bluetiger9

Hi! 🙂

I would like to build and install a custom kernel version with a patch, based on the current Pop!_OS 6.6.10-76060610-generic kernel. Are there any up to date instructions on how to build and install a custom Pop!_OS kernel?

The kernel patch is a simple quirk, that should fix a microphone issue in a Lenovo laptop, similar to the 171726a commit.

A guide I trying to follow is:
https://tutorialforlinux.com/2021/01/04/step-by-step-build-kernel-pop_os-guide/

Steps:

  • clone Pop_OS! Linux kernel repository
$ git clone --depth 1 https://github.com/pop-os/linux.git; cd linux
  • use the current kernel config
$ sudo cat /boot/config-6.6.10-76060610-generic > .config
  • clean and build with deb-pkg
$ make clean
$ make deb-pkg LOCALVERSION=-custom KDEB_PKGVERSION=$(make kernelversion)-1

This last command first gives a warning about uncommitted changes, and fails with a patch related error (see bellow).

Can somebody help me with this?

Log:

➜  linux git:(master) make deb-pkg LOCALVERSION=-custom KDEB_PKGVERSION=$(make kernelversion)-1                        [10/02 | 1:36:33]

  SYNC    include/config/auto.conf.cmd
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
  UPD     include/config/kernel.release
  GEN     debian
============================ WARNING ============================
Your working tree has diff from HEAD, and also untracked file(s).
Please make sure you did 'git add' for all new files you need in
the source package.
=================================================================
  UPD     .tmp_HEAD
  ARCHIVE linux.tar.gz
dpkg-buildpackage --build=source,binary --no-pre-clean --unsigned-changes --unsigned-source --compression=gzip --rules-file='make -f debian/rules' --jobs=1 -r'fakeroot -u' -a$(cat debian/arch)
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.6.10-1
dpkg-buildpackage: info: source distribution jammy
dpkg-buildpackage: info: source changed by bluetiger <bluetiger@Attila-Laptop>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --compression=gzip --before-build .
dpkg-source: info: using options from linux/debian/source/local-options: --diff-ignore --extend-diff-ignore=.*
dpkg-buildpackage: warning: building a source package without cleaning up as you asked; it might contain undesired files
 dpkg-source --compression=gzip -b .
dpkg-source: info: using options from linux/debian/source/local-options: --diff-ignore --extend-diff-ignore=.*
dpkg-source: info: using source format '3.0 (quilt)'
dpkg-source: info: building linux-upstream using existing ./linux-upstream_6.6.10.orig.tar.gz
dpkg-source: info: using patch list from debian/patches/series
The next patch would delete the file debian/canonical-certs.pem,
which does not exist!  Skipping patch.
1 out of 1 hunk ignored

....

The next patch would delete the file debian/zfs-modules.ignore,
which does not exist!  Skipping patch.
1 out of 1 hunk ignored
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch 'diff.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: info: if the file is present in the unpacked source, make sure it is also present in the orig tarball
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/diff.patch/ --reject-file=- < linux.orig.4EjSEs/debian/patches/diff.patch subprocess returned exit status 1
dpkg-buildpackage: error: dpkg-source --compression=gzip -b . subprocess returned exit status 2
make[2]: *** [scripts/Makefile.package:146: deb-pkg] Error 2
make[1]: *** [/home/bluetiger/kernel/linux/Makefile:1544: deb-pkg] Error 2
make: *** [Makefile:234: __sub-make] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions