Re-compilation Linux kernel > make deb-pkg

Tags: #<Tag:0x00007f33cf4f6988>

Bonjour,

Je viens « de tester » de compiler un noyau Linux en partant des sources de kernel.org :wink: et cela en créant de packages debian.

Style çà doit bien faire 15 ans je n’ai pas compilé :ok_hand: :rofl:

Je crois que ce n’est pas conseillé pour « un newbe de la compile » comme moi, mais c’est pour apprendre et, que surtout j’étais sur un kernel 5.x et que j’ai compilé un kernel 6.x - Tout va buguer.

J’ai suivis cette documentation debian - 8.10. Compiling a Kernel en compilant un kernel v6.x que j’ai appelé « ninja » pour Linux kernel version history - Releases 6.x.y - « Hurr durr I’ma ninja sloth » :smiley:

J’ajoute ce lien « Kernel Compilation in Debian Linux » et celle-ci « Debian Linux Kernel Handbook »

Comme c’est écrit ici :

Si vous choisissez de compiler votre propre noyau, vous devez en accepter les conséquences : Debian ne peut pas garantir les mises à jour de sécurité pour votre noyau personnalisé. En conservant le noyau fourni par Debian, vous bénéficiez des mises à jour préparées par l’équipe de sécurité du projet Debian.

Préparation :

root@vps:~ # apt install build-essential fakeroot bc python bison flex libelf-dev libssl-dev libncurses-dev dwarves lz4

root@vps:~ # mkdir kernel; cd kernel
root@vps:~/kernel # wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.0.9.tar.xz
root@vps:~/kernel # wget https://mirrors.edge.kernel.org/pub/linux/kernel/v6.x/linux-6.0.9.tar.sign
root@vps:~/kernel # unxz -c linux-6.0.9.tar.xz | gpg --verify linux-6.0.9.tar.sign -
root@vps:~/kernel # tar -xaf linux-6.0.9.tar.xz
root@vps:~/kernel # cp -rp linux-6.0.9 /usr/src/

root@vps:~/kernel # cd /usr/src/
root@vps:/usr/src # ln -snf linux-6.0.9/ linux
root@vps:/usr/src # cp /boot/config-$(uname -r) /usr/src/linux/.config
root@vps:/usr/src # cd linux

root@vps:/usr/src/linux # mkdir debian/certs/
root@vps:/usr/src/linux # echo "les clefs : https://salsa.debian.org/kernel-team/linux/-/blob/master/debian/certs/debian-uefi-certs.pem" >>>>>>>>>> debian/certs/debian-uefi-certs.pem

Configuration :

root@vps:/usr/src/linux # make menuconfig

Compilation :

root@vps:/usr/src/linux # make deb-pkg LOCALVERSION=-ninja KDEB_PKGVERSION=$(make kernelversion)-1
make clean
sh ./scripts/package/mkdebian
  TAR     linux-upstream.tar.gz
origversion=$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$//');\
        mv linux-upstream.tar.gz ../linux-upstream_${origversion}.orig.tar.gz
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -i.git -us -uc
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.0.9-1
dpkg-buildpackage: info: source distribution bullseye
dpkg-buildpackage: info: source changed by root <root@vps.zw3b.eu>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source -i.git --before-build .
 debian/rules clean
rm -rf debian/*tmp debian/files
make clean
 dpkg-source -i.git -b .
dpkg-source: info: using source format '1.0'
dpkg-source: warning: source directory 'linux-6.0.9' is not <sourcepackage>-<upstreamversion> 'linux-upstream-6.0.9'
dpkg-source: warning: .orig directory name linux-6.0.9.orig is not <package>-<upstreamversion> (wanted linux-upstream-6.0.9.orig)
dpkg-source: info: building linux-upstream using existing linux-upstream_6.0.9.orig.tar.gz
dpkg-source: info: building linux-upstream in linux-upstream_6.0.9-1.diff.gz
dpkg-source: warning: ignoring deletion of file .scmversion  
[....]
[....]
  INSTALL debian/linux-libc-dev/usr/include
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_6.0.9-1_amd64.deb'.
dpkg-deb: building package 'linux-image-6.0.9-ninja' in '../linux-image-6.0.9-ninja_6.0.9-1_amd64.deb'.
 dpkg-genbuildinfo
 dpkg-genchanges  >../linux-upstream_6.0.9-1_amd64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source -i.git --after-build .
dpkg-buildpackage: info: full upload (original source is included)
root@vps:/usr/src/linux #

Qui m’a créée ces fichiers :

root@vps:~ # ls -l /usr/src/
total 248460
lrwxrwxrwx  1 root root        12 Dec 11 17:59 linux -> linux-6.0.9/
drwxrwxr-x 26 root root      4096 Dec 11 23:05 linux-6.0.9
drwxr-xr-x  6 root root      4096 Dec 11 23:13 linux-headers-6.0.9-ninja
-rw-r--r--  1 root root   8487080 Dec 11 23:06 linux-headers-6.0.9-ninja_6.0.9-1_amd64.deb
-rw-r--r--  1 root root  20821448 Dec 11 23:07 linux-image-6.0.9-ninja_6.0.9-1_amd64.deb
-rw-r--r--  1 root root   1266852 Dec 11 23:06 linux-libc-dev_6.0.9-1_amd64.deb
-rw-r--r--  1 root root    251636 Dec 11 21:39 linux-upstream_6.0.9-1.diff.gz
-rw-r--r--  1 root root      1061 Dec 11 21:39 linux-upstream_6.0.9-1.dsc
-rw-r--r--  1 root root      5433 Dec 11 23:07 linux-upstream_6.0.9-1_amd64.buildinfo
-rw-r--r--  1 root root      2654 Dec 11 23:07 linux-upstream_6.0.9-1_amd64.changes
-rw-r--r--  1 root root 223544622 Dec 11 21:37 linux-upstream_6.0.9.orig.tar.gz

Pour installer le noyau Linux :

root@vps:~ # dpkg -i linux-libc-dev_6.0.9-1_amd64.deb
root@vps:~ # dpkg -i linux-image-6.0.9-ninja_6.0.9-1_amd64.deb
root@vps:~ # dpkg - i linux-headers-6.0.9-ninja_6.0.9-1_amd64.deb

Puis redémarrer :

root@vps:~ # reboot

Pour se retrouver sur un kernel 6.0.9.

root@vps:~ # uname -a
Linux vps 6.0.9-ninja #1 SMP PREEMPT_DYNAMIC Sun Dec 11 18:34:18 UTC 2022 x86_64 GNU/Linux

Je souhaiterais savoir à quoi servent ces fichiers après avoir lu « Upstream (développement logiciel) (en) , se dit d’un projet logiciel donné qui sert de base à un ou plusieurs autres, qualifiés pour leur part de downstream (comme par exemple le noyau Linux joue le rôle d’ upstream pour les distributions GNU/Linux). »

  1. linux-upstream_6.0.9-1.diff.gz
  2. linux-upstream_6.0.9-1.dsc
  3. linux-upstream_6.0.9-1_amd64.buildinfo
  4. linux-upstream_6.0.9-1_amd64.changes
  5. linux-upstream_6.0.9.orig.tar.gz

Donc, j’essaie de re-compiler avec d’autres valeurs dans la « .config » mais quand je relance la compilation du noyeau çà plante.

root@vps:/usr/src/linux # make deb-pkg LOCALVERSION=-ninja KDEB_PKGVERSION=$(make kernelversion)-2
  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
make clean
sh ./scripts/package/mkdebian
  TAR     linux-upstream.tar.gz
origversion=$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$//');\
        mv linux-upstream.tar.gz ../linux-upstream_${origversion}.orig.tar.gz
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -i.git -us -uc
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.0.9-2
dpkg-buildpackage: info: source distribution bullseye
dpkg-buildpackage: info: source changed by root <root@vps.zw3b.eu>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source -i.git --before-build .
 debian/rules clean
rm -rf debian/*tmp debian/files
make clean
 dpkg-source -i.git -b .
dpkg-source: info: using source format '1.0'
dpkg-source: warning: source directory 'linux-6.0.9' is not <sourcepackage>-<upstreamversion> 'linux-upstream-6.0.9'
dpkg-source: warning: .orig directory name linux-6.0.9.orig is not <package>-<upstreamversion> (wanted linux-upstream-6.0.9.orig)
dpkg-source: info: building linux-upstream using existing linux-upstream_6.0.9.orig.tar.gz
dpkg-source: info: building linux-upstream in linux-upstream_6.0.9-2.diff.gz
dpkg-source: error: cannot represent change to debian/linux-headers/lib/modules/6.0.9-ninja/build:
dpkg-source: error:   new version is symlink to /usr/src/linux-headers-6.0.9-ninja
dpkg-source: error:   old version is nonexistent
dpkg-source: error: cannot represent change to debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/include/dt-bindings/input/linux-event-codes.h:
dpkg-source: error:   new version is symlink to ../../uapi/linux/input-event-codes.h
dpkg-source: error:   old version is nonexistent
[....]
dpkg-source: warning: ignoring deletion of file .scmversion
dpkg-source: error: cannot represent change to debian/linux-headers/usr/share/doc/linux-headers-6.0.9-ninja/changelog.Debian.gz: binary file contents changed
dpkg-source: warning: newly created empty file 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/include/config/64BIT' will not be represented in diff
dpkg-source: warning: newly created empty file 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/include/config/ACPI' will not be represented in diff
[....]
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/scripts/Lindent' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/scripts/adjust_autoksyms.sh' will not be represented in diff
dpkg-source: warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/scripts/as-version.sh' will not be represented in diff
[....]
dpkg-source: warning: executable mode 0755 of 'debian/linux-image/DEBIAN/prerm' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-image/boot/vmlinuz-6.0.9-ninja: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/6.0.9-ninja/modules.alias.bin: binary file contents changed
dpkg-source: warning: newly created empty file 'debian/linux-image/lib/modules/6.0.9-ninja/modules.builtin.alias.bin' will not be represented in diff
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/6.0.9-ninja/modules.builtin.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/6.0.9-ninja/modules.builtin.modinfo: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/6.0.9-ninja/modules.dep.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/lib/modules/6.0.9-ninja/modules.symbols.bin: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-image/usr/share/doc/linux-image-6.0.9-ninja/changelog.Debian.gz: binary file contents changed
dpkg-source: error: cannot represent change to debian/linux-libc-dev/usr/share/doc/linux-libc-dev/changelog.Debian.gz: binary file contents changed
dpkg-source: warning: the diff modifies the following upstream files:
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 .version
 CREDITS
 MAINTAINERS
 Module.symvers
 README
dpkg-source: info: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: error: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -i.git -b . subprocess returned exit status 1
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Error 1
make: *** [Makefile:1558: deb-pkg] Error 2
root@vps:/usr/src/linux #
Info, warning, errror in EN
info: using source format '1.0'
warning: source directory 'linux-6.0.9' is not <sourcepackage>-<upstreamversion> 'linux-upstream-6.0.9'
warning: ".origin" directory name linux-6.0.9.orig is not <package>-<upstreamversion> (wanted linux-upstream-6.0.9.orig)
info: building linux-upstream using existing linux-upstream_6.0.9.orig.tar.gz
info: building linux-upstream in linux-upstream_6.0.9-2.diff.gz
error: cannot represent change to "debian/linux-headers/lib/modules/6.0.9-ninja/build"

error: new version is symlink to /usr/src/linux-headers-6.0.9-ninja
error: old version is nonexistent

warning: ignoring deletion of file .scmversion

error: cannot represent change to debian/linux-headers/usr/share/doc/linux-headers-6.0.9-ninja/changelog.Debian.gz: binary file contents changed

warning: newly created empty file 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/include/config/64BIT' will not be represented in diff

warning: executable mode 0755 of 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/scripts/adjust_autoksyms.sh' will not be represented in diff	

[…]

warning: the diff modifies the following upstream files:
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 .version
 CREDITS
 MAINTAINERS
 Module.symvers
 README
info: Use the '3.0 (quilt) format to have separate and documented changes in upstream files, see DPKG-Source (1)
error: unrepresentable changes to source
Info, warning, errror in FR
Info: Utilisation du format source '1.0'
AVERTISSEMENT: Le répertoire source 'linux-6.0.9' n'est pas <sourcepackage>-<upstreamversion> 'linux-upstream-6.0.9'
AVERTISSEMENT: ".origin" Nom du répertoire linux-6.0.9.orig n'est pas <package>-<upstreamversion> (recherché linux-upstream-6.0.9.orig)
Info: Building Linux-Upstream à l'aide de linux-upstream_6.0.9.orig.tar.gz existant
Info: Building Linux-Upstream dans linux-upstream_6.0.9-2.diff.gz
Erreur: Impossible de représenter le changement en "debian/linux-headers/lib/modules/6.0.9-ninja/build"

Erreur: la nouvelle version est SymLink à /usr/src/linux-headers-6.0.9-ninja
Erreur: l'ancienne version est inexistante

AVERTISSEMENT: Ignorer la suppression du fichier .scmversion

Erreur: Impossible de représenter le changement pour debian/linux-headers/usr/share/doc/linux-headers-6.0.9-ninja/changelog.Debian.gz: le contenu du fichier binaire modifié

AVERTISSEMENT: Fichier vide nouvellement créé 'debian/linux-headers/usr/src/linux-headers-6.0.9-ninja/include/config/64BIT' ne sera pas représenté dans Diff

AVERTISSEMENT: Mode exécutable 0755 de '/linux-headers/usr/src/linux-headers-6.0.9-ninja/scripts/adjust_autoksyms.sh' ne sera pas représenté dans Difff

[.....]

AVERTISSEMENT: le Diff modifie les fichiers en amont suivants:
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 .version
 CREDITS
 MAINTAINERS
 Module.symvers
 README
Info: Utilisez le format '3.0 (Quilt) pour avoir des modifications séparées et documentées dans les fichiers en amont, voir DPKG-source (1)
Erreur: modifications non représentables de la source

Note de Moi-même 19h25 :

À la place de « $(make kernelversion)-1 » → → « $(make kernelversion)-2 »
il aurait été préférable que je mette « $(make kernelversion)-0.1 » → → « $(make kernelversion)-0.2 » etc, n’est-ce pas ?

Si vous avez des informations ? Qui peut m’aider ?

Merci.
Romain

J’ajoute une question :

Une fois que je suis en noyau v6.x il doit falloir que je full-upgrade ou un truc du genre ? Que je change mes dépôts et tout çà ?

N’est-ce pas ?

C’est pour m’amuser à « essayer » d’avoir une super distribution new génération, perso :yum: À « m’essayer » de faire un module, de le signer, de l’implanter au système et de m’en servir.

DKMS : Dynamic Kernel Module Support (ou System)
MOK : Machine Owner Key (SecureBoot)


Debian WiKi FR : Modules du Kernel Linux :

Sous Debian, le module peut être installé à partir de trois différents types de sources :

  • Des modules du noyau amont (upstream) Linux : ils sont installés à partir du paquet linux-image-*.

  • Modules supplémentaires, qui ne sont pas dans le noyau amont de Linux. Il sont généralement construits en utilisant dkms. Les modules disponibles peuvent être listés en exécutant apt rdepends dkms.

  • Un mécanisme plus ancien et moins flexible pour construire des modules supplémentaires est → module-assistant.


The Linux Kernel Module Programming Guide : Chapter 2. Hello World → 2.1. Hello, World (part 1): The Simplest Module


Debian Kernel-Team handbook (Manuel)

Chapitre 4. Tâches courantes liées au noyau

4.5. Construire un noyau personnalisé à partir de la source du noyau Debian

4.6. Construire un noyau personnalisé à partir de la source du noyau « vierge »
Construire un noyau à partir de la source du noyau « vierge » (aussi parfois appelée « vanille »), distribué depuis www.kernel.org et ses miroirs, peut être parfois utile pour le débogage ou dans les situations où une version plus récente du noyau est souhaitée.

4.7. Modules de noyau hors arbre
Certains modules du noyau ne sont pas inclus dans la source du noyau en amont ou Debian, mais sont fournis en tant que packages source tiers. Il y a de fortes chances que l’archive Debian contienne la source des modules du noyau, empaquetés pour être utilisés avec le Dynamic Kernel Module System (DKMS), avec un nom de paquet se terminant par -dkms. Alternativement, il peut être empaqueté pour être utilisé avec module-assistant (m-a) de Debian, avec un nom de paquet se terminant par -source.

:wink:

Par exemple :

Donc,

root@vps:/usr/src # apt update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]
Get:5 http://deb.debian.org/debian bullseye-backports/main amd64 Packages.diff/Index [63.3 kB]
Get:6 http://deb.debian.org/debian bullseye-backports/main amd64 Packages T-2022-12-12-0804.06-F-2022-12-12-0804.06.pdiff [268 B]
Get:6 http://deb.debian.org/debian bullseye-backports/main amd64 Packages T-2022-12-12-0804.06-F-2022-12-12-0804.06.pdiff [268 B]
Fetched 205 kB in 1s (276 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
1 package can be upgraded. Run 'apt list --upgradable' to see it.

root@vps:/usr/src # apt list --upgradable
Listing... Done
linux-image-amd64-signed-template/bullseye-backports 6.0.3-1~bpo11+1 amd64 [upgradable from: 5.10.158-1]
N: There are 3 additional versions. Please use the '-a' switch to see them.

root@vps:/usr/src # apt list --upgradable -a
Listing... Done
linux-image-amd64-signed-template/bullseye-backports 6.0.3-1~bpo11+1 amd64 [upgradable from: 5.10.158-1]
linux-image-amd64-signed-template/now 5.10.158-1 amd64 [installed,upgradable to: 6.0.3-1~bpo11+1]
linux-image-amd64-signed-template/stable-security 5.10.149-2 amd64
linux-image-amd64-signed-template/stable 5.10.140-1 amd64

  • linux-upstream_6.0.9.orig.tar.gz → Permet de construire (les « applis » (en bas)) Linux en amont (du haut → vers le bas) à l’aide de … linux-upstream_6.0.9.9.orig.tar.gz existant… :slight_smile: Un truc du genre.

  • linux-upstream_6.0.9-1.diff.gz → les différences entre 2 versions (en l’occurrence 6.0.9 et 6.0.9-1)

File "linux-upstream_6.0.9-1.diff" :
root@vps:/usr/src # head -14 linux-upstream_6.0.9-1.diff
--- linux-upstream-6.0.9.orig/.clang-format
+++ linux-upstream-6.0.9/.clang-format
@@ -0,0 +1,683 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# clang-format configuration file. Intended for clang-format >= 11.
+#
+# For more information, see:
+#
+#   Documentation/process/clang-format.rst
+#   https://clang.llvm.org/docs/ClangFormat.html
+#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+#
+---
[....]

root@vps:/usr/src # tail -85 linux-upstream_6.0.9-1.diff
[....]
--- linux-upstream-6.0.9.orig/debian/changelog
+++ linux-upstream-6.0.9/debian/changelog
@@ -0,0 +1,5 @@
+linux-upstream (6.0.9-1) bullseye; urgency=low
+
+  * Custom built Linux kernel.
+
+ -- root <root@vps.zw3b.eu>  Sun, 11 Dec 2022 21:36:56 +0000
--- linux-upstream-6.0.9.orig/debian/control
+++ linux-upstream-6.0.9/debian/control
@@ -0,0 +1,29 @@
+Source: linux-upstream
+Section: kernel
+Priority: optional
+Maintainer: root <root@vps.zw3b.eu>
+Rules-Requires-Root: no
+Build-Depends: bc, rsync, kmod, cpio, bison, flex | flex:native , libelf-dev:native, libssl-dev:native
+Homepage: https://www.kernel.org/
+
+Package: linux-image-6.0.9-ninja
+Architecture: amd64
+Description: Linux kernel, version 6.0.9-ninja
+ This package contains the Linux kernel, modules and corresponding other
+ files, version: 6.0.9-ninja.
+
+Package: linux-libc-dev
+Section: devel
+Provides: linux-kernel-headers
+Architecture: amd64
+Description: Linux support headers for userspace development
+ This package provides userspaces headers from the Linux kernel.  These headers
+ are used by the installed headers for GNU glibc and other system libraries.
+Multi-Arch: same
+
+Package: linux-headers-6.0.9-ninja
+Architecture: amd64
+Description: Linux kernel headers for 6.0.9-ninja on amd64
+ This package provides kernel header files for 6.0.9-ninja on amd64
+ .
+ This is useful for people who need to build external modules
--- linux-upstream-6.0.9.orig/debian/copyright
+++ linux-upstream-6.0.9/debian/copyright
@@ -0,0 +1,16 @@
+This is a packacked upstream version of the Linux kernel.
+
+The sources may be found at most Linux archive sites, including:
+https://www.kernel.org/pub/linux/kernel
+
+Copyright: 1991 - 2018 Linus Torvalds and others.
+
+The git repository for mainline kernel development is at:
+git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; version 2 dated June, 1991.
+
+On Debian GNU/Linux systems, the complete text of the GNU General Public
+License version 2 can be found in `/usr/share/common-licenses/GPL-2'.
--- linux-upstream-6.0.9.orig/debian/rules
+++ linux-upstream-6.0.9/debian/rules
@@ -0,0 +1,19 @@
+#!/usr/bin/make -f
+
+srctree ?= .
+
+build-indep:
+build-arch:
+       $(MAKE) KERNELRELEASE=6.0.9-ninja ARCH=x86      KBUILD_BUILD_VERSION=1 -f $(srctree)/Makefile
+
+build: build-arch
+
+binary-indep:
+binary-arch: build-arch
+       $(MAKE) KERNELRELEASE=6.0.9-ninja ARCH=x86      KBUILD_BUILD_VERSION=1 -f $(srctree)/Makefile intdeb-pkg
+
+clean:
+       rm -rf debian/*tmp debian/files
+       $(MAKE) clean
+
+binary: binary-arch
--- linux-upstream-6.0.9.orig/debian/source/format
+++ linux-upstream-6.0.9/debian/source/format
@@ -0,0 +1 @@
+1.0

Bonsoir,

J’ai réussis à recompiler le noyau. J’ai utilisé « make bindeb-pkg » au lieu de « make deb-pkg ».

J’ai trouvé l’info ici. À priori, si j’ai bien compris, c’est parce que l’on part de la version par default « uname -r » (6.0.9-ninja) et on créait la révision #2 - çà doit être cela.

root@vps:/usr/src/linux # make bindeb-pkg LOCALVERSION=-ninja KDEB_PKGVERSION=$(make kernelversion)-2
sh ./scripts/package/mkdebian
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -b -nc -uc
dpkg-buildpackage: info: source package linux-upstream
dpkg-buildpackage: info: source version 6.0.9-2
dpkg-buildpackage: info: source distribution bullseye
dpkg-buildpackage: info: source changed by root <root@vps.zw3b.eu>
dpkg-buildpackage: info: host architecture amd64
 dpkg-source --before-build .
 debian/rules binary
make KERNELRELEASE=6.0.9-ninja ARCH=x86         KBUILD_BUILD_VERSION=2 -f ./Makefile
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/include/generated/uapi/asm/unistd_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/include/generated/asm/syscalls_64.h
  HYPERCALLS arch/x86/include/generated/asm/xen-hypercalls.h
  HOSTCC  scripts/basic/fixdep
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  HOSTCC  scripts/genksyms/genksyms.o
  YACC    scripts/genksyms/parse.tab.[ch]
  HOSTCC  scripts/genksyms/parse.tab.o
  LEX     scripts/genksyms/lex.lex.c
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTLD  scripts/genksyms/genksyms
  HOSTCC  scripts/selinux/genheaders/genheaders
  HOSTCC  scripts/selinux/mdp/mdp
  HOSTCC  scripts/bin2c
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/sorttable
  HOSTCC  scripts/asn1_compiler
  HOSTCC  scripts/sign-file
  HOSTCC  scripts/mod/mk_elfconfig
  CC      scripts/mod/empty.o
  MKELF   scripts/mod/elfconfig.h
  HOSTCC  scripts/mod/modpost.o
  CC      scripts/mod/devicetable-offsets.s
  HOSTCC  scripts/mod/file2alias.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTLD  scripts/mod/modpost
  CC      kernel/bounds.s
  CC      arch/x86/kernel/asm-offsets.s
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND objtool
  HOSTCC  /usr/src/linux-6.0.9/tools/objtool/fixdep.o
  HOSTLD  /usr/src/linux-6.0.9/tools/objtool/fixdep-in.o
  LINK    /usr/src/linux-6.0.9/tools/objtool/fixdep
  CC      /usr/src/linux-6.0.9/tools/objtool/exec-cmd.o
  CC      /usr/src/linux-6.0.9/tools/objtool/help.o
  CC      /usr/src/linux-6.0.9/tools/objtool/pager.o
  CC      /usr/src/linux-6.0.9/tools/objtool/parse-options.o
  CC      /usr/src/linux-6.0.9/tools/objtool/run-command.o
  CC      /usr/src/linux-6.0.9/tools/objtool/sigchain.o
  CC      /usr/src/linux-6.0.9/tools/objtool/subcmd-config.o
  LD      /usr/src/linux-6.0.9/tools/objtool/libsubcmd-in.o
  AR      /usr/src/linux-6.0.9/tools/objtool/libsubcmd.a
  CC      /usr/src/linux-6.0.9/tools/objtool/arch/x86/special.o
  CC      /usr/src/linux-6.0.9/tools/objtool/arch/x86/decode.o
  LD      /usr/src/linux-6.0.9/tools/objtool/arch/x86/objtool-in.o
  CC      /usr/src/linux-6.0.9/tools/objtool/weak.o
  CC      /usr/src/linux-6.0.9/tools/objtool/check.o
[....]
[....]
  HDRINST usr/include/asm/param.h
  HDRINST usr/include/asm/ioctl.h
  HDRINST usr/include/asm/fcntl.h
  HDRINST usr/include/asm/unistd_64.h
  INSTALL debian/linux-libc-dev/usr/include
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_6.0.9-2_amd64.deb'.
dpkg-deb: building package 'linux-image-6.0.9-ninja' in '../linux-image-6.0.9-ninja_6.0.9-2_amd64.deb'.
 dpkg-genbuildinfo --build=binary
 dpkg-genchanges --build=binary >../linux-upstream_6.0.9-2_amd64.changes
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
root@vps:/usr/src/linux #

Qui m’a créait :

root@vps:~ # ls -l /usr/src/
total 279120
[....]
-rw-r--r--  1 root root   8497236 Dec 15 22:32 linux-headers-6.0.9-ninja_6.0.9-2_amd64.deb
-rw-r--r--  1 root root  20877496 Dec 15 22:33 linux-image-6.0.9-ninja_6.0.9-2_amd64.deb
-rw-r--r--  1 root root   1266928 Dec 15 22:32 linux-libc-dev_6.0.9-2_amd64.deb
-rw-r--r--  1 root root      5185 Dec 15 22:33 linux-upstream_6.0.9-2_amd64.buildinfo
-rw-r--r--  1 root root      1834 Dec 15 22:33 linux-upstream_6.0.9-2_amd64.changes
[....]

Le noyau est toujours de version :

root@vps:~ # uname -r
6.0.9-ninja

Mais il y a une « révision » je crois que l’on appelle çà comme çà, les #num.

root@vps:~ # uname -a
Linux vps 6.0.9-ninja #2 SMP PREEMPT_DYNAMIC Thu Dec 15 19:58:40 UTC 2022 x86_64 GNU/Linux

C’était un autre post mais j’ai réussis à activer mon « ppp » en activant les modules dans le kernel.

Salutations,
Romain

Bonne soirée à vous.

En passant, bonsoir.

Je cherchais comment patcher le #kernel Linux (entre temps j’ai installé le kernel v6.1.0).

Voici la procédure avec le patch 6.1.2 :

root@vps:/usr/src # wget https://cdn.kernel.org/pub/linux/kernel/v6.x/patch-6.1.2.xz
root@vps:/usr/src # xz -k -d patch-6.1.2.xz
root@vps:/usr/src # cd linux
root@vps:/usr/src/linux # patch -p1 < ../patch-6.1.2
patching file Documentation/ABI/stable/sysfs-driver-dma-idxd
patching file Documentation/ABI/testing/sysfs-bus-spi-devices-spi-nor
[....]
patching file Makefile
patching file arch/Kconfig
patching file arch/alpha/include/asm/thread_info.h
patching file arch/alpha/kernel/entry.S
[....]

Et voilà c’est bon.

root@vps:/usr/src/linux # make kernelversion
6.1.2

root@vps:/usr/src/linux # uname -a
Linux vps 6.1.0-ninja #1 SMP PREEMPT_DYNAMIC Wed Jan  4 01:36:54 CET 2023 x86_64 GNU/Linux

Il faut maintenant recompiler le noyau, par exemple…

root@vps:/usr/src/linux # make bindeb-pkg LOCALVERSION=-ninja KDEB_PKGVERSION=$(make kernelversion)-1

Et installer les nouveaux package deb et reboot.

root@vps:/usr/src/ # dpkg -i linux-libc-dev_6.1.2-1_amd64.deb
root@vps:/usr/src/ # dpkg -i linux-image-6.1.0-ninja_6.1.2-1_amd64.deb

root@vps:/usr/src/ # reboot

root@vps:~ # uname -a
Linux vps 6.1.2-ninja #1 SMP PREEMPT_DYNAMIC Wed Jan  4 02:49:54 CET 2023 x86_64 GNU/Linux

J’ai trouvé l’information sur Debian-facile.orgNoyau linux / Wiki / Debian-facile.

Informations complémentaire : Applying Patches To The Linux Kernel — The Linux Kernel documentation

Romain

Histoire de suivre le fil :slight_smile:

Pour re-patcher, il me semble qu’il faut revenir / dé-patcher (reverse) le répertoire courant de /usr/src/linux et le patcher avec le dernier patch.

Exemple :

root@vps:/usr/src/linux # patch -p1 -R < ../patch-6.1.2
root@vps:/usr/src/linux # patch -p1 < ../patch-6.1.4

Et recompiler puis rebooter.

root@vps:~ # uname -a
Linux vps 6.1.4-ninja #1 SMP PREEMPT_DYNAMIC Sun Jan  8 06:11:10 CET 2023 x86_64 GNU/Linux

Sur une Debian GNU/Linux 11 (bullseye) :

root@vps:~ # cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

root@vps:~ # cat /etc/debian_version
11.6

root@vps:~ # apt update
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [48.4 kB]
Hit:2 http://deb.debian.org/debian bullseye InRelease
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [44.1 kB]
Get:4 http://deb.debian.org/debian bullseye-backports InRelease [49.0 kB]
Get:5 http://deb.debian.org/debian bullseye-backports/main Sources.diff/Index [63.3 kB]
Get:6 http://deb.debian.org/debian bullseye-backports/main amd64 Packages.diff/Index [63.3 kB]
Get:7 http://deb.debian.org/debian bullseye-backports/main Sources T-2023-01-08-1418.06-F-2023-01-08-0206.56.pdiff [2079 B]
Get:7 http://deb.debian.org/debian bullseye-backports/main Sources T-2023-01-08-1418.06-F-2023-01-08-0206.56.pdiff [2079 B]
Get:8 http://deb.debian.org/debian bullseye-backports/main amd64 Packages T-2023-01-08-1418.06-F-2023-01-08-0206.56.pdiff [2104 B]
Get:8 http://deb.debian.org/debian bullseye-backports/main amd64 Packages T-2023-01-08-1418.06-F-2023-01-08-0206.56.pdiff [2104 B]
Fetched 272 kB in 1s (218 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

root@vps:~ # cat /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main
deb http://deb.debian.org/debian bullseye-backports main
deb-src http://deb.debian.org/debian bullseye-backports main

root@vps:~ # ls -l /etc/apt/sources.list.d/
total 0

root@vps:~ # ls -lht /usr/src/
total 34M
-rw-r--r--  1 root root 1.8K Jan  8 06:18 linux-upstream_6.1.4-1_amd64.changes
-rw-r--r--  1 root root 5.1K Jan  8 06:18 linux-upstream_6.1.4-1_amd64.buildinfo
-rw-r--r--  1 root root  20M Jan  8 06:18 linux-image-6.1.4-ninja_6.1.4-1_amd64.deb
-rw-r--r--  1 root root 1.3M Jan  8 06:17 linux-libc-dev_6.1.4-1_amd64.deb
-rw-r--r--  1 root root 8.3M Jan  8 06:17 linux-headers-6.1.4-ninja_6.1.4-1_amd64.deb
drwxrwxr-x 27 root root 4.0K Jan  8 06:16 linux-6.1.4
lrwxrwxrwx  1 root root   11 Jan  8 04:36 linux -> linux-6.1.4
-rw-r--r--  1 root root 1.9M Jan  7 11:19 patch-6.1.4
-rw-r--r--  1 root root 401K Jan  7 11:19 patch-6.1.4.xz
drwxr-xr-x 26 root root 4.0K Jan  4 02:39 linux-6.1.orig
-rw-r--r--  1 root root 1.5M Dec 31 13:38 patch-6.1.2
-rw-r--r--  1 root root 320K Dec 31 13:38 patch-6.1.2.xz

root@vps:/usr/src # ls -lht /boot/
total 33M
drwxr-xr-x 6 root root 4.0K Jan  8 06:19 grub
-rw-r--r-- 1 root root  19M Jan  8 06:19 initrd.img-6.1.4-ninja
-rw-r--r-- 1 root root 3.4M Jan  8 04:36 System.map-6.1.4-ninja
-rw-r--r-- 1 root root 112K Jan  8 04:36 config-6.1.4-ninja
-rw-r--r-- 1 root root  11M Jan  8 04:36 vmlinuz-6.1.4-ninja
drwxr-xr-x 3 root root  16K Jan  1  1970 efi

1 janvier 1970 :smiley: :thinking: :grinning_face_with_smiling_eyes:

:slight_smile:

Bonne soirée.
Romain