I'm attempting to compile a custom kernel 'The Ubuntu Way' to produce a kernel that only includes minor changes and remains as close to the official package as possible. Unfortunately I've run into some problems along the way.
While there are many sources of documentation that describe how this can be achieved, many of them are severely out of date or provide conflicting information. The most concise instructions that I've had luck with are Mr. Wimpress' "Kernel Stuff" notes.
Attempting to follow the instructions verbatim, I've made some modifications to suit my particular situation. Specifically
- To save polluting the host environment (a 19.10 system), all of the build steps are performed inside a 19.10 LXD container; presumably this has no impact the build process.
- The 19.10 repository is cloned (`git clone git://kernel.ubuntu.com/ubuntu/ubuntu-eoan.git`) and a local branch is created to explicitly match the current kernel (`git checkout -b noflr Ubuntu-5.3.0-29.31`) before patching the source or updating `debian.master/changelog`.
- `+noflr` is appended to the version in `debian.master/changelog` making the first line `linux (5.3.0-29.31+noflr) eoan; urgency=medium`
After letting `fakeroot debian/rules clean` and `fakeroot debian/rules binary-headers binary-generic` successfully run to completion, I'm left with the following debs in the parent directory
Code:
linux-buildinfo-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-cloud-tools-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-headers-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-headers-5.3.0-29_5.3.0-29.31+noflr_all.deb
linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-modules-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-modules-extra-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
linux-tools-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
Pulling the resulting files out of the container back to the host and attempt to install them results in this error
Code:
$ sudo dpkg -i linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
dpkg: regarding linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb containing linux-image-unsigned-5.3.0-29-generic:
linux-image-unsigned-5.3.0-29-generic conflicts with linux-image-5.3.0-29-generic
linux-image-5.3.0-29-generic (version 5.3.0-29.31) is present and installed.
dpkg: error processing archive linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb (--install):
conflicting packages - not installing linux-image-unsigned-5.3.0-29-generic
Errors were encountered while processing:
linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
Contents of the kernel deb for reference
Code:
$ dpkg -c linux-image-unsigned-5.3.0-29-generic_5.3.0-29.31+noflr_amd64.deb
drwxr-xr-x root/root 0 2020-02-13 11:22 ./
drwxr-xr-x root/root 0 2020-02-13 11:15 ./boot/
-rw------- root/root 11398016 2020-02-13 11:15 ./boot/vmlinuz-5.3.0-29-generic
drwxr-xr-x root/root 0 2020-02-13 11:22 ./usr/
drwxr-xr-x root/root 0 2020-02-13 11:15 ./usr/lib/
drwxr-xr-x root/root 0 2020-02-13 11:15 ./usr/lib/linux/
drwxr-xr-x root/root 0 2020-02-13 11:15 ./usr/lib/linux/triggers/
drwxr-xr-x root/root 0 2020-02-13 11:22 ./usr/share/
drwxr-xr-x root/root 0 2020-02-13 11:22 ./usr/share/doc/
drwxr-xr-x root/root 0 2020-02-13 11:22 ./usr/share/doc/linux-image-unsigned-5.3.0-29-generic/
-rw-r--r-- root/root 172703 2020-02-13 10:59 ./usr/share/doc/linux-image-unsigned-5.3.0-29-generic/changelog.Debian.gz
-rw-r--r-- root/root 1292 2020-02-13 10:59 ./usr/share/doc/linux-image-unsigned-5.3.0-29-generic/copyright
Currently installed `linux-image-` packages for reference
Code:
$ apt list --installed | grep ^linux-image-
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
linux-image-5.3.0-26-generic/eoan-updates,eoan-security,now 5.3.0-26.28 amd64 [installed,automatic]
linux-image-5.3.0-29-generic/eoan-updates,eoan-security,now 5.3.0-29.31 amd64 [installed,automatic]
linux-image-generic/eoan-updates,eoan-security,now 5.3.0.29.33 amd64 [installed,automatic]
Questions:
- What is the cause of the package conflict with the existing `linux-image-5.3.0-29-generic` package?
- How do I work around it?
I would expect the additional version information defined in `debian.master/changelog` (`+noflr` in my case) to be picked up by the build scripts and propagated to all of the build artifacts; the resulting deb package file names (which seems to be working) and the files inside the deb packages (which does not seem to be working). When compiling the mainline kernel, this appears to be achieved with the `LOCALVERSION` or `CONFIG_LOCALVERSION` variables. Although I haven't tried setting these values, BuildYourOwnKernel provides this warning
do not attempt to use CONFIG_LOCALVERSION as this _will_ break the build.
Any help with the matter is greatly appreciated.
Bookmarks