Kernel build - append to version

Asked by Zoltan on 2020-03-19

I am building a new kernel (5.4.0-14-generi) in Ubuntu 20.04 with additional patches by following this guide: https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

fakeroot debian/rules clean
fakeroot debian/rules binary-headers binary-generic binary-perarch

How can I append an additional string to the kernel version (and to the debian package) to distinguish it from the installed kernel?

Thank you in advance!

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu linux Edit question
Assignee:
No assignee Edit question
Last query:
2020-03-19
Last reply:
2020-03-20

This question was reopened

Zoltan (zoltanbus) said : #2

I do not see a solution in the above post.

Local version can be appended in the config (e.g. in menuconfig: General setup -> Local version).
However, if I do so,

fakeroot debian/rules binary-headers binary-generic binary-perarch

fails with

depmod: ERROR: could not open directory /home/devel/focal/debian/linux-modules-5.4.0-14-generic/lib/modules/5.4.0-14-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
mv: cannot stat '/home/devel/focal/debian/linux-modules-5.4.0-14-generic/lib/modules/5.4.0-14-generic/kernel': No such file or directory
make: *** [debian/rules.d/2-binary-arch.mk:143: install-generic] Error 1

It still expects the original name without LOCALVERSION.

If I do not change LOCALVERSION, then the build produces .deb packages with the same name as the original installed .deb packages. Therefore they cannot be installed because they are in conflict with the original packages.

Zoltan (zoltanbus) said : #4

Finally, I have found a solution: dch -lsuffix or dch -i did the magic.
More info: http://manpages.ubuntu.com/manpages/trusty/man1/debchange.1.html

Steps they worked for me:

sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf python-docutils asciidoc default-jdk git build-essential debhelper bc zfs-dkms curl gawk

git clone --depth=1 git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal
cd focal
git apply ../mypatch.patch
fakeroot debian/rules clean
dch -l-mysuffix
fakeroot debian/rules binary-headers binary-generic binary-perarch

Please improve the documentation. This is an essential use-case.
Thanks!

Zoltan (zoltanbus) said : #5

I am taking back the posted solution.
The package generated by the described steps cannot be installed, it still conflicts with the original package:

Unpacking linux-headers-5.4.0-14-generic (5.4.0-14.17-mysuffix1) over (5.4.0-14.17-mysuffix1) ...
dpkg: regarding .../linux-image-unsigned-5.4.0-14-generic_5.4.0-14.17-mysuffix1_amd64.deb containing linux-image-unsigned-5.4.0-14-generic:
 linux-image-unsigned-5.4.0-14-generic conflicts with linux-image-5.4.0-14-generic
  linux-image-5.4.0-14-generic (version 5.4.0-14.17) is present and installed.

Bernard Stafford (bernard010) said : #6

I have a kernel problem where do I go?
If you have a problem which is related to the kernel you should visit the #ubuntu-kernel IRC channel on FreeNode (See How do I find the kernel team?). [Developers that will help you]
Explain that you are building a kernel, etc.

https://help.ubuntu.com/community/InternetRelayChat

I will do some more research on your current situation. You should make the generic kernel your own kernel.
That is in the documentation posted above. That may help.

Bernard Stafford (bernard010) said : #7

As the conflict states: linux-image-5.4.0-14-generic (version 5.4.0-14.17)
Test in Virtual Box as a patch : on your build system.
The set of 3 package files. image, header, base for your new: linux-image-5.4.0-14-generic (version 5.4.0-14.17)

fakeroot debian/rules clean
# quicker build:
fakeroot debian/rules binary-headers binary-generic binary-perarch
# if you need linux-tools or lowlatency kernel, run instead:
fakeroot debian/rules binary

To test:
sudo dpkg -i linux*5.4.0-14.17* .deb
sudo reboot

https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel

Manfred Hampl (m-hampl) said : #8

Looking at your error message:

 linux-image-unsigned-5.4.0-14-generic conflicts with linux-image-5.4.0-14-generic

What is the name of all currently installed kernel packages, and what is the name of the packages that you have built?

dpkg -l | grep 5.4.0-14-generic
ls -l linux*5.4.0-14.17* .deb

Can you help with this problem?

Provide an answer of your own, or ask Zoltan for more information if necessary.

To post a message you must log in.