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


Groups > linux.debian.user > #236819 > unrolled thread

make custom kernel

Started bymick crane <mick.crane@gmail.com>
First post2021-07-03 21:00 +0200
Last post2021-07-04 19:30 +0200
Articles 12 — 9 participants

Back to article view | Back to linux.debian.user

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#236819 — make custom kernel

Frommick crane <mick.crane@gmail.com>
Date2021-07-03 21:00 +0200
Subjectmake custom kernel
Message-ID<CwT1T-7Y6-1@gated-at.bofh.it>
I've done it before but I've forgotten and the order.
What's the procedure for making a custom kernel?
Install linux headers
change to a "build" directory
make menu-config
./configure
make
make dep
make install
make clean
?
mick
-- 
Key ID    4BFEBB31

[toc] | [next] | [standalone]


#236822

FromAnssi Saari <as@sci.fi>
Date2021-07-03 23:30 +0200
Message-ID<CwVn3-19s-7@gated-at.bofh.it>
In reply to#236819
mick crane <mick.crane@gmail.com> writes:

> I've done it before but I've forgotten and the order.
> What's the procedure for making a custom kernel?
> Install linux headers
> change to a "build" directory
> make menu-config
> ./configure
> make
> make dep
> make install
> make clean

I assume there are full instructions somewhere. One cool thing to
remember is that the mainstream kernel sources still have deb-pkg target
which neatly generates deb packages for the kernel image and
headers. Last time I built kernels I made good use of that. I stopped
around when Debian 10 came out, just didn't seem worth the trouble.

[toc] | [prev] | [next] | [standalone]


#236828

FromIL Ka <kazakevichilya@gmail.com>
Date2021-07-04 03:40 +0200
Message-ID<CwZgZ-3ya-1@gated-at.bofh.it>
In reply to#236822

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

On Sun, Jul 4, 2021 at 12:20 AM Anssi Saari <as@sci.fi> wrote:

> mick crane <mick.crane@gmail.com> writes:
>
> > I've done it before but I've forgotten and the order.
> > What's the procedure for making a custom kernel?
>
> I assume there are full instructions somewhere.

Here it is
http://www.kroah.com/lkn/


``make help`` in kernel source it also worth reading

[toc] | [prev] | [next] | [standalone]


#236839

Frommlnl <mlnl@mailbox.org>
Date2021-07-04 07:30 +0200
Message-ID<Cx2Rz-62X-1@gated-at.bofh.it>
In reply to#236819
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)

-- 
mlnl

GPG:1FC05426F87FA623

[toc] | [prev] | [next] | [standalone]


#236842

FromPolyna-Maude Racicot-Summerside <debian@polynamaude.com>
Date2021-07-04 11:00 +0200
Message-ID<Cx68O-7Y7-3@gated-at.bofh.it>
In reply to#236839

[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

[toc] | [prev] | [next] | [standalone]


#236846

FromIL Ka <kazakevichilya@gmail.com>
Date2021-07-04 12:30 +0200
Message-ID<Cx7xT-At-1@gated-at.bofh.it>
In reply to#236839

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

>
> thank you very much. Can I somehow load the current configuration so
> menuconfig shows what choices were made for current kernel ?
>
>
zcat /proc/config.gz > .config

[toc] | [prev] | [next] | [standalone]


#236847

FromThe Wanderer <wanderer@fastmail.fm>
Date2021-07-04 12:30 +0200
Message-ID<Cx7xT-At-7@gated-at.bofh.it>
In reply to#236846

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

On 2021-07-04 at 06:26, IL Ka wrote:

>> thank you very much. Can I somehow load the current configuration
>> so menuconfig shows what choices were made for current kernel ?
> 
> zcat /proc/config.gz > .config

AFAIK, Debian hasn't shipped kernels with /proc/config.gz enabled for
quite a few years now - I think over a decade.

I think the reason was that it's not useful enough often enough to
justify having it take up RAM on every Debian system at all times, and
most or all of the same benefit can be had from just putting the same
config on-disk under /boot.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

[toc] | [prev] | [next] | [standalone]


#236848

FromIL Ka <kazakevichilya@gmail.com>
Date2021-07-04 12:40 +0200
Message-ID<Cx7Hz-Eq-1@gated-at.bofh.it>
In reply to#236847

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

On Sun, Jul 4, 2021 at 1:26 PM The Wanderer <wanderer@fastmail.fm> wrote:

> On 2021-07-04 at 06:26, IL Ka wrote:
>
> >> thank you very much. Can I somehow load the current configuration
> >> so menuconfig shows what choices were made for current kernel ?
> >
> > zcat /proc/config.gz > .config
>
> AFAIK, Debian hasn't shipped kernels with /proc/config.gz enabled for
> quite a few years now - I think over a decade.
>

ooops, sorry. You are right.
Then it should be in

cat /boot/config-$(uname -r)

 https://wiki.debian.org/KernelFAQ
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=541489

[toc] | [prev] | [next] | [standalone]


#236850

Fromdeloptes <emanoil.kotsev@deloptes.org>
Date2021-07-04 13:50 +0200
Message-ID<Cx8Nj-1iC-1@gated-at.bofh.it>
In reply to#236839
mlnl wrote:

> 10. make deb-pkg LOCALVERSION=-nameN KDEB_PKGVERSION=$(make
> kernelversion)-1 (nameN e. g. v1)

I prefer bindeb-dpkg saves some overhead in zipping the source

[toc] | [prev] | [next] | [standalone]


#236859

FromDavid Wright <deblis@lionunicorn.co.uk>
Date2021-07-04 17:30 +0200
Message-ID<Cxcef-3xo-9@gated-at.bofh.it>
In reply to#236819
On Sat 03 Jul 2021 at 19:53:03 (+0100), mick crane wrote:
> I've done it before but I've forgotten and the order.
> What's the procedure for making a custom kernel?
> Install linux headers
> change to a "build" directory
> make menu-config
> ./configure
> make
> make dep
> make install
> make clean
> ?

There used to be a kernel-package, which I used until about 15 years
ago when the kernels got too complex for me to bother. The last
version I've found is jessie's, and its manpages, docs and howtos may
be worth reading through.

That said, if customising your kernel is for fixing your room problem,
then I would exhaust all the other courses of action first.
(And I would investigate why your initrd files are /so/ large.)

Cheers,
David.

[toc] | [prev] | [next] | [standalone]


#236862

Frommick crane <mick.crane@gmail.com>
Date2021-07-04 18:50 +0200
Message-ID<CxdtD-4dI-1@gated-at.bofh.it>
In reply to#236859
On 2021-07-04 16:26, David Wright wrote:
> On Sat 03 Jul 2021 at 19:53:03 (+0100), mick crane wrote:
>> I've done it before but I've forgotten and the order.
>> What's the procedure for making a custom kernel?
>> Install linux headers
>> change to a "build" directory
>> make menu-config
>> ./configure
>> make
>> make dep
>> make install
>> make clean
>> ?
> 
> There used to be a kernel-package, which I used until about 15 years
> ago when the kernels got too complex for me to bother. The last
> version I've found is jessie's, and its manpages, docs and howtos may
> be worth reading through.
> 
> That said, if customising your kernel is for fixing your room problem,
> then I would exhaust all the other courses of action first.
> (And I would investigate why your initrd files are /so/ large.)
> 
> Cheers,
> David.

How would you suggest I find out why initrd files are so big and how 
make it smaller?
As I can make out the initrd image contains the modules it thinks are 
needed?
How to make it smaller without building new kernel ?

cheers
mick
-- 
Key ID    4BFEBB31

[toc] | [prev] | [next] | [standalone]


#236864

FromBrian <ad44@cityscape.co.uk>
Date2021-07-04 19:30 +0200
Message-ID<Cxe6m-4FZ-3@gated-at.bofh.it>
In reply to#236859
On Sun 04 Jul 2021 at 10:26:26 -0500, David Wright wrote:

> On Sat 03 Jul 2021 at 19:53:03 (+0100), mick crane wrote:
> > I've done it before but I've forgotten and the order.
> > What's the procedure for making a custom kernel?
> > Install linux headers
> > change to a "build" directory
> > make menu-config
> > ./configure
> > make
> > make dep
> > make install
> > make clean
> > ?
> 
> There used to be a kernel-package, which I used until about 15 years
> ago when the kernels got too complex for me to bother. The last
> version I've found is jessie's, and its manpages, docs and howtos may
> be worth reading through.

I used it extensively circa the same era as you. It did the job.
My recollection (not to be relied on) was that the the kernel and
initrd were not that much smaller for me to continue its use.

Anyway it is discontinued upstream, regarded as obsolete and better
options are said to exist.
 
> That said, if customising your kernel is for fixing your room problem,
> then I would exhaust all the other courses of action first.

Definitely. Has gparted been mentioned?

> (And I would investigate why your initrd files are /so/ large.)

You me worried, but not so much I intend to do anything about it :).
On this machine: about 6.8 M; on others 2.3 M.

__ 
Brian.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web