Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #236842

Re: make custom kernel

From Polyna-Maude Racicot-Summerside <debian@polynamaude.com>
Newsgroups linux.debian.user
Subject Re: make custom kernel
Date 2021-07-04 11:00 +0200
Message-ID <Cx68O-7Y7-3@gated-at.bofh.it> (permalink)
References <CwT1T-7Y6-3@gated-at.bofh.it> <CwT1T-7Y6-1@gated-at.bofh.it> <Cx2Rz-62X-1@gated-at.bofh.it> <Cx68O-7Y7-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,


On 2021-07-04 2:42 a.m., mick crane wrote:
> On 2021-07-04 06:22, mlnl wrote:
>> Hi Mick,
>>
>> mick crane <mick.crane@gmail.com> wrote:
>>
>>> I've done it before but I've forgotten and the order.
>>> What's the procedure for making a custom kernel?
>>
>> Do you mean a custom Debian or a vanilla kernel from kernel.org?
>> For a Debian kernel you can look at
>> <https://kernel-team.pages.debian.net/kernel-handbook/>
>>
>> For a vanilla kernel, i use the following steps:
>> 1. download the kernel source archive of your choice
>> 2. extract the xz archive with unxz
>> 3. verify the tar archive with gpg
>> 4. untar the tar archive
>> 5. cd linux-version
>> 6. make mrproper
>> (6b) copy old config as linux-version/.config and/or certs in
>> linux-version/certs for modules signing
>> 8. make menuconfig (you need some packages, libncurses etc.)
>> 9. export CONCURRENCY_LEVEL="$(grep -c '^processor' /proc/cpuinfo)"
>> 10. make deb-pkg LOCALVERSION=-nameN KDEB_PKGVERSION=$(make
>> kernelversion)-1 (nameN e. g. v1)
>> 11. sudo dpkg -i kernel-packages (-headers, -image, -libc-dev)
> 
> thank you very much. Can I somehow load the current configuration so
> menuconfig shows what choices were made for current kernel ?
> 
The step 6b does exactly what you ask.
The .config file contain the Kernel options.
You can use the files contained inside you /boot directory.
Ex:
For myself :

ls /boot

config-4.19.0-16-amd64       initrd.img-5.10.0-0.bpo.5-amd64
config-4.19.0-9-amd64        System.map-4.19.0-16-amd64
config-4.19.182              System.map-4.19.0-9-amd64
config-5.10.0-0.bpo.5-amd64  System.map-4.19.182
efi                          System.map-5.10.0-0.bpo.5-amd64
grub                         vmlinuz-4.19.0-16-amd64
initrd.img-4.19.0-16-amd64   vmlinuz-4.19.0-9-amd64
initrd.img-4.19.0-9-amd64    vmlinuz-4.19.182
initrd.img-4.19.182          vmlinuz-5.10.0-0.bpo.5-amd64

The file config-4.19-182 and config-5.10.0-0.bpo.5-and64 both contain
kernel configs.
So does the other config-* files.

If you copy this file into the base of your new kernel source it will be
used as base for building.
Depending on the differences between the config file you use as base and
the actual kernel you are compiling there may be some necessary config
missing. So it is always better to run a *make menuconfig* as a safe bet.

Also if you look into the /usr/src folder you may find some other config
files, depending if you installed kernel header or not.

For my case :

*usr/src/linux-headers-4.19.0-16-amd64*

will contain a file named .config
Here's a list of my */usr/src*

binutils                        linux-headers-4.19.182
castle-game-engine-6.4          linux-headers-5.10.0-0.bpo.5-amd64
gcc-7                           linux-headers-5.10.0-0.bpo.5-common
gcc-8                           linux-kbuild-4.19
gdb.tar.bz2                     linux-kbuild-5.10
glibc                           linux-patch-4.19-rt.patch.xz
gmock                           linux-patch-5.10-rt.patch.xz
googletest                      linux-source-4.19.tar.xz
gtest                           linux-source-5.10.tar.xz
libdvd-pkg                      linux-support-4.19.0-16
liblzf                          linux-support-4.19.0-9
linux-config-4.19               nvidia-current-418.181.07
linux-config-5.10               nvidia-tesla-460-460.73.01
linux-headers-4.19.0-16-amd64   nvidia-tesla-460-kernel.tar.xz
linux-headers-4.19.0-16-common  v4l2loopback-0.12.1
linux-headers-4.19.0-9-amd64    v4l2loopback.tar.bz2
linux-headers-4.19.0-9-common

Everything called linux-config* and linux-headers-* will contain a
.config file.

So as a hint, I'd say to install the closest linux-headers you can get
to the version you wish to compile as your custom kernel.
For example if you plan compiling 5.19.182 then installing Debian kernel
version 4.19.0 would be a good start.
If planning to compile a custom kernel version 5.10.xxx then installing
a 5.10 backport kernel headers and using this .config as a base would be
a good start for this one.

Hope this will put you on track for your new custom kernel.

Sincerely,
PM



> mick

-- 
Polyna-Maude R.-Summerside
-Be smart, Be wise, Support opensource development

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

make custom kernel mick crane <mick.crane@gmail.com> - 2021-07-03 21:00 +0200
  Re: make custom kernel Anssi Saari <as@sci.fi> - 2021-07-03 23:30 +0200
    Re: make custom kernel IL Ka <kazakevichilya@gmail.com> - 2021-07-04 03:40 +0200
  Re: make custom kernel mlnl <mlnl@mailbox.org> - 2021-07-04 07:30 +0200
    Re: make custom kernel Polyna-Maude Racicot-Summerside <debian@polynamaude.com> - 2021-07-04 11:00 +0200
    Re: make custom kernel IL Ka <kazakevichilya@gmail.com> - 2021-07-04 12:30 +0200
      Re: make custom kernel The Wanderer <wanderer@fastmail.fm> - 2021-07-04 12:30 +0200
        Re: make custom kernel IL Ka <kazakevichilya@gmail.com> - 2021-07-04 12:40 +0200
    Re: make custom kernel deloptes <emanoil.kotsev@deloptes.org> - 2021-07-04 13:50 +0200
  Re: make custom kernel David Wright <deblis@lionunicorn.co.uk> - 2021-07-04 17:30 +0200
    Re: make custom kernel mick crane <mick.crane@gmail.com> - 2021-07-04 18:50 +0200
    Re: make custom kernel Brian <ad44@cityscape.co.uk> - 2021-07-04 19:30 +0200

csiph-web